Skip to content

Commit

Permalink
Populate BLS key diffs for subnet validators
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph committed Oct 21, 2024
1 parent 58d5b8d commit 273fbbe
Show file tree
Hide file tree
Showing 3 changed files with 241 additions and 130 deletions.
12 changes: 8 additions & 4 deletions vms/platformvm/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ type State interface {
validators map[ids.NodeID]*validators.GetValidatorOutput,
startHeight uint64,
endHeight uint64,
subnetID ids.ID,
) error

SetHeight(height uint64)
Expand Down Expand Up @@ -1244,10 +1245,11 @@ func (s *state) ApplyValidatorPublicKeyDiffs(
validators map[ids.NodeID]*validators.GetValidatorOutput,
startHeight uint64,
endHeight uint64,
subnetID ids.ID,
) error {
diffIter := s.validatorPublicKeyDiffsDB.NewIteratorWithStartAndPrefix(
marshalStartDiffKey(constants.PrimaryNetworkID, startHeight),
constants.PrimaryNetworkID[:],
marshalStartDiffKey(subnetID, startHeight),
subnetID[:],
)
defer diffIter.Release()

Expand Down Expand Up @@ -2101,8 +2103,10 @@ func (s *state) writeCurrentStakersSubnetDiff(
// writing.
pk = vdr.validator.PublicKey
} else {
// This should never happen.
return ErrMissingPrimaryNetworkValidator
// This should never happen as the primary network diffs are
// written last and subnet validator times must be a subset
// of the primary network validator times.
return errMissingPrimaryNetworkValidator
}
}

Expand Down
Loading

0 comments on commit 273fbbe

Please sign in to comment.