-
Notifications
You must be signed in to change notification settings - Fork 610
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
02-client-refactor: rename update to UpdateState for 07-tendermint #1117
Conversation
rename 07-tendermint update function to UpdateState add pruneOldestConsensusState function add check for duplicate update
if pruneError != nil { | ||
panic(pruneError) | ||
} |
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 think we should just panic within the iterate function, but I can fix in a followup pr
testCases := []struct { | ||
name string | ||
malleate func() | ||
expResult func() |
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 find it useful to add a expected results callback for test cases which need to check unique state changes
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, I could see this being a useful approach for testing other state updates. ICS29 tests come to mind! :)
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, looks clean! LGTM 🚀
// pruneOldestConsensusState will retrieve the earliest consensus state for this clientID and check if it is expired. If it is, | ||
// that consensus state will be pruned from store along with all associated metadata. This will prevent the client store from | ||
// becoming bloated with expired consensus states that can no longer be used for updates and packet verification. | ||
func (cs ClientState) pruneOldestConsensusState(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore) { |
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: add some logical spacing between code in this function.
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.
sounds good. Copied from existing code, but agree it could use spacing
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!
testCases := []struct { | ||
name string | ||
malleate func() | ||
expResult func() |
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, I could see this being a useful approach for testing other state updates. ICS29 tests come to mind! :)
…osmos#1117) * rename update to UpdateState rename 07-tendermint update function to UpdateState add pruneOldestConsensusState function add check for duplicate update * fix: duplicate update check was performing incorrect logic * update godoc * add UpdateState tests * update godoc * chore: fix code spacing Co-authored-by: Sean King <[email protected]>
<!-- 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 I did a quick audit of the code for infinite for loops to catch any remaining places where we might be hanging after a shutdown. This PR adds some comments to explain some test helpers and adds two select statements that watch for cancellation of subscriptions to help with a cleaner shutdown. <!-- 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. --> closes cosmos#1069 ## 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
Description
ref: #879
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