Skip to content

Commit

Permalink
Merge pull request #1384 from maticnetwork/manav/fix-invalid-validato…
Browse files Browse the repository at this point in the history
…r-set

Use `header.ParentHash` while fetching validator set from child chain contract so that while making the call, it uses the state which belongs to the same fork which is being imported.
  • Loading branch information
manav2401 authored Dec 11, 2024
2 parents 67b12b5 + 14c8887 commit e1f6d25
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions consensus/bor/bor.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,9 @@ func (c *Bor) verifyCascadingFields(chain consensus.ChainHeaderReader, header *t

// Verify the validator list match the local contract
if IsSprintStart(number+1, c.config.CalculateSprint(number)) {
newValidators, err := c.spanner.GetCurrentValidatorsByBlockNrOrHash(context.Background(), rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber), number+1)

// Use parent block's hash to make the eth_call to fetch validators so that the state being
// used to make the call is of the same fork.
newValidators, err := c.spanner.GetCurrentValidatorsByBlockNrOrHash(context.Background(), rpc.BlockNumberOrHashWithHash(header.ParentHash, false), number+1)
if err != nil {
return err
}
Expand Down

0 comments on commit e1f6d25

Please sign in to comment.