DAGNode Links[] sort order

Is the Links[] array in a DAGNode guaranteed to preserve order? Or does it (or might it in the future) get sorted like in GitTree objects?

@agentofuser I think we already saw this come back in different orders, I don’t think it’s deterministic.

@icidasset I think you bumped into this or might remember?

1 Like

The order should be preserved according to the spec:
https://specs.ipld.io/block-layer/codecs/dag-pb.html#constraints

1 Like

It’s preserved sorted, but not in insertion order, right?

elements must be sorted in ascending order by their Name values, which are compared by bytes rather than as strings.

So I can’t make a DAGNode that has links [b, a] and that’s different from [a, b], correct?

Yeah correct, always sorted by Name

1 Like