accounts/abi/bind/backends: fix EstimateGas

pull/21083/head
rjl493456442 5 years ago committed by Péter Szilágyi
parent 7cdf4eea7e
commit 53508c5d46
No known key found for this signature in database
GPG Key ID: E9AE538CEDF8293D
  1. 8
      accounts/abi/bind/backends/simulated.go
  2. 2
      accounts/abi/bind/backends/simulated_test.go

@ -509,13 +509,7 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMs
if failed {
if result != nil && result.Err != vm.ErrOutOfGas {
if len(result.Revert()) > 0 {
reason, err := abi.UnpackRevert(result.Revert())
if err == nil {
return 0, &revertError{
error: errors.New("execution reverted"),
errData: reason,
}
}
return 0, newRevertError(result)
}
return 0, result.Err
}

@ -415,7 +415,7 @@ func TestSimulatedBackend_EstimateGas(t *testing.T) {
GasPrice: big.NewInt(0),
Value: nil,
Data: common.Hex2Bytes("d8b98391"),
}, 0, errors.New("execution reverted"), "revert reason"},
}, 0, errors.New("execution reverted: revert reason"), "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d72657665727420726561736f6e00000000000000000000000000000000000000"},
{"PureRevert", ethereum.CallMsg{
From: addr,

Loading…
Cancel
Save