From 9be07631aff632cd1e0eb40b0c65e72bc247cd21 Mon Sep 17 00:00:00 2001 From: William Banfield Date: Tue, 14 Dec 2021 18:17:16 -0500 Subject: [PATCH] wip --- docs/rfc/README.md | 1 + docs/rfc/rfc-007-deterministic-proto-bytes.md | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/rfc/README.md b/docs/rfc/README.md index a66969042..400b7c2a5 100644 --- a/docs/rfc/README.md +++ b/docs/rfc/README.md @@ -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) diff --git a/docs/rfc/rfc-007-deterministic-proto-bytes.md b/docs/rfc/rfc-007-deterministic-proto-bytes.md index 1e39135f4..e8cae3b50 100644 --- a/docs/rfc/rfc-007-deterministic-proto-bytes.md +++ b/docs/rfc/rfc-007-deterministic-proto-bytes.md @@ -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