-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Remove Last Header from ClientState #6873
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6873 +/- ##
==========================================
+ Coverage 55.60% 61.44% +5.84%
==========================================
Files 457 517 +60
Lines 27440 32103 +4663
==========================================
+ Hits 15257 19726 +4469
+ Misses 11083 10804 -279
- Partials 1100 1573 +473 |
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.
looks good. Minor comments
Time: chain.CurrentHeader.Time, | ||
Time: chain.CurrentHeader.Time, | ||
ValidatorsHash: chain.Vals.Hash(), | ||
NextValidatorsHash: chain.Vals.Hash(), |
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 guess it's ok for now but it would be useful to test validator 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.
could we open up an issue for this?
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.
add to #6509 testing pkg wishlist
@@ -31,6 +33,8 @@ const ( | |||
channelOrder = channeltypes.ORDERED | |||
channelVersion = "1.0" | |||
|
|||
height = 10 |
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, can we use the ibc testing package here? 🙏
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 is just used by genesis_test.go
, fine for now. handler_test.go
uses ibc testing pkg
ErrTrustingPeriodExpired = sdkerrors.Register(SubModuleName, 6, "time since latest trusted state has passed the trusting period") | ||
ErrUnbondingPeriodExpired = sdkerrors.Register(SubModuleName, 7, "time since latest trusted state has passed the unbonding period") | ||
ErrInvalidProofSpecs = sdkerrors.Register(SubModuleName, 8, "invalid proof specs") | ||
ErrInvalidChainID = sdkerrors.Register(SubModuleName, 2, "invalid chain-id") |
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 this should live on the sdkerrors
package since it's very general
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
…sdk into aditya/remove-last-header
Note: This PR currently does not support updating past heights once a client has already been frozen. Thus, in an unfrozen client: It is possible for the latest height of client to be at height 10, and update to fill in a consensus state height at 7 In a frozen client with frozen height 10, it is not possible to update and fill in a consensus state at height < frozenheight. Enabling this would require adding a method on If this addition is worth it, I can implement it in this PR; it is a fairly trivial addition from an implementation standpoint cc: @cwgoes |
Hmm, good question, per our current definition of |
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.
Let's not store the validator set but rather the hash. Otherwise looks fine.
Root commitmentexported.Root `json:"root" yaml:"root"` | ||
Height uint64 `json:"height" yaml:"height"` | ||
NextValidatorsHash tmbytes.HexBytes `json:"next_validators_hash"` // validators hash for the next block | ||
ValidatorSet *tmtypes.ValidatorSet `json:"validator_set" yaml:"validator_set"` |
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 don't think we want to store the whole validator set in each consensus state - too large - can we store the hash and require that the validator set be passed in update messages instead?
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.
Hmm yea that's fine. Note this makes relayer flow for updating more complicated since the relayer needs to know the LatestHeight
of the client in order to query the last trusted valset.
Though since this is true, we can just query for the ValidatorSet
at LatestHeight+1
so that we can use NextValidators
of last trusted header in lite.Verify
Ref issue here: https://github.com/cosmos/ics/issues/456#issuecomment-665118922
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 requires significant changes with tradeoffs, I will implement this in a separate PR so people can see the diffs in isolation.
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.
opened an issue to track this #6930
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.
Agreed, this can be done in a follow-up.
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.
Implementation looks good to me. This is a great add on, nice work!
The godoc and error messages seem to be have been neglected and need some love in being updated to convey the new functionality. I think it'd be fantastic if you could update the ibc spec on this logic as well. Maybe add a section in concepts.
The testing pkg was also relying on the client state needing the full signed header, which means there is now a lot of redundant info being tracked that can be discarded. Could you update the changes this pr does in relation to those fields?
I think it'd also be very nice to add some testing with the testing pkg. Just adding a func to update at a specific height would be nice and then testing filling consensus states for previous height. This could be done in a followup issue though
Time: chain.CurrentHeader.Time, | ||
Time: chain.CurrentHeader.Time, | ||
ValidatorsHash: chain.Vals.Hash(), | ||
NextValidatorsHash: chain.Vals.Hash(), |
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.
could we open up an issue for this?
Co-authored-by: colin axner <25233464+colin-axner@users.noreply.github.com> Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
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.
left some more nits and suggestions
Following merge of this pr I'm pretty sure we can migrate client state entirely, consensusState and headers will have to wait for tendemint update. No fields in client state rely on tendermint except |
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
…sdk into aditya/remove-last-header
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.
LGTM - amazing work!
I think the following changes should still be done
But since this pr is now the blocking factor for client state migration, they should be done in followup pr's |
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, one minor query, agreed on follow-ups
Root commitmentexported.Root `json:"root" yaml:"root"` | ||
Height uint64 `json:"height" yaml:"height"` | ||
NextValidatorsHash tmbytes.HexBytes `json:"next_validators_hash"` // validators hash for the next block | ||
ValidatorSet *tmtypes.ValidatorSet `json:"validator_set" yaml:"validator_set"` |
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.
Agreed, this can be done in a follow-up.
@@ -71,9 +71,16 @@ func (k Keeper) UpdateClient(ctx sdk.Context, clientID string, header exported.H | |||
|
|||
switch clientType { | |||
case exported.Tendermint: | |||
trustedConsState, found := k.GetClientConsensusStateLTE(ctx, clientID, header.GetHeight()) |
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 is probably alright, although I wonder if we want to allow the transaction to provide an explicit past height to update from - though in most cases the most recent height will be best, as we have here
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.
LGTM
* implement features, fix tendermint tests * allow test headers to pass in custom nextvalidatorset * allow updates to previous heights and test * remove unnecessary testing feature * fix client tests * fix ibc tests, and updating consensus state * fix ibc-transfer tests * appease linter * Apply suggestions from code review Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> * add chainID test case * fix expPass value * Apply suggestions from code review Co-authored-by: colin axner <25233464+colin-axner@users.noreply.github.com> Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> * address rest of @colin-axner review * fix bug and errors * Apply suggestions from code review Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> * address rest of @colin-axner review * implement updating before frozen height Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Co-authored-by: colin axner <25233464+colin-axner@users.noreply.github.com>
Description
closes: #6736 and https://github.com/cosmos/ics/issues/420
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