From cf3a7a9d896c7ff82129779bfa67c4f8931b2dbc Mon Sep 17 00:00:00 2001 From: mmsqe Date: Wed, 22 Mar 2023 21:42:16 +0800 Subject: [PATCH 1/9] add estimate_gas test --- .../hardhat/contracts/TestERC20A.sol | 10 ++++++++++ tests/integration_tests/test_estimate_gas.py | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tests/integration_tests/test_estimate_gas.py diff --git a/tests/integration_tests/hardhat/contracts/TestERC20A.sol b/tests/integration_tests/hardhat/contracts/TestERC20A.sol index edb92c4aa8..8d38b2e3e7 100644 --- a/tests/integration_tests/hardhat/contracts/TestERC20A.sol +++ b/tests/integration_tests/hardhat/contracts/TestERC20A.sol @@ -7,4 +7,14 @@ contract TestERC20A is ERC20 { constructor() public ERC20("TestERC20", "Test") { _mint(msg.sender, 100000000000000000000000000); } + + // 0x9ffb86a5 + function revertWithMsg() public pure { + revert("Function has been reverted"); + } + + // 0x3246485d + function revertWithoutMsg() public pure { + revert(); + } } diff --git a/tests/integration_tests/test_estimate_gas.py b/tests/integration_tests/test_estimate_gas.py new file mode 100644 index 0000000000..d18d41b780 --- /dev/null +++ b/tests/integration_tests/test_estimate_gas.py @@ -0,0 +1,19 @@ +from .utils import ADDRS, CONTRACTS, deploy_contract + + +def test_revert(ethermint): + w3 = ethermint.w3 + call = w3.provider.make_request + validator = ADDRS["validator"] + erc20, _ = deploy_contract( + w3, + CONTRACTS["TestERC20A"], + ) + method = "eth_estimateGas" + # revert methods + for data in ["0x9ffb86a5"]: + params = {"from": validator, "to": erc20.address, "data": data} + error = call(method, [params])["error"] + assert error["code"] == 3 + assert error["message"] == "execution reverted: Function has been reverted" + assert error["data"] == "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001a46756e6374696f6e20686173206265656e207265766572746564000000000000" # noqa: E501 From d31aa36e86b084a5c817f1f957031d7afc59d054 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Wed, 22 Mar 2023 21:42:53 +0800 Subject: [PATCH 2/9] add ret and vm_error for revert reason --- proto/ethermint/evm/v1/query.proto | 5 + rpc/backend/call_tx.go | 6 + x/evm/keeper/grpc_query.go | 5 +- x/evm/types/query.pb.go | 291 ++++++++++++++++++++--------- 4 files changed, 215 insertions(+), 92 deletions(-) diff --git a/proto/ethermint/evm/v1/query.proto b/proto/ethermint/evm/v1/query.proto index e533edc927..49feb723fc 100644 --- a/proto/ethermint/evm/v1/query.proto +++ b/proto/ethermint/evm/v1/query.proto @@ -231,6 +231,11 @@ message EthCallRequest { message EstimateGasResponse { // gas returns the estimated gas uint64 gas = 1; + // ret is the returned data from evm function (result or data supplied with revert + // opcode) + bytes ret = 2; + // vm_error is the error returned by vm execution + string vm_error = 3; } // QueryTraceTxRequest defines TraceTx request diff --git a/rpc/backend/call_tx.go b/rpc/backend/call_tx.go index 7967d06fe2..19b099dd8b 100644 --- a/rpc/backend/call_tx.go +++ b/rpc/backend/call_tx.go @@ -336,6 +336,12 @@ func (b *Backend) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *rp if err != nil { return 0, err } + if len(res.VmError) > 0 { + if res.VmError != vm.ErrExecutionReverted.Error() { + return 0, status.Error(codes.Internal, res.VmError) + } + return 0, evmtypes.NewExecErrorWithReason(res.Ret) + } return hexutil.Uint64(res.Gas), nil } diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index 59a3678714..e4a2d330ce 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -379,7 +379,10 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type if failed { if result != nil && result.VmError != vm.ErrOutOfGas.Error() { if result.VmError == vm.ErrExecutionReverted.Error() { - return nil, types.NewExecErrorWithReason(result.Ret) + return &types.EstimateGasResponse{ + Ret: result.Ret, + VmError: result.VmError, + }, nil } return nil, errors.New(result.VmError) } diff --git a/x/evm/types/query.pb.go b/x/evm/types/query.pb.go index d259a96d2b..eeb4bc45f6 100644 --- a/x/evm/types/query.pb.go +++ b/x/evm/types/query.pb.go @@ -863,6 +863,11 @@ func (m *EthCallRequest) GetChainId() int64 { type EstimateGasResponse struct { // gas returns the estimated gas Gas uint64 `protobuf:"varint,1,opt,name=gas,proto3" json:"gas,omitempty"` + // ret is the returned data from evm function (result or data supplied with revert + // opcode) + Ret []byte `protobuf:"bytes,2,opt,name=ret,proto3" json:"ret,omitempty"` + // vm_error is the error returned by vm execution + VmError string `protobuf:"bytes,3,opt,name=vm_error,json=vmError,proto3" json:"vm_error,omitempty"` } func (m *EstimateGasResponse) Reset() { *m = EstimateGasResponse{} } @@ -905,6 +910,20 @@ func (m *EstimateGasResponse) GetGas() uint64 { return 0 } +func (m *EstimateGasResponse) GetRet() []byte { + if m != nil { + return m.Ret + } + return nil +} + +func (m *EstimateGasResponse) GetVmError() string { + if m != nil { + return m.VmError + } + return "" +} + // QueryTraceTxRequest defines TraceTx request type QueryTraceTxRequest struct { // msg is the MsgEthereumTx for the requested transaction @@ -1314,97 +1333,99 @@ func init() { func init() { proto.RegisterFile("ethermint/evm/v1/query.proto", fileDescriptor_e15a877459347994) } var fileDescriptor_e15a877459347994 = []byte{ - // 1434 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0xcd, 0x6f, 0x13, 0x47, - 0x14, 0xcf, 0xc6, 0x4e, 0xec, 0x3c, 0x07, 0x70, 0x87, 0x50, 0xcc, 0x36, 0xb1, 0xc3, 0x42, 0x3e, - 0x09, 0xbb, 0x8d, 0x5b, 0x21, 0x95, 0x4b, 0xc1, 0x56, 0xa0, 0x14, 0xa8, 0xa8, 0x1b, 0xf5, 0x50, - 0x09, 0x59, 0xe3, 0xf5, 0xb0, 0xb6, 0x62, 0xef, 0x9a, 0x9d, 0xb1, 0xeb, 0x40, 0xe9, 0xa1, 0x52, - 0x11, 0x15, 0x52, 0x85, 0xd4, 0x7b, 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, 0x6c, 0x24, 0x90, 0x7e, - 0xea, 0x37, 0x12, 0xc8, 0x00, 0xa9, 0x33, 0xb6, 0x05, 0x90, 0x73, 0x68, 0x23, 0x0c, 0x84, 0x06, - 0xa2, 0x5d, 0x1c, 0xd6, 0xfd, 0x3d, 0xb2, 0xff, 0x00, 0xdd, 0x83, 0x28, 0x27, 0x6d, 0xc8, 0x18, - 0x59, 0x32, 0x1d, 0x26, 0xa8, 0x9f, 0x19, 0x2b, 0x23, 0x31, 0x6c, 0x08, 0x0c, 0x67, 0xd0, 0xe9, - 0x61, 0xd5, 0x54, 0xee, 0x8b, 0xc4, 0x97, 0x30, 0x1b, 0xf0, 0x16, 0x74, 0x76, 0x84, 0xe6, 0x3e, - 0x7a, 0xa4, 0xaf, 0x4c, 0x90, 0x92, 0x08, 0x96, 0x05, 0x02, 0x1d, 0xa5, 0xc2, 0x08, 0x02, 0x62, - 0x84, 0xda, 0x10, 0x93, 0xbc, 0x08, 0x2d, 0x87, 0x75, 0xf6, 0x53, 0x26, 0x7d, 0x6d, 0xd2, 0xac, - 0x50, 0x76, 0x0d, 0x61, 0x77, 0x11, 0xe9, 0x61, 0xbb, 0x84, 0x55, 0x8a, 0x36, 0x37, 0xf7, 0x35, - 0x24, 0x7a, 0x88, 0xcd, 0x21, 0xac, 0x0f, 0xf1, 0x79, 0x08, 0x33, 0x32, 0x56, 0x85, 0xed, 0x65, - 0x94, 0x1e, 0x62, 0x5b, 0x8a, 0x17, 0x1d, 0x4c, 0xd1, 0x57, 0x10, 0x93, 0x73, 0x74, 0x64, 0xed, - 0xf5, 0x33, 0xa9, 0x91, 0xb5, 0x37, 0x30, 0x8e, 0xc7, 0x79, 0x1f, 0x0c, 0x51, 0xd6, 0x46, 0x8f, - 0x34, 0x80, 0xee, 0x24, 0x40, 0xeb, 0xe3, 0x54, 0xf7, 0x0e, 0x6f, 0x7d, 0xe3, 0x10, 0x92, 0x12, - 0xc7, 0x8a, 0xc0, 0x91, 0x41, 0x4b, 0xa3, 0x70, 0x88, 0xb1, 0xc8, 0x03, 0x21, 0xa7, 0xc9, 0x98, - 0x6e, 0xd0, 0x3b, 0x84, 0xc6, 0x74, 0x83, 0xbe, 0xa1, 0x34, 0x2e, 0x10, 0x6a, 0x58, 0xe5, 0x2e, - 0x3d, 0x7b, 0x95, 0xd6, 0x9e, 0xbf, 0x4a, 0x6b, 0x2f, 0x5f, 0xa5, 0xb5, 0x27, 0x07, 0xe9, 0xa9, - 0xe7, 0x07, 0xe9, 0xa9, 0x5f, 0x0f, 0xd2, 0x53, 0x5f, 0xf4, 0x0e, 0x2f, 0xd2, 0xe2, 0xb3, 0xab, - 0xab, 0xa5, 0x2d, 0xf4, 0x88, 0x01, 0x56, 0x9a, 0x15, 0xb3, 0xff, 0xbd, 0x7f, 0x02, 0x00, 0x00, - 0xff, 0xff, 0xa4, 0xba, 0x06, 0x5b, 0xc7, 0x11, 0x00, 0x00, + // 1461 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0xcb, 0x8f, 0x13, 0x47, + 0x13, 0xdf, 0x59, 0x7b, 0xd7, 0xde, 0xb6, 0x01, 0x7f, 0xcd, 0xf2, 0x61, 0xe6, 0xdb, 0xb5, 0x97, + 0x81, 0x7d, 0xb2, 0xcc, 0x7c, 0xeb, 0x44, 0x48, 0xe1, 0x12, 0xb0, 0xb5, 0x10, 0x02, 0x44, 0x64, + 0xb2, 0xca, 0x21, 0x12, 0xb2, 0xda, 0xe3, 0x66, 0x6c, 0xad, 0x67, 0xda, 0x4c, 0xb7, 0x1d, 0x2f, + 0x84, 0x1c, 0x22, 0x05, 0x11, 0x21, 0x45, 0x48, 0xb9, 0x47, 0xfc, 0x07, 0x39, 0xe6, 0x5f, 0xe0, + 0x88, 0x94, 0x4b, 0x94, 0x03, 0x41, 0x90, 0x43, 0x6e, 0xb9, 0xe7, 0x14, 0xf5, 0x63, 0xfc, 0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2, 0x53, 0xcc, 0xef, 0x56, 0x50, 0x03, 0xf9, 0x0e, 0x0e, 0xef, 0xaa, 0x2d, + 0xfc, 0x1f, 0x58, 0x70, 0x48, 0x15, 0x97, 0x6b, 0x88, 0xd6, 0xb2, 0xb3, 0xe2, 0x2c, 0xc9, 0x05, + 0x1f, 0x20, 0x5a, 0x83, 0x8b, 0x60, 0xce, 0x27, 0xfc, 0x52, 0x6c, 0x45, 0xdb, 0x88, 0xdb, 0x72, + 0x63, 0xbc, 0x0f, 0x4e, 0x09, 0x27, 0x25, 0x91, 0xde, 0xbf, 0x81, 0xf2, 0xa1, 0x06, 0xf4, 0x51, + 0x16, 0x14, 0xd8, 0x55, 0x70, 0x54, 0xbe, 0x5c, 0x79, 0xd0, 0xd2, 0x11, 0x29, 0xbd, 0x2c, 0x85, + 0x50, 0x07, 0x49, 0xca, 0x9d, 0x72, 0x7c, 0xb3, 0x02, 0x5f, 0x77, 0xcf, 0x4d, 0x20, 0x69, 0xb5, + 0xec, 0xb7, 0xbc, 0x0a, 0x0e, 0x54, 0x04, 0x47, 0x94, 0xf4, 0x23, 0x21, 0x34, 0xae, 0x83, 0x25, + 0x81, 0xe3, 0x53, 0xd4, 0xa8, 0x57, 0x11, 0x23, 0xc1, 0x50, 0x30, 0xa7, 0x41, 0xda, 0x21, 0xfe, + 0x30, 0x8e, 0x14, 0x97, 0x5d, 0x8e, 0x44, 0xf5, 0x58, 0x03, 0xcb, 0x63, 0xac, 0xa9, 0xc0, 0xd6, + 0xc1, 0xb1, 0x10, 0xd5, 0xa0, 0xc5, 0x10, 0xec, 0x5b, 0x0c, 0x2d, 0x2c, 0xa2, 0xa2, 0x7c, 0xe7, + 0x37, 0x79, 0x9e, 0xff, 0xab, 0x22, 0xea, 0x5e, 0x9d, 0x56, 0x44, 0xc6, 0x75, 0xe5, 0xec, 0x13, + 0x46, 0x02, 0xe4, 0x4e, 0x77, 0x06, 0x33, 0x20, 0xb6, 0x8f, 0x0f, 0x54, 0xbd,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0x52, 0x76, 0x88, 0x7f, 0xa7, 0xee, 0x0a, 0x4f, + 0xa9, 0xc2, 0x72, 0xf4, 0xae, 0x70, 0x55, 0x12, 0x4a, 0x76, 0x8a, 0xf5, 0x36, 0xb0, 0x04, 0xd2, + 0xcd, 0x00, 0x57, 0xb1, 0x83, 0x29, 0x25, 0x01, 0xcd, 0xc6, 0x45, 0xf5, 0x4d, 0xf5, 0x3e, 0x70, + 0x89, 0xb7, 0xd4, 0x4a, 0x83, 0x38, 0xfb, 0x61, 0xf3, 0x9a, 0x13, 0x69, 0x4c, 0x09, 0x99, 0x6c, + 0x5d, 0x70, 0x19, 0x00, 0xa9, 0x22, 0xfe, 0xb0, 0x79, 0x91, 0x91, 0x05, 0x21, 0x11, 0x43, 0xa9, + 0x14, 0x1e, 0xf3, 0xb9, 0x99, 0x4d, 0x88, 0x30, 0x74, 0x53, 0x0e, 0x55, 0x33, 0x1c, 0xaa, 0xe6, + 0x5e, 0x38, 0x54, 0x8b, 0x49, 0x5e, 0x61, 0x4f, 0x7e, 0xcd, 0x6b, 0xca, 0x08, 0x3f, 0x19, 0x59, + 0x28, 0xc9, 0x7f, 0xa6, 0x50, 0x16, 0x06, 0x0a, 0xe5, 0xc3, 0x78, 0x72, 0x36, 0x13, 0xb3, 0x93, + 0xac, 0x53, 0xae, 0xfb, 0x55, 0xdc, 0x31, 0xb6, 0x54, 0xbb, 0xeb, 0xbe, 0x70, 0xaf, 0x17, 0x55, + 0x11, 0x43, 0x61, 0xdd, 0xf3, 0xb5, 0xf1, 0x6d, 0x0c, 0xfc, 0xb7, 0xa7, 0x5c, 0xe4, 0xd1, 0xf4, + 0x55, 0x04, 0xeb, 0x84, 0x1d, 0x61, 0x7a, 0x45, 0xb0, 0x0e, 0x7d, 0x0b, 0x15, 0xf1, 0x6f, 0x7f, + 0x4c, 0xe3, 0x3c, 0x38, 0x19, 0x79, 0x8f, 0x09, 0xef, 0x77, 0xa2, 0x3b, 0x94, 0x29, 0xbe, 0x82, +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 0x1e, 0x2e, + 0x8f, 0xc3, 0x21, 0xc6, 0x22, 0x4f, 0x84, 0x9a, 0x26, 0x13, 0xba, 0x41, 0xff, 0x10, 0x9a, 0xd0, + 0x0d, 0x06, 0x86, 0xd2, 0xa4, 0x44, 0x84, 0xc3, 0xaa, 0x78, 0xe9, 0xd9, 0xab, 0x9c, 0xf6, 0xfc, + 0x55, 0x4e, 0x7b, 0xf9, 0x2a, 0xa7, 0x3d, 0x79, 0x9d, 0x9b, 0x79, 0xfe, 0x3a, 0x37, 0xf3, 0xf3, + 0xeb, 0xdc, 0xcc, 0x67, 0xfd, 0xc3, 0x0b, 0xb7, 0xf9, 0xec, 0xea, 0x59, 0xe9, 0x08, 0x3b, 0x62, + 0x80, 0x55, 0xe6, 0xc5, 0xec, 0x7f, 0xe7, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x36, 0x7e, 0x29, + 0xbf, 0xf4, 0x11, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2526,6 +2547,20 @@ func (m *EstimateGasResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.VmError) > 0 { + i -= len(m.VmError) + copy(dAtA[i:], m.VmError) + i = encodeVarintQuery(dAtA, i, uint64(len(m.VmError))) + i-- + dAtA[i] = 0x1a + } + if len(m.Ret) > 0 { + i -= len(m.Ret) + copy(dAtA[i:], m.Ret) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Ret))) + i-- + dAtA[i] = 0x12 + } if m.Gas != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.Gas)) i-- @@ -3104,6 +3139,14 @@ func (m *EstimateGasResponse) Size() (n int) { if m.Gas != 0 { n += 1 + sovQuery(uint64(m.Gas)) } + l = len(m.Ret) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.VmError) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -4955,6 +4998,72 @@ func (m *EstimateGasResponse) Unmarshal(dAtA []byte) error { break } } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ret", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ret = append(m.Ret[:0], dAtA[iNdEx:postIndex]...) + if m.Ret == nil { + m.Ret = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VmError", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VmError = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) From b60ba22f752472d0e296f86f8ec852692096a7d2 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Wed, 22 Mar 2023 17:56:11 +0800 Subject: [PATCH 3/9] update nix --- gomod2nix.toml | 105 +++++++++++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 48 deletions(-) diff --git a/gomod2nix.toml b/gomod2nix.toml index 65ab566060..8e30973f14 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -2,11 +2,11 @@ schema = 3 [mod] [mod."cloud.google.com/go"] - version = "v0.105.0" - hash = "sha256-2nYtHjuN9ghGcM6aPlOxyNNarHebHtj0Xec48sWwdaI=" + version = "v0.107.0" + hash = "sha256-sb3SjuWj84ZUtIGYIioOmycfHLL0KZSYt/Y1zzfcd5M=" [mod."cloud.google.com/go/compute"] - version = "v1.14.0" - hash = "sha256-Ay0oTR0I/ROajIiBSuZ1LfVVio142f8mUa64tGwreG8=" + version = "v1.15.1" + hash = "sha256-F63wL70xdjxzFUKn8FEcBSI7FB94v1lo0f/aLDHiwMA=" [mod."cloud.google.com/go/compute/metadata"] version = "v0.2.3" hash = "sha256-kYB1FTQRdTDqCqJzSU/jJYbVUGyxbkASUKbEs36FUyU=" @@ -20,8 +20,8 @@ schema = 3 version = "v1.0.0-beta.7" hash = "sha256-XblGvIx6Wvvq6wggXjp+KbeJGXoe7AZH7hXEdauCezU=" [mod."cosmossdk.io/math"] - version = "v1.0.0-beta.4" - hash = "sha256-UYdq/46EubyjxkldGike8FlwJLWGCB576VB7th285ao=" + version = "v1.0.0-rc.0" + hash = "sha256-bQ2hxg1dwVxbyBzbdepCz8nFGx6dfr63syqDNQ8AFQc=" [mod."filippo.io/edwards25519"] version = "v1.0.0-rc.1" hash = "sha256-3DboBqby2ejRU33FG96Z8JF5AJ8HP2rC/v++VyoQ2LQ=" @@ -45,8 +45,8 @@ schema = 3 version = "v0.4.1" hash = "sha256-usxTUHA0QQMdM6sHi2z51nmnEKMbA0qUilxJFpWHlYE=" [mod."github.com/aws/aws-sdk-go"] - version = "v1.40.45" - hash = "sha256-7m4jOfXs356SUZG9tR+z3Yfa/O0CorkSkOXg/AmbqRM=" + version = "v1.44.122" + hash = "sha256-bzkXf4Sf+6y6on7iulGtXkPdj0XoevkHYGQYPTNL7To=" [mod."github.com/beorn7/perks"] version = "v1.0.1" hash = "sha256-h75GUqfwJKngCJQVE5Ao5wnO3cfKD9lSIteoLp/3xJ4=" @@ -75,8 +75,8 @@ schema = 3 version = "v1.1.0" hash = "sha256-nVDTtXH9PC3yJ0THaQZEN243UP9xgLi/clt5xRqj3+M=" [mod."github.com/cespare/xxhash/v2"] - version = "v2.1.2" - hash = "sha256-YV9SmXDtmmgQylQUfrUgQLAPfqYexcHxegMBT+IX9qM=" + version = "v2.2.0" + hash = "sha256-nPufwYQfTkyrEkbBrpqM3C2vnMxfIz6tAaBmiUP7vd4=" [mod."github.com/chzyer/readline"] version = "v0.0.0-20180603132655-2972be24d48e" hash = "sha256-2Uj5LGpHEbLQG3d/7z9AL8DknUBZyoTAMs4j+VVDmIA=" @@ -93,8 +93,8 @@ schema = 3 version = "v1.0.5" hash = "sha256-t572Sr5iiHcuMKLMWa2i+LBAt192oa+G1oA371tG/eI=" [mod."github.com/cosmos/cosmos-proto"] - version = "v1.0.0-beta.1" - hash = "sha256-oATkuj+fM5eBn+ywO+w/tL0AFSIEkx0J3Yz+VhVe0QA=" + version = "v1.0.0-beta.3" + hash = "sha256-V0/ZhRdqK7Cqcv8X30gr33/hlI54bRXeHhI9LZKyLt8=" [mod."github.com/cosmos/cosmos-sdk"] version = "v0.46.8" hash = "sha256-jETbixsZq5XJ1pl1XaVJvD5jkcygBrEcHRK/L0+XI68=" @@ -102,8 +102,8 @@ schema = 3 version = "v1.0.0" hash = "sha256-Qm2aC2vaS8tjtMUbHmlBSagOSqbduEEDwc51qvQaBmA=" [mod."github.com/cosmos/gogoproto"] - version = "v1.4.3" - hash = "sha256-Y/NL76ay/oAl8mS3skkK5ula0/xudqbwW1o22lZjKRg=" + version = "v1.4.6" + hash = "sha256-9SCEKBJyK1FHkKyeaBjDT3GURRAtsIoeiDkNwH8a9Co=" [mod."github.com/cosmos/gorocksdb"] version = "v1.2.0" hash = "sha256-209TcVuXc5s/TcOvNlaQ1HEJAUDTEK3nxPhs+d8TEcY=" @@ -189,8 +189,11 @@ schema = 3 version = "v2.1.3+incompatible" hash = "sha256-eXhXPPLnAy/rmt/zDgeqni2G3o58UtnHjR8vHLXvISI=" [mod."github.com/go-stack/stack"] - version = "v1.8.0" - hash = "sha256-26RlTEcAkbewMUtmirKrDGQ1WJlNousp69v7HMopYnI=" + version = "v1.8.1" + hash = "sha256-ixcJ2RrK1ZH3YWGQZF9QFBo02NOuLeSp9wJ7gniipgY=" + [mod."github.com/go-task/slim-sprig"] + version = "v0.0.0-20210107165309-348f09dbbbc0" + hash = "sha256-jgza4peLzeJlwmMh/c1gNkmtwA9YtSdGaBzBUDXhIZo=" [mod."github.com/godbus/dbus"] version = "v0.0.0-20190726142602-4481cbc300e2" hash = "sha256-R7Gb9+Zjy80FbQSDGketoVEqfdOQKuOVTfWRjQ5kxZY=" @@ -208,8 +211,8 @@ schema = 3 version = "v0.0.0-20210331224755-41bb18bfe9da" hash = "sha256-7Gs7CS9gEYZkbu5P4hqPGBpeGZWC64VDwraSKFF+VR0=" [mod."github.com/golang/protobuf"] - version = "v1.5.2" - hash = "sha256-IVwooaIo46iq7euSSVWTBAdKd+2DUaJ67MtBao1DpBI=" + version = "v1.5.3" + hash = "sha256-svogITcP4orUIsJFjMtp+Uv1+fKJv2Q5Zwf2dMqnpOQ=" [mod."github.com/golang/snappy"] version = "v0.0.4" hash = "sha256-Umx+5xHAQCN/Gi4HbtMhnDCSPFAXSsjVbXd8n5LhjAA=" @@ -222,6 +225,9 @@ schema = 3 [mod."github.com/google/orderedcode"] version = "v0.0.1" hash = "sha256-KrExYovtUQrHGI1mPQf57jGw8soz7eWOC2xqEaV0uGk=" + [mod."github.com/google/pprof"] + version = "v0.0.0-20210720184732-4bb14d4b1be1" + hash = "sha256-m6l2Yay3iCu7Ses6nmwXifyztNqfP1B/MX81/tDK4Hw=" [mod."github.com/google/uuid"] version = "v1.3.0" hash = "sha256-QoR55eBtA94T2tBszyxfDtO7/pjZZSGb5vm7U0Xhs0Y=" @@ -259,8 +265,8 @@ schema = 3 version = "v0.5.2" hash = "sha256-N9GOKYo7tK6XQUFhvhImtL7PZW/mr4C4Manx/yPVvcQ=" [mod."github.com/hashicorp/go-getter"] - version = "v1.6.1" - hash = "sha256-WPCbbfFbE617EIUXxq81p3XrvhkSvYOeuiaR7n23nr0=" + version = "v1.7.0" + hash = "sha256-kjXfacmxofi5mtyh9wpPeo3yBHNJMcTrfyEbYEAzLfs=" [mod."github.com/hashicorp/go-immutable-radix"] version = "v1.3.1" hash = "sha256-65+A2HiVfS/GV9G+6/TkXXjzXhI/V98e6RlJWjxy+mg=" @@ -346,8 +352,8 @@ schema = 3 version = "v1.1.0" hash = "sha256-oduBKXHAQG8X6aqLEpqZHs5DOKe84u6WkBwi4W6cv3k=" [mod."github.com/mitchellh/go-testing-interface"] - version = "v1.0.0" - hash = "sha256-/Dpv/4i5xuK8hDH+q8YTdF6Jg6NNtfO4Wqig2JCWgrY=" + version = "v1.14.1" + hash = "sha256-TMGi38D13BEVN5cpeKDzKRIgLclm4ErOG+JEyqJrN/c=" [mod."github.com/mitchellh/mapstructure"] version = "v1.5.0" hash = "sha256-ztVhGQXs67MF8UadVvG72G3ly0ypQW0IRDdOOkjYwoE=" @@ -358,11 +364,11 @@ schema = 3 version = "v0.0.5" hash = "sha256-/5i70IkH/qSW5KjGzv8aQNKh9tHoz98tqtL0K2DMFn4=" [mod."github.com/onsi/ginkgo/v2"] - version = "v2.7.0" - hash = "sha256-BKqQKCsPA73FaQwYpAY+QsWFHIncrG5jgRhC2IiNmCk=" + version = "v2.9.1" + hash = "sha256-7yMsN5CMJS/4VU9/Z27/xdbKzZac6/R1JRJDXxGmwiQ=" [mod."github.com/onsi/gomega"] - version = "v1.26.0" - hash = "sha256-B18jsoJHK/oE+wudT0dOsUb41s5+ZIAu/ZBzQ5djOLE=" + version = "v1.27.4" + hash = "sha256-Fhltm/e6KVXdwfUl65cE8PD1MLyXJa7OH0lg4Bvewv0=" [mod."github.com/pelletier/go-toml/v2"] version = "v2.0.6" hash = "sha256-BxAeApnn5H+OLlH3TXGvIbtC6LmbRnjwbcfT1qMZ4PE=" @@ -433,14 +439,14 @@ schema = 3 version = "v1.15.0" hash = "sha256-FvpbekXegcdWNbek/vs2zakgRsT5FROF8O8fhn5DNpI=" [mod."github.com/status-im/keycard-go"] - version = "v0.0.0-20200402102358-957c09536969" - hash = "sha256-yddXXuu6mEFEO2/K6c1tWymeBKzOcvLQnNsFGRjtfXk=" + version = "v0.2.0" + hash = "sha256-UUiGmlgaIZDeMUJv3fdZBoQ9hJeSsg2ixRGmm6TgHug=" [mod."github.com/stretchr/objx"] version = "v0.5.0" hash = "sha256-nY4mvP0f0Ry1IKMKQAYNuioA5h4red4mmQqeGZw6EF0=" [mod."github.com/stretchr/testify"] - version = "v1.8.1" - hash = "sha256-3e0vOJLgCMAan+GfaGN8RGZdarh5iCavM6flf6YMNPk=" + version = "v1.8.2" + hash = "sha256-n32PGyJL6VLtwOGEbS0lFchxunNU9nlol7OSEZlrKUM=" [mod."github.com/subosito/gotenv"] version = "v1.4.2" hash = "sha256-LnrDR1k/AoCFWBMcU7vQsoQLkZ65evT2hoQHLDudTsg=" @@ -469,8 +475,8 @@ schema = 3 version = "v1.1.0" hash = "sha256-3YhWBtSwRLGwm7vNwqumphZG3uLBW1vwT9QkQ8JuSjU=" [mod."github.com/ulikunitz/xz"] - version = "v0.5.8" - hash = "sha256-bfG3dssBUn+mSOAuKL+a/DTGGLUA+eASgLoGv/Gkqs0=" + version = "v0.5.10" + hash = "sha256-bogOwQNmQVS7W+C7wci7XEUeYm9TB7PnxnyBIXKYbm0=" [mod."github.com/zondax/hid"] version = "v0.9.1" hash = "sha256-hSVmN/f/lQHFhF60o6ej78ELC0MMoqQgqIX2hHjdTXg=" @@ -487,26 +493,29 @@ schema = 3 version = "v0.3.0" hash = "sha256-Un9wPqz8u/xpV98T4IqE6RMXIPhGCIm2prsNkHP3cjg=" [mod."golang.org/x/exp"] - version = "v0.0.0-20220722155223-a9213eeb770e" - hash = "sha256-kNgzydWRpjm0sZl4uXEs3LX5L0xjJtJRAFf/CTlYUN4=" + version = "v0.0.0-20230131160201-f062dba9d201" + hash = "sha256-sxLT/VOe93v0h3miChJSHS9gscTZS/B71+390ju/e20=" [mod."golang.org/x/net"] - version = "v0.5.0" - hash = "sha256-HpbIAiLs7S1+tVsaSSdbCPw1IK43A0bFFuSzPSyjLbo=" + version = "v0.8.0" + hash = "sha256-2cOtqa7aJ5mn64kZ+8+PVjJ4uGbhpXTpC1vm/+iaZzM=" [mod."golang.org/x/oauth2"] - version = "v0.0.0-20221014153046-6fdb5e3db783" - hash = "sha256-IoygidVNqyAZmN+3macDeIefK8hhJToygpcqlwehdYQ=" + version = "v0.4.0" + hash = "sha256-Dj9wHbSbs0Ghr9Hef0hSfanaR8L0GShI18jGBT3yNn8=" [mod."golang.org/x/sync"] version = "v0.1.0" hash = "sha256-Hygjq9euZ0qz6TvHYQwOZEjNiTbTh1nSLRAWZ6KFGR8=" [mod."golang.org/x/sys"] - version = "v0.4.0" - hash = "sha256-jchMzHCH5dg+IL/F+LqaX/fyAcB/nvHQpfBjqwaRJH0=" + version = "v0.6.0" + hash = "sha256-zAgxiTuL24sGhbXrna9R1UYqLQh46ldztpumOScmduY=" [mod."golang.org/x/term"] - version = "v0.4.0" - hash = "sha256-wQKxHV10TU4vCU8Re2/hFmAbur/jRWEOB8QXBzgTFNY=" - [mod."golang.org/x/text"] version = "v0.6.0" - hash = "sha256-+bpeRWR3relKACdal6NPj+eP5dnWCplTViArSN7/qA4=" + hash = "sha256-Ao0yXpwY8GyG+/23dVfJUYrfEfNUTES3RF45v1VhUAk=" + [mod."golang.org/x/text"] + version = "v0.8.0" + hash = "sha256-hgWFnT01DRmywBEXKYEVaOee7i6z8Ydz7zGbjcWwOgI=" + [mod."golang.org/x/tools"] + version = "v0.7.0" + hash = "sha256-ZEjfFulQd6U9r4mEJ5RZOnW49NZnQnrCFLMKCgLg7go=" [mod."golang.org/x/xerrors"] version = "v0.0.0-20220907171357-04be3eba64a2" hash = "sha256-6+zueutgefIYmgXinOflz8qGDDDj0Zhv+2OkGhBTKno=" @@ -517,11 +526,11 @@ schema = 3 version = "v1.6.7" hash = "sha256-zIxGRHiq4QBvRqkrhMGMGCaVL4iM4TtlYpAi/hrivS4=" [mod."google.golang.org/genproto"] - version = "v0.0.0-20221227171554-f9683d7f8bef" - hash = "sha256-vvYjJcG73odJwPUb3sZIz4MSHnzK1Jj2uo0CwZ8S8rQ=" + version = "v0.0.0-20230110181048-76db0878b65f" + hash = "sha256-Jc90F9KU+ZKI0ynF/p3Vwl7TJPb7/MxDFs0ebagty2s=" [mod."google.golang.org/grpc"] - version = "v1.52.3" - hash = "sha256-vVkuG0kKgnh62f63unpk4JDa9rIu6kk0qtnPJOiew2M=" + version = "v1.53.0" + hash = "sha256-LkB13k1JaQ7e4nGpCoEA9q4T8oIV0KvkFIDZmHhDr08=" [mod."google.golang.org/protobuf"] version = "v1.28.2-0.20220831092852-f930b1dc76e8" hash = "sha256-li5hXlXwTJ5LIZ8bVki1AZ6UFI2gXHl33JwdX1dOrtM=" From d663fb2efa44da898e54025f6380a99a978aa48e Mon Sep 17 00:00:00 2001 From: mmsqe Date: Wed, 22 Mar 2023 23:43:12 +0800 Subject: [PATCH 4/9] compare with eth --- tests/integration_tests/test_estimate_gas.py | 42 ++++++++++++++++---- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/tests/integration_tests/test_estimate_gas.py b/tests/integration_tests/test_estimate_gas.py index d18d41b780..405ca73f08 100644 --- a/tests/integration_tests/test_estimate_gas.py +++ b/tests/integration_tests/test_estimate_gas.py @@ -1,8 +1,31 @@ +import pytest + +from .network import setup_ethermint from .utils import ADDRS, CONTRACTS, deploy_contract -def test_revert(ethermint): - w3 = ethermint.w3 +@pytest.fixture(scope="module") +def custom_ethermint(tmp_path_factory): + path = tmp_path_factory.mktemp("estimate-gas") + yield from setup_ethermint(path, 27010, long_timeout_commit=True) + + +@pytest.fixture(scope="module", params=["ethermint", "geth"]) +def cluster(request, custom_ethermint, geth): + """ + run on both ethermint and geth + """ + provider = request.param + if provider == "ethermint": + yield custom_ethermint + elif provider == "geth": + yield geth + else: + raise NotImplementedError + + +def test_revert(cluster): + w3 = cluster.w3 call = w3.provider.make_request validator = ADDRS["validator"] erc20, _ = deploy_contract( @@ -10,10 +33,13 @@ def test_revert(ethermint): CONTRACTS["TestERC20A"], ) method = "eth_estimateGas" - # revert methods - for data in ["0x9ffb86a5"]: + + def do_call(data): params = {"from": validator, "to": erc20.address, "data": data} - error = call(method, [params])["error"] - assert error["code"] == 3 - assert error["message"] == "execution reverted: Function has been reverted" - assert error["data"] == "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001a46756e6374696f6e20686173206265656e207265766572746564000000000000" # noqa: E501 + return call(method, [params])["error"] + + # revertWithMsg + error = do_call("0x9ffb86a5") + assert error["code"] == 3 + assert error["message"] == "execution reverted: Function has been reverted" + assert error["data"] == "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001a46756e6374696f6e20686173206265656e207265766572746564000000000000" # noqa: E501 From 8777b89097922b7ee567a709898e9b138eb69aef Mon Sep 17 00:00:00 2001 From: mmsqe Date: Wed, 22 Mar 2023 23:43:18 +0800 Subject: [PATCH 5/9] test revertWithoutMsg --- tests/integration_tests/test_estimate_gas.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/integration_tests/test_estimate_gas.py b/tests/integration_tests/test_estimate_gas.py index 405ca73f08..70260196a3 100644 --- a/tests/integration_tests/test_estimate_gas.py +++ b/tests/integration_tests/test_estimate_gas.py @@ -43,3 +43,8 @@ def do_call(data): assert error["code"] == 3 assert error["message"] == "execution reverted: Function has been reverted" assert error["data"] == "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001a46756e6374696f6e20686173206265656e207265766572746564000000000000" # noqa: E501 + + # revertWithoutMsg + error = do_call("0x3246485d") + assert error["code"] == -32000 + assert error["message"] == "execution reverted" From 457fe20e41b8d5ce5a8e68079998fb30862c2a13 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Wed, 22 Mar 2023 23:43:22 +0800 Subject: [PATCH 6/9] align revertWithoutMsg response for eth_estimateGas --- rpc/backend/call_tx.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rpc/backend/call_tx.go b/rpc/backend/call_tx.go index 19b099dd8b..5aa2d3637d 100644 --- a/rpc/backend/call_tx.go +++ b/rpc/backend/call_tx.go @@ -340,6 +340,9 @@ func (b *Backend) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *rp if res.VmError != vm.ErrExecutionReverted.Error() { return 0, status.Error(codes.Internal, res.VmError) } + if len(res.Ret) == 0 { + return 0, errors.New(res.VmError) + } return 0, evmtypes.NewExecErrorWithReason(res.Ret) } return hexutil.Uint64(res.Gas), nil From d262e4e4db35ba36bbe1f65f19ffa9b65174d6b0 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Wed, 22 Mar 2023 23:43:26 +0800 Subject: [PATCH 7/9] align revertWithoutMsg response for eth_call --- rpc/backend/call_tx.go | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/rpc/backend/call_tx.go b/rpc/backend/call_tx.go index 5aa2d3637d..097cc3d8ec 100644 --- a/rpc/backend/call_tx.go +++ b/rpc/backend/call_tx.go @@ -304,6 +304,20 @@ func (b *Backend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.Transac return args, nil } +// handleRevertError returns revert related error. +func (b *Backend) handleRevertError(vmError string, ret []byte) error { + if len(vmError) > 0 { + if vmError != vm.ErrExecutionReverted.Error() { + return status.Error(codes.Internal, vmError) + } + if len(ret) == 0 { + return errors.New(vmError) + } + return evmtypes.NewExecErrorWithReason(ret) + } + return nil +} + // EstimateGas returns an estimate of gas usage for the given smart contract call. func (b *Backend) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *rpctypes.BlockNumber) (hexutil.Uint64, error) { blockNr := rpctypes.EthPendingBlockNumber @@ -336,14 +350,8 @@ func (b *Backend) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *rp if err != nil { return 0, err } - if len(res.VmError) > 0 { - if res.VmError != vm.ErrExecutionReverted.Error() { - return 0, status.Error(codes.Internal, res.VmError) - } - if len(res.Ret) == 0 { - return 0, errors.New(res.VmError) - } - return 0, evmtypes.NewExecErrorWithReason(res.Ret) + if err = b.handleRevertError(res.VmError, res.Ret); err != nil { + return 0, err } return hexutil.Uint64(res.Gas), nil } @@ -394,13 +402,9 @@ func (b *Backend) DoCall( return nil, err } - if res.Failed() { - if res.VmError != vm.ErrExecutionReverted.Error() { - return nil, status.Error(codes.Internal, res.VmError) - } - return nil, evmtypes.NewExecErrorWithReason(res.Ret) + if err = b.handleRevertError(res.VmError, res.Ret); err != nil { + return nil, err } - return res, nil } From 9981efc4f3936e479ae2958b97af0bb3c89a1efb Mon Sep 17 00:00:00 2001 From: mmsqe Date: Wed, 22 Mar 2023 23:43:32 +0800 Subject: [PATCH 8/9] add change doc --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0904e251f7..798a79b8b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,11 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## Unreleased +### Bug Fixes + +* (rpc) [#1722](https://github.com/evmos/ethermint/pull/1722) Align revert response for `eth_estimateGas` and `eth_call` as Ethereum. + + ### State Machine Breaking * (deps) [#1168](https://github.com/evmos/ethermint/pull/1168) Upgrade Cosmos SDK to [`v0.46.6`] From 87730f3a29ed56e10581c45a636ed8bc5067c374 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Thu, 23 Mar 2023 09:49:05 +0800 Subject: [PATCH 9/9] separate contract to avoid gas change --- .../hardhat/contracts/TestERC20A.sol | 10 ---------- .../hardhat/contracts/TestRevert.sol | 14 ++++++++++++++ tests/integration_tests/test_estimate_gas.py | 4 ++-- tests/integration_tests/utils.py | 1 + 4 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 tests/integration_tests/hardhat/contracts/TestRevert.sol diff --git a/tests/integration_tests/hardhat/contracts/TestERC20A.sol b/tests/integration_tests/hardhat/contracts/TestERC20A.sol index 8d38b2e3e7..edb92c4aa8 100644 --- a/tests/integration_tests/hardhat/contracts/TestERC20A.sol +++ b/tests/integration_tests/hardhat/contracts/TestERC20A.sol @@ -7,14 +7,4 @@ contract TestERC20A is ERC20 { constructor() public ERC20("TestERC20", "Test") { _mint(msg.sender, 100000000000000000000000000); } - - // 0x9ffb86a5 - function revertWithMsg() public pure { - revert("Function has been reverted"); - } - - // 0x3246485d - function revertWithoutMsg() public pure { - revert(); - } } diff --git a/tests/integration_tests/hardhat/contracts/TestRevert.sol b/tests/integration_tests/hardhat/contracts/TestRevert.sol new file mode 100644 index 0000000000..4214d4ed47 --- /dev/null +++ b/tests/integration_tests/hardhat/contracts/TestRevert.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.10; + +contract TestRevert { + // 0x9ffb86a5 + function revertWithMsg() public pure { + revert("Function has been reverted"); + } + + // 0x3246485d + function revertWithoutMsg() public pure { + revert(); + } +} diff --git a/tests/integration_tests/test_estimate_gas.py b/tests/integration_tests/test_estimate_gas.py index 70260196a3..44bd58f511 100644 --- a/tests/integration_tests/test_estimate_gas.py +++ b/tests/integration_tests/test_estimate_gas.py @@ -30,7 +30,7 @@ def test_revert(cluster): validator = ADDRS["validator"] erc20, _ = deploy_contract( w3, - CONTRACTS["TestERC20A"], + CONTRACTS["TestRevert"], ) method = "eth_estimateGas" @@ -42,7 +42,7 @@ def do_call(data): error = do_call("0x9ffb86a5") assert error["code"] == 3 assert error["message"] == "execution reverted: Function has been reverted" - assert error["data"] == "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001a46756e6374696f6e20686173206265656e207265766572746564000000000000" # noqa: E501 + assert (error["data"] == "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001a46756e6374696f6e20686173206265656e207265766572746564000000000000") # noqa: E501 # revertWithoutMsg error = do_call("0x3246485d") diff --git a/tests/integration_tests/utils.py b/tests/integration_tests/utils.py index b277beeaa3..7468a46825 100644 --- a/tests/integration_tests/utils.py +++ b/tests/integration_tests/utils.py @@ -32,6 +32,7 @@ "TestChainID": "ChainID.sol", "Mars": "Mars.sol", "StateContract": "StateContract.sol", + "TestRevert": "TestRevert.sol", }