-
Notifications
You must be signed in to change notification settings - Fork 383
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
ICS8: Update the WASM Client spec #901
Conversation
Signed-off-by: Blas Rodriguez Irizar <[email protected]>
Signed-off-by: Eduardo Díaz <[email protected]>
Signed-off-by: Eduardo Díaz <[email protected]>
add a basic typescript impl
Update the spec with the implementation
Signed-off-by: Carlos Rodriguez <[email protected]>
updates to ICS 08
Co-authored-by: Blas Rodriguez Irizar <[email protected]> Signed-off-by: Carlos Rodriguez <[email protected]>
ics 08: updates after recent refactoring
clientStore = provableStore.prefixStore("clients/{clientMsg.identifier}") | ||
|
||
// use underlying wasm contract to verify client message | ||
assert(callContract(clientStore, clientState, marshalJSON(payload))) |
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.
NIT: Since the read-only operations are now changed to be queries, I would use queryContract
when a read-only query is made to the underlying contract and callContract
when an execute/sudo entrypoint is called.
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.
Thanks for the feedback. Yes, I agree; I will change 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.
Nice work! Couple minor issues also pending change to queryContract for reads as mentioned by other reviewers
} | ||
|
||
// retrieve client identifier-prefixed store | ||
clientStore = provableStore.prefixStore("clients/{clientIdentifier}") |
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.
formatting
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.
How should it be?
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.
the assignment to clientStore appears to be indented? (maybe this is githubs UI being all weird)
Co-authored-by: Aditya <[email protected]>
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.
Since this is correct and only pending minor improvements, I'm approving and merging so we can tackle future issues in smaller PRs. THanks everyone for their hard work and patience!
|
||
### Gas costs | ||
|
||
[]`wasmd`](https://github.com/CosmWasm/wasmd) has thoroughly benchmarked [gas adjustments for CosmWasm](https://github.com/CosmWasm/wasmd/blob/v0.41.0/x/wasm/keeper/gas_register.go#L13-L56) and the same values are being applied in the Wasm VM used in ibc-go's implementation of ICS 8. |
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.
[]`wasmd`](https://github.com/CosmWasm/wasmd) has thoroughly benchmarked [gas adjustments for CosmWasm](https://github.com/CosmWasm/wasmd/blob/v0.41.0/x/wasm/keeper/gas_register.go#L13-L56) and the same values are being applied in the Wasm VM used in ibc-go's implementation of ICS 8. | |
[`wasmd`](https://github.com/CosmWasm/wasmd) has thoroughly benchmarked [gas adjustments for CosmWasm](https://github.com/CosmWasm/wasmd/blob/v0.41.0/x/wasm/keeper/gas_register.go#L13-L56) and the same values are being applied in the Wasm VM used in ibc-go's implementation of ICS 8. |
Comparison between heights is implemented as follows: | ||
### Headers | ||
|
||
Contents of Wasm client headers depend upon Wasm contract. Binary data represented by the `data` field is opaque and only interpreted by the Wasm contract, and will consist either of a valid header or of two conflicting headers, both of which the Wasm contract would have considered valid. In the latter case, the contract will update the consensus state with the valid header; in the former case, the light client may detect misbehaviour and freeze the client (thus preventing further packet flow). |
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.
appear to be opposite? 😄
Contents of Wasm client headers depend upon Wasm contract. Binary data represented by the `data` field is opaque and only interpreted by the Wasm contract, and will consist either of a valid header or of two conflicting headers, both of which the Wasm contract would have considered valid. In the latter case, the contract will update the consensus state with the valid header; in the former case, the light client may detect misbehaviour and freeze the client (thus preventing further packet flow). | |
Contents of Wasm client headers depend upon Wasm contract. Binary data represented by the `data` field is opaque and only interpreted by the Wasm contract, and will consist either of a valid header or of two conflicting headers, both of which the Wasm contract would have considered valid. In the former case, the contract will update the consensus state with the valid header; in the latter case, the light client may detect misbehaviour and freeze the client (thus preventing further packet flow). |
} | ||
|
||
// retrieve client identifier-prefixed store | ||
clientStore = provableStore.prefixStore("clients/{clientIdentifier}") |
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.
the assignment to clientStore appears to be indented? (maybe this is githubs UI being all weird)
assert(codeHandle.verifyNextSequenceRecv(clientState, height, prefix, proof, portIdentifier, channelIdentifier, nextSequenceRecv)) | ||
#### Contract instantiation | ||
|
||
Instantiation of a contract is minimal. No data is passed in the message for the contract call, but the |
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.
consensus & client state is also passed in?
pub is_valid: bool, // Execute was successful | ||
pub error_msg: String, // Error message |
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.
this was brought up in slack discussion at some point, I remember both is_valid
and error_msg
being unused in contracts. Either way, can be left for another PR after we actually remove em from code.
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.
Thank you for all the work on updating the spec and the feedback from the reviewers. I will merge the PR now as is and continue improving it and addressing the remaining feedback in a separate PR.
No description provided.