internal/ethapi: added binary data to revertError data

This commit is contained in:
Marius van der Wijden
2020-06-04 10:40:23 +02:00
committed by Péter Szilágyi
parent 4515f84958
commit c9deb8a227
3 changed files with 10 additions and 10 deletions

View File

@ -380,8 +380,8 @@ func (b *SimulatedBackend) CallContract(ctx context.Context, call ethereum.CallM
reason, err := abi.UnpackRevert(res.Revert())
if err == nil {
return nil, &revertError{
error: errors.New("execution reverted"),
errData: reason,
error: fmt.Errorf("execution reverted: %v", reason),
errData: res.Revert(),
}
}
}
@ -403,8 +403,8 @@ func (b *SimulatedBackend) PendingCallContract(ctx context.Context, call ethereu
reason, err := abi.UnpackRevert(res.Revert())
if err == nil {
return nil, &revertError{
error: errors.New("execution reverted"),
errData: reason,
error: fmt.Errorf("execution reverted: %v", reason),
errData: res.Revert(),
}
}
}

View File

@ -1053,8 +1053,8 @@ func TestSimulatedBackend_CallContractRevert(t *testing.T) {
if !ok {
t.Errorf("expect revert error")
}
if !reflect.DeepEqual(rerr.ErrorData(), val) {
t.Errorf("error was malformed: got %v want %v", rerr.ErrorData(), val)
if rerr.Error() != "execution reverted: "+val.(string) {
t.Errorf("error was malformed: got %v want %v", rerr.Error(), val)
}
} else {
// revert(0x0,0x0)

View File

@ -899,8 +899,8 @@ func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNrOr
reason, err := abi.UnpackRevert(result.Revert())
if err == nil {
return nil, &revertError{
error: errors.New("execution reverted"),
errData: reason,
error: fmt.Errorf("execution reverted: %v", reason),
errData: result.Revert(),
}
}
}
@ -1003,8 +1003,8 @@ func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash
reason, err := abi.UnpackRevert(result.Revert())
if err == nil {
return 0, &revertError{
error: errors.New("execution reverted"),
errData: reason,
error: fmt.Errorf("execution reverted: %v", reason),
errData: result.Revert(),
}
}
}