Skip to content

Conversation

@jinoosss
Copy link
Member

Descriptions

This PR fixes the field ordering inconsistency in the Gno VM protobuf messages to ensure proper serialization/deserialization and maintain consistency across the codebase.

Changes Made

Protocol Buffer Definitions (proto/gno/vm.proto)

  • MsgCall: Moved max_deposit field from position 6 to position 3, reordering subsequent fields accordingly:

    • max_deposit: 6 → 3
    • pkg_path: 3 → 4
    • func: 4 → 5
    • args: 5 → 6
  • MsgRun: Moved max_deposit field from position 4 to position 3, and package from position 3 to position 4:

    • max_deposit: 4 → 3
    • package: 3 → 4

Generated TypeScript Code (src/proto/gno/vm.ts)

  • Updated all corresponding TypeScript interfaces, encoding/decoding functions, and JSON serialization methods to match the new field ordering
  • Fixed wire format encoding with correct field numbers
  • Updated deserialization logic to handle the new field positions

Copy link
Member

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To anyone from the future reading this PR, I hope you don't judge us for these sins on common sense we're doing, but Amino is forcing our hand. The protobuf field ordering NEEDS to follow the Go structure ordering, to preserve Amino compatibility:

type MsgRun struct {
	Caller     crypto.Address  `json:"caller" yaml:"caller"`
	Send       std.Coins       `json:"send" yaml:"send"`
	MaxDeposit std.Coins       `json:"max_deposit,omitempty" yaml:"max_deposit"`
	Package    *std.MemPackage `json:"package" yaml:"package"`
}

type MsgAddPackage struct {
	Creator    crypto.Address  `json:"creator" yaml:"creator"`
	Package    *std.MemPackage `json:"package" yaml:"package"`
	Send       std.Coins       `json:"send" yaml:"send"`
	MaxDeposit std.Coins       `json:"max_deposit,omitempty" yaml:"max_deposit"`
}

It is a sad day to have eyes.

Thank you @jinoosss for noticing this and fixing it up 🙏

@zivkovicmilos zivkovicmilos merged commit 9d6f08f into main Jul 25, 2025
2 checks passed
@zivkovicmilos zivkovicmilos deleted the fix/fix-the-order-of-columns-in-proto branch July 25, 2025 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants