Skip to content

Support for not emitting unpopulated fields when proto json marshaling  #13727

@colin-axner

Description

@colin-axner

Summary

When adding new fields to IBC packet data, we would like the ability to not emit (marshal) unpopulated fields. This would allow for new fields to be added without requiring a full network upgrade.

Problem Definition

Currently the ProtoMarshalJSON function sets EmitDefaults to true which will emit unpopulated fields and thus cause unmarshal errors on the packet's receiving side.

Proposal

We need this now, so we have decided to fork this function solely for marshaling ics20 packets.

We anticipate the need for this again and would appreciate the flexibility of controlling the EmitDefaults value. I could see a number of possible solutions to this issue (potentially utilizing the proto codec to indicate the EmitDefaults value). It appears the current justification for setting EmitDefaults to true is for cli purposes, so maybe it should be clear when a proto codec is used for cli vs the state machine.

I don't see any security considerations with regards to setting EmitDefaults to false, as it should marshal less information, but it will be state machine breaking.

Since we have decided to make the change on our end, there is no immediate demand for this feature, but it would be greatly appreciated so we could remove our forked code 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: ProtoProto definition and proto release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions