Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBOR map order for named fields in protocol v1.1.0 #649

Open
Alexey-N-Chernyshov opened this issue Dec 1, 2021 · 1 comment
Open

CBOR map order for named fields in protocol v1.1.0 #649

Alexey-N-Chernyshov opened this issue Dec 1, 2021 · 1 comment

Comments

@Alexey-N-Chernyshov
Copy link

Protocols ask/mk/status CBOR encoding don't meet Core CBOR determenistic encoding requirements. The order of keys in the map is as it is defined in the code (for example). The problem is that different order of CBOR map produces different hash that is used in message signatures, so other implementations have to support the non cacnonical order.
I suggest add map keys sorting in canonical order for MarshalCBOR.

@rvagg
Copy link
Member

rvagg commented Dec 1, 2021

See also whyrusleeping/cbor-gen#42 (followed by whyrusleeping/cbor-gen#56) where I've tried to push this before.

It's not the Core CBOR standard we should be following, but the DAG-CBOR standard where we're very explicit about this: https://ipld.io/specs/codecs/dag-cbor/spec/#strictness

Unfortunately this ship sailed at Filecoin launch and changing this now requires a bit more work. I'd love to see this done, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants