vacuumlabs/trezor-firmware

Preserve order of tokenBundle entries

Closed this issue · 1 comments

Currently trezor reorders the tokenBundle nested dictionary entries when serializing it into the resulting CBOR structure: https://github.com/trezor/trezor-firmware/blob/850aa56691ee98fedc6c61c377e516c8864dccd0/core/src/apps/cardano/sign_tx.py#L414 . This may cause issues with multi-party transactions where other parties may have a different way of serializing those keys, so there would not be a way for such users to co-sign the same transaction

Solution: use an ordered dictionary to represent the token bundle and implement serialization logic that would preserve the order of the entries.

Ater internal discussion we concluded canonical ordering is the one that makes sense from interoperability perspective and we should rather specify at CIP level that this is the ordering serialized transactions should follow on any CIP-compliant wallet, hence making the automatic ordering that Trezor does acceptable