From a0ecf30f36aad58ab12bd2cb9d69d310613efc22 Mon Sep 17 00:00:00 2001 From: Oliver Bundalo Date: Fri, 31 May 2024 12:44:49 +0200 Subject: [PATCH] TestE2E_Consensus_RegisterValidator fix --- consensus/polybft/system_state.go | 2 +- e2e-polybft/e2e/consensus_test.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/consensus/polybft/system_state.go b/consensus/polybft/system_state.go index 96685aa772..2057fedf6c 100644 --- a/consensus/polybft/system_state.go +++ b/consensus/polybft/system_state.go @@ -13,9 +13,9 @@ import ( // ValidatorInfo is data transfer object which holds validator information, // provided by smart contract type ValidatorInfo struct { - Address types.Address `json:"address"` Stake *big.Int `json:"stake"` WithdrawableRewards *big.Int `json:"withdrawableRewards"` + Address types.Address `json:"address"` IsActive bool `json:"isActive"` IsWhitelisted bool `json:"isWhitelisted"` } diff --git a/e2e-polybft/e2e/consensus_test.go b/e2e-polybft/e2e/consensus_test.go index 3aa23ef778..fe961eb030 100644 --- a/e2e-polybft/e2e/consensus_test.go +++ b/e2e-polybft/e2e/consensus_test.go @@ -243,6 +243,11 @@ func TestE2E_Consensus_RegisterValidator(t *testing.T) { // register the second validator with stake require.NoError(t, secondValidator.RegisterValidatorWithStake(stakeAmount)) + // get owner's latest block and wait for 1 block before checks + latestBlock, err := owner.JSONRPC().BlockNumber() + require.NoError(t, err) + require.NoError(t, cluster.WaitForBlock(latestBlock+1, 5*time.Second)) + firstValidatorInfo, err := validatorHelper.GetValidatorInfo(firstValidatorAddr, relayer) require.NoError(t, err) require.True(t, firstValidatorInfo.IsActive)