Skip to content

Full Proto Encoding #5444

Closed
Closed
@alexanderbez

Description

Summary

Encoding in the SDK is currently handled by the go-amino wire codec. The implementation and use of this encoding protocol has introduced several major concerns over time, with the two biggest being performance and cross-client/language support.

The context and discussions had over amino are dense, so the above is solely meant to be a high-level primer.

Problem Definition

In order to facilitate easier integration for clients and drastically improve the usability of the SDK and its performance, alternative encoding methods need to be explored.

Proposal

As it stands, the proposals are as follows:

  1. Update go-amino to be fully proto3 compatible. There is already a PR that attempts to achieve this.
    a. This is probably the path of least resistance but doesn't actually solve any of our problems directly and seems like a fragile attempt that will require handling corner-cases increasing the surface area for bugs and poor UX support.
  2. Remove go-amino entirely in favor of gogo-proto.
    a. This seems to be the most viable and promising approach. It will address both performance and client UX concerns.
  3. Remove go-amino entirely in favor of capn-proto.
    a. Similar to proposal (2) but with zero-copy and canonicalization features. However, the concern is somewhat of "vendor-lockin" in terms of not having as rich of a multi-client support as pure proto. AFAIK, encoding uses fixed-width integers so this approach could lead to larger encoding size. Compaction is available, but doing so negates the zero-copy feature.
  4. Consider another encoding scheme entirely (e.g. flatbuffers).
    a. Too late for this most likely (atm). It would require heavy research and pretty compelling arguments to steer toward this direction. In addition, it would probably take drastically more time than any other proposal.

Accepted Proposal

Proposal (2) will be adopted. However, @jaekwon will continue to develop go-amino with the goal of it being fully wire-compatible with this proposal. The go-amino proposal is tracked in tendermint/go-amino#302.

What does this mean?

  • When the amino changes are complete, we shall revisit reincorporating go-amino based mainly on UX and performance.
  • Interfaces must adhere to the oneof implementation where the oneof is the only field member and the sum fields must start at 1.
  • Modules will define their own messages and types that must be binary serialized and persisted using package name cosmos_sdk.{module}.v1.
  • An application-level codec will exist with a single oneof to handle messages.

Roadmap & Actionables

State

Client

TX CLI/REST

Tutorials

  • nameservice
  • scavenge

Documentation & Upgrade Guide

Client libs

  • cosmos/amino-js (if need be)

@jordansexton @aaronc


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions