Merge pull request #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.
This commit is contained in:
Manav Darji 2024-12-11 15:15:11 +07:00 committed by GitHub
commit e1f6d2593d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
}