-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add amino proto annotations #4629
Changes from 5 commits
d711ae5
bf51c2f
f42c5fb
1e83a1a
49736d9
a94a17f
558e8c1
0df6c7d
d9cacdc
71e0684
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,8 +90,8 @@ require ( | |
) | ||
|
||
replace ( | ||
// Our cosmos-sdk branch is: https://github.com/osmosis-labs/cosmos-sdk, current branch: v16.x. Direct commit link: https://github.com/osmosis-labs/cosmos-sdk/commit/4f857c6a941a3e3849aad40aae1781e80f8e1dda | ||
github.com/cosmos/cosmos-sdk => github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20230313061712-4f857c6a941a | ||
// Our cosmos-sdk branch is: https://github.com/osmosis-labs/cosmos-sdk, current branch: v15.x. Direct commit link: https://github.com/osmosis-labs/cosmos-sdk/commit/14238df02ba5e9f75cc37a64df94bdef5fc5e42a | ||
github.com/cosmos/cosmos-sdk => github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20230315103109-14238df02ba5 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same question There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above, fixing the comment to be 16.x though |
||
// use cosmos-compatible protobufs | ||
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 | ||
// use grpc compatible with cosmos protobufs | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,8 +131,8 @@ require ( | |
) | ||
|
||
replace ( | ||
// Our cosmos-sdk branch is: https://github.com/osmosis-labs/cosmos-sdk, current branch: v16.x. Direct commit link: https://github.com/osmosis-labs/cosmos-sdk/commit/4f857c6a941a3e3849aad40aae1781e80f8e1dda | ||
github.com/cosmos/cosmos-sdk => github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20230313061712-4f857c6a941a | ||
// Our cosmos-sdk branch is: https://github.com/osmosis-labs/cosmos-sdk, current branch: v16.x. Direct commit link: https://github.com/osmosis-labs/cosmos-sdk/commit/14238df02ba5e9f75cc37a64df94bdef5fc5e42a | ||
github.com/cosmos/cosmos-sdk => github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20230315103109-14238df02ba5 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same question There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above, |
||
// use cosmos-compatible protobufs | ||
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 | ||
// use grpc compatible with cosmos protobufs | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
syntax = "proto3"; | ||
|
||
package amino; | ||
|
||
import "google/protobuf/descriptor.proto"; | ||
|
||
// TODO(fdymylja): once we fully migrate to protov2 the go_package needs to be | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is fdymylja? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. must have been ported together from the cherry pick, erasing this |
||
// updated. We need this right now because gogoproto codegen needs to import the | ||
// extension. | ||
option go_package = "github.com/cosmos/cosmos-sdk/types/tx/amino"; | ||
|
||
extend google.protobuf.MessageOptions { | ||
// name is the string used when registering a concrete | ||
// type into the Amino type registry, via the Amino codec's | ||
// `RegisterConcrete()` method. This string MUST be at most 39 | ||
// characters long, or else the message will be rejected by the | ||
// Ledger hardware device. | ||
string name = 11110001; | ||
|
||
// encoding describes the encoding format used by Amino for the given | ||
// message. The field type is chosen to be a string for | ||
// flexibility, but it should ideally be short and expected to be | ||
// machine-readable, for example "base64" or "utf8_json". We | ||
// highly recommend to use underscores for word separation instead of spaces. | ||
// | ||
// If left empty, then the Amino encoding is expected to be the same as the | ||
// Protobuf one. | ||
// | ||
// This annotation should not be confused with the `encoding` | ||
// one which operates on the field level. | ||
string message_encoding = 11110002; | ||
} | ||
|
||
extend google.protobuf.FieldOptions { | ||
// encoding describes the encoding format used by Amino for | ||
// the given field. The field type is chosen to be a string for | ||
// flexibility, but it should ideally be short and expected to be | ||
// machine-readable, for example "base64" or "utf8_json". We | ||
// highly recommend to use underscores for word separation instead of spaces. | ||
// | ||
// If left empty, then the Amino encoding is expected to be the same as the | ||
// Protobuf one. | ||
// | ||
// This annotation should not be confused with the | ||
// `message_encoding` one which operates on the message level. | ||
string encoding = 11110003; | ||
|
||
// field_name sets a different field name (i.e. key name) in | ||
// the amino JSON object for the given field. | ||
// | ||
// Example: | ||
// | ||
// message Foo { | ||
// string bar = 1 [(amino.field_name) = "baz"]; | ||
// } | ||
// | ||
// Then the Amino encoding of Foo will be: | ||
// `{"baz":"some value"}` | ||
string field_name = 11110004; | ||
|
||
// dont_omitempty sets the field in the JSON object even if | ||
// its value is empty, i.e. equal to the Golang zero value. To learn what | ||
// the zero values are, see https://go.dev/ref/spec#The_zero_value. | ||
// | ||
// Fields default to `omitempty`, which is the default behavior when this | ||
// annotation is unset. When set to true, then the field value in the | ||
// JSON object will be set, i.e. not `undefined`. | ||
// | ||
// Example: | ||
// | ||
// message Foo { | ||
// string bar = 1; | ||
// string baz = 2 [(amino.dont_omitempty) = true]; | ||
// } | ||
// | ||
// f := Foo{}; | ||
// out := AminoJSONEncoder(&f); | ||
// out == {"baz":""} | ||
bool dont_omitempty = 11110005; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cant find this commit on the v15.x or 16.x branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the commit osmosis-labs/cosmos-sdk@14238df
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing this to a more recent version of sdk v16.x, osmosis-labs/cosmos-sdk@6ed904c