-
Notifications
You must be signed in to change notification settings - Fork 586
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
imp: use bytes in wasm contract api instead of wrapped types #5154
Conversation
ConsensusState *ConsensusState `json:"consensus_state"` | ||
ClientState []byte `json:"client_state"` | ||
ConsensusState []byte `json:"consensus_state"` | ||
Checksum []byte `json:"checksum"` |
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 left the checksum here for now.
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.
What about latest height. Also, I don't see why contracts would need their own checksum. I think we should remove this.
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 didn't add it because the contract takes the latest height from the underlying client state (the bytes that we are passing here) and uses that to set the latest height of the 08-wasm wrapping type.
Happy to remove the checksum if you do me the favour to figure out how the contract can calculate that itself. I don't think I will have the time to investigate that. 🙏
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.
Happy to keep. Contracts can only get this through a querier which we are passing nil
. I think this was the only way to get it for standard contracts. I still don't see the reason why the contract should be aware of its own codehash.
Also it can get its own code hash during other executions from the clientStore right? Eitherway. Happy to keep.
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 think we should assume that the contract cannot get it's own codehash in instantiate if we remove this since we are not passing in a querier. But it can get it during other executions. I think the contract does not need it's own codeHash in instantiate and we could remove this. I'm in favour of removal but happy to hear what others think
ConsensusState *ConsensusState `json:"consensus_state"` | ||
ClientState []byte `json:"client_state"` | ||
ConsensusState []byte `json:"consensus_state"` | ||
Checksum []byte `json:"checksum"` |
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.
What about latest height. Also, I don't see why contracts would need their own checksum. I think we should remove this.
@@ -101,7 +103,7 @@ func (suite *TypesTestSuite) TestVerifyClientMessage() { | |||
clientState := endpoint.GetClientState() | |||
|
|||
clientMsg = &types.ClientMessage{ | |||
Data: []byte{1}, |
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 could have left this as it was, but I like using tests as some sort of documentation as well, and thus being explicit that we expect a header here it's more helpful for the reader, I think.
@@ -29,8 +29,11 @@ func (endpoint *WasmEndpoint) CreateClient() error { | |||
checksum, err := types.CreateChecksum(Code) | |||
require.NoError(endpoint.Chain.TB, err) | |||
|
|||
clientState := types.NewClientState(contractClientState, checksum, clienttypes.NewHeight(0, 1)) | |||
consensusState := types.NewConsensusState(contractConsensusState) | |||
wrappedClientStateBz := clienttypes.MustMarshalClientState(endpoint.Chain.App.AppCodec(), CreateMockWrappedClientState(clienttypes.NewHeight(1, 5))) |
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.
wrappedClientStateBz := clienttypes.MustMarshalClientState(endpoint.Chain.App.AppCodec(), CreateMockWrappedClientState(clienttypes.NewHeight(1, 5))) | |
wrappedClientStateBz := clienttypes.MustMarshalClientState(endpoint.Chain.App.AppCodec(), MockWrappedClientState) |
Would this work?
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 wanted to use a different mock client state with a different height than MockWrappedClientState
because there are some tests where the client state is updated with MockWrappedClientState
and wanted to verify that the height actually changes.
CI is now green 👍🏻 I didn't modify the migrate contract files |
Yes, that is expected, since we didn't change anything in the migration flow. Thanks for getting CI green, @damiannolan @chatton! 🍾 |
Note for myself: I need to update the docs. |
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.
LGTM, thanks everyone who contributed to this PR 🙏🏻
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.
ACK docs, thanks @crodriguezvega 🙏🏻
I left one suggestion for noting the base64 encoded byte strings
Co-authored-by: srdtrk <srdtrk@hotmail.com> Co-authored-by: Damian Nolan <damiannolan@gmail.com> (cherry picked from commit f2cc21c) # Conflicts: # docs/docs/03-light-clients/04-wasm/07-contracts.md # e2e/tests/wasm/contracts/ics10_grandpa_cw_expiry.wasm.gz # e2e/tests/wasm/grandpa_test.go # modules/light-clients/08-wasm/testing/values.go # modules/light-clients/08-wasm/testing/wasm_endpoint.go # modules/light-clients/08-wasm/types/client_state_test.go # modules/light-clients/08-wasm/types/misbehaviour_handle_test.go # modules/light-clients/08-wasm/types/proposal_handle_test.go # modules/light-clients/08-wasm/types/update_test.go # modules/light-clients/08-wasm/types/upgrade_test.go
Co-authored-by: srdtrk <srdtrk@hotmail.com> Co-authored-by: Damian Nolan <damiannolan@gmail.com> (cherry picked from commit f2cc21c) # Conflicts: # e2e/tests/wasm/contracts/ics10_grandpa_cw_expiry.wasm.gz # e2e/tests/wasm/grandpa_test.go # modules/light-clients/08-wasm/testing/wasm_endpoint.go # modules/light-clients/08-wasm/types/client_state_test.go # modules/light-clients/08-wasm/types/update_test.go
…#5154) (#5275) * imp: use bytes in wasm contract api instead of wrapped types (#5154) Co-authored-by: srdtrk <srdtrk@hotmail.com> Co-authored-by: Damian Nolan <damiannolan@gmail.com> (cherry picked from commit f2cc21c) # Conflicts: # docs/docs/03-light-clients/04-wasm/07-contracts.md # e2e/tests/wasm/contracts/ics10_grandpa_cw_expiry.wasm.gz # e2e/tests/wasm/grandpa_test.go # modules/light-clients/08-wasm/testing/values.go # modules/light-clients/08-wasm/testing/wasm_endpoint.go # modules/light-clients/08-wasm/types/client_state_test.go # modules/light-clients/08-wasm/types/misbehaviour_handle_test.go # modules/light-clients/08-wasm/types/proposal_handle_test.go # modules/light-clients/08-wasm/types/update_test.go # modules/light-clients/08-wasm/types/upgrade_test.go * fix conflicts * delete e2e * delete docs file --------- Co-authored-by: Carlos Rodriguez <carlos@interchain.io> Co-authored-by: Damian Nolan <damiannolan@gmail.com>
…#5154) (#5276) * imp: use bytes in wasm contract api instead of wrapped types (#5154) Co-authored-by: srdtrk <srdtrk@hotmail.com> Co-authored-by: Damian Nolan <damiannolan@gmail.com> (cherry picked from commit f2cc21c) # Conflicts: # e2e/tests/wasm/contracts/ics10_grandpa_cw_expiry.wasm.gz # e2e/tests/wasm/grandpa_test.go # modules/light-clients/08-wasm/testing/wasm_endpoint.go # modules/light-clients/08-wasm/types/client_state_test.go # modules/light-clients/08-wasm/types/update_test.go * fix conflicts * delete e2e --------- Co-authored-by: Carlos Rodriguez <carlos@interchain.io> Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Co-authored-by: srdtrk <srdtrk@hotmail.com> Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Description
Changes for:
VerifyClientMessageMsg
InstantiateMessage
VerifyUpgradeAndUpdateStateMsg
CheckForMisbehaviourMsg
UpdateStateMsg
UpdateStateOnMisbehaviourMsg
Contract changes here.
closes: #XXXX
Commit Message / Changelog Entry
see the guidelines for commit messages. (view raw markdown for examples)
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
).godoc
comments.Files changed
in the Github PR explorer.Codecov Report
in the comment section below once CI passes.