|
|
@ -806,7 +806,7 @@ func (diff *StateOverride) Apply(state *state.StateDB) error { |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func DoCall(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride, vmCfg vm.Config, timeout time.Duration, globalGasCap uint64) (*core.ExecutionResult, error) { |
|
|
|
func DoCall(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride, timeout time.Duration, globalGasCap uint64) (*core.ExecutionResult, error) { |
|
|
|
defer func(start time.Time) { log.Debug("Executing EVM call finished", "runtime", time.Since(start)) }(time.Now()) |
|
|
|
defer func(start time.Time) { log.Debug("Executing EVM call finished", "runtime", time.Since(start)) }(time.Now()) |
|
|
|
|
|
|
|
|
|
|
|
state, header, err := b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash) |
|
|
|
state, header, err := b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash) |
|
|
@ -895,7 +895,7 @@ func (e *revertError) ErrorData() interface{} { |
|
|
|
// Note, this function doesn't make and changes in the state/blockchain and is
|
|
|
|
// Note, this function doesn't make and changes in the state/blockchain and is
|
|
|
|
// useful to execute and retrieve values.
|
|
|
|
// useful to execute and retrieve values.
|
|
|
|
func (s *PublicBlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride) (hexutil.Bytes, error) { |
|
|
|
func (s *PublicBlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride) (hexutil.Bytes, error) { |
|
|
|
result, err := DoCall(ctx, s.b, args, blockNrOrHash, overrides, vm.Config{}, 5*time.Second, s.b.RPCGasCap()) |
|
|
|
result, err := DoCall(ctx, s.b, args, blockNrOrHash, overrides, 5*time.Second, s.b.RPCGasCap()) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
@ -969,7 +969,7 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr |
|
|
|
executable := func(gas uint64) (bool, *core.ExecutionResult, error) { |
|
|
|
executable := func(gas uint64) (bool, *core.ExecutionResult, error) { |
|
|
|
args.Gas = (*hexutil.Uint64)(&gas) |
|
|
|
args.Gas = (*hexutil.Uint64)(&gas) |
|
|
|
|
|
|
|
|
|
|
|
result, err := DoCall(ctx, b, args, blockNrOrHash, nil, vm.Config{}, 0, gasCap) |
|
|
|
result, err := DoCall(ctx, b, args, blockNrOrHash, nil, 0, gasCap) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
if errors.Is(err, core.ErrIntrinsicGas) { |
|
|
|
if errors.Is(err, core.ErrIntrinsicGas) { |
|
|
|
return true, nil, nil // Special case, raise gas limit
|
|
|
|
return true, nil, nil // Special case, raise gas limit
|
|
|
|