Skip to content

Commit fd2b6b2

Browse files
committed
Revert changes to staking_test
1 parent 0154433 commit fd2b6b2

File tree

1 file changed

+49
-3
lines changed

1 file changed

+49
-3
lines changed

state-transition/core/state_processor_staking_test.go

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -726,9 +726,31 @@ func TestTransitionHittingValidatorsCap_ExtraSmall(t *testing.T) {
726726
blk = moveToEndOfEpoch(t, blk, cs, sp, st, ctx, depRoot)
727727

728728
// finally the block turning epoch. extra validator deposits
729-
// will be withdrawn asap (#Validator / MaxValidatorsPerWithdrawalsSweep)
729+
// will be withdrawn within 3 blocks (#Validator / MaxValidatorsPerWithdrawalsSweep)
730730
extraValAddr, err := extraValCreds.ToExecutionAddress()
731731
require.NoError(t, err)
732+
blk = buildNextBlock(
733+
t,
734+
st,
735+
types.NewEth1Data(depRoot),
736+
blk.GetTimestamp()+1,
737+
[]*types.Deposit{},
738+
st.EVMInflationWithdrawal(blk.GetTimestamp()+1),
739+
)
740+
_, err = sp.Transition(ctx, st, blk)
741+
require.NoError(t, err)
742+
743+
blk = buildNextBlock(
744+
t,
745+
st,
746+
types.NewEth1Data(depRoot),
747+
blk.GetTimestamp()+1,
748+
[]*types.Deposit{},
749+
st.EVMInflationWithdrawal(blk.GetTimestamp()+1),
750+
)
751+
_, err = sp.Transition(ctx, st, blk)
752+
require.NoError(t, err)
753+
732754
withdrawals := []*engineprimitives.Withdrawal{
733755
st.EVMInflationWithdrawal(blk.GetTimestamp() + 1),
734756
{
@@ -755,7 +777,7 @@ func TestTransitionHittingValidatorsCap_ExtraSmall(t *testing.T) {
755777
// validator added when validators set is at cap improves amount staked
756778
// an existing validator is removed at the beginning of next epoch.
757779
//
758-
//nolint:paralleltest // uses envars
780+
//nolint:paralleltest,maintidx // uses envars
759781
func TestTransitionHittingValidatorsCap_ExtraBig(t *testing.T) {
760782
cs := setupChain(t)
761783
sp, st, ds, ctx, _, _ := statetransition.SetupTestState(t, cs)
@@ -979,13 +1001,37 @@ func TestTransitionHittingValidatorsCap_ExtraBig(t *testing.T) {
9791001
require.Equal(t, constants.GenesisEpoch+3, smallestVal.WithdrawableEpoch)
9801002

9811003
// STEP 4: move the chain to the next epoch and show withdrawal
982-
// for rejected validator is enqueued asap
1004+
// for rejected validator is enqueued within 3 blocks
9831005
// (#Validator / MaxValidatorsPerWithdrawalsSweep)
9841006
_ = moveToEndOfEpoch(t, blk, cs, sp, st, ctx, depRoot)
9851007

9861008
valToEvict := genDeposits[0]
9871009
valToEvictAddr, err := valToEvict.Credentials.ToExecutionAddress()
9881010
require.NoError(t, err)
1011+
1012+
// finally the block turning epoch
1013+
blk = buildNextBlock(
1014+
t,
1015+
st,
1016+
types.NewEth1Data(depRoot),
1017+
blk.GetTimestamp()+1,
1018+
[]*types.Deposit{},
1019+
st.EVMInflationWithdrawal(blk.GetTimestamp()+1),
1020+
)
1021+
_, err = sp.Transition(ctx, st, blk)
1022+
require.NoError(t, err)
1023+
1024+
blk = buildNextBlock(
1025+
t,
1026+
st,
1027+
types.NewEth1Data(depRoot),
1028+
blk.GetTimestamp()+1,
1029+
[]*types.Deposit{},
1030+
st.EVMInflationWithdrawal(blk.GetTimestamp()+1),
1031+
)
1032+
_, err = sp.Transition(ctx, st, blk)
1033+
require.NoError(t, err)
1034+
9891035
withdrawals := []*engineprimitives.Withdrawal{
9901036
st.EVMInflationWithdrawal(blk.GetTimestamp() + 1),
9911037
{

0 commit comments

Comments
 (0)