This commit is contained in:
William Banfield
2021-12-14 18:17:16 -05:00
parent 260e1a4ff8
commit 9be07631af
2 changed files with 7 additions and 6 deletions

View File

@@ -44,5 +44,6 @@ sections.
- [RFC-004: E2E Test Framework Enhancements](./rfc-004-e2e-framework.md)
- [RFC-005: Event System](./rfc-005-event-system.rst)
- [RFC-006: Event Subscription](./rfc-006-event-subscription.md)
- [RFC-007: Deterministic Proto Byte Serialization](./rfc-007-deterministic-proto-bytes.md)
<!-- - [RFC-NNN: Title](./rfc-NNN-title.md) -->

View File

@@ -69,15 +69,15 @@ serializers written in other languages that produce the same output as gogoproto
The serialized form of a proto message can be transformed into a canonical representation
by applying simple rules to the serialized bytes. Re-ordering the serialized bytes
would allow Tendermint to produce a canonical byte representation without having to
simultaneously maintain a custom proto marshaller.
would allow Tendermint to produce a canonical byte representation without having to
simultaneously maintain a custom proto marshaller.
This could be implemented as a function in many languages that performed the following steps:
1. Reordered all fields to be in tag-sorted order.
2. Reordered all `repeated` sub-fields to be in lexicographically sorted order.
3. Deleted all default values from the representation.
4. Set our proto decoder package to remove unknown fields on deserialization.
1. Set our proto decoder package to remove unknown fields on deserialization.
2. Reordered all fields to be in tag-sorted order.
3. Reordered all `repeated` sub-fields to be in lexicographically sorted order.
4. Deleted all default values from the byte representation.
This would still require that messages never unmarshal data structures with unknown fields.
This can be accomplished by defining adding fields to a structure that needs canonicalization