Skip to content

Commit

Permalink
accounts/abi/bind/backends: fix EstimateGas
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 authored and karalabe committed Jun 5, 2020
1 parent 7cdf4ee commit 53508c5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
8 changes: 1 addition & 7 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/bind/backends/simulated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 53508c5

Please sign in to comment.