-
Notifications
You must be signed in to change notification settings - Fork 616
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
chore: 07-tendermint set client/consensus states in UpdateState #1199
chore: 07-tendermint set client/consensus states in UpdateState #1199
Conversation
// SetConsensusState stores the consensus state at the given height. | ||
func SetConsensusState(clientStore sdk.KVStore, cdc codec.BinaryCodec, consensusState *ConsensusState, height exported.Height) { | ||
// setConsensusState stores the consensus state at the given height. | ||
func setConsensusState(clientStore sdk.KVStore, cdc codec.BinaryCodec, consensusState *ConsensusState, height exported.Height) { |
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.
Updated to make private / unexported
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.
Excellent! Left some suggestions on improving the testing changes
bz := clientStore.Get(host.ClientStateKey()) | ||
updatedClientState := clienttypes.MustUnmarshalClientState(suite.chainA.App.AppCodec(), bz) | ||
|
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.
should this go in malleate? I'm not sure these checks perform any actual checks now since GetClientState()
performs the same 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.
Right, yeah I get you! GetClientState
is essentially just getting from the store and unmarshalling as well. So this is basically asserting true is true.
Could you expand on what you're suggesting for moving to malleate? I'm not sure I follow, malleate will be called before UpdateState
right, so the client state retrieved is not yet updated. Are you suggesting to retrieve the not yet updated state in malleate and then in expResult() assert that they are not equal?
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.
Are you suggesting to retrieve the not yet updated state in malleate and then in expResult() assert that they are not equal?
These test cases are asserting the client state didn't get updated (since we updated to a previous height). So yes, I am suggesting we construct the expected client state in malleate and then ensure the client state doesn't change after calling UpdateState
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.
Ah yes, sorry overlooked that when I wrote the comment. I've updated as you suggested to retrieve the "previous" states before update in malleate and check for equality in expResult! :))
bz := clientStore.Get(host.ClientStateKey()) | ||
updatedClientState := clienttypes.MustUnmarshalClientState(suite.chainA.App.AppCodec(), bz) | ||
|
||
bz = clientStore.Get(host.ConsensusStateKey(clientMessage.GetHeight())) | ||
updatedConsensusState := clienttypes.MustUnmarshalConsensusState(suite.chainA.App.AppCodec(), bz) |
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.
ditto on moving into malleate
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.
Done 👍
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 pending these testing improvements. Wonderful that things are moving forward!
…os#1199) * adding storage ops to 07-tendermint UpdateState, updating tests * use clientMessage.GetHeight() as per review suggestions * updating tests to obtain previous client/consensus state in malleate
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. --> ## Overview <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. --> This PR adds [mdbook](https://rust-lang.github.io/mdBook/guide/installation.html) for hosting the specs site. A workflow was added to deploy the specs site to github pages. ## Checklist <!-- Please complete the checklist to ensure that the PR is ready to be reviewed. IMPORTANT: PRs should be left in Draft until the below checklist is completed. --> - [ ] New and updated code has appropriate documentation - [ ] New and updated code has new and/or updated testing - [ ] Required CI checks are passing - [ ] Visual proof for any user facing features like CLI or documentation updates - [ ] Linked issues closed with keywords --------- Co-authored-by: nashqueue <99758629+nashqueue@users.noreply.github.com>
Description
ClientState
andConsensusState
in store within07-tendermint
UpdateState
closes: #1190
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.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes