Skip to content

Commit e1f6d25

Browse files
authored
Merge pull request ethereum#1384 from maticnetwork/manav/fix-invalid-validator-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.
2 parents 67b12b5 + 14c8887 commit e1f6d25

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

consensus/bor/bor.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,9 @@ func (c *Bor) verifyCascadingFields(chain consensus.ChainHeaderReader, header *t
468468

469469
// Verify the validator list match the local contract
470470
if IsSprintStart(number+1, c.config.CalculateSprint(number)) {
471-
newValidators, err := c.spanner.GetCurrentValidatorsByBlockNrOrHash(context.Background(), rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber), number+1)
472-
471+
// Use parent block's hash to make the eth_call to fetch validators so that the state being
472+
// used to make the call is of the same fork.
473+
newValidators, err := c.spanner.GetCurrentValidatorsByBlockNrOrHash(context.Background(), rpc.BlockNumberOrHashWithHash(header.ParentHash, false), number+1)
473474
if err != nil {
474475
return err
475476
}

0 commit comments

Comments
 (0)