Skip to content

Commit

Permalink
Fix test arbitrum test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
dimriou committed Feb 17, 2023
1 parent 2c2609e commit 6d5e9bd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/chains/evm/gas/arbitrum_estimator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func TestArbitrumEstimator(t *testing.T) {
const maxGasLimit uint32 = 500_000
calldata := []byte{0x00, 0x00, 0x01, 0x02, 0x03}
const gasLimit uint32 = 80000
const gasPriceBufferPercentage = 25

t.Run("calling GetLegacyGas on unstarted estimator returns error", func(t *testing.T) {
config := mocks.NewConfig(t)
Expand Down Expand Up @@ -64,7 +65,8 @@ func TestArbitrumEstimator(t *testing.T) {
t.Cleanup(func() { assert.NoError(t, o.Close()) })
gasPrice, chainSpecificGasLimit, err := o.GetLegacyGas(testutils.Context(t), calldata, gasLimit, maxGasPrice)
require.NoError(t, err)
assert.Equal(t, assets.NewWeiI(42), gasPrice)
// Expected price for a standard l2_suggested_estimator would be 42, but we add a fixed gasPriceBufferPercentage.
assert.Equal(t, assets.NewWeiI(42).AddPercentage(gasPriceBufferPercentage), gasPrice)
assert.Equal(t, gasLimit, chainSpecificGasLimit)
})

Expand Down Expand Up @@ -185,7 +187,8 @@ func TestArbitrumEstimator(t *testing.T) {
gasPrice, chainSpecificGasLimit, err := o.GetLegacyGas(testutils.Context(t), calldata, gasLimit, maxGasPrice)
require.NoError(t, err)
require.NotNil(t, gasPrice)
assert.Equal(t, "42 wei", gasPrice.String())
// Again, a normal l2_suggested_estimator would return 42, but arbitrum_estimator adds a buffer.
assert.Equal(t, "52 wei", gasPrice.String())
assert.Equal(t, expLimit, chainSpecificGasLimit, "expected %d but got %d", expLimit, chainSpecificGasLimit)
})

Expand Down

0 comments on commit 6d5e9bd

Please sign in to comment.