Skip to content

Commit

Permalink
apply PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ramtinms committed Oct 15, 2024
1 parent cdc3555 commit 413e4b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
18 changes: 9 additions & 9 deletions fvm/evm/offchain/query/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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),
Expand Down Expand Up @@ -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.
//
Expand Down
3 changes: 0 additions & 3 deletions fvm/evm/offchain/query/view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}),
)
Expand All @@ -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,
Expand All @@ -127,7 +125,6 @@ func TestView(t *testing.T) {
big.NewInt(2)),
big.NewInt(0),
maxCallGasLimit+1,
big.NewInt(0),
)
require.Error(t, err)

Expand Down

0 comments on commit 413e4b4

Please sign in to comment.