-
Notifications
You must be signed in to change notification settings - Fork 629
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
fix: remove marshalling of anys to bytes for verify upgrade #5967
Merged
damiannolan
merged 8 commits into
carlos/client-routing-verify-upgrade-update-state
from
damian/rm-redundant-any-encoding
Mar 12, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0fe7df4
fix: remove marshalling of anys to bytes for verify upgrade
damiannolan 3072bb4
test: refactor 02-client tests for verify upgrade
damiannolan 8db1631
test: fix tests in 07-tenderint client module
damiannolan c0e4665
chore: rm backwards compatability notice and marshalling of anys in c…
damiannolan 1298b89
test: cleanup happy path assertions in 07-tendermint verify upgrade test
damiannolan 3e28783
nit: update inline code commentin test
damiannolan e550c20
doc: update godoc of UpgradeClient handler in core ibc
damiannolan 59d5690
lint: make lint-fix
damiannolan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,26 +67,18 @@ func (k Keeper) UpdateClient(goCtx context.Context, msg *clienttypes.MsgUpdateCl | |
} | ||
|
||
// UpgradeClient defines a rpc handler method for MsgUpgradeClient. | ||
// NOTE: The raw bytes of the conretes types encoded into protobuf.Any is passed to the client keeper. | ||
// The 02-client handler will route to the appropriate light client module based on client identifier and it is the responsibility | ||
// of the light client module to unmarshal and interpret the proto encoded bytes. | ||
// Backwards compatibility with older versions of ibc-go is maintained through the light client module reconstructing and encoding | ||
// the expected concrete type to the protobuf.Any for proof verification. | ||
func (k Keeper) UpgradeClient(goCtx context.Context, msg *clienttypes.MsgUpgradeClient) (*clienttypes.MsgUpgradeClientResponse, error) { | ||
ctx := sdk.UnwrapSDKContext(goCtx) | ||
|
||
// Backwards Compatibility: the light client module is expecting | ||
// to unmarshal an interface so we marshal the client state Any | ||
upgradedClientState, err := k.cdc.Marshal(msg.ClientState) | ||
if err != nil { | ||
return nil, err | ||
} | ||
// Backwards Compatibility: the light client module is expecting | ||
// to unmarshal an interface so we marshal the consensus state Any | ||
upgradedConsensusState, err := k.cdc.Marshal(msg.ConsensusState) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
if err := k.ClientKeeper.UpgradeClient( | ||
ctx, msg.ClientId, | ||
upgradedClientState, | ||
upgradedConsensusState, | ||
msg.ClientState.Value, | ||
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. Can we maybe write a short comment to explain this? 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. Updated the godoc of |
||
msg.ConsensusState.Value, | ||
msg.ProofUpgradeClient, | ||
msg.ProofUpgradeConsensusState, | ||
); err != nil { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Marshalling the any here is exactly what
clienttypes.MarshalClientState()
andclienttypes.MarshalConsensusState()
were doing previously.https://github.com/cosmos/cosmos-sdk/blob/main/codec/proto_codec.go#L230-L239