From 413e4b4cce800eb28e361bc5a3ce81f85e57c411 Mon Sep 17 00:00:00 2001 From: ramtinms Date: Tue, 15 Oct 2024 12:22:17 -0700 Subject: [PATCH] apply PR feedback --- fvm/evm/offchain/query/view.go | 18 +++++++++--------- fvm/evm/offchain/query/view_test.go | 3 --- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/fvm/evm/offchain/query/view.go b/fvm/evm/offchain/query/view.go index 1bf5e73ecbe..bb1647ec657 100644 --- a/fvm/evm/offchain/query/view.go +++ b/fvm/evm/offchain/query/view.go @@ -112,9 +112,16 @@ func (v *View) DryCall( data []byte, value *big.Int, gasLimit uint64, - gasPrice *big.Int, opts ...DryCallOption, ) (*types.Result, error) { + + if gasLimit > v.maxCallGasLimit { + return nil, fmt.Errorf( + "gas limit is bigger than max gas limit allowed %d > %d", + gasLimit, v.maxCallGasLimit, + ) + } + // apply all the options for _, op := range opts { err := op(v) @@ -140,13 +147,6 @@ func (v *View) DryCall( return nil, err } - if gasLimit > v.maxCallGasLimit { - return nil, fmt.Errorf( - "gas limit is bigger than max gas limit allowed %d > %d", - gasLimit, v.maxCallGasLimit, - ) - } - res, err := bv.DirectCall( &types.DirectCall{ From: types.NewAddress(from), @@ -333,7 +333,7 @@ func WithTracer( } } -// WithTracer constructs a dry call option +// WithExtraPrecompiledContracts constructs a dry call option // that allows adding the precompiled contracts // while executing the dry-call. // diff --git a/fvm/evm/offchain/query/view_test.go b/fvm/evm/offchain/query/view_test.go index 4bcd47cc024..22aa9c4d99c 100644 --- a/fvm/evm/offchain/query/view_test.go +++ b/fvm/evm/offchain/query/view_test.go @@ -89,7 +89,6 @@ func TestView(t *testing.T) { testContract.MakeCallData(t, "verifyArchCallToFlowBlockHeight", expectedFlowHeight), big.NewInt(0), uint64(1_000_000), - big.NewInt(0), query.WithExtraPrecompiledContracts( []types.PrecompiledContract{pc}), ) @@ -108,7 +107,6 @@ func TestView(t *testing.T) { newBalance), big.NewInt(0), uint64(1_000_000), - big.NewInt(0), query.WithStateOverrideBalance( testAccount.Address().ToCommon(), newBalance, @@ -127,7 +125,6 @@ func TestView(t *testing.T) { big.NewInt(2)), big.NewInt(0), maxCallGasLimit+1, - big.NewInt(0), ) require.Error(t, err)