-
Notifications
You must be signed in to change notification settings - Fork 751
imp: use bytes in wasm contract api instead of wrapped types #5154
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
Changes from 13 commits
60f8166
0db7a22
1b70f2a
6d7dee5
3069577
fc0687e
7062231
fa3e116
5ebdd4f
f628c0e
9a0b880
404b303
c7f143e
c24c541
ace5a04
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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))) | ||||||
|
||||||
| 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.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,8 +7,9 @@ import ( | |
|
|
||
| // InstantiateMessage is the message that is sent to the contract's instantiate entry point. | ||
| type InstantiateMessage struct { | ||
| ClientState *ClientState `json:"client_state"` | ||
| ConsensusState *ConsensusState `json:"consensus_state"` | ||
| ClientState []byte `json:"client_state"` | ||
| ConsensusState []byte `json:"consensus_state"` | ||
| Checksum []byte `json:"checksum"` | ||
|
Contributor
Author
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. I left the checksum here for now.
Member
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 about latest height. Also, I don't see why contracts would need their own checksum. I think we should remove this.
Contributor
Author
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. 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. 🙏
Member
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. Happy to keep. Contracts can only get this through a querier which we are passing Also it can get its own code hash during other executions from the clientStore right? Eitherway. Happy to keep.
Member
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. 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 |
||
| } | ||
|
|
||
| // QueryMsg is used to encode messages that are sent to the contract's query entry point. | ||
|
|
@@ -36,12 +37,12 @@ type TimestampAtHeightMsg struct { | |
|
|
||
| // VerifyClientMessageMsg is a queryMsg sent to the contract to verify a client message. | ||
| type VerifyClientMessageMsg struct { | ||
| ClientMessage *ClientMessage `json:"client_message"` | ||
| ClientMessage []byte `json:"client_message"` | ||
| } | ||
|
|
||
| // CheckForMisbehaviourMsg is a queryMsg sent to the contract to check for misbehaviour. | ||
| type CheckForMisbehaviourMsg struct { | ||
| ClientMessage *ClientMessage `json:"client_message"` | ||
| ClientMessage []byte `json:"client_message"` | ||
| } | ||
|
|
||
| // SudoMsg is used to encode messages that are sent to the contract's sudo entry point. | ||
|
|
@@ -59,12 +60,12 @@ type SudoMsg struct { | |
|
|
||
| // UpdateStateMsg is a sudoMsg sent to the contract to update the client state. | ||
| type UpdateStateMsg struct { | ||
| ClientMessage *ClientMessage `json:"client_message"` | ||
| ClientMessage []byte `json:"client_message"` | ||
| } | ||
|
|
||
| // UpdateStateOnMisbehaviourMsg is a sudoMsg sent to the contract to update its state on misbehaviour. | ||
| type UpdateStateOnMisbehaviourMsg struct { | ||
| ClientMessage *ClientMessage `json:"client_message"` | ||
| ClientMessage []byte `json:"client_message"` | ||
| } | ||
|
|
||
| // VerifyMembershipMsg is a sudoMsg sent to the contract to verify a membership proof. | ||
|
|
@@ -88,10 +89,10 @@ type VerifyNonMembershipMsg struct { | |
|
|
||
| // VerifyUpgradeAndUpdateStateMsg is a sudoMsg sent to the contract to verify an upgrade and update its state. | ||
| type VerifyUpgradeAndUpdateStateMsg struct { | ||
| UpgradeClientState ClientState `json:"upgrade_client_state"` | ||
| UpgradeConsensusState ConsensusState `json:"upgrade_consensus_state"` | ||
| ProofUpgradeClient []byte `json:"proof_upgrade_client"` | ||
| ProofUpgradeConsensusState []byte `json:"proof_upgrade_consensus_state"` | ||
| UpgradeClientState []byte `json:"upgrade_client_state"` | ||
| UpgradeConsensusState []byte `json:"upgrade_consensus_state"` | ||
| ProofUpgradeClient []byte `json:"proof_upgrade_client"` | ||
| ProofUpgradeConsensusState []byte `json:"proof_upgrade_consensus_state"` | ||
| } | ||
|
|
||
| // MigrateClientStore is a sudoMsg sent to the contract to verify a given substitute client and update to its state. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.