Skip to content
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

Merged
merged 28 commits into from
Nov 6, 2023

Conversation

blasrodri
Copy link
Contributor

No description provided.

@blasrodri blasrodri marked this pull request as ready for review March 22, 2023 14:44
crodriguezvega and others added 2 commits September 7, 2023 21:37
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)))
Copy link

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.

Copy link
Contributor

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.

Copy link
Member

@AdityaSripal AdityaSripal left a 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}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How should it be?

Copy link
Contributor

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)

spec/client/ics-008-wasm-client/README.md Outdated Show resolved Hide resolved
spec/client/ics-008-wasm-client/README.md Show resolved Hide resolved
spec/client/ics-008-wasm-client/README.md Show resolved Hide resolved
Copy link
Member

@AdityaSripal AdityaSripal left a 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[]`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).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appear to be opposite? 😄

Suggested change
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}")
Copy link
Contributor

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
Copy link
Contributor

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?

Comment on lines +522 to +523
pub is_valid: bool, // Execute was successful
pub error_msg: String, // Error message
Copy link
Contributor

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.

Copy link
Contributor

@crodriguezvega crodriguezvega left a 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.

@crodriguezvega crodriguezvega merged commit 8c3b960 into cosmos:main Nov 6, 2023
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

7 participants