From b1818a10555c2962bd241eee2af5dde55b874d10 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 6 Oct 2020 13:12:16 -0700 Subject: [PATCH] fix base fee tests for different smoke heights --- chain/store/basefee_test.go | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/chain/store/basefee_test.go b/chain/store/basefee_test.go index b4757f70e..b3d414cf5 100644 --- a/chain/store/basefee_test.go +++ b/chain/store/basefee_test.go @@ -11,24 +11,27 @@ import ( func TestBaseFee(t *testing.T) { tests := []struct { - basefee uint64 - limitUsed int64 - noOfBlocks int - output uint64 + basefee uint64 + limitUsed int64 + noOfBlocks int + preSmoke, postSmoke uint64 }{ - {100e6, 0, 1, 87.5e6}, - {100e6, 0, 5, 87.5e6}, - {100e6, build.BlockGasTarget, 1, 103.125e6}, - {100e6, build.BlockGasTarget * 2, 2, 103.125e6}, - {100e6, build.BlockGasLimit * 2, 2, 112.5e6}, - {100e6, build.BlockGasLimit * 1.5, 2, 110937500}, + {100e6, 0, 1, 87.5e6, 87.5e6}, + {100e6, 0, 5, 87.5e6, 87.5e6}, + {100e6, build.BlockGasTarget, 1, 103.125e6, 100e6}, + {100e6, build.BlockGasTarget * 2, 2, 103.125e6, 100e6}, + {100e6, build.BlockGasLimit * 2, 2, 112.5e6, 112.5e6}, + {100e6, build.BlockGasLimit * 1.5, 2, 110937500, 106.250e6}, } for _, test := range tests { test := test t.Run(fmt.Sprintf("%v", test), func(t *testing.T) { - output := ComputeNextBaseFee(types.NewInt(test.basefee), test.limitUsed, test.noOfBlocks, 0) - assert.Equal(t, fmt.Sprintf("%d", test.output), output.String()) + preSmoke := ComputeNextBaseFee(types.NewInt(test.basefee), test.limitUsed, test.noOfBlocks, build.UpgradeSmokeHeight-1) + assert.Equal(t, fmt.Sprintf("%d", test.preSmoke), preSmoke.String()) + + postSmoke := ComputeNextBaseFee(types.NewInt(test.basefee), test.limitUsed, test.noOfBlocks, build.UpgradeSmokeHeight+1) + assert.Equal(t, fmt.Sprintf("%d", test.postSmoke), postSmoke.String()) }) } }