You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The biggest change is that it will be invalid to add a new field to an existing message and a breaking change detector will need to be created which augments [buf breaking](https://docs.buf.build/breaking/overview) to detect this.
The reasons for this are two-fold:
1) from an API compatibility perspective, adding a new field to an existing message is actually a state machine breaking change which in [ADR 020](https://docs.cosmos.network/v0.52/build/architecture/adr-020-protobuf-transaction-encoding) required us to add an unknown field detector. Furthermore, in [ADR 054](https://docs.cosmos.network/v0.52/build/architecture/adr-054-semver-compatible-modules) this "feature" of protobuf poses one of the biggest problems for correct forward compatibility between different versions of the same module. 2) not allowing new fields in existing messages makes the generated code in languages like Rust (which is currently our highest priority target), much simpler and more performant because we can assume a fixed size struct gets allocated. If new fields can be added to existing messages, we need to encode the number of fields into the message and then do runtime checks. So this both increases memory layers and requires another layout of indirection. With the encoding proposed below, "plain old Rust structs" (used with some special field types) can be used.
Instead of adding new fields to existing messages, APIs can add new messages to existing packages or create new packages with new versions of the messages. Also, we are not restricting the addition of cases to oneofs or values to enums. All of these cases are easier to detect at runtime with standard switch statements than the addition of new fields.
Non-goals / Non-deliverables
Forking the Cosmos SDK
Creating our own encoding rules / best practices
Trying to make the Cosmos SDK change based on our own opinions
General deliverables
Comments: Add/update TODOs and comments alongside the source code so it is easier to follow.
Testing: Add new tests (unit and/or E2E) to the test suite.
Makefile: Add new targets to the Makefile to make the new functionality easier to use.
Documentation: Update architectural or development READMEs; use mermaid diagrams where appropriate.
Objective
Understand what limitations the newer version of Cosmos imposes on us and adapt appropriately.
Origin Document
Goals
Cosmos SDK
when it comesprotobuf
encodingonchain
state) and interfaces (gRPC
queries & transactions) inpoktroll
v0.52
,v0.2
and beyondDeliverables
onchain
structures to comply with:Non-goals / Non-deliverables
General deliverables
Creator: @Olshansk
Co-Owners: @red-0ne @bryanchriswhite
The text was updated successfully, but these errors were encountered: