From 14c88877e6255bcbc9250e455108f0b1439b44d8 Mon Sep 17 00:00:00 2001 From: Manav Darji Date: Tue, 10 Dec 2024 21:15:49 +0530 Subject: [PATCH] consensus/bor: fetch validator set using parent hash --- consensus/bor/bor.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index baac3b4001..3bf38f6ac0 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -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 }