-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
feat(accounts): use gogoproto API instead of protov2. #18653
Changes from 16 commits
381c68c
06abade
4cba9cb
30aed7a
142a23c
5a02492
6561acc
a575014
f60f005
eb78e39
262bc0b
47aaba7
2b6a2f3
c8f9692
1b9d735
ce7b4e0
4054de8
58a3b20
6de1484
a70d3fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ import ( | |
"reflect" | ||
|
||
gogoproto "github.com/cosmos/gogoproto/proto" | ||
"github.com/golang/protobuf/proto" // nolint: staticcheck // needed because gogoproto.Merge does not work consistently. See NOTE: comments. | ||
"google.golang.org/grpc" | ||
proto2 "google.golang.org/protobuf/proto" | ||
"google.golang.org/protobuf/reflect/protoreflect" | ||
|
@@ -125,14 +126,18 @@ func makeGogoHybridHandler(prefMethod protoreflect.MethodDescriptor, cdc codec.B | |
} | ||
resp, err := method.Handler(handler, ctx, func(msg any) error { | ||
// merge! ref: https://github.com/cosmos/cosmos-sdk/issues/18003 | ||
gogoproto.Merge(msg.(gogoproto.Message), inReq) | ||
// NOTE: using gogoproto.Merge will fail for some reason unknown to me, but | ||
// using proto.Merge with gogo messages seems to work fine. | ||
proto.Merge(msg.(gogoproto.Message), inReq) | ||
return nil | ||
}, nil) | ||
if err != nil { | ||
return err | ||
} | ||
// merge resp, ref: https://github.com/cosmos/cosmos-sdk/issues/18003 | ||
gogoproto.Merge(outResp.(gogoproto.Message), resp.(gogoproto.Message)) | ||
// NOTE: using gogoproto.Merge will fail for some reason unknown to me, but | ||
// using proto.Merge with gogo messages seems to work fine. | ||
proto.Merge(outResp.(gogoproto.Message), resp.(gogoproto.Message)) | ||
return nil | ||
}, nil | ||
} | ||
|
@@ -165,14 +170,19 @@ func makeGogoHybridHandler(prefMethod protoreflect.MethodDescriptor, cdc codec.B | |
// we can just call the handler after making a copy of the message, for safety reasons. | ||
resp, err := method.Handler(handler, ctx, func(msg any) error { | ||
// ref: https://github.com/cosmos/cosmos-sdk/issues/18003 | ||
gogoproto.Merge(msg.(gogoproto.Message), m) | ||
asGogoProto := msg.(gogoproto.Message) | ||
// NOTE: using gogoproto.Merge will fail for some reason unknown to me, but | ||
// using proto.Merge with gogo messages seems to work fine. | ||
proto.Merge(asGogoProto, m) | ||
return nil | ||
}, nil) | ||
if err != nil { | ||
return err | ||
} | ||
// merge on the resp, ref: https://github.com/cosmos/cosmos-sdk/issues/18003 | ||
gogoproto.Merge(outResp.(gogoproto.Message), resp.(gogoproto.Message)) | ||
// NOTE: using gogoproto.Merge will fail for some reason unknown to me, but | ||
// using proto.Merge with gogo messages seems to work fine. | ||
proto.Merge(outResp.(gogoproto.Message), resp.(gogoproto.Message)) | ||
return nil | ||
default: | ||
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. The logic for handling message merging in |
||
panic("unreachable") | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -287,9 +287,10 @@ func NewSimApp( | |
runtime.EventService{}, | ||
runtime.BranchService{}, | ||
app.AuthKeeper.AddressCodec(), | ||
appCodec.InterfaceRegistry().SigningContext(), | ||
appCodec, | ||
app.MsgServiceRouter(), | ||
app.GRPCQueryRouter(), | ||
appCodec.InterfaceRegistry(), | ||
Comment on lines
287
to
+293
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.
The review of the
Analysis chainThe changes in the |
||
accountstd.AddAccount("counter", counter.NewAccount), | ||
accountstd.AddAccount("aa_minimal", account_abstraction.NewMinimalAbstractedAccount), | ||
accountstd.AddAccount("aa_full", account_abstraction.NewFullAbstractedAccount), | ||
|
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.
Should we maybe extract this in another PR and backport it to v0.50?
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.
@julienrbrt 100%, I'll do so.