-
Notifications
You must be signed in to change notification settings - Fork 170
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
feat: Add kv for validator BLS key set #242
Conversation
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 helping out! No blocker from my side except for two minor bugs
} | ||
|
||
// ClearValidatorSet removes the validator BLS set of a given epoch | ||
// TODO: This is called upon the epoch is checkpointed |
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.
Will we prune validator sets of finalised epochs? I feel the answer is no since CZ might want to query CZ headers in finalised epochs.
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.
Yeah, I had the same feelings. They should stay in storage for a fairly long period of time. But, a question maybe not for now, are we going to prune it, and how?
testutil/datagen/raw_checkpoint.go
Outdated
var ( | ||
valSet []*types.ValidatorWithBlsKey | ||
valSet *types.ValidatorWithBlsKeySet |
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.
Is valSet.ValSet
initialised here? If not then its value will be nil
and L84 will panic
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 catch!
@@ -22,6 +23,12 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper, req abci.RequestBeginBlock) | |||
|
|||
// if this block is the second block of an epoch | |||
epoch := k.GetEpoch(ctx) | |||
if epoch.IsFirstBlock(ctx) { |
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 you help me add a comment about the contract for IsFirstBlockOfNextEpoch
as our offline discussion? Something like below. Thanks :)
// CONTRACT: IsFirstBlockOfNextEpoch can only be called by the epoching module once upon the first block of a new epoch. Other modules should use IsFirstBlock instead.
x/checkpointing/types/val_bls_set.go
Outdated
valSet *ValidatorWithBlsKeySet | ||
) | ||
|
||
for i := 0; i < bm.Len(); i++ { |
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.
for i := 0; i < bm.Len(); i++ { | |
for i := 0; i < len(ks); i++ { |
Here bm.Len()
will be 104 while len(ks)
will be 100. If iterating over bm.Len()
then L30 will panic upon i reaches 100
. This PR identifies and fixes this issue. Perhaps we can fix it here directly.
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 one!
This PR is to add a kv for the validator BLS key set, i.e., epoch -> repeated(addr, BLS PK, power). Adding this is to support ZoneConcierge module to generate a succinct poof of the sealed epoch.
The validator BLS key set is stored for every epoch upon epoch boundary.