Skip to content

Consider proto.Any / proto compatible message for registered types #267

@liamsi

Description

@liamsi

Currently "registered types" are done via prefixing the (proto) encoded struct bytes with its "prefix bytes" as described in the Readme.
An alternative we could consider is to use proto.Any:

Basically we would use the type URL to differentiate between the actual send bytes.

Pros:

  • full proto compatibility
  • more human readable (as URL is string based; basically as the amino name)

Cons:

  • type URLs could be long(er than current prefixes)

Update: The discussion (here and on slack) evolved quite a bit. It could be worthwhile to write our own proto wrapper for any registered type and keep the prefix bytes instead of a string based URL scheme (like proto.Any).

Here I summarize pros/cons of both approaches:

proto.Any

Pros:

  • developers might already be familiar with the concept
  • proto implementations provide some tooling around proto.Any
  • messages contain a human readable/understandable identifier (the type URL)

Cons

  • additional overhead of adding a (non size limited) string to the proto encoding (type URL)

our own proto message / BytePrefixedAny

Pros:

  • closer to the existing amino library (we can keep the prefix/disfix logic)
  • byte prefix / disfix are shorter -> less load on the wire or when storing

Cons:

  • people need to understand how prefix/disamb bytes are computed (we need to provide guidance and implementations)
  • slightly more computation when computing prefix
  • less human parseable

to be continued

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions