imp: use bytes in wasm contract api instead of wrapped types#5154
imp: use bytes in wasm contract api instead of wrapped types#5154crodriguezvega merged 15 commits intomainfrom
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.
I left the checksum here for now.
There was a problem hiding this comment.
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.
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.
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.
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.
What about latest height. Also, I don't see why contracts would need their own checksum. I think we should remove this.
| clientState := endpoint.GetClientState() | ||
|
|
||
| clientMsg = &types.ClientMessage{ | ||
| Data: []byte{1}, |
There was a problem hiding this comment.
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.
|
|
||
| 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.
| 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.
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. |
damiannolan
left a comment
There was a problem hiding this comment.
LGTM, thanks everyone who contributed to this PR 🙏🏻
damiannolan
left a comment
There was a problem hiding this comment.
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:
VerifyClientMessageMsgInstantiateMessageVerifyUpgradeAndUpdateStateMsgCheckForMisbehaviourMsgUpdateStateMsgUpdateStateOnMisbehaviourMsgContract 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/).godoccomments.Files changedin the Github PR explorer.Codecov Reportin the comment section below once CI passes.