diff --git a/CHANGELOG.md b/CHANGELOG.md index ffc1bd981..8def679f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ ### IMPROVEMENTS +- [\#538](https://github.com/cosmos/evm/pull/538) Optimize `eth_estimateGas` gRPC path: short-circuit plain transfers, add optimistic gas bound based on `MaxUsedGas`. - [\#513](https://github.com/cosmos/evm/pull/513) Replace `TestEncodingConfig` with production `EncodingConfig` in encoding package to remove test dependencies from production code. - [\#467](https://github.com/cosmos/evm/pull/467) Replace GlobalEVMMempool by passing to JSONRPC on initiate. - [\#352](https://github.com/cosmos/evm/pull/352) Remove the creation of a Geth EVM instance, stateDB during the AnteHandler balance check. diff --git a/api/cosmos/evm/vm/v1/tx.pulsar.go b/api/cosmos/evm/vm/v1/tx.pulsar.go index 89f899c3c..01c31e38d 100644 --- a/api/cosmos/evm/vm/v1/tx.pulsar.go +++ b/api/cosmos/evm/vm/v1/tx.pulsar.go @@ -913,12 +913,13 @@ func (x *_MsgEthereumTxResponse_2_list) IsValid() bool { } var ( - md_MsgEthereumTxResponse protoreflect.MessageDescriptor - fd_MsgEthereumTxResponse_hash protoreflect.FieldDescriptor - fd_MsgEthereumTxResponse_logs protoreflect.FieldDescriptor - fd_MsgEthereumTxResponse_ret protoreflect.FieldDescriptor - fd_MsgEthereumTxResponse_vm_error protoreflect.FieldDescriptor - fd_MsgEthereumTxResponse_gas_used protoreflect.FieldDescriptor + md_MsgEthereumTxResponse protoreflect.MessageDescriptor + fd_MsgEthereumTxResponse_hash protoreflect.FieldDescriptor + fd_MsgEthereumTxResponse_logs protoreflect.FieldDescriptor + fd_MsgEthereumTxResponse_ret protoreflect.FieldDescriptor + fd_MsgEthereumTxResponse_vm_error protoreflect.FieldDescriptor + fd_MsgEthereumTxResponse_gas_used protoreflect.FieldDescriptor + fd_MsgEthereumTxResponse_max_used_gas protoreflect.FieldDescriptor ) func init() { @@ -929,6 +930,7 @@ func init() { fd_MsgEthereumTxResponse_ret = md_MsgEthereumTxResponse.Fields().ByName("ret") fd_MsgEthereumTxResponse_vm_error = md_MsgEthereumTxResponse.Fields().ByName("vm_error") fd_MsgEthereumTxResponse_gas_used = md_MsgEthereumTxResponse.Fields().ByName("gas_used") + fd_MsgEthereumTxResponse_max_used_gas = md_MsgEthereumTxResponse.Fields().ByName("max_used_gas") } var _ protoreflect.Message = (*fastReflection_MsgEthereumTxResponse)(nil) @@ -1026,6 +1028,12 @@ func (x *fastReflection_MsgEthereumTxResponse) Range(f func(protoreflect.FieldDe return } } + if x.MaxUsedGas != uint64(0) { + value := protoreflect.ValueOfUint64(x.MaxUsedGas) + if !f(fd_MsgEthereumTxResponse_max_used_gas, value) { + return + } + } } // Has reports whether a field is populated. @@ -1051,6 +1059,8 @@ func (x *fastReflection_MsgEthereumTxResponse) Has(fd protoreflect.FieldDescript return x.VmError != "" case "cosmos.evm.vm.v1.MsgEthereumTxResponse.gas_used": return x.GasUsed != uint64(0) + case "cosmos.evm.vm.v1.MsgEthereumTxResponse.max_used_gas": + return x.MaxUsedGas != uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.vm.v1.MsgEthereumTxResponse")) @@ -1077,6 +1087,8 @@ func (x *fastReflection_MsgEthereumTxResponse) Clear(fd protoreflect.FieldDescri x.VmError = "" case "cosmos.evm.vm.v1.MsgEthereumTxResponse.gas_used": x.GasUsed = uint64(0) + case "cosmos.evm.vm.v1.MsgEthereumTxResponse.max_used_gas": + x.MaxUsedGas = uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.vm.v1.MsgEthereumTxResponse")) @@ -1111,6 +1123,9 @@ func (x *fastReflection_MsgEthereumTxResponse) Get(descriptor protoreflect.Field case "cosmos.evm.vm.v1.MsgEthereumTxResponse.gas_used": value := x.GasUsed return protoreflect.ValueOfUint64(value) + case "cosmos.evm.vm.v1.MsgEthereumTxResponse.max_used_gas": + value := x.MaxUsedGas + return protoreflect.ValueOfUint64(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.vm.v1.MsgEthereumTxResponse")) @@ -1143,6 +1158,8 @@ func (x *fastReflection_MsgEthereumTxResponse) Set(fd protoreflect.FieldDescript x.VmError = value.Interface().(string) case "cosmos.evm.vm.v1.MsgEthereumTxResponse.gas_used": x.GasUsed = value.Uint() + case "cosmos.evm.vm.v1.MsgEthereumTxResponse.max_used_gas": + x.MaxUsedGas = value.Uint() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.vm.v1.MsgEthereumTxResponse")) @@ -1177,6 +1194,8 @@ func (x *fastReflection_MsgEthereumTxResponse) Mutable(fd protoreflect.FieldDesc panic(fmt.Errorf("field vm_error of message cosmos.evm.vm.v1.MsgEthereumTxResponse is not mutable")) case "cosmos.evm.vm.v1.MsgEthereumTxResponse.gas_used": panic(fmt.Errorf("field gas_used of message cosmos.evm.vm.v1.MsgEthereumTxResponse is not mutable")) + case "cosmos.evm.vm.v1.MsgEthereumTxResponse.max_used_gas": + panic(fmt.Errorf("field max_used_gas of message cosmos.evm.vm.v1.MsgEthereumTxResponse is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.vm.v1.MsgEthereumTxResponse")) @@ -1201,6 +1220,8 @@ func (x *fastReflection_MsgEthereumTxResponse) NewField(fd protoreflect.FieldDes return protoreflect.ValueOfString("") case "cosmos.evm.vm.v1.MsgEthereumTxResponse.gas_used": return protoreflect.ValueOfUint64(uint64(0)) + case "cosmos.evm.vm.v1.MsgEthereumTxResponse.max_used_gas": + return protoreflect.ValueOfUint64(uint64(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.vm.v1.MsgEthereumTxResponse")) @@ -1291,6 +1312,9 @@ func (x *fastReflection_MsgEthereumTxResponse) ProtoMethods() *protoiface.Method if x.GasUsed != 0 { n += 1 + runtime.Sov(uint64(x.GasUsed)) } + if x.MaxUsedGas != 0 { + n += 1 + runtime.Sov(uint64(x.MaxUsedGas)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -1320,6 +1344,11 @@ func (x *fastReflection_MsgEthereumTxResponse) ProtoMethods() *protoiface.Method i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.MaxUsedGas != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.MaxUsedGas)) + i-- + dAtA[i] = 0x30 + } if x.GasUsed != 0 { i = runtime.EncodeVarint(dAtA, i, uint64(x.GasUsed)) i-- @@ -1562,6 +1591,25 @@ func (x *fastReflection_MsgEthereumTxResponse) ProtoMethods() *protoiface.Method break } } + case 6: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaxUsedGas", wireType) + } + x.MaxUsedGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.MaxUsedGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -3474,6 +3522,8 @@ type MsgEthereumTxResponse struct { VmError string `protobuf:"bytes,4,opt,name=vm_error,json=vmError,proto3" json:"vm_error,omitempty"` // gas_used specifies how much gas was consumed by the transaction GasUsed uint64 `protobuf:"varint,5,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` + // max_used_gas specifies the gas consumed by the transaction, not including refunds + MaxUsedGas uint64 `protobuf:"varint,6,opt,name=max_used_gas,json=maxUsedGas,proto3" json:"max_used_gas,omitempty"` } func (x *MsgEthereumTxResponse) Reset() { @@ -3531,6 +3581,13 @@ func (x *MsgEthereumTxResponse) GetGasUsed() uint64 { return 0 } +func (x *MsgEthereumTxResponse) GetMaxUsedGas() uint64 { + if x != nil { + return x.MaxUsedGas + } + return 0 +} + // MsgUpdateParams defines a Msg for updating the x/vm module parameters. type MsgUpdateParams struct { state protoimpl.MessageState @@ -3706,7 +3763,7 @@ var file_cosmos_evm_vm_v1_tx_proto_rawDesc = []byte{ 0x04, 0x08, 0x03, 0x10, 0x04, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x22, 0x22, 0x0a, 0x1a, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x54, 0x78, 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, 0x22, - 0xa4, 0x01, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x54, + 0xc6, 0x01, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x54, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x29, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f, @@ -3716,69 +3773,71 @@ var file_cosmos_evm_vm_v1_tx_proto_rawDesc = []byte{ 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x61, 0x73, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x67, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, - 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, 0x22, 0xba, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, - 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, - 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x74, 0x79, 0x12, 0x3b, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, - 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, - 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, - 0x32, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, - 0xe7, 0xb0, 0x2a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x78, - 0x2f, 0x76, 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xd6, - 0x01, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x72, - 0x65, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, - 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, - 0x79, 0x12, 0x49, 0x0a, 0x0b, 0x70, 0x72, 0x65, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x69, 0x6e, 0x73, - 0x74, 0x61, 0x6c, 0x6c, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, - 0x0b, 0x70, 0x72, 0x65, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x73, 0x3a, 0x39, 0x82, 0xe7, - 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, - 0x26, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x78, 0x2f, 0x76, 0x6d, - 0x2f, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x72, 0x65, 0x69, - 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x73, 0x22, 0x20, 0x0a, 0x1e, 0x4d, 0x73, 0x67, 0x52, 0x65, + 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x61, 0x78, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x67, 0x61, 0x73, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x6d, 0x61, 0x78, 0x55, 0x73, 0x65, 0x64, 0x47, + 0x61, 0x73, 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, 0x22, 0xba, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x74, 0x79, 0x12, 0x3b, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, + 0x6d, 0x2e, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, + 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x3a, 0x32, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, + 0x2f, 0x78, 0x2f, 0x76, 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0xd6, 0x01, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, + 0x50, 0x72, 0x65, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, + 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x74, 0x79, 0x12, 0x49, 0x0a, 0x0b, 0x70, 0x72, 0x65, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, + 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x69, + 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, + 0x01, 0x52, 0x0b, 0x70, 0x72, 0x65, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x73, 0x3a, 0x39, + 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, + 0xb0, 0x2a, 0x26, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x78, 0x2f, + 0x76, 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x72, + 0x65, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x73, 0x22, 0x20, 0x0a, 0x1e, 0x4d, 0x73, 0x67, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x72, 0x65, 0x69, 0x6e, 0x73, 0x74, 0x61, + 0x6c, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xdc, 0x02, 0x0a, 0x03, + 0x4d, 0x73, 0x67, 0x12, 0x7d, 0x0a, 0x0a, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x54, + 0x78, 0x12, 0x1f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, + 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, + 0x54, 0x78, 0x1a, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, + 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, + 0x6d, 0x54, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x1f, 0x22, 0x1d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, + 0x2f, 0x76, 0x6d, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5f, + 0x74, 0x78, 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, + 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, + 0x76, 0x6d, 0x2e, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x71, 0x0a, 0x13, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x72, 0x65, 0x69, + 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x73, 0x12, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x72, 0x65, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xdc, 0x02, 0x0a, 0x03, 0x4d, 0x73, - 0x67, 0x12, 0x7d, 0x0a, 0x0a, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x54, 0x78, 0x12, - 0x1f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x6d, 0x2e, - 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x54, 0x78, - 0x1a, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x6d, - 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x54, - 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x1f, 0x22, 0x1d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x76, - 0x6d, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5f, 0x74, 0x78, - 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x12, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x6d, - 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, - 0x2e, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x71, - 0x0a, 0x13, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x72, 0x65, 0x69, 0x6e, 0x73, - 0x74, 0x61, 0x6c, 0x6c, 0x73, 0x12, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, - 0x76, 0x6d, 0x2e, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, - 0x73, 0x74, 0x65, 0x72, 0x50, 0x72, 0x65, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x73, 0x1a, - 0x30, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x6d, 0x2e, - 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x72, - 0x65, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xaa, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x6d, 0x2e, 0x76, - 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x26, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x76, 0x6d, 0x2f, 0x76, 0x31, 0x3b, - 0x76, 0x6d, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x45, 0x56, 0xaa, 0x02, 0x10, 0x43, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, 0x56, 0x6d, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x56, 0x6d, 0x5c, 0x56, 0x31, - 0xe2, 0x02, 0x1c, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x56, 0x6d, - 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x6d, 0x3a, 0x3a, 0x56, - 0x6d, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x1a, 0x30, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, + 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, + 0x50, 0x72, 0x65, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xaa, 0x01, 0x0a, 0x14, 0x63, + 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x6d, + 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x26, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x76, 0x6d, 0x2f, 0x76, + 0x31, 0x3b, 0x76, 0x6d, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x45, 0x56, 0xaa, 0x02, 0x10, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, 0x56, 0x6d, 0x2e, 0x56, 0x31, 0xca, + 0x02, 0x10, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x56, 0x6d, 0x5c, + 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, + 0x56, 0x6d, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x6d, 0x3a, + 0x3a, 0x56, 0x6d, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/evmd/tests/integration/x_vm_test.go b/evmd/tests/integration/x_vm_test.go index 37c439a17..c1aec6e9f 100644 --- a/evmd/tests/integration/x_vm_test.go +++ b/evmd/tests/integration/x_vm_test.go @@ -1,13 +1,87 @@ package integration import ( + "encoding/json" "testing" - "github.com/stretchr/testify/suite" - + "github.com/cosmos/evm/server/config" "github.com/cosmos/evm/tests/integration/x/vm" + "github.com/cosmos/evm/testutil/integration/evm/network" + "github.com/cosmos/evm/testutil/keyring" + feemarkettypes "github.com/cosmos/evm/x/feemarket/types" + "github.com/cosmos/evm/x/vm/types" + "github.com/ethereum/go-ethereum/common" + + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" ) +func BenchmarkGasEstimation(b *testing.B) { + // Setup benchmark test environment + keys := keyring.New(2) + // Set custom balance based on test params + customGenesis := network.CustomGenesisState{} + feemarketGenesis := feemarkettypes.DefaultGenesisState() + feemarketGenesis.Params.NoBaseFee = true + customGenesis[feemarkettypes.ModuleName] = feemarketGenesis + opts := []network.ConfigOption{ + network.WithPreFundedAccounts(keys.GetAllAccAddrs()...), + network.WithCustomGenesis(customGenesis), + } + nw := network.NewUnitTestNetwork(CreateEvmd, opts...) + // gh := grpc.NewIntegrationHandler(nw) + // tf := factory.New(nw, gh) + + chainConfig := types.DefaultChainConfig(nw.GetEIP155ChainID().Uint64()) + // get the denom and decimals set on chain initialization + // because we'll need to set them again when resetting the chain config + denom := types.GetEVMCoinDenom() + extendedDenom := types.GetEVMCoinExtendedDenom() + displayDenom := types.GetEVMCoinDisplayDenom() + decimals := types.GetEVMCoinDecimals() + + configurator := types.NewEVMConfigurator() + configurator.ResetTestConfig() + err := configurator. + WithChainConfig(chainConfig). + WithEVMCoinInfo(types.EvmCoinInfo{ + Denom: denom, + ExtendedDenom: extendedDenom, + DisplayDenom: displayDenom, + Decimals: decimals, + }). + Configure() + require.NoError(b, err) + + // Use simple transaction args for consistent benchmarking + args := types.TransactionArgs{ + To: &common.Address{}, + } + + marshalArgs, err := json.Marshal(args) + require.NoError(b, err) + + req := types.EthCallRequest{ + Args: marshalArgs, + GasCap: config.DefaultGasCap, + ProposerAddress: nw.GetContext().BlockHeader().ProposerAddress, + } + + // Reset timer to exclude setup time + b.ResetTimer() + + // Run the benchmark + for i := 0; i < b.N; i++ { + _, err := nw.GetEvmClient().EstimateGas( + nw.GetContext(), + &req, + ) + if err != nil { + b.Fatal(err) + } + } +} + func TestKeeperTestSuite(t *testing.T) { s := vm.NewKeeperTestSuite(CreateEvmd) s.EnableFeemarket = false diff --git a/proto/cosmos/evm/vm/v1/tx.proto b/proto/cosmos/evm/vm/v1/tx.proto index 384c047cc..3d953e9e0 100644 --- a/proto/cosmos/evm/vm/v1/tx.proto +++ b/proto/cosmos/evm/vm/v1/tx.proto @@ -71,6 +71,8 @@ message MsgEthereumTxResponse { string vm_error = 4; // gas_used specifies how much gas was consumed by the transaction uint64 gas_used = 5; + // max_used_gas specifies the gas consumed by the transaction, not including refunds + uint64 max_used_gas = 6; } // MsgUpdateParams defines a Msg for updating the x/vm module parameters. diff --git a/x/vm/keeper/grpc_query.go b/x/vm/keeper/grpc_query.go index eb895079c..9f2413cd8 100644 --- a/x/vm/keeper/grpc_query.go +++ b/x/vm/keeper/grpc_query.go @@ -404,20 +404,32 @@ func (k Keeper) EstimateGasInternal(c context.Context, req *types.EthCallRequest return len(rsp.VmError) > 0, rsp, nil } - // Execute the binary search and hone in on an executable gas limit - hi, err = types.BinSearch(lo, hi, executable) + // Adapted from go-ethereum gas estimator for early short-circuit and optimistic bounds: + // https://github.com/ethereum/go-ethereum/blob/v1.16.2/eth/gasestimator/gasestimator.go + + // If the transaction is a plain value transfer, short circuit estimation and + // directly try 21000. Returning 21000 without any execution is dangerous as + // some tx field combos might bump the price up even for plain transfers (e.g. + // unused access list items). Ever so slightly wasteful, but safer overall. + if len(msg.Data) == 0 && msg.To != nil { + acct := k.GetAccountWithoutBalance(ctx, *msg.To) + if acct == nil || !acct.IsContract() { + failed, _, err := executable(ethparams.TxGas) + if err == nil && !failed { + return &types.EstimateGasResponse{Gas: ethparams.TxGas}, nil + } + } + } + + // We first execute the transaction at the highest allowable gas limit, since if this fails we + // can return error immediately. + failed, result, err := executable(hi) if err != nil { return nil, err } - - // Reject the transaction as invalid if it still fails at the highest allowance - if hi == gasCap { - failed, result, err := executable(hi) - if err != nil { - return nil, err - } - - if failed { + if failed { + // Preserve Cosmos error semantics when the cap is reached + if hi == gasCap { if result != nil && result.VmError != vm.ErrOutOfGas.Error() { if result.VmError == vm.ErrExecutionReverted.Error() { return &types.EstimateGasResponse{ @@ -427,10 +439,34 @@ func (k Keeper) EstimateGasInternal(c context.Context, req *types.EthCallRequest } return nil, errors.New(result.VmError) } - // Otherwise, the specified gas cap is too low return nil, fmt.Errorf("gas required exceeds allowance (%d)", gasCap) } + // If no larger allowance is available, fail fast + return nil, fmt.Errorf("gas required exceeds allowance (%d)", hi) } + + // There's a fairly high chance for the transaction to execute successfully + // with gasLimit set to the first execution's usedGas + gasRefund. Explicitly + // check that gas amount and use as a limit for the binary search. + optimisticGasLimit := (result.MaxUsedGas + ethparams.CallStipend) * 64 / 63 + if optimisticGasLimit < hi { + failed, _, err = executable(optimisticGasLimit) + if err != nil { + return nil, err + } + if failed { + lo = optimisticGasLimit + } else { + hi = optimisticGasLimit + } + } + + // Binary search for the smallest gas limit that allows the tx to execute successfully. + hi, err = types.BinSearch(lo, hi, executable) + if err != nil { + return nil, err + } + return &types.EstimateGasResponse{Gas: hi}, nil } diff --git a/x/vm/keeper/state_transition.go b/x/vm/keeper/state_transition.go index d163bdc4a..7811bc334 100644 --- a/x/vm/keeper/state_transition.go +++ b/x/vm/keeper/state_transition.go @@ -460,12 +460,12 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, msg core.Message, trace return nil, errorsmod.Wrap(types.ErrGasOverflow, "apply message") } // refund gas - temporaryGasUsed := msg.GasLimit - leftoverGas - refund := GasToRefund(stateDB.GetRefund(), temporaryGasUsed, refundQuotient) + maxUsedGas := msg.GasLimit - leftoverGas + refund := GasToRefund(stateDB.GetRefund(), maxUsedGas, refundQuotient) // update leftoverGas and temporaryGasUsed with refund amount leftoverGas += refund - temporaryGasUsed -= refund + temporaryGasUsed := maxUsedGas - refund // EVM execution error needs to be available for the JSON-RPC client var vmError string @@ -508,11 +508,12 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, msg core.Message, trace } return &types.MsgEthereumTxResponse{ - GasUsed: gasUsed.TruncateInt().Uint64(), - VmError: vmError, - Ret: ret, - Logs: types.NewLogsFromEth(stateDB.Logs()), - Hash: txConfig.TxHash.Hex(), + GasUsed: gasUsed.TruncateInt().Uint64(), + MaxUsedGas: maxUsedGas, + VmError: vmError, + Ret: ret, + Logs: types.NewLogsFromEth(stateDB.Logs()), + Hash: txConfig.TxHash.Hex(), }, nil } diff --git a/x/vm/types/tx.pb.go b/x/vm/types/tx.pb.go index 3dd000bf8..dc6c10831 100644 --- a/x/vm/types/tx.pb.go +++ b/x/vm/types/tx.pb.go @@ -128,6 +128,8 @@ type MsgEthereumTxResponse struct { VmError string `protobuf:"bytes,4,opt,name=vm_error,json=vmError,proto3" json:"vm_error,omitempty"` // gas_used specifies how much gas was consumed by the transaction GasUsed uint64 `protobuf:"varint,5,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` + // max_used_gas specifies the gas consumed by the transaction, not including refunds + MaxUsedGas uint64 `protobuf:"varint,6,opt,name=max_used_gas,json=maxUsedGas,proto3" json:"max_used_gas,omitempty"` } func (m *MsgEthereumTxResponse) Reset() { *m = MsgEthereumTxResponse{} } @@ -363,50 +365,51 @@ func init() { func init() { proto.RegisterFile("cosmos/evm/vm/v1/tx.proto", fileDescriptor_77a8ac5e8c9c4850) } var fileDescriptor_77a8ac5e8c9c4850 = []byte{ - // 678 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4f, 0x6b, 0x13, 0x41, - 0x1c, 0xcd, 0x66, 0xb7, 0x6d, 0x3a, 0xad, 0x18, 0xc7, 0xd6, 0x6e, 0x97, 0xba, 0x49, 0x17, 0xff, - 0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, 0xf8, 0x14, 0x4c, 0x0f, 0xdd, 0xaa, 0xc5, 0x54, 0xfd, 0x24, 0xc5, 0x58, - 0x3a, 0x93, 0x72, 0xf2, 0x27, 0x7a, 0x0e, 0x2e, 0xa6, 0x65, 0x5b, 0x4a, 0x55, 0x48, 0x61, 0x1a, - 0x37, 0xff, 0x95, 0x79, 0xdc, 0xd2, 0x18, 0x7b, 0x25, 0x83, 0xac, 0x55, 0x77, 0x0f, 0x4c, 0x65, - 0xef, 0xc0, 0x54, 0x7e, 0x1f, 0x98, 0xca, 0xbb, 0x43, 0x33, 0xb3, 0x77, 0x68, 0x66, 0x7e, 0x1c, - 0x9a, 0x99, 0x27, 0x45, 0xe2, 0x8a, 0x76, 0x77, 0xa3, 0xbc, 0x49, 0x3d, 0xfb, 0x74, 0x9a, 0x62, - 0x2b, 0xc0, 0x7c, 0x63, 0x3c, 0xfc, 0x8c, 0xdd, 0xfa, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x5f, 0x48, - 0x3b, 0x6f, 0x8c, 0x05, 0x00, 0x00, + // 699 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4f, 0x6b, 0x13, 0x4f, + 0x18, 0xce, 0x26, 0xdb, 0x36, 0x9d, 0xf6, 0xc7, 0x2f, 0x8e, 0xad, 0xdd, 0x2e, 0x35, 0x49, 0x17, + 0xff, 0xa4, 0x05, 0xb3, 0x36, 0x82, 0x60, 0x3c, 0x19, 0x28, 0x62, 0x30, 0x58, 0x56, 0x7b, 0x11, + 0x21, 0x4c, 0x9b, 0x71, 0xb2, 0x90, 0xd9, 0x59, 0x67, 0x26, 0x31, 0x3d, 0x08, 0x52, 0x3c, 0x88, + 0x27, 0xc1, 0x2f, 0xe0, 0xd1, 0x63, 0x0f, 0x9e, 0xfc, 0x00, 0xd2, 0x63, 0x51, 0x10, 0x11, 0x29, + 0xd2, 0x0a, 0xf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0xcd, 0xe4, 0xf4, 0xba, 0x9e, 0xd5, + 0x73, 0x63, 0x96, 0x05, 0xcc, 0xd5, 0xbe, 0xc4, 0x9e, 0x70, 0x99, 0xf7, 0xc0, 0x0f, 0x06, 0x1c, + 0x54, 0x55, 0x75, 0x25, 0x6c, 0x7d, 0xd6, 0xc0, 0xec, 0x90, 0x9a, 0x83, 0x85, 0xcf, 0x3c, 0x81, + 0xd5, 0xc8, 0x6d, 0x24, 0xda, 0x86, 0x56, 0xd4, 0x4a, 0x93, 0x4e, 0xb0, 0x86, 0x4b, 0x40, 0xef, + 0x30, 0x22, 0x8c, 0x74, 0x31, 0x53, 0x9a, 0xaa, 0xcc, 0x96, 0x4f, 0x07, 0x52, 0xbe, 0xcf, 0x88, + 0x13, 0x50, 0x60, 0x0e, 0x64, 0x38, 0x96, 0x46, 0x26, 0x30, 0xac, 0x96, 0x70, 0x1e, 0x64, 0x7b, + 0xb4, 0x89, 0x39, 0x67, 0xdc, 0xd0, 0x03, 0xd1, 0x89, 0x1e, 0x5d, 0x55, 0x8f, 0x0a, 0x22, 0x48, + 0x34, 0xbb, 0x02, 0xb7, 0x82, 0x23, 0xd2, 0x9d, 0x09, 0x82, 0xc4, 0xba, 0xc0, 0x2d, 0x58, 0x04, + 0xd3, 0x14, 0xf5, 0x03, 0xa8, 0x49, 0x90, 0x08, 0x8e, 0x4b, 0x77, 0x00, 0x45, 0x7d, 0x05, 0xdf, + 0x45, 0x22, 0x32, 0xf2, 0x49, 0x03, 0xff, 0x37, 0x04, 0x59, 0xf7, 0x5b, 0x48, 0xe2, 0x35, 0xc4, + 0x11, 0x15, 0xf0, 0x26, 0x98, 0x44, 0x5d, 0xd9, 0x66, 0xdc, 0x95, 0x5b, 0xa1, 0x8f, 0x9a, 0xf1, + 0xe5, 0xe3, 0xb5, 0x99, 0x68, 0xec, 0x3b, 0xad, 0x16, 0xc7, 0x42, 0x3c, 0x94, 0xdc, 0xf5, 0x88, + 0x33, 0xa0, 0xc2, 0x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2, 0x1c, 0x7b, 0xa9, 0x82, 0xac, 0x55, + 0x77, 0x0f, 0xf2, 0xda, 0xde, 0x41, 0x5e, 0xfb, 0x75, 0x90, 0xd7, 0xde, 0x1e, 0xe6, 0x53, 0x7b, + 0x87, 0xf9, 0xd4, 0xf7, 0xc3, 0x7c, 0xea, 0x71, 0x91, 0xb8, 0xb2, 0xdd, 0xdd, 0x28, 0x6f, 0x32, + 0x6a, 0x9f, 0x4e, 0x53, 0x6e, 0xf9, 0x58, 0x6c, 0x8c, 0x07, 0x3f, 0xba, 0x1b, 0x7f, 0x02, 0x00, + 0x00, 0xff, 0xff, 0xf9, 0x21, 0xde, 0xc0, 0xae, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -658,6 +661,11 @@ func (m *MsgEthereumTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.MaxUsedGas != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.MaxUsedGas)) + i-- + dAtA[i] = 0x30 + } if m.GasUsed != 0 { i = encodeVarintTx(dAtA, i, uint64(m.GasUsed)) i-- @@ -893,6 +901,9 @@ func (m *MsgEthereumTxResponse) Size() (n int) { if m.GasUsed != 0 { n += 1 + sovTx(uint64(m.GasUsed)) } + if m.MaxUsedGas != 0 { + n += 1 + sovTx(uint64(m.MaxUsedGas)) + } return n } @@ -1301,6 +1312,25 @@ func (m *MsgEthereumTxResponse) Unmarshal(dAtA []byte) error { break } } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxUsedGas", wireType) + } + m.MaxUsedGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxUsedGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:])