Do all DAML Ledgers do collision detection and validation in the same order?

A DAML transaction as submitted to a ledger post interpretation has all the information needed to do either scheduling and collision detection, or validation by reinterpretation. So I’m wondering whether all DAML Ledgers do the two in the same order. If so, what happens first? If I have both a stale input contract, and a wrong negative key lookup, which error do I get?

What if the stale input contract, and the negative key lookup are known to different validators only? Is there some guarantee about which of the errors I get back through the API?

2 Likes

I guess another example would be “Unknown Party” vs “Authorization Error”. Both are thrown on the submitting node during interpretation, but I don’t know in which order. If Alice submits create Foo wtih sig = bob where bob is an unknown party, which error does Alice get? Is it the same for all ledgers?

1 Like

At present, different ledgers will report different answers, depending on how the ledger implementation processes transactions. In theory, ledgers could even concurrently run re-interpretation and conflict detection and report the error that is hit first. Similarly, if there are several conflicts, the ledger reports only one of them, but which one is again up to the ledger implementation. In your example with a stale input contract and a wrong negative key lookup, these are both conflict conditions and the ledger can report either of them. In either case, the error will be INCONSISTENT, though.

A ticket in the backlog of the DAML repo shows that certain checks should be performed before others for security reasons, but that is not yet implemented. Even then, it is not clear that error reporting will be deterministic.

2 Likes