Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,18 @@ func (b *SimulatedBackend) CallContract(ctx context.Context, call ethereum.CallM
return nil, err
}
res, err := b.callContract(ctx, call, b.blockchain.CurrentBlock(), state)

if res != nil && res.Err != vm.ErrOutOfGas {
Comment thread
gastonponti marked this conversation as resolved.
if len(res.Revert()) > 0 {
ret, err := abi.UnpackRevert(res.Revert())
if err != nil {
return nil, fmt.Errorf("execution reverted: %#x", res.Revert())
} else {
return nil, fmt.Errorf("execution reverted: %s", ret)
}
Comment thread
mcortesi marked this conversation as resolved.
Outdated
}
}

if err != nil {
return nil, err
}
Expand Down
11 changes: 11 additions & 0 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,17 @@ func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNrOr
if err != nil {
return nil, err
}

if result != nil && result.Err != vm.ErrOutOfGas {
if len(result.Revert()) > 0 {
ret, err := abi.UnpackRevert(result.Revert())
if err != nil {
return nil, fmt.Errorf("execution reverted: %#x", result.Revert())
} else {
return nil, fmt.Errorf("execution reverted: %s", ret)
}
Comment thread
mcortesi marked this conversation as resolved.
Outdated
}
}
return result.Return(), nil
}

Expand Down