diff --git a/CHANGELOG.md b/CHANGELOG.md index 76b6b6b66..f7524dfb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ - [\#609](https://github.com/cosmos/evm/pull/609) Make `erc20Keeper` optional in the EVM keeper - [\#624](https://github.com/cosmos/evm/pull/624) Cleanup unnecessary `fix-revert-gas-refund-height`. - [\#635](https://github.com/cosmos/evm/pull/635) Move DefaultStaticPrecompiles to /evm and allow projects to set it by default alongside the keeper. +- [\#639](https://github.com/cosmos/evm/pull/639) Remove `/types` and move types into respective folders. - [\#630](https://github.com/cosmos/evm/pull/630) Reduce feemarket parameter loading to minimize memory allocations. - [\#577](https://github.com/cosmos/evm/pull/577) Cleanup precompiles boilerplate code. - [\#648](https://github.com/cosmos/evm/pull/648) Move all `ante` logic such as `NewAnteHandler` from the `evmd` package to `evm/ante` so it can be used as library functions. diff --git a/ante/cosmos/eip712.go b/ante/cosmos/eip712.go index 5a209880c..e800cee0f 100644 --- a/ante/cosmos/eip712.go +++ b/ante/cosmos/eip712.go @@ -11,7 +11,6 @@ import ( anteinterfaces "github.com/cosmos/evm/ante/interfaces" "github.com/cosmos/evm/crypto/ethsecp256k1" "github.com/cosmos/evm/ethereum/eip712" - "github.com/cosmos/evm/types" errorsmod "cosmossdk.io/errors" @@ -30,7 +29,7 @@ var evmCodec codec.ProtoCodecMarshaler func init() { registry := codectypes.NewInterfaceRegistry() - types.RegisterInterfaces(registry) + eip712.RegisterInterfaces(registry) evmCodec = codec.NewProtoCodec(registry) } @@ -204,7 +203,7 @@ func VerifySignature( return errorsmod.Wrap(errortypes.ErrUnknownExtensionOptions, "tx doesn't contain expected amount of extension options") } - extOpt, ok := opts[0].GetCachedValue().(*types.ExtensionOptionsWeb3Tx) + extOpt, ok := opts[0].GetCachedValue().(*eip712.ExtensionOptionsWeb3Tx) if !ok { return errorsmod.Wrap(errortypes.ErrUnknownExtensionOptions, "unknown extension option") } diff --git a/ante/evm/08_gas_consume.go b/ante/evm/08_gas_consume.go index 6580d43e2..18dbad747 100644 --- a/ante/evm/08_gas_consume.go +++ b/ante/evm/08_gas_consume.go @@ -7,7 +7,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" anteinterfaces "github.com/cosmos/evm/ante/interfaces" - "github.com/cosmos/evm/types" + antetypes "github.com/cosmos/evm/ante/types" evmtypes "github.com/cosmos/evm/x/vm/types" errorsmod "cosmossdk.io/errors" @@ -99,7 +99,7 @@ func GetMsgPriority( // TODO: (@fedekunze) Why is this necessary? This seems to be a duplicate from the CheckGasWanted function. func CheckBlockGasLimit(ctx sdktypes.Context, gasWanted uint64, minPriority int64) (sdktypes.Context, error) { - blockGasLimit := types.BlockGasLimit(ctx) + blockGasLimit := antetypes.BlockGasLimit(ctx) // return error if the tx gas is greater than the block limit (max gas) @@ -122,7 +122,7 @@ func CheckBlockGasLimit(ctx sdktypes.Context, gasWanted uint64, minPriority int6 // FIXME: use a custom gas configuration that doesn't add any additional gas and only // takes into account the gas consumed at the end of the EVM transaction. ctx = ctx. - WithGasMeter(types.NewInfiniteGasMeterWithLimit(gasWanted)). + WithGasMeter(evmtypes.NewInfiniteGasMeterWithLimit(gasWanted)). WithPriority(minPriority) return ctx, nil diff --git a/ante/evm/10_gas_wanted.go b/ante/evm/10_gas_wanted.go index 9245e0446..ef07c0ec7 100644 --- a/ante/evm/10_gas_wanted.go +++ b/ante/evm/10_gas_wanted.go @@ -4,7 +4,7 @@ import ( "math/big" anteinterfaces "github.com/cosmos/evm/ante/interfaces" - "github.com/cosmos/evm/types" + "github.com/cosmos/evm/ante/types" feemarkettypes "github.com/cosmos/evm/x/feemarket/types" evmtypes "github.com/cosmos/evm/x/vm/types" diff --git a/ante/evm/fee_checker.go b/ante/evm/fee_checker.go index 3f0ea1c32..a31c1f013 100644 --- a/ante/evm/fee_checker.go +++ b/ante/evm/fee_checker.go @@ -5,7 +5,7 @@ import ( "github.com/ethereum/go-ethereum/params" - cosmosevmtypes "github.com/cosmos/evm/types" + cosmosevmtypes "github.com/cosmos/evm/ante/types" feemarkettypes "github.com/cosmos/evm/x/feemarket/types" evmtypes "github.com/cosmos/evm/x/vm/types" diff --git a/ante/evm/fee_checker_test.go b/ante/evm/fee_checker_test.go index fdd2db012..0c83002ca 100644 --- a/ante/evm/fee_checker_test.go +++ b/ante/evm/fee_checker_test.go @@ -9,10 +9,10 @@ import ( tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/evm/ante/evm" + "github.com/cosmos/evm/ante/types" "github.com/cosmos/evm/config" "github.com/cosmos/evm/encoding" testconstants "github.com/cosmos/evm/testutil/constants" - "github.com/cosmos/evm/types" feemarkettypes "github.com/cosmos/evm/x/feemarket/types" evmtypes "github.com/cosmos/evm/x/vm/types" diff --git a/types/block.go b/ante/types/block.go similarity index 100% rename from types/block.go rename to ante/types/block.go diff --git a/types/dynamic_fee.go b/ante/types/dynamic_fee.go similarity index 100% rename from types/dynamic_fee.go rename to ante/types/dynamic_fee.go diff --git a/types/dynamic_fee.pb.go b/ante/types/dynamic_fee.pb.go similarity index 80% rename from types/dynamic_fee.pb.go rename to ante/types/dynamic_fee.pb.go index 29fd6621e..f1c499c06 100644 --- a/types/dynamic_fee.pb.go +++ b/ante/types/dynamic_fee.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/evm/types/v1/dynamic_fee.proto +// source: cosmos/evm/ante/v1/dynamic_fee.proto package types @@ -37,7 +37,7 @@ func (m *ExtensionOptionDynamicFeeTx) Reset() { *m = ExtensionOptionDyna func (m *ExtensionOptionDynamicFeeTx) String() string { return proto.CompactTextString(m) } func (*ExtensionOptionDynamicFeeTx) ProtoMessage() {} func (*ExtensionOptionDynamicFeeTx) Descriptor() ([]byte, []int) { - return fileDescriptor_3385bb4614fa656c, []int{0} + return fileDescriptor_057a31d9192a8080, []int{0} } func (m *ExtensionOptionDynamicFeeTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -67,31 +67,31 @@ func (m *ExtensionOptionDynamicFeeTx) XXX_DiscardUnknown() { var xxx_messageInfo_ExtensionOptionDynamicFeeTx proto.InternalMessageInfo func init() { - proto.RegisterType((*ExtensionOptionDynamicFeeTx)(nil), "cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx") + proto.RegisterType((*ExtensionOptionDynamicFeeTx)(nil), "cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx") } func init() { - proto.RegisterFile("cosmos/evm/types/v1/dynamic_fee.proto", fileDescriptor_3385bb4614fa656c) + proto.RegisterFile("cosmos/evm/ante/v1/dynamic_fee.proto", fileDescriptor_057a31d9192a8080) } -var fileDescriptor_3385bb4614fa656c = []byte{ - // 253 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x2d, 0xcb, 0xd5, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2f, 0x33, 0xd4, - 0x4f, 0xa9, 0xcc, 0x4b, 0xcc, 0xcd, 0x4c, 0x8e, 0x4f, 0x4b, 0x4d, 0xd5, 0x2b, 0x28, 0xca, 0x2f, - 0xc9, 0x17, 0x12, 0x86, 0x28, 0xd3, 0x4b, 0x2d, 0xcb, 0xd5, 0x03, 0x2b, 0xd3, 0x2b, 0x33, 0x94, - 0x12, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, 0x10, 0x75, 0x52, 0x22, 0xe9, 0xf9, 0xe9, - 0xf9, 0x60, 0xa6, 0x3e, 0x88, 0x05, 0x11, 0x55, 0x2a, 0xe5, 0x92, 0x76, 0xad, 0x28, 0x49, 0xcd, - 0x2b, 0xce, 0xcc, 0xcf, 0xf3, 0x2f, 0x28, 0xc9, 0xcc, 0xcf, 0x73, 0x81, 0xd8, 0xe0, 0x96, 0x9a, - 0x1a, 0x52, 0x21, 0x14, 0xc6, 0x25, 0x94, 0x9b, 0x58, 0x11, 0x5f, 0x50, 0x94, 0x99, 0x5f, 0x94, - 0x59, 0x52, 0x09, 0x62, 0x24, 0xa7, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x3a, 0x69, 0x9c, 0xb8, - 0x27, 0xcf, 0x70, 0xeb, 0x9e, 0xbc, 0x34, 0xc4, 0x01, 0xc5, 0x29, 0xd9, 0x7a, 0x99, 0xf9, 0xfa, - 0xb9, 0x89, 0x25, 0x19, 0x7a, 0x3e, 0xa9, 0xe9, 0x89, 0xc9, 0x95, 0x2e, 0xa9, 0xc9, 0x2b, 0x9e, - 0x6f, 0xd0, 0x62, 0x0c, 0x12, 0xc8, 0x4d, 0xac, 0x08, 0x80, 0x1a, 0x11, 0x00, 0x32, 0xc1, 0xc9, - 0xf4, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, - 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xa4, 0xd3, 0x33, 0x4b, 0x32, - 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd1, 0x03, 0x20, 0x89, 0x0d, 0xec, 0x68, 0x63, 0x40, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x06, 0x83, 0x4f, 0xe5, 0x1b, 0x01, 0x00, 0x00, +var fileDescriptor_057a31d9192a8080 = []byte{ + // 256 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x49, 0xce, 0x2f, 0xce, + 0xcd, 0x2f, 0xd6, 0x4f, 0x2d, 0xcb, 0xd5, 0x4f, 0xcc, 0x2b, 0x49, 0xd5, 0x2f, 0x33, 0xd4, 0x4f, + 0xa9, 0xcc, 0x4b, 0xcc, 0xcd, 0x4c, 0x8e, 0x4f, 0x4b, 0x4d, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, + 0x17, 0x12, 0x82, 0xa8, 0xd2, 0x4b, 0x2d, 0xcb, 0xd5, 0x03, 0xa9, 0xd2, 0x2b, 0x33, 0x94, 0x12, + 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, 0x10, 0x65, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, + 0x60, 0xa6, 0x3e, 0x88, 0x05, 0x11, 0x55, 0x2a, 0xe5, 0x92, 0x76, 0xad, 0x28, 0x49, 0xcd, 0x2b, + 0xce, 0xcc, 0xcf, 0xf3, 0x2f, 0x28, 0xc9, 0xcc, 0xcf, 0x73, 0x81, 0x58, 0xe0, 0x96, 0x9a, 0x1a, + 0x52, 0x21, 0x14, 0xc6, 0x25, 0x94, 0x9b, 0x58, 0x11, 0x5f, 0x50, 0x94, 0x99, 0x5f, 0x94, 0x59, + 0x52, 0x09, 0x62, 0x24, 0xa7, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x3a, 0x69, 0x9c, 0xb8, 0x27, + 0xcf, 0x70, 0xeb, 0x9e, 0xbc, 0x34, 0xc4, 0xfe, 0xe2, 0x94, 0x6c, 0xbd, 0xcc, 0x7c, 0xfd, 0xdc, + 0xc4, 0x92, 0x0c, 0x3d, 0x9f, 0xd4, 0xf4, 0xc4, 0xe4, 0x4a, 0x97, 0xd4, 0xe4, 0x15, 0xcf, 0x37, + 0x68, 0x31, 0x06, 0x09, 0xe4, 0x26, 0x56, 0x04, 0x40, 0x8d, 0x08, 0x00, 0x99, 0xe0, 0x64, 0x75, + 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, + 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x0a, 0xe9, 0x99, 0x25, 0x19, 0xa5, + 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe8, 0xde, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, + 0xbb, 0xdc, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xac, 0x66, 0x4c, 0xd0, 0x1e, 0x01, 0x00, 0x00, } func (m *ExtensionOptionDynamicFeeTx) Marshal() (dAtA []byte, err error) { diff --git a/api/cosmos/evm/types/v1/dynamic_fee.pulsar.go b/api/cosmos/evm/ante/v1/dynamic_fee.pulsar.go similarity index 73% rename from api/cosmos/evm/types/v1/dynamic_fee.pulsar.go rename to api/cosmos/evm/ante/v1/dynamic_fee.pulsar.go index e4408114e..8a4eb6eb8 100644 --- a/api/cosmos/evm/types/v1/dynamic_fee.pulsar.go +++ b/api/cosmos/evm/ante/v1/dynamic_fee.pulsar.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package typesv1 +package antev1 import ( _ "cosmossdk.io/api/amino" @@ -20,8 +20,8 @@ var ( ) func init() { - file_cosmos_evm_types_v1_dynamic_fee_proto_init() - md_ExtensionOptionDynamicFeeTx = File_cosmos_evm_types_v1_dynamic_fee_proto.Messages().ByName("ExtensionOptionDynamicFeeTx") + file_cosmos_evm_ante_v1_dynamic_fee_proto_init() + md_ExtensionOptionDynamicFeeTx = File_cosmos_evm_ante_v1_dynamic_fee_proto.Messages().ByName("ExtensionOptionDynamicFeeTx") fd_ExtensionOptionDynamicFeeTx_max_priority_price = md_ExtensionOptionDynamicFeeTx.Fields().ByName("max_priority_price") } @@ -34,7 +34,7 @@ func (x *ExtensionOptionDynamicFeeTx) ProtoReflect() protoreflect.Message { } func (x *ExtensionOptionDynamicFeeTx) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_evm_types_v1_dynamic_fee_proto_msgTypes[0] + mi := &file_cosmos_evm_ante_v1_dynamic_fee_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111,13 +111,13 @@ func (x *fastReflection_ExtensionOptionDynamicFeeTx) Range(f func(protoreflect.F // a repeated field is populated if it is non-empty. func (x *fastReflection_ExtensionOptionDynamicFeeTx) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx.max_priority_price": + case "cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx.max_priority_price": return x.MaxPriorityPrice != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx does not contain field %s", fd.FullName())) } } @@ -129,13 +129,13 @@ func (x *fastReflection_ExtensionOptionDynamicFeeTx) Has(fd protoreflect.FieldDe // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_ExtensionOptionDynamicFeeTx) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx.max_priority_price": + case "cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx.max_priority_price": x.MaxPriorityPrice = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx does not contain field %s", fd.FullName())) } } @@ -147,14 +147,14 @@ func (x *fastReflection_ExtensionOptionDynamicFeeTx) Clear(fd protoreflect.Field // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_ExtensionOptionDynamicFeeTx) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx.max_priority_price": + case "cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx.max_priority_price": value := x.MaxPriorityPrice return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx does not contain field %s", descriptor.FullName())) } } @@ -170,13 +170,13 @@ func (x *fastReflection_ExtensionOptionDynamicFeeTx) Get(descriptor protoreflect // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_ExtensionOptionDynamicFeeTx) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx.max_priority_price": + case "cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx.max_priority_price": x.MaxPriorityPrice = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx does not contain field %s", fd.FullName())) } } @@ -192,13 +192,13 @@ func (x *fastReflection_ExtensionOptionDynamicFeeTx) Set(fd protoreflect.FieldDe // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_ExtensionOptionDynamicFeeTx) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx.max_priority_price": - panic(fmt.Errorf("field max_priority_price of message cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx is not mutable")) + case "cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx.max_priority_price": + panic(fmt.Errorf("field max_priority_price of message cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx does not contain field %s", fd.FullName())) } } @@ -207,13 +207,13 @@ func (x *fastReflection_ExtensionOptionDynamicFeeTx) Mutable(fd protoreflect.Fie // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_ExtensionOptionDynamicFeeTx) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx.max_priority_price": + case "cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx.max_priority_price": return protoreflect.ValueOfString("") default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx does not contain field %s", fd.FullName())) } } @@ -223,7 +223,7 @@ func (x *fastReflection_ExtensionOptionDynamicFeeTx) NewField(fd protoreflect.Fi func (x *fastReflection_ExtensionOptionDynamicFeeTx) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx", d.FullName())) } panic("unreachable") } @@ -438,7 +438,7 @@ func (x *fastReflection_ExtensionOptionDynamicFeeTx) ProtoMethods() *protoiface. // versions: // protoc-gen-go v1.27.0 // protoc (unknown) -// source: cosmos/evm/types/v1/dynamic_fee.proto +// source: cosmos/evm/ante/v1/dynamic_fee.proto const ( // Verify that this generated code is sufficiently up-to-date. @@ -462,7 +462,7 @@ type ExtensionOptionDynamicFeeTx struct { func (x *ExtensionOptionDynamicFeeTx) Reset() { *x = ExtensionOptionDynamicFeeTx{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_evm_types_v1_dynamic_fee_proto_msgTypes[0] + mi := &file_cosmos_evm_ante_v1_dynamic_fee_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -476,7 +476,7 @@ func (*ExtensionOptionDynamicFeeTx) ProtoMessage() {} // Deprecated: Use ExtensionOptionDynamicFeeTx.ProtoReflect.Descriptor instead. func (*ExtensionOptionDynamicFeeTx) Descriptor() ([]byte, []int) { - return file_cosmos_evm_types_v1_dynamic_fee_proto_rawDescGZIP(), []int{0} + return file_cosmos_evm_ante_v1_dynamic_fee_proto_rawDescGZIP(), []int{0} } func (x *ExtensionOptionDynamicFeeTx) GetMaxPriorityPrice() string { @@ -486,55 +486,55 @@ func (x *ExtensionOptionDynamicFeeTx) GetMaxPriorityPrice() string { return "" } -var File_cosmos_evm_types_v1_dynamic_fee_proto protoreflect.FileDescriptor - -var file_cosmos_evm_types_v1_dynamic_fee_proto_rawDesc = []byte{ - 0x0a, 0x25, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x5f, 0x66, 0x65, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x65, 0x76, 0x6d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x11, 0x61, 0x6d, - 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x75, 0x0a, 0x1b, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x46, - 0x65, 0x65, 0x54, 0x78, 0x12, 0x56, 0x0a, 0x12, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x72, 0x69, 0x6f, - 0x72, 0x69, 0x74, 0x79, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x28, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, - 0x63, 0x79, 0x44, 0x65, 0x63, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x50, - 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x50, 0x72, 0x69, 0x63, 0x65, 0x42, 0xc7, 0x01, 0x0a, - 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0f, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, - 0x63, 0x46, 0x65, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 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, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76, - 0x31, 0x3b, 0x74, 0x79, 0x70, 0x65, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x45, 0x54, 0xaa, - 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, 0x54, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, - 0x76, 0x6d, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x56, - 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x6d, 0x3a, 0x3a, 0x54, 0x79, 0x70, - 0x65, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_cosmos_evm_ante_v1_dynamic_fee_proto protoreflect.FileDescriptor + +var file_cosmos_evm_ante_v1_dynamic_fee_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x61, 0x6e, 0x74, + 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x5f, 0x66, 0x65, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, + 0x76, 0x6d, 0x2e, 0x61, 0x6e, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, + 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, + 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x75, 0x0a, 0x1b, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x46, 0x65, 0x65, + 0x54, 0x78, 0x12, 0x56, 0x0a, 0x12, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, + 0x74, 0x79, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x28, + 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, + 0x44, 0x65, 0x63, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x50, 0x72, 0x69, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x50, 0x72, 0x69, 0x63, 0x65, 0x42, 0xc0, 0x01, 0x0a, 0x16, 0x63, + 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x61, 0x6e, + 0x74, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0f, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x46, 0x65, + 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 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, 0x61, 0x6e, 0x74, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x6e, + 0x74, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x45, 0x41, 0xaa, 0x02, 0x12, 0x43, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, 0x41, 0x6e, 0x74, 0x65, 0x2e, 0x56, 0x31, 0xca, + 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x41, 0x6e, 0x74, + 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, + 0x6d, 0x5c, 0x41, 0x6e, 0x74, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, + 0x45, 0x76, 0x6d, 0x3a, 0x3a, 0x41, 0x6e, 0x74, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_cosmos_evm_types_v1_dynamic_fee_proto_rawDescOnce sync.Once - file_cosmos_evm_types_v1_dynamic_fee_proto_rawDescData = file_cosmos_evm_types_v1_dynamic_fee_proto_rawDesc + file_cosmos_evm_ante_v1_dynamic_fee_proto_rawDescOnce sync.Once + file_cosmos_evm_ante_v1_dynamic_fee_proto_rawDescData = file_cosmos_evm_ante_v1_dynamic_fee_proto_rawDesc ) -func file_cosmos_evm_types_v1_dynamic_fee_proto_rawDescGZIP() []byte { - file_cosmos_evm_types_v1_dynamic_fee_proto_rawDescOnce.Do(func() { - file_cosmos_evm_types_v1_dynamic_fee_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_evm_types_v1_dynamic_fee_proto_rawDescData) +func file_cosmos_evm_ante_v1_dynamic_fee_proto_rawDescGZIP() []byte { + file_cosmos_evm_ante_v1_dynamic_fee_proto_rawDescOnce.Do(func() { + file_cosmos_evm_ante_v1_dynamic_fee_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_evm_ante_v1_dynamic_fee_proto_rawDescData) }) - return file_cosmos_evm_types_v1_dynamic_fee_proto_rawDescData + return file_cosmos_evm_ante_v1_dynamic_fee_proto_rawDescData } -var file_cosmos_evm_types_v1_dynamic_fee_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_cosmos_evm_types_v1_dynamic_fee_proto_goTypes = []interface{}{ - (*ExtensionOptionDynamicFeeTx)(nil), // 0: cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx +var file_cosmos_evm_ante_v1_dynamic_fee_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_cosmos_evm_ante_v1_dynamic_fee_proto_goTypes = []interface{}{ + (*ExtensionOptionDynamicFeeTx)(nil), // 0: cosmos.evm.ante.v1.ExtensionOptionDynamicFeeTx } -var file_cosmos_evm_types_v1_dynamic_fee_proto_depIdxs = []int32{ +var file_cosmos_evm_ante_v1_dynamic_fee_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type 0, // [0:0] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name @@ -542,13 +542,13 @@ var file_cosmos_evm_types_v1_dynamic_fee_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_cosmos_evm_types_v1_dynamic_fee_proto_init() } -func file_cosmos_evm_types_v1_dynamic_fee_proto_init() { - if File_cosmos_evm_types_v1_dynamic_fee_proto != nil { +func init() { file_cosmos_evm_ante_v1_dynamic_fee_proto_init() } +func file_cosmos_evm_ante_v1_dynamic_fee_proto_init() { + if File_cosmos_evm_ante_v1_dynamic_fee_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_cosmos_evm_types_v1_dynamic_fee_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_cosmos_evm_ante_v1_dynamic_fee_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ExtensionOptionDynamicFeeTx); i { case 0: return &v.state @@ -565,18 +565,18 @@ func file_cosmos_evm_types_v1_dynamic_fee_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cosmos_evm_types_v1_dynamic_fee_proto_rawDesc, + RawDescriptor: file_cosmos_evm_ante_v1_dynamic_fee_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_cosmos_evm_types_v1_dynamic_fee_proto_goTypes, - DependencyIndexes: file_cosmos_evm_types_v1_dynamic_fee_proto_depIdxs, - MessageInfos: file_cosmos_evm_types_v1_dynamic_fee_proto_msgTypes, + GoTypes: file_cosmos_evm_ante_v1_dynamic_fee_proto_goTypes, + DependencyIndexes: file_cosmos_evm_ante_v1_dynamic_fee_proto_depIdxs, + MessageInfos: file_cosmos_evm_ante_v1_dynamic_fee_proto_msgTypes, }.Build() - File_cosmos_evm_types_v1_dynamic_fee_proto = out.File - file_cosmos_evm_types_v1_dynamic_fee_proto_rawDesc = nil - file_cosmos_evm_types_v1_dynamic_fee_proto_goTypes = nil - file_cosmos_evm_types_v1_dynamic_fee_proto_depIdxs = nil + File_cosmos_evm_ante_v1_dynamic_fee_proto = out.File + file_cosmos_evm_ante_v1_dynamic_fee_proto_rawDesc = nil + file_cosmos_evm_ante_v1_dynamic_fee_proto_goTypes = nil + file_cosmos_evm_ante_v1_dynamic_fee_proto_depIdxs = nil } diff --git a/api/cosmos/evm/types/v1/web3.pulsar.go b/api/cosmos/evm/eip712/v1/web3.pulsar.go similarity index 73% rename from api/cosmos/evm/types/v1/web3.pulsar.go rename to api/cosmos/evm/eip712/v1/web3.pulsar.go index c56141069..2c0ef3604 100644 --- a/api/cosmos/evm/types/v1/web3.pulsar.go +++ b/api/cosmos/evm/eip712/v1/web3.pulsar.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package typesv1 +package eip712v1 import ( fmt "fmt" @@ -21,8 +21,8 @@ var ( ) func init() { - file_cosmos_evm_types_v1_web3_proto_init() - md_ExtensionOptionsWeb3Tx = File_cosmos_evm_types_v1_web3_proto.Messages().ByName("ExtensionOptionsWeb3Tx") + file_cosmos_evm_eip712_v1_web3_proto_init() + md_ExtensionOptionsWeb3Tx = File_cosmos_evm_eip712_v1_web3_proto.Messages().ByName("ExtensionOptionsWeb3Tx") fd_ExtensionOptionsWeb3Tx_typed_data_chain_id = md_ExtensionOptionsWeb3Tx.Fields().ByName("typed_data_chain_id") fd_ExtensionOptionsWeb3Tx_fee_payer = md_ExtensionOptionsWeb3Tx.Fields().ByName("fee_payer") fd_ExtensionOptionsWeb3Tx_fee_payer_sig = md_ExtensionOptionsWeb3Tx.Fields().ByName("fee_payer_sig") @@ -37,7 +37,7 @@ func (x *ExtensionOptionsWeb3Tx) ProtoReflect() protoreflect.Message { } func (x *ExtensionOptionsWeb3Tx) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_evm_types_v1_web3_proto_msgTypes[0] + mi := &file_cosmos_evm_eip712_v1_web3_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -126,17 +126,17 @@ func (x *fastReflection_ExtensionOptionsWeb3Tx) Range(f func(protoreflect.FieldD // a repeated field is populated if it is non-empty. func (x *fastReflection_ExtensionOptionsWeb3Tx) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.typed_data_chain_id": + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.typed_data_chain_id": return x.TypedDataChainId != uint64(0) - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.fee_payer": + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.fee_payer": return x.FeePayer != "" - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.fee_payer_sig": + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.fee_payer_sig": return len(x.FeePayerSig) != 0 default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.ExtensionOptionsWeb3Tx")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.ExtensionOptionsWeb3Tx does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx does not contain field %s", fd.FullName())) } } @@ -148,17 +148,17 @@ func (x *fastReflection_ExtensionOptionsWeb3Tx) Has(fd protoreflect.FieldDescrip // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_ExtensionOptionsWeb3Tx) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.typed_data_chain_id": + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.typed_data_chain_id": x.TypedDataChainId = uint64(0) - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.fee_payer": + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.fee_payer": x.FeePayer = "" - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.fee_payer_sig": + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.fee_payer_sig": x.FeePayerSig = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.ExtensionOptionsWeb3Tx")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.ExtensionOptionsWeb3Tx does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx does not contain field %s", fd.FullName())) } } @@ -170,20 +170,20 @@ func (x *fastReflection_ExtensionOptionsWeb3Tx) Clear(fd protoreflect.FieldDescr // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_ExtensionOptionsWeb3Tx) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.typed_data_chain_id": + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.typed_data_chain_id": value := x.TypedDataChainId return protoreflect.ValueOfUint64(value) - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.fee_payer": + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.fee_payer": value := x.FeePayer return protoreflect.ValueOfString(value) - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.fee_payer_sig": + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.fee_payer_sig": value := x.FeePayerSig return protoreflect.ValueOfBytes(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.ExtensionOptionsWeb3Tx")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.ExtensionOptionsWeb3Tx does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx does not contain field %s", descriptor.FullName())) } } @@ -199,17 +199,17 @@ func (x *fastReflection_ExtensionOptionsWeb3Tx) Get(descriptor protoreflect.Fiel // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_ExtensionOptionsWeb3Tx) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.typed_data_chain_id": + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.typed_data_chain_id": x.TypedDataChainId = value.Uint() - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.fee_payer": + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.fee_payer": x.FeePayer = value.Interface().(string) - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.fee_payer_sig": + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.fee_payer_sig": x.FeePayerSig = value.Bytes() default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.ExtensionOptionsWeb3Tx")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.ExtensionOptionsWeb3Tx does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx does not contain field %s", fd.FullName())) } } @@ -225,17 +225,17 @@ func (x *fastReflection_ExtensionOptionsWeb3Tx) Set(fd protoreflect.FieldDescrip // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_ExtensionOptionsWeb3Tx) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.typed_data_chain_id": - panic(fmt.Errorf("field typed_data_chain_id of message cosmos.evm.types.v1.ExtensionOptionsWeb3Tx is not mutable")) - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.fee_payer": - panic(fmt.Errorf("field fee_payer of message cosmos.evm.types.v1.ExtensionOptionsWeb3Tx is not mutable")) - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.fee_payer_sig": - panic(fmt.Errorf("field fee_payer_sig of message cosmos.evm.types.v1.ExtensionOptionsWeb3Tx is not mutable")) + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.typed_data_chain_id": + panic(fmt.Errorf("field typed_data_chain_id of message cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx is not mutable")) + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.fee_payer": + panic(fmt.Errorf("field fee_payer of message cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx is not mutable")) + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.fee_payer_sig": + panic(fmt.Errorf("field fee_payer_sig of message cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.ExtensionOptionsWeb3Tx")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.ExtensionOptionsWeb3Tx does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx does not contain field %s", fd.FullName())) } } @@ -244,17 +244,17 @@ func (x *fastReflection_ExtensionOptionsWeb3Tx) Mutable(fd protoreflect.FieldDes // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_ExtensionOptionsWeb3Tx) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.typed_data_chain_id": + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.typed_data_chain_id": return protoreflect.ValueOfUint64(uint64(0)) - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.fee_payer": + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.fee_payer": return protoreflect.ValueOfString("") - case "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx.fee_payer_sig": + case "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx.fee_payer_sig": return protoreflect.ValueOfBytes(nil) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.ExtensionOptionsWeb3Tx")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.ExtensionOptionsWeb3Tx does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx does not contain field %s", fd.FullName())) } } @@ -264,7 +264,7 @@ func (x *fastReflection_ExtensionOptionsWeb3Tx) NewField(fd protoreflect.FieldDe func (x *fastReflection_ExtensionOptionsWeb3Tx) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.evm.types.v1.ExtensionOptionsWeb3Tx", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx", d.FullName())) } panic("unreachable") } @@ -551,7 +551,7 @@ func (x *fastReflection_ExtensionOptionsWeb3Tx) ProtoMethods() *protoiface.Metho // versions: // protoc-gen-go v1.27.0 // protoc (unknown) -// source: cosmos/evm/types/v1/web3.proto +// source: cosmos/evm/eip712/v1/web3.proto const ( // Verify that this generated code is sufficiently up-to-date. @@ -581,7 +581,7 @@ type ExtensionOptionsWeb3Tx struct { func (x *ExtensionOptionsWeb3Tx) Reset() { *x = ExtensionOptionsWeb3Tx{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_evm_types_v1_web3_proto_msgTypes[0] + mi := &file_cosmos_evm_eip712_v1_web3_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -595,7 +595,7 @@ func (*ExtensionOptionsWeb3Tx) ProtoMessage() {} // Deprecated: Use ExtensionOptionsWeb3Tx.ProtoReflect.Descriptor instead. func (*ExtensionOptionsWeb3Tx) Descriptor() ([]byte, []int) { - return file_cosmos_evm_types_v1_web3_proto_rawDescGZIP(), []int{0} + return file_cosmos_evm_eip712_v1_web3_proto_rawDescGZIP(), []int{0} } func (x *ExtensionOptionsWeb3Tx) GetTypedDataChainId() uint64 { @@ -619,61 +619,62 @@ func (x *ExtensionOptionsWeb3Tx) GetFeePayerSig() []byte { return nil } -var File_cosmos_evm_types_v1_web3_proto protoreflect.FileDescriptor - -var file_cosmos_evm_types_v1_web3_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x65, 0x62, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x13, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf5, 0x01, 0x0a, 0x16, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x57, 0x65, 0x62, 0x33, 0x54, 0x78, 0x12, 0x61, 0x0a, 0x13, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, - 0x64, 0x61, 0x74, 0x61, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x04, 0x42, 0x32, 0xe2, 0xde, 0x1f, 0x10, 0x54, 0x79, 0x70, 0x65, 0x64, 0x44, 0x61, - 0x74, 0x61, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x44, 0xea, 0xde, 0x1f, 0x1a, 0x74, 0x79, 0x70, - 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x44, 0x2c, 0x6f, 0x6d, - 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x10, 0x74, 0x79, 0x70, 0x65, 0x64, 0x44, 0x61, - 0x74, 0x61, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x09, 0x66, 0x65, 0x65, - 0x5f, 0x70, 0x61, 0x79, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x16, 0xea, 0xde, - 0x1f, 0x12, 0x66, 0x65, 0x65, 0x50, 0x61, 0x79, 0x65, 0x72, 0x2c, 0x6f, 0x6d, 0x69, 0x74, 0x65, - 0x6d, 0x70, 0x74, 0x79, 0x52, 0x08, 0x66, 0x65, 0x65, 0x50, 0x61, 0x79, 0x65, 0x72, 0x12, 0x3d, - 0x0a, 0x0d, 0x66, 0x65, 0x65, 0x5f, 0x70, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x73, 0x69, 0x67, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x19, 0xea, 0xde, 0x1f, 0x15, 0x66, 0x65, 0x65, 0x50, 0x61, - 0x79, 0x65, 0x72, 0x53, 0x69, 0x67, 0x2c, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, - 0x52, 0x0b, 0x66, 0x65, 0x65, 0x50, 0x61, 0x79, 0x65, 0x72, 0x53, 0x69, 0x67, 0x3a, 0x04, 0x88, - 0xa0, 0x1f, 0x00, 0x42, 0xc1, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x42, - 0x09, 0x57, 0x65, 0x62, 0x33, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 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, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, - 0x76, 0x31, 0x3b, 0x74, 0x79, 0x70, 0x65, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x45, 0x54, - 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, 0x54, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, - 0x45, 0x76, 0x6d, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, - 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x6d, 0x3a, 0x3a, 0x54, 0x79, - 0x70, 0x65, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_cosmos_evm_eip712_v1_web3_proto protoreflect.FileDescriptor + +var file_cosmos_evm_eip712_v1_web3_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x65, 0x69, 0x70, + 0x37, 0x31, 0x32, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x65, 0x62, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x69, + 0x70, 0x37, 0x31, 0x32, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf5, 0x01, + 0x0a, 0x16, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x57, 0x65, 0x62, 0x33, 0x54, 0x78, 0x12, 0x61, 0x0a, 0x13, 0x74, 0x79, 0x70, 0x65, + 0x64, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x32, 0xe2, 0xde, 0x1f, 0x10, 0x54, 0x79, 0x70, 0x65, 0x64, + 0x44, 0x61, 0x74, 0x61, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x44, 0xea, 0xde, 0x1f, 0x1a, 0x74, + 0x79, 0x70, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x44, 0x2c, + 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x10, 0x74, 0x79, 0x70, 0x65, 0x64, + 0x44, 0x61, 0x74, 0x61, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x09, 0x66, + 0x65, 0x65, 0x5f, 0x70, 0x61, 0x79, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x16, + 0xea, 0xde, 0x1f, 0x12, 0x66, 0x65, 0x65, 0x50, 0x61, 0x79, 0x65, 0x72, 0x2c, 0x6f, 0x6d, 0x69, + 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x08, 0x66, 0x65, 0x65, 0x50, 0x61, 0x79, 0x65, 0x72, + 0x12, 0x3d, 0x0a, 0x0d, 0x66, 0x65, 0x65, 0x5f, 0x70, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x73, 0x69, + 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x19, 0xea, 0xde, 0x1f, 0x15, 0x66, 0x65, 0x65, + 0x50, 0x61, 0x79, 0x65, 0x72, 0x53, 0x69, 0x67, 0x2c, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, + 0x74, 0x79, 0x52, 0x0b, 0x66, 0x65, 0x65, 0x50, 0x61, 0x79, 0x65, 0x72, 0x53, 0x69, 0x67, 0x3a, + 0x04, 0x88, 0xa0, 0x1f, 0x00, 0x42, 0xc8, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x69, 0x70, 0x37, 0x31, 0x32, 0x2e, + 0x76, 0x31, 0x42, 0x09, 0x57, 0x65, 0x62, 0x33, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x2e, 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, 0x65, 0x69, 0x70, + 0x37, 0x31, 0x32, 0x2f, 0x76, 0x31, 0x3b, 0x65, 0x69, 0x70, 0x37, 0x31, 0x32, 0x76, 0x31, 0xa2, + 0x02, 0x03, 0x43, 0x45, 0x45, 0xaa, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x45, + 0x76, 0x6d, 0x2e, 0x45, 0x69, 0x70, 0x37, 0x31, 0x32, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x14, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x45, 0x69, 0x70, 0x37, 0x31, 0x32, + 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, + 0x5c, 0x45, 0x69, 0x70, 0x37, 0x31, 0x32, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, + 0x3a, 0x45, 0x76, 0x6d, 0x3a, 0x3a, 0x45, 0x69, 0x70, 0x37, 0x31, 0x32, 0x3a, 0x3a, 0x56, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_cosmos_evm_types_v1_web3_proto_rawDescOnce sync.Once - file_cosmos_evm_types_v1_web3_proto_rawDescData = file_cosmos_evm_types_v1_web3_proto_rawDesc + file_cosmos_evm_eip712_v1_web3_proto_rawDescOnce sync.Once + file_cosmos_evm_eip712_v1_web3_proto_rawDescData = file_cosmos_evm_eip712_v1_web3_proto_rawDesc ) -func file_cosmos_evm_types_v1_web3_proto_rawDescGZIP() []byte { - file_cosmos_evm_types_v1_web3_proto_rawDescOnce.Do(func() { - file_cosmos_evm_types_v1_web3_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_evm_types_v1_web3_proto_rawDescData) +func file_cosmos_evm_eip712_v1_web3_proto_rawDescGZIP() []byte { + file_cosmos_evm_eip712_v1_web3_proto_rawDescOnce.Do(func() { + file_cosmos_evm_eip712_v1_web3_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_evm_eip712_v1_web3_proto_rawDescData) }) - return file_cosmos_evm_types_v1_web3_proto_rawDescData + return file_cosmos_evm_eip712_v1_web3_proto_rawDescData } -var file_cosmos_evm_types_v1_web3_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_cosmos_evm_types_v1_web3_proto_goTypes = []interface{}{ - (*ExtensionOptionsWeb3Tx)(nil), // 0: cosmos.evm.types.v1.ExtensionOptionsWeb3Tx +var file_cosmos_evm_eip712_v1_web3_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_cosmos_evm_eip712_v1_web3_proto_goTypes = []interface{}{ + (*ExtensionOptionsWeb3Tx)(nil), // 0: cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx } -var file_cosmos_evm_types_v1_web3_proto_depIdxs = []int32{ +var file_cosmos_evm_eip712_v1_web3_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type 0, // [0:0] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name @@ -681,13 +682,13 @@ var file_cosmos_evm_types_v1_web3_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_cosmos_evm_types_v1_web3_proto_init() } -func file_cosmos_evm_types_v1_web3_proto_init() { - if File_cosmos_evm_types_v1_web3_proto != nil { +func init() { file_cosmos_evm_eip712_v1_web3_proto_init() } +func file_cosmos_evm_eip712_v1_web3_proto_init() { + if File_cosmos_evm_eip712_v1_web3_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_cosmos_evm_types_v1_web3_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_cosmos_evm_eip712_v1_web3_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ExtensionOptionsWeb3Tx); i { case 0: return &v.state @@ -704,18 +705,18 @@ func file_cosmos_evm_types_v1_web3_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cosmos_evm_types_v1_web3_proto_rawDesc, + RawDescriptor: file_cosmos_evm_eip712_v1_web3_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_cosmos_evm_types_v1_web3_proto_goTypes, - DependencyIndexes: file_cosmos_evm_types_v1_web3_proto_depIdxs, - MessageInfos: file_cosmos_evm_types_v1_web3_proto_msgTypes, + GoTypes: file_cosmos_evm_eip712_v1_web3_proto_goTypes, + DependencyIndexes: file_cosmos_evm_eip712_v1_web3_proto_depIdxs, + MessageInfos: file_cosmos_evm_eip712_v1_web3_proto_msgTypes, }.Build() - File_cosmos_evm_types_v1_web3_proto = out.File - file_cosmos_evm_types_v1_web3_proto_rawDesc = nil - file_cosmos_evm_types_v1_web3_proto_goTypes = nil - file_cosmos_evm_types_v1_web3_proto_depIdxs = nil + File_cosmos_evm_eip712_v1_web3_proto = out.File + file_cosmos_evm_eip712_v1_web3_proto_rawDesc = nil + file_cosmos_evm_eip712_v1_web3_proto_goTypes = nil + file_cosmos_evm_eip712_v1_web3_proto_depIdxs = nil } diff --git a/api/cosmos/evm/types/v1/indexer.pulsar.go b/api/cosmos/evm/server/v1/indexer.pulsar.go similarity index 74% rename from api/cosmos/evm/types/v1/indexer.pulsar.go rename to api/cosmos/evm/server/v1/indexer.pulsar.go index 8a9fe8c83..90362349a 100644 --- a/api/cosmos/evm/types/v1/indexer.pulsar.go +++ b/api/cosmos/evm/server/v1/indexer.pulsar.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package typesv1 +package serverv1 import ( fmt "fmt" @@ -25,8 +25,8 @@ var ( ) func init() { - file_cosmos_evm_types_v1_indexer_proto_init() - md_TxResult = File_cosmos_evm_types_v1_indexer_proto.Messages().ByName("TxResult") + file_cosmos_evm_server_v1_indexer_proto_init() + md_TxResult = File_cosmos_evm_server_v1_indexer_proto.Messages().ByName("TxResult") fd_TxResult_height = md_TxResult.Fields().ByName("height") fd_TxResult_tx_index = md_TxResult.Fields().ByName("tx_index") fd_TxResult_msg_index = md_TxResult.Fields().ByName("msg_index") @@ -45,7 +45,7 @@ func (x *TxResult) ProtoReflect() protoreflect.Message { } func (x *TxResult) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_evm_types_v1_indexer_proto_msgTypes[0] + mi := &file_cosmos_evm_server_v1_indexer_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -158,25 +158,25 @@ func (x *fastReflection_TxResult) Range(f func(protoreflect.FieldDescriptor, pro // a repeated field is populated if it is non-empty. func (x *fastReflection_TxResult) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "cosmos.evm.types.v1.TxResult.height": + case "cosmos.evm.server.v1.TxResult.height": return x.Height != int64(0) - case "cosmos.evm.types.v1.TxResult.tx_index": + case "cosmos.evm.server.v1.TxResult.tx_index": return x.TxIndex != uint32(0) - case "cosmos.evm.types.v1.TxResult.msg_index": + case "cosmos.evm.server.v1.TxResult.msg_index": return x.MsgIndex != uint32(0) - case "cosmos.evm.types.v1.TxResult.eth_tx_index": + case "cosmos.evm.server.v1.TxResult.eth_tx_index": return x.EthTxIndex != int32(0) - case "cosmos.evm.types.v1.TxResult.failed": + case "cosmos.evm.server.v1.TxResult.failed": return x.Failed != false - case "cosmos.evm.types.v1.TxResult.gas_used": + case "cosmos.evm.server.v1.TxResult.gas_used": return x.GasUsed != uint64(0) - case "cosmos.evm.types.v1.TxResult.cumulative_gas_used": + case "cosmos.evm.server.v1.TxResult.cumulative_gas_used": return x.CumulativeGasUsed != uint64(0) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.TxResult")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.server.v1.TxResult")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.TxResult does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.evm.server.v1.TxResult does not contain field %s", fd.FullName())) } } @@ -188,25 +188,25 @@ func (x *fastReflection_TxResult) Has(fd protoreflect.FieldDescriptor) bool { // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_TxResult) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "cosmos.evm.types.v1.TxResult.height": + case "cosmos.evm.server.v1.TxResult.height": x.Height = int64(0) - case "cosmos.evm.types.v1.TxResult.tx_index": + case "cosmos.evm.server.v1.TxResult.tx_index": x.TxIndex = uint32(0) - case "cosmos.evm.types.v1.TxResult.msg_index": + case "cosmos.evm.server.v1.TxResult.msg_index": x.MsgIndex = uint32(0) - case "cosmos.evm.types.v1.TxResult.eth_tx_index": + case "cosmos.evm.server.v1.TxResult.eth_tx_index": x.EthTxIndex = int32(0) - case "cosmos.evm.types.v1.TxResult.failed": + case "cosmos.evm.server.v1.TxResult.failed": x.Failed = false - case "cosmos.evm.types.v1.TxResult.gas_used": + case "cosmos.evm.server.v1.TxResult.gas_used": x.GasUsed = uint64(0) - case "cosmos.evm.types.v1.TxResult.cumulative_gas_used": + case "cosmos.evm.server.v1.TxResult.cumulative_gas_used": x.CumulativeGasUsed = uint64(0) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.TxResult")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.server.v1.TxResult")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.TxResult does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.evm.server.v1.TxResult does not contain field %s", fd.FullName())) } } @@ -218,32 +218,32 @@ func (x *fastReflection_TxResult) Clear(fd protoreflect.FieldDescriptor) { // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_TxResult) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "cosmos.evm.types.v1.TxResult.height": + case "cosmos.evm.server.v1.TxResult.height": value := x.Height return protoreflect.ValueOfInt64(value) - case "cosmos.evm.types.v1.TxResult.tx_index": + case "cosmos.evm.server.v1.TxResult.tx_index": value := x.TxIndex return protoreflect.ValueOfUint32(value) - case "cosmos.evm.types.v1.TxResult.msg_index": + case "cosmos.evm.server.v1.TxResult.msg_index": value := x.MsgIndex return protoreflect.ValueOfUint32(value) - case "cosmos.evm.types.v1.TxResult.eth_tx_index": + case "cosmos.evm.server.v1.TxResult.eth_tx_index": value := x.EthTxIndex return protoreflect.ValueOfInt32(value) - case "cosmos.evm.types.v1.TxResult.failed": + case "cosmos.evm.server.v1.TxResult.failed": value := x.Failed return protoreflect.ValueOfBool(value) - case "cosmos.evm.types.v1.TxResult.gas_used": + case "cosmos.evm.server.v1.TxResult.gas_used": value := x.GasUsed return protoreflect.ValueOfUint64(value) - case "cosmos.evm.types.v1.TxResult.cumulative_gas_used": + case "cosmos.evm.server.v1.TxResult.cumulative_gas_used": value := x.CumulativeGasUsed return protoreflect.ValueOfUint64(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.TxResult")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.server.v1.TxResult")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.TxResult does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message cosmos.evm.server.v1.TxResult does not contain field %s", descriptor.FullName())) } } @@ -259,25 +259,25 @@ func (x *fastReflection_TxResult) Get(descriptor protoreflect.FieldDescriptor) p // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_TxResult) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "cosmos.evm.types.v1.TxResult.height": + case "cosmos.evm.server.v1.TxResult.height": x.Height = value.Int() - case "cosmos.evm.types.v1.TxResult.tx_index": + case "cosmos.evm.server.v1.TxResult.tx_index": x.TxIndex = uint32(value.Uint()) - case "cosmos.evm.types.v1.TxResult.msg_index": + case "cosmos.evm.server.v1.TxResult.msg_index": x.MsgIndex = uint32(value.Uint()) - case "cosmos.evm.types.v1.TxResult.eth_tx_index": + case "cosmos.evm.server.v1.TxResult.eth_tx_index": x.EthTxIndex = int32(value.Int()) - case "cosmos.evm.types.v1.TxResult.failed": + case "cosmos.evm.server.v1.TxResult.failed": x.Failed = value.Bool() - case "cosmos.evm.types.v1.TxResult.gas_used": + case "cosmos.evm.server.v1.TxResult.gas_used": x.GasUsed = value.Uint() - case "cosmos.evm.types.v1.TxResult.cumulative_gas_used": + case "cosmos.evm.server.v1.TxResult.cumulative_gas_used": x.CumulativeGasUsed = value.Uint() default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.TxResult")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.server.v1.TxResult")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.TxResult does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.evm.server.v1.TxResult does not contain field %s", fd.FullName())) } } @@ -293,25 +293,25 @@ func (x *fastReflection_TxResult) Set(fd protoreflect.FieldDescriptor, value pro // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_TxResult) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.evm.types.v1.TxResult.height": - panic(fmt.Errorf("field height of message cosmos.evm.types.v1.TxResult is not mutable")) - case "cosmos.evm.types.v1.TxResult.tx_index": - panic(fmt.Errorf("field tx_index of message cosmos.evm.types.v1.TxResult is not mutable")) - case "cosmos.evm.types.v1.TxResult.msg_index": - panic(fmt.Errorf("field msg_index of message cosmos.evm.types.v1.TxResult is not mutable")) - case "cosmos.evm.types.v1.TxResult.eth_tx_index": - panic(fmt.Errorf("field eth_tx_index of message cosmos.evm.types.v1.TxResult is not mutable")) - case "cosmos.evm.types.v1.TxResult.failed": - panic(fmt.Errorf("field failed of message cosmos.evm.types.v1.TxResult is not mutable")) - case "cosmos.evm.types.v1.TxResult.gas_used": - panic(fmt.Errorf("field gas_used of message cosmos.evm.types.v1.TxResult is not mutable")) - case "cosmos.evm.types.v1.TxResult.cumulative_gas_used": - panic(fmt.Errorf("field cumulative_gas_used of message cosmos.evm.types.v1.TxResult is not mutable")) + case "cosmos.evm.server.v1.TxResult.height": + panic(fmt.Errorf("field height of message cosmos.evm.server.v1.TxResult is not mutable")) + case "cosmos.evm.server.v1.TxResult.tx_index": + panic(fmt.Errorf("field tx_index of message cosmos.evm.server.v1.TxResult is not mutable")) + case "cosmos.evm.server.v1.TxResult.msg_index": + panic(fmt.Errorf("field msg_index of message cosmos.evm.server.v1.TxResult is not mutable")) + case "cosmos.evm.server.v1.TxResult.eth_tx_index": + panic(fmt.Errorf("field eth_tx_index of message cosmos.evm.server.v1.TxResult is not mutable")) + case "cosmos.evm.server.v1.TxResult.failed": + panic(fmt.Errorf("field failed of message cosmos.evm.server.v1.TxResult is not mutable")) + case "cosmos.evm.server.v1.TxResult.gas_used": + panic(fmt.Errorf("field gas_used of message cosmos.evm.server.v1.TxResult is not mutable")) + case "cosmos.evm.server.v1.TxResult.cumulative_gas_used": + panic(fmt.Errorf("field cumulative_gas_used of message cosmos.evm.server.v1.TxResult is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.TxResult")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.server.v1.TxResult")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.TxResult does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.evm.server.v1.TxResult does not contain field %s", fd.FullName())) } } @@ -320,25 +320,25 @@ func (x *fastReflection_TxResult) Mutable(fd protoreflect.FieldDescriptor) proto // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_TxResult) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.evm.types.v1.TxResult.height": + case "cosmos.evm.server.v1.TxResult.height": return protoreflect.ValueOfInt64(int64(0)) - case "cosmos.evm.types.v1.TxResult.tx_index": + case "cosmos.evm.server.v1.TxResult.tx_index": return protoreflect.ValueOfUint32(uint32(0)) - case "cosmos.evm.types.v1.TxResult.msg_index": + case "cosmos.evm.server.v1.TxResult.msg_index": return protoreflect.ValueOfUint32(uint32(0)) - case "cosmos.evm.types.v1.TxResult.eth_tx_index": + case "cosmos.evm.server.v1.TxResult.eth_tx_index": return protoreflect.ValueOfInt32(int32(0)) - case "cosmos.evm.types.v1.TxResult.failed": + case "cosmos.evm.server.v1.TxResult.failed": return protoreflect.ValueOfBool(false) - case "cosmos.evm.types.v1.TxResult.gas_used": + case "cosmos.evm.server.v1.TxResult.gas_used": return protoreflect.ValueOfUint64(uint64(0)) - case "cosmos.evm.types.v1.TxResult.cumulative_gas_used": + case "cosmos.evm.server.v1.TxResult.cumulative_gas_used": return protoreflect.ValueOfUint64(uint64(0)) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.types.v1.TxResult")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.server.v1.TxResult")) } - panic(fmt.Errorf("message cosmos.evm.types.v1.TxResult does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.evm.server.v1.TxResult does not contain field %s", fd.FullName())) } } @@ -348,7 +348,7 @@ func (x *fastReflection_TxResult) NewField(fd protoreflect.FieldDescriptor) prot func (x *fastReflection_TxResult) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.evm.types.v1.TxResult", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in cosmos.evm.server.v1.TxResult", d.FullName())) } panic("unreachable") } @@ -715,7 +715,7 @@ func (x *fastReflection_TxResult) ProtoMethods() *protoiface.Methods { // versions: // protoc-gen-go v1.27.0 // protoc (unknown) -// source: cosmos/evm/types/v1/indexer.proto +// source: cosmos/evm/server/v1/indexer.proto const ( // Verify that this generated code is sufficiently up-to-date. @@ -752,7 +752,7 @@ type TxResult struct { func (x *TxResult) Reset() { *x = TxResult{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_evm_types_v1_indexer_proto_msgTypes[0] + mi := &file_cosmos_evm_server_v1_indexer_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -766,7 +766,7 @@ func (*TxResult) ProtoMessage() {} // Deprecated: Use TxResult.ProtoReflect.Descriptor instead. func (*TxResult) Descriptor() ([]byte, []int) { - return file_cosmos_evm_types_v1_indexer_proto_rawDescGZIP(), []int{0} + return file_cosmos_evm_server_v1_indexer_proto_rawDescGZIP(), []int{0} } func (x *TxResult) GetHeight() int64 { @@ -818,61 +818,61 @@ func (x *TxResult) GetCumulativeGasUsed() uint64 { return 0 } -var File_cosmos_evm_types_v1_indexer_proto protoreflect.FileDescriptor - -var file_cosmos_evm_types_v1_indexer_proto_rawDesc = []byte{ - 0x0a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x72, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe5, - 0x01, 0x0a, 0x08, 0x54, 0x78, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x68, - 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x68, 0x65, 0x69, - 0x67, 0x68, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x78, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x74, 0x78, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, - 0x0a, 0x09, 0x6d, 0x73, 0x67, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x08, 0x6d, 0x73, 0x67, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x20, 0x0a, 0x0c, 0x65, - 0x74, 0x68, 0x5f, 0x74, 0x78, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x0a, 0x65, 0x74, 0x68, 0x54, 0x78, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x16, 0x0a, - 0x06, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, - 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x61, 0x73, 0x5f, 0x75, 0x73, 0x65, - 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x67, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, - 0x12, 0x2e, 0x0a, 0x13, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x67, - 0x61, 0x73, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x63, - 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x47, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, - 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, 0x42, 0xc4, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x76, 0x31, 0x42, 0x0c, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x2c, 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, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x74, 0x79, 0x70, 0x65, 0x73, 0x76, 0x31, - 0xa2, 0x02, 0x03, 0x43, 0x45, 0x54, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x45, 0x76, 0x6d, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x43, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, - 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, - 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x45, - 0x76, 0x6d, 0x3a, 0x3a, 0x54, 0x79, 0x70, 0x65, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_cosmos_evm_server_v1_indexer_proto protoreflect.FileDescriptor + +var file_cosmos_evm_server_v1_indexer_proto_rawDesc = []byte{ + 0x0a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x72, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0xe5, 0x01, 0x0a, 0x08, 0x54, 0x78, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, + 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x68, + 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x78, 0x5f, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x74, 0x78, 0x49, 0x6e, 0x64, 0x65, 0x78, + 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x73, 0x67, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6d, 0x73, 0x67, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x20, 0x0a, + 0x0c, 0x65, 0x74, 0x68, 0x5f, 0x74, 0x78, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0a, 0x65, 0x74, 0x68, 0x54, 0x78, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, + 0x16, 0x0a, 0x06, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x06, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x61, 0x73, 0x5f, 0x75, + 0x73, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x67, 0x61, 0x73, 0x55, 0x73, + 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x13, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, + 0x5f, 0x67, 0x61, 0x73, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x11, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x47, 0x61, 0x73, 0x55, 0x73, + 0x65, 0x64, 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, 0x42, 0xcb, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x72, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 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, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x45, 0x53, 0xaa, 0x02, 0x14, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, + 0x56, 0x31, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5c, 0x56, 0x31, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x17, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x6d, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_cosmos_evm_types_v1_indexer_proto_rawDescOnce sync.Once - file_cosmos_evm_types_v1_indexer_proto_rawDescData = file_cosmos_evm_types_v1_indexer_proto_rawDesc + file_cosmos_evm_server_v1_indexer_proto_rawDescOnce sync.Once + file_cosmos_evm_server_v1_indexer_proto_rawDescData = file_cosmos_evm_server_v1_indexer_proto_rawDesc ) -func file_cosmos_evm_types_v1_indexer_proto_rawDescGZIP() []byte { - file_cosmos_evm_types_v1_indexer_proto_rawDescOnce.Do(func() { - file_cosmos_evm_types_v1_indexer_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_evm_types_v1_indexer_proto_rawDescData) +func file_cosmos_evm_server_v1_indexer_proto_rawDescGZIP() []byte { + file_cosmos_evm_server_v1_indexer_proto_rawDescOnce.Do(func() { + file_cosmos_evm_server_v1_indexer_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_evm_server_v1_indexer_proto_rawDescData) }) - return file_cosmos_evm_types_v1_indexer_proto_rawDescData + return file_cosmos_evm_server_v1_indexer_proto_rawDescData } -var file_cosmos_evm_types_v1_indexer_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_cosmos_evm_types_v1_indexer_proto_goTypes = []interface{}{ - (*TxResult)(nil), // 0: cosmos.evm.types.v1.TxResult +var file_cosmos_evm_server_v1_indexer_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_cosmos_evm_server_v1_indexer_proto_goTypes = []interface{}{ + (*TxResult)(nil), // 0: cosmos.evm.server.v1.TxResult } -var file_cosmos_evm_types_v1_indexer_proto_depIdxs = []int32{ +var file_cosmos_evm_server_v1_indexer_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type 0, // [0:0] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name @@ -880,13 +880,13 @@ var file_cosmos_evm_types_v1_indexer_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_cosmos_evm_types_v1_indexer_proto_init() } -func file_cosmos_evm_types_v1_indexer_proto_init() { - if File_cosmos_evm_types_v1_indexer_proto != nil { +func init() { file_cosmos_evm_server_v1_indexer_proto_init() } +func file_cosmos_evm_server_v1_indexer_proto_init() { + if File_cosmos_evm_server_v1_indexer_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_cosmos_evm_types_v1_indexer_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_cosmos_evm_server_v1_indexer_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TxResult); i { case 0: return &v.state @@ -903,18 +903,18 @@ func file_cosmos_evm_types_v1_indexer_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cosmos_evm_types_v1_indexer_proto_rawDesc, + RawDescriptor: file_cosmos_evm_server_v1_indexer_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_cosmos_evm_types_v1_indexer_proto_goTypes, - DependencyIndexes: file_cosmos_evm_types_v1_indexer_proto_depIdxs, - MessageInfos: file_cosmos_evm_types_v1_indexer_proto_msgTypes, + GoTypes: file_cosmos_evm_server_v1_indexer_proto_goTypes, + DependencyIndexes: file_cosmos_evm_server_v1_indexer_proto_depIdxs, + MessageInfos: file_cosmos_evm_server_v1_indexer_proto_msgTypes, }.Build() - File_cosmos_evm_types_v1_indexer_proto = out.File - file_cosmos_evm_types_v1_indexer_proto_rawDesc = nil - file_cosmos_evm_types_v1_indexer_proto_goTypes = nil - file_cosmos_evm_types_v1_indexer_proto_depIdxs = nil + File_cosmos_evm_server_v1_indexer_proto = out.File + file_cosmos_evm_server_v1_indexer_proto_rawDesc = nil + file_cosmos_evm_server_v1_indexer_proto_goTypes = nil + file_cosmos_evm_server_v1_indexer_proto_depIdxs = nil } diff --git a/config/config.go b/config/config.go index d7cfce0f6..6c09e0562 100644 --- a/config/config.go +++ b/config/config.go @@ -1,7 +1,7 @@ package config import ( - "github.com/cosmos/evm/types" + "github.com/cosmos/evm/crypto/hd" evmtypes "github.com/cosmos/evm/x/vm/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -87,7 +87,7 @@ func SetBech32Prefixes(config *sdk.Config) { // SetBip44CoinType sets the global coin type to be used in hierarchical deterministic wallets. func SetBip44CoinType(config *sdk.Config) { - config.SetCoinType(types.Bip44CoinType) - config.SetPurpose(sdk.Purpose) // Shared - config.SetFullFundraiserPath(types.BIP44HDPath) //nolint: staticcheck + config.SetCoinType(hd.Bip44CoinType) + config.SetPurpose(sdk.Purpose) // Shared + config.SetFullFundraiserPath(hd.BIP44HDPath) //nolint: staticcheck } diff --git a/crypto/hd/algorithm_test.go b/crypto/hd/algorithm_test.go index 3d736975c..d518ce3d9 100644 --- a/crypto/hd/algorithm_test.go +++ b/crypto/hd/algorithm_test.go @@ -10,7 +10,6 @@ import ( cryptocodec "github.com/cosmos/evm/crypto/codec" enccodec "github.com/cosmos/evm/encoding/codec" - cosmosevmtypes "github.com/cosmos/evm/types" amino "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" @@ -49,7 +48,7 @@ func TestKeyring(t *testing.T) { require.Nil(t, info) mockIn.Reset("password\npassword\n") - info, mnemonic, err := kr.NewMnemonic("foo", keyring.English, cosmosevmtypes.BIP44HDPath, keyring.DefaultBIP39Passphrase, EthSecp256k1) + info, mnemonic, err := kr.NewMnemonic("foo", keyring.English, BIP44HDPath, keyring.DefaultBIP39Passphrase, EthSecp256k1) require.NoError(t, err) require.NotEmpty(t, mnemonic) require.Equal(t, "foo", info.Name) @@ -58,7 +57,7 @@ func TestKeyring(t *testing.T) { require.NoError(t, err) require.Equal(t, string(EthSecp256k1Type), pubKey.Type()) - hdPath := cosmosevmtypes.BIP44HDPath + hdPath := BIP44HDPath bz, err := EthSecp256k1.Derive()(mnemonic, keyring.DefaultBIP39Passphrase, hdPath) require.NoError(t, err) @@ -84,7 +83,7 @@ func TestKeyring(t *testing.T) { } func TestDerivation(t *testing.T) { - bz, err := EthSecp256k1.Derive()(mnemonic, keyring.DefaultBIP39Passphrase, cosmosevmtypes.BIP44HDPath) + bz, err := EthSecp256k1.Derive()(mnemonic, keyring.DefaultBIP39Passphrase, BIP44HDPath) require.NoError(t, err) require.NotEmpty(t, bz) @@ -102,7 +101,7 @@ func TestDerivation(t *testing.T) { wallet, err := NewFromMnemonic(mnemonic) require.NoError(t, err) - path := MustParseDerivationPath(cosmosevmtypes.BIP44HDPath) + path := MustParseDerivationPath(BIP44HDPath) account, err := wallet.Derive(path, false) require.NoError(t, err) diff --git a/crypto/hd/benchmark_test.go b/crypto/hd/benchmark_test.go index 281af9df2..66a782700 100644 --- a/crypto/hd/benchmark_test.go +++ b/crypto/hd/benchmark_test.go @@ -3,8 +3,6 @@ package hd import ( "testing" - "github.com/cosmos/evm/types" - "github.com/cosmos/cosmos-sdk/crypto/keyring" ) @@ -12,14 +10,14 @@ func BenchmarkEthSecp256k1Algo_Derive(b *testing.B) { b.ReportAllocs() for i := 0; i < b.N; i++ { deriveFn := EthSecp256k1.Derive() - if _, err := deriveFn(mnemonic, keyring.DefaultBIP39Passphrase, types.BIP44HDPath); err != nil { + if _, err := deriveFn(mnemonic, keyring.DefaultBIP39Passphrase, BIP44HDPath); err != nil { b.Fatal(err) } } } func BenchmarkEthSecp256k1Algo_Generate(b *testing.B) { - bz, err := EthSecp256k1.Derive()(mnemonic, keyring.DefaultBIP39Passphrase, types.BIP44HDPath) + bz, err := EthSecp256k1.Derive()(mnemonic, keyring.DefaultBIP39Passphrase, BIP44HDPath) if err != nil { b.Fatal(err) } diff --git a/types/hdpath.go b/crypto/hd/hdpath.go similarity index 83% rename from types/hdpath.go rename to crypto/hd/hdpath.go index 7c55ddc1a..f53aff180 100644 --- a/types/hdpath.go +++ b/crypto/hd/hdpath.go @@ -1,4 +1,4 @@ -package types +package hd import ( ethaccounts "github.com/ethereum/go-ethereum/accounts" @@ -13,12 +13,12 @@ var ( ) type ( - HDPathIterator func() ethaccounts.DerivationPath + PathIterator func() ethaccounts.DerivationPath ) // NewHDPathIterator receives a base path as a string and a boolean for the desired iterator type and // returns a function that iterates over the base HD path, returning the string. -func NewHDPathIterator(basePath string, ledgerIter bool) (HDPathIterator, error) { +func NewHDPathIterator(basePath string, ledgerIter bool) (PathIterator, error) { hdPath, err := ethaccounts.ParseDerivationPath(basePath) if err != nil { return nil, err diff --git a/docs/migrations/v0.4.0_to_v0.5.0_UNRELEASED.md b/docs/migrations/v0.4.0_to_v0.5.0_UNRELEASED.md index 2aaf9d202..7bb1a791b 100644 --- a/docs/migrations/v0.4.0_to_v0.5.0_UNRELEASED.md +++ b/docs/migrations/v0.4.0_to_v0.5.0_UNRELEASED.md @@ -18,7 +18,62 @@ go mod tidy --- -## 2) App wiring in `app.go` +## 2) Fix `"github.com/cosmos/evm/types" imports` + +`v0.5.0` removes `github.com/cosmos/evm/types` and moves files to their folders, respective to function. +For a complete list of changes, refer to [this PR](https://github.com/cosmos/evm/pull/639). The +following list includes references within `evmd` that have been moved. + +### Summary of import changes in `evmd`: + +**Removed import:** +```diff +- cosmosevmtypes "github.com/cosmos/evm/types" +``` + +**Added imports:** +```diff ++ antetypes "github.com/cosmos/evm/ante/types" ++ evmaddress "github.com/cosmos/evm/encoding/address" ++ "github.com/cosmos/evm/utils" +``` + +### Detailed mapping of moved items: + +- **`AttoPowerReduction`** → moved to `"github.com/cosmos/evm/utils"` + ```diff + - sdk.DefaultPowerReduction = cosmosevmtypes.AttoPowerReduction + + sdk.DefaultPowerReduction = utils.AttoPowerReduction + ``` + +- **`HasDynamicFeeExtensionOption`** → moved to `"github.com/cosmos/evm/ante/types"` + ```diff + - ExtensionOptionChecker: cosmosevmtypes.HasDynamicFeeExtensionOption, + + ExtensionOptionChecker: antetypes.HasDynamicFeeExtensionOption, + ``` + +- **Address Codec functions** → new package `"github.com/cosmos/evm/encoding/address"` + + Use `evmaddress.NewEvmCodec()` for address codec initialization: + ```go + app.AccountKeeper = authkeeper.NewAccountKeeper( + appCodec, + runtime.NewKVStoreService(keys[authtypes.StoreKey]), + authtypes.ProtoBaseAccount, + evmconfig.GetMaccPerms(), + evmaddress.NewEvmCodec(sdk.GetConfig().GetBech32AccountAddrPrefix()), + sdk.GetConfig().GetBech32AccountAddrPrefix(), + authAddr, + ) + ``` + +- **`Bip44CoinType`, `BIP44HDPath`** → moved to `"github.com/cosmos/evm/crypto/hd"` + +- **`GenesisState`** → removed as a duplicate object can be found in the `evmd` folder and a testing version is in `"github.com/cosmos/evm/testutil"` + +--- + +## 3) App wiring in `app.go` ### Mempool diff --git a/encoding/codec/codec.go b/encoding/codec/codec.go index 4f43282c9..bd1b8dbb6 100644 --- a/encoding/codec/codec.go +++ b/encoding/codec/codec.go @@ -2,7 +2,7 @@ package codec import ( cryptocodec "github.com/cosmos/evm/crypto/codec" - "github.com/cosmos/evm/types" + "github.com/cosmos/evm/ethereum/eip712" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -21,5 +21,5 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { func RegisterInterfaces(interfaceRegistry codectypes.InterfaceRegistry) { std.RegisterInterfaces(interfaceRegistry) cryptocodec.RegisterInterfaces(interfaceRegistry) - types.RegisterInterfaces(interfaceRegistry) + eip712.RegisterInterfaces(interfaceRegistry) } diff --git a/types/codec.go b/ethereum/eip712/codec.go similarity index 88% rename from types/codec.go rename to ethereum/eip712/codec.go index d41102085..f8a6391f3 100644 --- a/types/codec.go +++ b/ethereum/eip712/codec.go @@ -1,6 +1,8 @@ -package types +package eip712 import ( + antetypes "github.com/cosmos/evm/ante/types" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdktypes "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx" @@ -23,6 +25,6 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { registry.RegisterImplementations( (*tx.TxExtensionOptionI)(nil), &ExtensionOptionsWeb3Tx{}, - &ExtensionOptionDynamicFeeTx{}, + &antetypes.ExtensionOptionDynamicFeeTx{}, ) } diff --git a/ethereum/eip712/preprocess.go b/ethereum/eip712/preprocess.go index 3e18b7f58..1c2593126 100644 --- a/ethereum/eip712/preprocess.go +++ b/ethereum/eip712/preprocess.go @@ -3,8 +3,6 @@ package eip712 import ( "fmt" - "github.com/cosmos/evm/types" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec/address" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -55,7 +53,7 @@ func PreprocessLedgerTx(evmChainID uint64, keyType cosmoskr.KeyType, txBuilder c } // Add ExtensionOptionsWeb3Tx extension with signature var option *codectypes.Any - option, err = codectypes.NewAnyWithValue(&types.ExtensionOptionsWeb3Tx{ + option, err = codectypes.NewAnyWithValue(&ExtensionOptionsWeb3Tx{ FeePayer: feePayerAddr, TypedDataChainID: evmChainID, FeePayerSig: sigBytes, diff --git a/ethereum/eip712/preprocess_test.go b/ethereum/eip712/preprocess_test.go index a93c1c5ee..d379e5d9f 100644 --- a/ethereum/eip712/preprocess_test.go +++ b/ethereum/eip712/preprocess_test.go @@ -13,7 +13,6 @@ import ( "github.com/cosmos/evm/ethereum/eip712" "github.com/cosmos/evm/testutil/constants" utiltx "github.com/cosmos/evm/testutil/tx" - "github.com/cosmos/evm/types" evmtypes "github.com/cosmos/evm/x/vm/types" "cosmossdk.io/math" @@ -81,7 +80,7 @@ func TestLedgerPreprocessing(t *testing.T) { require.True(t, ok) require.True(t, len(hasExtOptsTx.GetExtensionOptions()) == 1) - expectedExt := types.ExtensionOptionsWeb3Tx{ + expectedExt := eip712.ExtensionOptionsWeb3Tx{ TypedDataChainID: 9001, FeePayer: feePayerAddress, FeePayerSig: tc.expectedSignatureBytes, diff --git a/types/web3.pb.go b/ethereum/eip712/web3.pb.go similarity index 80% rename from types/web3.pb.go rename to ethereum/eip712/web3.pb.go index d48e6a634..1388fe9ee 100644 --- a/types/web3.pb.go +++ b/ethereum/eip712/web3.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/evm/types/v1/web3.proto +// source: cosmos/evm/eip712/v1/web3.proto -package types +package eip712 import ( fmt "fmt" @@ -41,7 +41,7 @@ func (m *ExtensionOptionsWeb3Tx) Reset() { *m = ExtensionOptionsWeb3Tx{} func (m *ExtensionOptionsWeb3Tx) String() string { return proto.CompactTextString(m) } func (*ExtensionOptionsWeb3Tx) ProtoMessage() {} func (*ExtensionOptionsWeb3Tx) Descriptor() ([]byte, []int) { - return fileDescriptor_8a9cacdd2daddb96, []int{0} + return fileDescriptor_1743a56ebcab8cbd, []int{0} } func (m *ExtensionOptionsWeb3Tx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -71,32 +71,33 @@ func (m *ExtensionOptionsWeb3Tx) XXX_DiscardUnknown() { var xxx_messageInfo_ExtensionOptionsWeb3Tx proto.InternalMessageInfo func init() { - proto.RegisterType((*ExtensionOptionsWeb3Tx)(nil), "cosmos.evm.types.v1.ExtensionOptionsWeb3Tx") + proto.RegisterType((*ExtensionOptionsWeb3Tx)(nil), "cosmos.evm.eip712.v1.ExtensionOptionsWeb3Tx") } -func init() { proto.RegisterFile("cosmos/evm/types/v1/web3.proto", fileDescriptor_8a9cacdd2daddb96) } +func init() { proto.RegisterFile("cosmos/evm/eip712/v1/web3.proto", fileDescriptor_1743a56ebcab8cbd) } -var fileDescriptor_8a9cacdd2daddb96 = []byte{ - // 300 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x2d, 0xcb, 0xd5, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2f, 0x33, 0xd4, - 0x2f, 0x4f, 0x4d, 0x32, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0xc8, 0xeb, 0xa5, - 0x96, 0xe5, 0xea, 0x81, 0xe5, 0xf5, 0xca, 0x0c, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xf2, - 0xfa, 0x20, 0x16, 0x44, 0xa9, 0xd2, 0x57, 0x46, 0x2e, 0x31, 0xd7, 0x8a, 0x92, 0xd4, 0xbc, 0xe2, - 0xcc, 0xfc, 0x3c, 0xff, 0x82, 0x92, 0xcc, 0xfc, 0xbc, 0xe2, 0xf0, 0xd4, 0x24, 0xe3, 0x90, 0x0a, - 0xa1, 0x44, 0x2e, 0x61, 0x90, 0xe6, 0x94, 0xf8, 0x94, 0xc4, 0x92, 0xc4, 0xf8, 0xe4, 0x8c, 0xc4, - 0xcc, 0xbc, 0xf8, 0xcc, 0x14, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x16, 0x27, 0xa3, 0x47, 0xf7, 0xe4, - 0x05, 0x42, 0x40, 0xd2, 0x2e, 0x89, 0x25, 0x89, 0xce, 0x20, 0x49, 0x4f, 0x97, 0x57, 0xf7, 0xe4, - 0xa5, 0x4a, 0xd0, 0xc4, 0x74, 0xf2, 0x73, 0x33, 0x4b, 0x52, 0x73, 0x0b, 0x4a, 0x2a, 0x83, 0x04, - 0xd0, 0xe4, 0x52, 0x84, 0x8c, 0xb9, 0x38, 0xd3, 0x52, 0x53, 0xe3, 0x0b, 0x12, 0x2b, 0x53, 0x8b, - 0x24, 0x98, 0x14, 0x18, 0x35, 0x38, 0x9d, 0xc4, 0x5e, 0xdd, 0x93, 0x17, 0x4a, 0x4b, 0x4d, 0x0d, - 0x00, 0x89, 0x21, 0x69, 0xe6, 0x80, 0x89, 0x09, 0xd9, 0x72, 0xf1, 0xc2, 0x35, 0xc5, 0x17, 0x67, - 0xa6, 0x4b, 0x30, 0x2b, 0x30, 0x6a, 0xf0, 0x38, 0x49, 0xbe, 0xba, 0x27, 0x2f, 0x0a, 0x53, 0x14, - 0x9c, 0x99, 0x8e, 0xa4, 0x97, 0x1b, 0x49, 0xd8, 0x8a, 0xa5, 0x63, 0x81, 0x3c, 0x83, 0x93, 0xe9, - 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, - 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x49, 0xa7, 0x67, 0x96, 0x64, 0x94, - 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa3, 0x87, 0x73, 0x12, 0x1b, 0x38, 0xd4, 0x8c, 0x01, 0x01, - 0x00, 0x00, 0xff, 0xff, 0x3e, 0x08, 0x6e, 0x8c, 0x82, 0x01, 0x00, 0x00, +var fileDescriptor_1743a56ebcab8cbd = []byte{ + // 311 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0x31, 0x4b, 0xc3, 0x40, + 0x1c, 0xc5, 0x73, 0x5a, 0xc4, 0x46, 0x85, 0x12, 0x6b, 0xa9, 0x1d, 0xee, 0x8a, 0x20, 0x74, 0x90, + 0x1c, 0x6d, 0x06, 0x41, 0x10, 0x21, 0xd6, 0xc1, 0x49, 0xd1, 0x82, 0xe0, 0x12, 0x2e, 0xcd, 0xbf, + 0xe9, 0x0d, 0x97, 0x3b, 0x9a, 0x6b, 0x6c, 0xbf, 0x81, 0xa3, 0x1f, 0xc1, 0x8f, 0xe3, 0xd8, 0xd1, + 0x29, 0x48, 0xba, 0x75, 0x77, 0x97, 0xb4, 0x44, 0x42, 0xb7, 0xc7, 0xef, 0xfd, 0xde, 0xf2, 0x4c, + 0x32, 0x94, 0xb1, 0x90, 0x31, 0x85, 0x44, 0x50, 0xe0, 0xea, 0xb2, 0xdb, 0xa3, 0x49, 0x97, 0xbe, + 0x81, 0xef, 0xd8, 0x6a, 0x22, 0xb5, 0xb4, 0xea, 0x1b, 0xc1, 0x86, 0x44, 0xd8, 0x1b, 0xc1, 0x4e, + 0xba, 0xad, 0x7a, 0x28, 0x43, 0xb9, 0x16, 0x68, 0x9e, 0x36, 0xee, 0xd9, 0x2f, 0x32, 0x1b, 0x77, + 0x33, 0x0d, 0x51, 0xcc, 0x65, 0xf4, 0xa0, 0x34, 0x97, 0x51, 0xfc, 0x02, 0xbe, 0x33, 0x98, 0x59, + 0xcc, 0x3c, 0xd6, 0x73, 0x05, 0x81, 0x17, 0x30, 0xcd, 0xbc, 0xe1, 0x98, 0xf1, 0xc8, 0xe3, 0x41, + 0x13, 0xb5, 0x51, 0xa7, 0xe2, 0xf6, 0xb2, 0x94, 0xd4, 0x06, 0x79, 0xdd, 0x67, 0x9a, 0xdd, 0xe6, + 0xe5, 0x7d, 0x7f, 0x95, 0x92, 0x96, 0xde, 0x62, 0x17, 0x52, 0x70, 0x0d, 0x42, 0xe9, 0xf9, 0x53, + 0x6d, 0xab, 0x0b, 0x2c, 0xc7, 0xac, 0x8e, 0x00, 0x3c, 0xc5, 0xe6, 0x30, 0x69, 0xee, 0xb4, 0x51, + 0xa7, 0xea, 0x36, 0x56, 0x29, 0xb1, 0x46, 0x00, 0x8f, 0x39, 0x2b, 0x8d, 0xf7, 0x0b, 0x66, 0x5d, + 0x9b, 0x47, 0xff, 0x23, 0x2f, 0xe6, 0x61, 0x73, 0xb7, 0x8d, 0x3a, 0x87, 0xee, 0xe9, 0x2a, 0x25, + 0x27, 0x85, 0xf4, 0xcc, 0xc3, 0xd2, 0xf6, 0xa0, 0x84, 0xaf, 0x2a, 0xef, 0x9f, 0xc4, 0x70, 0x6f, + 0xbe, 0x32, 0x8c, 0x16, 0x19, 0x46, 0x3f, 0x19, 0x46, 0x1f, 0x4b, 0x6c, 0x2c, 0x96, 0xd8, 0xf8, + 0x5e, 0x62, 0xe3, 0xf5, 0x3c, 0xe4, 0x7a, 0x3c, 0xf5, 0xed, 0xa1, 0x14, 0xb4, 0xfc, 0xb4, 0x1e, + 0xc3, 0x04, 0xa6, 0xc5, 0xe5, 0xfe, 0xde, 0xfa, 0x3f, 0xe7, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x81, + 0x8f, 0x55, 0x3f, 0x8e, 0x01, 0x00, 0x00, } func (m *ExtensionOptionsWeb3Tx) Marshal() (dAtA []byte, err error) { diff --git a/evmd/app.go b/evmd/app.go index 5da626ac6..d4c350f8a 100644 --- a/evmd/app.go +++ b/evmd/app.go @@ -4,9 +4,8 @@ import ( "encoding/json" "errors" "fmt" - "io" - precompiletypes "github.com/cosmos/evm/precompiles/types" + "io" "os" @@ -21,12 +20,14 @@ import ( dbm "github.com/cosmos/cosmos-db" evmante "github.com/cosmos/evm/ante" + antetypes "github.com/cosmos/evm/ante/types" evmconfig "github.com/cosmos/evm/config" evmosencoding "github.com/cosmos/evm/encoding" evmaddress "github.com/cosmos/evm/encoding/address" evmmempool "github.com/cosmos/evm/mempool" + precompiletypes "github.com/cosmos/evm/precompiles/types" srvflags "github.com/cosmos/evm/server/flags" - cosmosevmtypes "github.com/cosmos/evm/types" + "github.com/cosmos/evm/utils" "github.com/cosmos/evm/x/erc20" erc20keeper "github.com/cosmos/evm/x/erc20/keeper" erc20types "github.com/cosmos/evm/x/erc20/types" @@ -133,7 +134,7 @@ import ( func init() { // manually update the power reduction by replacing micro (u) -> atto (a) evmos - sdk.DefaultPowerReduction = cosmosevmtypes.AttoPowerReduction + sdk.DefaultPowerReduction = utils.AttoPowerReduction defaultNodeHome = evmconfig.MustGetDefaultNodeHome() } @@ -788,7 +789,7 @@ func (app *EVMD) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64) { Cdc: app.appCodec, AccountKeeper: app.AccountKeeper, BankKeeper: app.BankKeeper, - ExtensionOptionChecker: cosmosevmtypes.HasDynamicFeeExtensionOption, + ExtensionOptionChecker: antetypes.HasDynamicFeeExtensionOption, EvmKeeper: app.EVMKeeper, FeegrantKeeper: app.FeeGrantKeeper, IBCKeeper: app.IBCKeeper, @@ -851,7 +852,7 @@ func (app *EVMD) Configurator() module.Configurator { // InitChainer application update at chain initialization func (app *EVMD) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { - var genesisState cosmosevmtypes.GenesisState + var genesisState GenesisState if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { panic(err) } diff --git a/evmd/tests/ibc/ibc_middleware_test.go b/evmd/tests/ibc/ibc_middleware_test.go index f704a3704..a1acc0298 100644 --- a/evmd/tests/ibc/ibc_middleware_test.go +++ b/evmd/tests/ibc/ibc_middleware_test.go @@ -20,9 +20,9 @@ import ( "github.com/cosmos/evm/x/erc20" erc20Keeper "github.com/cosmos/evm/x/erc20/keeper" "github.com/cosmos/evm/x/erc20/types" - testutil2 "github.com/cosmos/evm/x/ibc/callbacks/testutil" - types2 "github.com/cosmos/evm/x/ibc/callbacks/types" - types3 "github.com/cosmos/evm/x/vm/types" + ibctestutil "github.com/cosmos/evm/x/ibc/callbacks/testutil" + callbacktypes "github.com/cosmos/evm/x/ibc/callbacks/types" + evmtypes "github.com/cosmos/evm/x/vm/types" ibctransfer "github.com/cosmos/ibc-go/v10/modules/apps/transfer" transfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" @@ -74,7 +74,7 @@ func TestMiddlewareTestSuite(t *testing.T) { func (suite *MiddlewareTestSuite) TestOnRecvPacketWithCallback() { var packet channeltypes.Packet - var contractData types3.CompiledContract + var contractData evmtypes.CompiledContract var contractAddr common.Address var voucherDenom string var path *evmibctesting.Path @@ -314,10 +314,10 @@ func (suite *MiddlewareTestSuite) TestOnRecvPacketWithCallback() { // Generate the isolated address for the sender sendAmt := ibctesting.DefaultCoinAmount - isolatedAddr := types2.GenerateIsolatedAddress(path.EndpointA.ChannelID, suite.chainB.SenderAccount.GetAddress().String()) + isolatedAddr := callbacktypes.GenerateIsolatedAddress(path.EndpointA.ChannelID, suite.chainB.SenderAccount.GetAddress().String()) // Get callback tester contract and deploy it - contractData, err = testutil2.LoadCounterWithCallbacksContract() + contractData, err = ibctestutil.LoadCounterWithCallbacksContract() suite.Require().NoError(err) deploymentData := testutiltypes.ContractDeploymentData{ @@ -639,12 +639,12 @@ func (suite *MiddlewareTestSuite) TestOnRecvPacketNativeErc20() { chainBNativeErc20Denom.Path(), recvAmt.String(), chainBAccount.String(), - types2.GenerateIsolatedAddress(path.EndpointA.ChannelID, suite.chainB.SenderAccount.GetAddress().String()).String(), + callbacktypes.GenerateIsolatedAddress(path.EndpointA.ChannelID, suite.chainB.SenderAccount.GetAddress().String()).String(), "", ) // get callback tester contract and deploy it - contractData, err := testutil2.LoadCounterWithCallbacksContract() + contractData, err := ibctestutil.LoadCounterWithCallbacksContract() suite.Require().NoError(err) deploymentData := testutiltypes.ContractDeploymentData{ @@ -741,7 +741,7 @@ func (suite *MiddlewareTestSuite) TestOnRecvPacketNativeErc20() { // the packet that failed conversion due to the minting restriction should instead remain as the bank token // and will be in the isolated address used to invoke the callback - trappedBal := evmApp.BankKeeper.GetBalance(evmCtx, types2.GenerateIsolatedAddress(path.EndpointA.ChannelID, + trappedBal := evmApp.BankKeeper.GetBalance(evmCtx, callbacktypes.GenerateIsolatedAddress(path.EndpointA.ChannelID, suite.chainB.SenderAccount.GetAddress().String()), nativeErc20.Denom) suite.Require().Equal(recvAmt.String(), trappedBal.Amount.String()) } @@ -751,7 +751,7 @@ func (suite *MiddlewareTestSuite) TestOnAcknowledgementPacketWithCallback() { var ( packet channeltypes.Packet ack []byte - contractData types3.CompiledContract + contractData evmtypes.CompiledContract contractAddr common.Address ) @@ -1008,7 +1008,7 @@ func (suite *MiddlewareTestSuite) TestOnAcknowledgementPacketWithCallback() { receiver := suite.chainB.SenderAccount.GetAddress() // Deploy callback contract on source chain (evmChainA) - contractData, err = testutil2.LoadCounterWithCallbacksContract() + contractData, err = ibctestutil.LoadCounterWithCallbacksContract() suite.Require().NoError(err) deploymentData := testutiltypes.ContractDeploymentData{ @@ -1624,7 +1624,7 @@ func (suite *MiddlewareTestSuite) TestOnTimeoutPacket() { func (suite *MiddlewareTestSuite) TestOnTimeoutPacketWithCallback() { var ( packet channeltypes.Packet - contractData types3.CompiledContract + contractData evmtypes.CompiledContract contractAddr common.Address ) @@ -1835,7 +1835,7 @@ func (suite *MiddlewareTestSuite) TestOnTimeoutPacketWithCallback() { receiver := suite.chainB.SenderAccount.GetAddress() // Deploy callback contract on source chain (evmChainA) - contractData, err = testutil2.LoadCounterWithCallbacksContract() + contractData, err = ibctestutil.LoadCounterWithCallbacksContract() suite.Require().NoError(err) deploymentData := testutiltypes.ContractDeploymentData{ diff --git a/evmd/tests/network/network.go b/evmd/tests/network/network.go index ffe926440..8a61762d9 100644 --- a/evmd/tests/network/network.go +++ b/evmd/tests/network/network.go @@ -6,7 +6,7 @@ import ( "encoding/json" "errors" "fmt" - evmconfig "github.com/cosmos/evm/config" + "github.com/cosmos/evm/utils" "net/http" "net/url" "os" @@ -27,11 +27,12 @@ import ( cmtclient "github.com/cometbft/cometbft/rpc/client" dbm "github.com/cosmos/cosmos-db" + evmconfig "github.com/cosmos/evm/config" "github.com/cosmos/evm/crypto/hd" "github.com/cosmos/evm/evmd" "github.com/cosmos/evm/server/config" + evmtestutil "github.com/cosmos/evm/testutil" testconstants "github.com/cosmos/evm/testutil/constants" - cosmosevmtypes "github.com/cosmos/evm/types" "cosmossdk.io/log" "cosmossdk.io/math" @@ -48,7 +49,7 @@ import ( "github.com/cosmos/cosmos-sdk/server/api" srvconfig "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/testutil" + sdktestutil "github.com/cosmos/cosmos-sdk/testutil" simutils "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -76,14 +77,14 @@ type Config struct { InterfaceRegistry codectypes.InterfaceRegistry TxConfig client.TxConfig AccountRetriever client.AccountRetriever - AppConstructor AppConstructor // the ABCI application constructor - GenesisState cosmosevmtypes.GenesisState // custom gensis state to provide - TimeoutCommit time.Duration // the consensus commitment timeout - AccountTokens math.Int // the amount of unique validator tokens (e.g. 1000node0) - StakingTokens math.Int // the amount of tokens each validator has available to stake - BondedTokens math.Int // the amount of tokens each validator stakes - NumValidators int // the total number of validators to create and bond - ChainID string // the network chain-id + AppConstructor AppConstructor // the ABCI application constructor + GenesisState evmtestutil.GenesisState // custom gensis state to provide + TimeoutCommit time.Duration // the consensus commitment timeout + AccountTokens math.Int // the amount of unique validator tokens (e.g. 1000node0) + StakingTokens math.Int // the amount of tokens each validator has available to stake + BondedTokens math.Int // the amount of tokens each validator stakes + NumValidators int // the total number of validators to create and bond + ChainID string // the network chain-id EVMChainID uint64 BondDenom string // the staking bond denomination MinGasPrices string // the minimum gas prices each validator will accept @@ -122,9 +123,9 @@ func DefaultConfig() Config { NumValidators: 4, BondDenom: testconstants.ExampleAttoDenom, MinGasPrices: fmt.Sprintf("0.000006%s", testconstants.ExampleAttoDenom), - AccountTokens: sdk.TokensFromConsensusPower(1000000000000000000, cosmosevmtypes.AttoPowerReduction), - StakingTokens: sdk.TokensFromConsensusPower(500000000000000000, cosmosevmtypes.AttoPowerReduction), - BondedTokens: sdk.TokensFromConsensusPower(100000000000000000, cosmosevmtypes.AttoPowerReduction), + AccountTokens: sdk.TokensFromConsensusPower(1000000000000000000, utils.AttoPowerReduction), + StakingTokens: sdk.TokensFromConsensusPower(500000000000000000, utils.AttoPowerReduction), + BondedTokens: sdk.TokensFromConsensusPower(100000000000000000, utils.AttoPowerReduction), PruningStrategy: pruningtypes.PruningOptionNothing, CleanupDir: true, SigningAlgo: string(hd.EthSecp256k1Type), @@ -386,7 +387,7 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) { return nil, err } - addr, secret, err := testutil.GenerateSaveCoinKey(kb, nodeDirName, "", true, algo) + addr, secret, err := sdktestutil.GenerateSaveCoinKey(kb, nodeDirName, "", true, algo) if err != nil { return nil, err } diff --git a/evmd/testutil/eth_setup.go b/evmd/testutil/eth_setup.go index 64b1f8dcb..52a7ed1ab 100644 --- a/evmd/testutil/eth_setup.go +++ b/evmd/testutil/eth_setup.go @@ -6,7 +6,7 @@ import ( cmtypes "github.com/cometbft/cometbft/types" "github.com/cosmos/evm" - cosmosevmtypes "github.com/cosmos/evm/types" + "github.com/cosmos/evm/testutil" "cosmossdk.io/math" @@ -48,7 +48,7 @@ var EthDefaultConsensusParams = &cmtypes.ConsensusParams{ // // TODO: are these different genesis functions necessary or can they all be refactored into one? // there's also other genesis state functions; some like app.DefaultGenesis() or others in test helpers only. -func NewTestGenesisState(app evm.EvmApp) cosmosevmtypes.GenesisState { +func NewTestGenesisState(app evm.EvmApp) testutil.GenesisState { privVal := mock.NewPV() pubKey, err := privVal.GetPubKey() if err != nil { @@ -70,10 +70,10 @@ func NewTestGenesisState(app evm.EvmApp) cosmosevmtypes.GenesisState { return genesisStateWithValSet(app.AppCodec(), genesisState, valSet, []authtypes.GenesisAccount{acc}, balance) } -func genesisStateWithValSet(codec codec.Codec, genesisState cosmosevmtypes.GenesisState, +func genesisStateWithValSet(codec codec.Codec, genesisState testutil.GenesisState, valSet *cmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance, -) cosmosevmtypes.GenesisState { +) testutil.GenesisState { // set genesis accounts authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) genesisState[authtypes.ModuleName] = codec.MustMarshalJSON(authGenesis) diff --git a/indexer/kv_indexer.go b/indexer/kv_indexer.go index ae8941acf..9bf85ccdc 100644 --- a/indexer/kv_indexer.go +++ b/indexer/kv_indexer.go @@ -10,7 +10,7 @@ import ( dbm "github.com/cosmos/cosmos-db" rpctypes "github.com/cosmos/evm/rpc/types" - cosmosevmtypes "github.com/cosmos/evm/types" + servertypes "github.com/cosmos/evm/server/types" evmtypes "github.com/cosmos/evm/x/vm/types" errorsmod "cosmossdk.io/errors" @@ -30,7 +30,7 @@ const ( TxIndexKeyLength = 1 + 8 + 8 ) -var _ cosmosevmtypes.EVMTxIndexer = &KVIndexer{} +var _ servertypes.EVMTxIndexer = &KVIndexer{} // KVIndexer implements a eth tx indexer on a KV db. type KVIndexer struct { @@ -84,7 +84,7 @@ func (kv *KVIndexer) IndexBlock(block *cmttypes.Block, txResults []*abci.ExecTxR ethMsg := msg.(*evmtypes.MsgEthereumTx) txHash := ethMsg.Hash() - txResult := cosmosevmtypes.TxResult{ + txResult := servertypes.TxResult{ Height: height, TxIndex: uint32(txIndex), //#nosec G115 -- int overflow is not a concern here MsgIndex: uint32(msgIndex), //#nosec G115 -- int overflow is not a concern here @@ -134,7 +134,7 @@ func (kv *KVIndexer) FirstIndexedBlock() (int64, error) { } // GetByTxHash finds eth tx by eth tx hash -func (kv *KVIndexer) GetByTxHash(hash common.Hash) (*cosmosevmtypes.TxResult, error) { +func (kv *KVIndexer) GetByTxHash(hash common.Hash) (*servertypes.TxResult, error) { bz, err := kv.db.Get(TxHashKey(hash)) if err != nil { return nil, errorsmod.Wrapf(err, "GetByTxHash %s", hash.Hex()) @@ -142,7 +142,7 @@ func (kv *KVIndexer) GetByTxHash(hash common.Hash) (*cosmosevmtypes.TxResult, er if len(bz) == 0 { return nil, fmt.Errorf("tx not found, hash: %s", hash.Hex()) } - var txKey cosmosevmtypes.TxResult + var txKey servertypes.TxResult if err := kv.clientCtx.Codec.Unmarshal(bz, &txKey); err != nil { return nil, errorsmod.Wrapf(err, "GetByTxHash %s", hash.Hex()) } @@ -150,7 +150,7 @@ func (kv *KVIndexer) GetByTxHash(hash common.Hash) (*cosmosevmtypes.TxResult, er } // GetByBlockAndIndex finds eth tx by block number and eth tx index -func (kv *KVIndexer) GetByBlockAndIndex(blockNumber int64, txIndex int32) (*cosmosevmtypes.TxResult, error) { +func (kv *KVIndexer) GetByBlockAndIndex(blockNumber int64, txIndex int32) (*servertypes.TxResult, error) { bz, err := kv.db.Get(TxIndexKey(blockNumber, txIndex)) if err != nil { return nil, errorsmod.Wrapf(err, "GetByBlockAndIndex %d %d", blockNumber, txIndex) @@ -213,7 +213,7 @@ func isEthTx(tx sdk.Tx) bool { } // saveTxResult index the txResult into the kv db batch -func saveTxResult(codec codec.Codec, batch dbm.Batch, txHash common.Hash, txResult *cosmosevmtypes.TxResult) error { +func saveTxResult(codec codec.Codec, batch dbm.Batch, txHash common.Hash, txResult *servertypes.TxResult) error { bz := codec.MustMarshal(txResult) if err := batch.Set(TxHashKey(txHash), bz); err != nil { return errorsmod.Wrap(err, "set tx-hash key") diff --git a/proto/cosmos/evm/types/v1/dynamic_fee.proto b/proto/cosmos/evm/ante/v1/dynamic_fee.proto similarity index 85% rename from proto/cosmos/evm/types/v1/dynamic_fee.proto rename to proto/cosmos/evm/ante/v1/dynamic_fee.proto index bca7e6498..8ed4eeb44 100644 --- a/proto/cosmos/evm/types/v1/dynamic_fee.proto +++ b/proto/cosmos/evm/ante/v1/dynamic_fee.proto @@ -1,11 +1,11 @@ syntax = "proto3"; -package cosmos.evm.types.v1; +package cosmos.evm.ante.v1; import "amino/amino.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/cosmos/evm/types"; +option go_package = "github.com/cosmos/evm/ante/types"; // ExtensionOptionDynamicFeeTx is an extension option that specifies the // maxPrioPrice for cosmos tx diff --git a/proto/cosmos/evm/types/v1/web3.proto b/proto/cosmos/evm/eip712/v1/web3.proto similarity index 91% rename from proto/cosmos/evm/types/v1/web3.proto rename to proto/cosmos/evm/eip712/v1/web3.proto index b52851dca..1636af468 100644 --- a/proto/cosmos/evm/types/v1/web3.proto +++ b/proto/cosmos/evm/eip712/v1/web3.proto @@ -1,10 +1,10 @@ syntax = "proto3"; -package cosmos.evm.types.v1; +package cosmos.evm.eip712.v1; import "gogoproto/gogo.proto"; -option go_package = "github.com/cosmos/evm/types"; +option go_package = "github.com/cosmos/evm/ethereum/eip712"; // ExtensionOptionsWeb3Tx is an extension option that specifies the typed chain // id, the fee payer as well as its signature data. diff --git a/proto/cosmos/evm/types/v1/indexer.proto b/proto/cosmos/evm/server/v1/indexer.proto similarity index 91% rename from proto/cosmos/evm/types/v1/indexer.proto rename to proto/cosmos/evm/server/v1/indexer.proto index aaee57961..cb6115be4 100644 --- a/proto/cosmos/evm/types/v1/indexer.proto +++ b/proto/cosmos/evm/server/v1/indexer.proto @@ -1,10 +1,10 @@ syntax = "proto3"; -package cosmos.evm.types.v1; +package cosmos.evm.server.v1; import "gogoproto/gogo.proto"; -option go_package = "github.com/cosmos/evm/types"; +option go_package = "github.com/cosmos/evm/server/types"; // TxResult is the value stored in eth tx indexer message TxResult { diff --git a/rpc/apis.go b/rpc/apis.go index e969f86e5..2ea7100ef 100644 --- a/rpc/apis.go +++ b/rpc/apis.go @@ -16,7 +16,7 @@ import ( "github.com/cosmos/evm/rpc/namespaces/ethereum/txpool" "github.com/cosmos/evm/rpc/namespaces/ethereum/web3" "github.com/cosmos/evm/rpc/stream" - "github.com/cosmos/evm/types" + servertypes "github.com/cosmos/evm/server/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" @@ -47,7 +47,7 @@ type APICreator = func( clientCtx client.Context, stream *stream.RPCStream, allowUnprotectedTxs bool, - indexer types.EVMTxIndexer, + indexer servertypes.EVMTxIndexer, mempool *evmmempool.ExperimentalEVMMempool, ) []rpc.API @@ -60,7 +60,7 @@ func init() { clientCtx client.Context, stream *stream.RPCStream, allowUnprotectedTxs bool, - indexer types.EVMTxIndexer, + indexer servertypes.EVMTxIndexer, mempool *evmmempool.ExperimentalEVMMempool, ) []rpc.API { evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer, mempool) @@ -79,7 +79,7 @@ func init() { }, } }, - Web3Namespace: func(*server.Context, client.Context, *stream.RPCStream, bool, types.EVMTxIndexer, *evmmempool.ExperimentalEVMMempool) []rpc.API { + Web3Namespace: func(*server.Context, client.Context, *stream.RPCStream, bool, servertypes.EVMTxIndexer, *evmmempool.ExperimentalEVMMempool) []rpc.API { return []rpc.API{ { Namespace: Web3Namespace, @@ -89,7 +89,7 @@ func init() { }, } }, - NetNamespace: func(ctx *server.Context, clientCtx client.Context, _ *stream.RPCStream, _ bool, _ types.EVMTxIndexer, _ *evmmempool.ExperimentalEVMMempool) []rpc.API { + NetNamespace: func(ctx *server.Context, clientCtx client.Context, _ *stream.RPCStream, _ bool, _ servertypes.EVMTxIndexer, _ *evmmempool.ExperimentalEVMMempool) []rpc.API { return []rpc.API{ { Namespace: NetNamespace, @@ -103,7 +103,7 @@ func init() { clientCtx client.Context, _ *stream.RPCStream, allowUnprotectedTxs bool, - indexer types.EVMTxIndexer, + indexer servertypes.EVMTxIndexer, mempool *evmmempool.ExperimentalEVMMempool, ) []rpc.API { evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer, mempool) @@ -120,7 +120,7 @@ func init() { clientCtx client.Context, _ *stream.RPCStream, allowUnprotectedTxs bool, - indexer types.EVMTxIndexer, + indexer servertypes.EVMTxIndexer, mempool *evmmempool.ExperimentalEVMMempool, ) []rpc.API { evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer, mempool) @@ -137,7 +137,7 @@ func init() { clientCtx client.Context, _ *stream.RPCStream, allowUnprotectedTxs bool, - indexer types.EVMTxIndexer, + indexer servertypes.EVMTxIndexer, mempool *evmmempool.ExperimentalEVMMempool, ) []rpc.API { evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer, mempool) @@ -154,7 +154,7 @@ func init() { clientCtx client.Context, _ *stream.RPCStream, allowUnprotectedTxs bool, - indexer types.EVMTxIndexer, + indexer servertypes.EVMTxIndexer, mempool *evmmempool.ExperimentalEVMMempool, ) []rpc.API { evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer, mempool) @@ -175,7 +175,7 @@ func GetRPCAPIs(ctx *server.Context, clientCtx client.Context, stream *stream.RPCStream, allowUnprotectedTxs bool, - indexer types.EVMTxIndexer, + indexer servertypes.EVMTxIndexer, selectedAPIs []string, mempool *evmmempool.ExperimentalEVMMempool, ) []rpc.API { diff --git a/rpc/backend/backend.go b/rpc/backend/backend.go index 99266a853..4a62e5067 100644 --- a/rpc/backend/backend.go +++ b/rpc/backend/backend.go @@ -19,9 +19,9 @@ import ( tmrpctypes "github.com/cometbft/cometbft/rpc/core/types" evmmempool "github.com/cosmos/evm/mempool" - rpctypes "github.com/cosmos/evm/rpc/types" + "github.com/cosmos/evm/rpc/types" "github.com/cosmos/evm/server/config" - cosmosevmtypes "github.com/cosmos/evm/types" + servertypes "github.com/cosmos/evm/server/types" evmtypes "github.com/cosmos/evm/x/vm/types" "cosmossdk.io/log" @@ -64,31 +64,31 @@ type EVMBackend interface { // Blocks Info BlockNumber() (hexutil.Uint64, error) - GetHeaderByNumber(blockNum rpctypes.BlockNumber) (map[string]interface{}, error) + GetHeaderByNumber(blockNum types.BlockNumber) (map[string]interface{}, error) GetHeaderByHash(hash common.Hash) (map[string]interface{}, error) - GetBlockByNumber(blockNum rpctypes.BlockNumber, fullTx bool) (map[string]interface{}, error) + GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) GetBlockTransactionCountByHash(hash common.Hash) *hexutil.Uint - GetBlockTransactionCountByNumber(blockNum rpctypes.BlockNumber) *hexutil.Uint - CometBlockByNumber(blockNum rpctypes.BlockNumber) (*tmrpctypes.ResultBlock, error) + GetBlockTransactionCountByNumber(blockNum types.BlockNumber) *hexutil.Uint + CometBlockByNumber(blockNum types.BlockNumber) (*tmrpctypes.ResultBlock, error) CometBlockByHash(blockHash common.Hash) (*tmrpctypes.ResultBlock, error) - BlockNumberFromComet(blockNrOrHash rpctypes.BlockNumberOrHash) (rpctypes.BlockNumber, error) + BlockNumberFromComet(blockNrOrHash types.BlockNumberOrHash) (types.BlockNumber, error) BlockNumberFromCometByHash(blockHash common.Hash) (*big.Int, error) EthMsgsFromCometBlock(block *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) []*evmtypes.MsgEthereumTx BlockBloomFromCometBlock(blockRes *tmrpctypes.ResultBlockResults) (ethtypes.Bloom, error) - HeaderByNumber(blockNum rpctypes.BlockNumber) (*ethtypes.Header, error) + HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Header, error) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error) RPCBlockFromCometBlock(resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults, fullTx bool) (map[string]interface{}, error) - EthBlockByNumber(blockNum rpctypes.BlockNumber) (*ethtypes.Block, error) + EthBlockByNumber(blockNum types.BlockNumber) (*ethtypes.Block, error) EthBlockFromCometBlock(resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) (*ethtypes.Block, error) - GetBlockReceipts(blockNrOrHash rpctypes.BlockNumberOrHash) ([]map[string]interface{}, error) + GetBlockReceipts(blockNrOrHash types.BlockNumberOrHash) ([]map[string]interface{}, error) // Account Info - GetCode(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Bytes, error) - GetBalance(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (*hexutil.Big, error) - GetStorageAt(address common.Address, key string, blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Bytes, error) - GetProof(address common.Address, storageKeys []string, blockNrOrHash rpctypes.BlockNumberOrHash) (*rpctypes.AccountResult, error) - GetTransactionCount(address common.Address, blockNum rpctypes.BlockNumber) (*hexutil.Uint64, error) + GetCode(address common.Address, blockNrOrHash types.BlockNumberOrHash) (hexutil.Bytes, error) + GetBalance(address common.Address, blockNrOrHash types.BlockNumberOrHash) (*hexutil.Big, error) + GetStorageAt(address common.Address, key string, blockNrOrHash types.BlockNumberOrHash) (hexutil.Bytes, error) + GetProof(address common.Address, storageKeys []string, blockNrOrHash types.BlockNumberOrHash) (*types.AccountResult, error) + GetTransactionCount(address common.Address, blockNum types.BlockNumber) (*hexutil.Uint64, error) // Chain Info ChainID() (*hexutil.Big, error) @@ -98,26 +98,26 @@ type EVMBackend interface { CurrentHeader() (*ethtypes.Header, error) PendingTransactions() ([]*sdk.Tx, error) GetCoinbase() (sdk.AccAddress, error) - FeeHistory(blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*rpctypes.FeeHistoryResult, error) + FeeHistory(blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*types.FeeHistoryResult, error) SuggestGasTipCap(baseFee *big.Int) (*big.Int, error) // Tx Info - GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransaction, error) - GetTxByEthHash(txHash common.Hash) (*cosmosevmtypes.TxResult, error) - GetTxByTxIndex(height int64, txIndex uint) (*cosmosevmtypes.TxResult, error) - GetTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) + GetTransactionByHash(txHash common.Hash) (*types.RPCTransaction, error) + GetTxByEthHash(txHash common.Hash) (*servertypes.TxResult, error) + GetTxByTxIndex(height int64, txIndex uint) (*servertypes.TxResult, error) + GetTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock, idx hexutil.Uint) (*types.RPCTransaction, error) GetTransactionReceipt(hash common.Hash) (map[string]interface{}, error) GetTransactionLogs(hash common.Hash) ([]*ethtypes.Log, error) - GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) - GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockNumber, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) - CreateAccessList(args evmtypes.TransactionArgs, blockNrOrHash rpctypes.BlockNumberOrHash, overrides *json.RawMessage) (*rpctypes.AccessListResult, error) + GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*types.RPCTransaction, error) + GetTransactionByBlockNumberAndIndex(blockNum types.BlockNumber, idx hexutil.Uint) (*types.RPCTransaction, error) + CreateAccessList(args evmtypes.TransactionArgs, blockNrOrHash types.BlockNumberOrHash, overrides *json.RawMessage) (*types.AccessListResult, error) // Send Transaction Resend(args evmtypes.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error) SendRawTransaction(data hexutil.Bytes) (common.Hash, error) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error) - EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *rpctypes.BlockNumber) (hexutil.Uint64, error) - DoCall(args evmtypes.TransactionArgs, blockNr rpctypes.BlockNumber, overrides *json.RawMessage) (*evmtypes.MsgEthereumTxResponse, error) + EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *types.BlockNumber) (hexutil.Uint64, error) + DoCall(args evmtypes.TransactionArgs, blockNr types.BlockNumber, overrides *json.RawMessage) (*evmtypes.MsgEthereumTxResponse, error) GasPrice() (*hexutil.Big, error) // Filter API @@ -126,14 +126,14 @@ type EVMBackend interface { BloomStatus() (uint64, uint64) // TxPool API - Content() (map[string]map[string]map[string]*rpctypes.RPCTransaction, error) - ContentFrom(address common.Address) (map[string]map[string]*rpctypes.RPCTransaction, error) + Content() (map[string]map[string]map[string]*types.RPCTransaction, error) + ContentFrom(address common.Address) (map[string]map[string]*types.RPCTransaction, error) Inspect() (map[string]map[string]map[string]string, error) Status() (map[string]hexutil.Uint, error) // Tracing - TraceTransaction(hash common.Hash, config *rpctypes.TraceConfig) (interface{}, error) - TraceBlock(height rpctypes.BlockNumber, config *rpctypes.TraceConfig, block *tmrpctypes.ResultBlock) ([]*evmtypes.TxTraceResult, error) + TraceTransaction(hash common.Hash, config *types.TraceConfig) (interface{}, error) + TraceBlock(height types.BlockNumber, config *types.TraceConfig, block *tmrpctypes.ResultBlock) ([]*evmtypes.TxTraceResult, error) } var _ BackendI = (*Backend)(nil) @@ -156,7 +156,7 @@ type ProcessBlocker func( ethBlock *map[string]interface{}, rewardPercentiles []float64, tendermintBlockResult *tmrpctypes.ResultBlockResults, - targetOneFeeHistory *rpctypes.OneFeeHistory, + targetOneFeeHistory *types.OneFeeHistory, ) error // Backend implements the BackendI interface @@ -164,12 +164,12 @@ type Backend struct { Ctx context.Context ClientCtx client.Context RPCClient tmrpcclient.SignClient - QueryClient *rpctypes.QueryClient // gRPC query client + QueryClient *types.QueryClient // gRPC query client Logger log.Logger EvmChainID *big.Int Cfg config.Config AllowUnprotectedTxs bool - Indexer cosmosevmtypes.EVMTxIndexer + Indexer servertypes.EVMTxIndexer ProcessBlocker ProcessBlocker Mempool *evmmempool.ExperimentalEVMMempool } @@ -184,7 +184,7 @@ func NewBackend( logger log.Logger, clientCtx client.Context, allowUnprotectedTxs bool, - indexer cosmosevmtypes.EVMTxIndexer, + indexer servertypes.EVMTxIndexer, mempool *evmmempool.ExperimentalEVMMempool, ) *Backend { appConf, err := config.GetConfig(ctx.Viper) @@ -201,7 +201,7 @@ func NewBackend( Ctx: context.Background(), ClientCtx: clientCtx, RPCClient: rpcClient, - QueryClient: rpctypes.NewQueryClient(clientCtx), + QueryClient: types.NewQueryClient(clientCtx), Logger: logger.With("module", "backend"), EvmChainID: big.NewInt(int64(appConf.EVM.EVMChainID)), //nolint:gosec // G115 // won't exceed uint64 Cfg: appConf, diff --git a/rpc/backend/blocks.go b/rpc/backend/blocks.go index f367e599f..e3b8aa105 100644 --- a/rpc/backend/blocks.go +++ b/rpc/backend/blocks.go @@ -12,7 +12,7 @@ import ( cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" - rpctypes "github.com/cosmos/evm/rpc/types" + "github.com/cosmos/evm/rpc/types" evmtypes "github.com/cosmos/evm/x/vm/types" grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" @@ -46,7 +46,7 @@ func (b *Backend) BlockNumber() (hexutil.Uint64, error) { // GetBlockByNumber returns the JSON-RPC compatible Ethereum block identified by // block number. Depending on fullTx it either returns the full transaction // objects or if false only the hashes of the transactions. -func (b *Backend) GetBlockByNumber(blockNum rpctypes.BlockNumber, fullTx bool) (map[string]interface{}, error) { +func (b *Backend) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) { resBlock, err := b.CometBlockByNumber(blockNum) if err != nil { return nil, nil @@ -119,7 +119,7 @@ func (b *Backend) GetBlockTransactionCountByHash(hash common.Hash) *hexutil.Uint // GetBlockTransactionCountByNumber returns the number of Ethereum transactions // in the block identified by number. -func (b *Backend) GetBlockTransactionCountByNumber(blockNum rpctypes.BlockNumber) *hexutil.Uint { +func (b *Backend) GetBlockTransactionCountByNumber(blockNum types.BlockNumber) *hexutil.Uint { block, err := b.CometBlockByNumber(blockNum) if err != nil { b.Logger.Debug("block not found", "height", blockNum.Int64(), "error", err.Error()) @@ -148,7 +148,7 @@ func (b *Backend) getBlockTransactionCount(block *cmtrpctypes.ResultBlock) *hexu } // EthBlockByNumber returns the Ethereum Block identified by number. -func (b *Backend) EthBlockByNumber(blockNum rpctypes.BlockNumber) (*ethtypes.Block, error) { +func (b *Backend) EthBlockByNumber(blockNum types.BlockNumber) (*ethtypes.Block, error) { resBlock, err := b.CometBlockByNumber(blockNum) if err != nil { return nil, err @@ -174,7 +174,7 @@ func (b *Backend) EthBlockByNumber(blockNum rpctypes.BlockNumber) (*ethtypes.Blo // GetBlockReceipts returns the receipts for a given block number or hash. func (b *Backend) GetBlockReceipts( - blockNrOrHash rpctypes.BlockNumberOrHash, + blockNrOrHash types.BlockNumberOrHash, ) ([]map[string]interface{}, error) { blockNum, err := b.BlockNumberFromComet(blockNrOrHash) if err != nil { @@ -216,11 +216,10 @@ func (b *Backend) GetBlockReceipts( return nil, fmt.Errorf("failed to get sender: %w", err) } - result[i], err = rpctypes.RPCMarshalReceipt(receipts[i], tx, from) + result[i], err = types.RPCMarshalReceipt(receipts[i], tx, from) if err != nil { return nil, fmt.Errorf("failed to marshal receipt") } } - return result, nil } diff --git a/rpc/backend/comet.go b/rpc/backend/comet.go index 6efaf9480..3b295b08b 100644 --- a/rpc/backend/comet.go +++ b/rpc/backend/comet.go @@ -9,7 +9,7 @@ import ( cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" rpctypes "github.com/cosmos/evm/rpc/types" - cosmosevmtypes "github.com/cosmos/evm/types" + "github.com/cosmos/evm/utils" ) // CometBlockByNumber returns a CometBFT-formatted block for a given @@ -95,7 +95,7 @@ func (b *Backend) getHeightByBlockNum(blockNum rpctypes.BlockNumber) (int64, err if err != nil { return 0, err } - height, err = cosmosevmtypes.SafeHexToInt64(n) + height, err = utils.SafeHexToInt64(n) if err != nil { return 0, err } diff --git a/rpc/backend/tx_info.go b/rpc/backend/tx_info.go index a929fec89..fbbd13a1e 100644 --- a/rpc/backend/tx_info.go +++ b/rpc/backend/tx_info.go @@ -20,7 +20,8 @@ import ( "github.com/cosmos/evm/mempool/txpool" rpctypes "github.com/cosmos/evm/rpc/types" - "github.com/cosmos/evm/types" + servertypes "github.com/cosmos/evm/server/types" + "github.com/cosmos/evm/utils" evmtypes "github.com/cosmos/evm/x/vm/types" errorsmod "cosmossdk.io/errors" @@ -131,7 +132,7 @@ func (b *Backend) GetTransactionByHashPending(txHash common.Hash) (*rpctypes.RPC } // GetGasUsed returns gasUsed from transaction -func (b *Backend) GetGasUsed(res *types.TxResult, price *big.Int, gas uint64) uint64 { +func (b *Backend) GetGasUsed(res *servertypes.TxResult, price *big.Int, gas uint64) uint64 { return res.GasUsed } @@ -144,7 +145,7 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{ maxRetries := 10 baseDelay := 50 * time.Millisecond - var res *types.TxResult + var res *servertypes.TxResult var err error for attempt := 0; attempt <= maxRetries; attempt++ { @@ -232,7 +233,7 @@ func (b *Backend) GetTransactionLogs(hash common.Hash) ([]*ethtypes.Log, error) b.Logger.Debug("block result not found", "number", res.Height, "error", err.Error()) return nil, nil } - height, err := types.SafeUint64(resBlockResult.Height) + height, err := utils.SafeUint64(resBlockResult.Height) if err != nil { return nil, err } @@ -293,7 +294,7 @@ func (b *Backend) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockNum // GetTxByEthHash uses `/tx_query` to find transaction by ethereum tx hash // TODO: Don't need to convert once hashing is fixed on CometBFT // https://github.com/cometbft/cometbft/issues/6539 -func (b *Backend) GetTxByEthHash(hash common.Hash) (*types.TxResult, error) { +func (b *Backend) GetTxByEthHash(hash common.Hash) (*servertypes.TxResult, error) { if b.Indexer != nil { return b.Indexer.GetByTxHash(hash) } @@ -310,7 +311,7 @@ func (b *Backend) GetTxByEthHash(hash common.Hash) (*types.TxResult, error) { } // GetTxByTxIndex uses `/tx_query` to find transaction by tx index of valid ethereum txs -func (b *Backend) GetTxByTxIndex(height int64, index uint) (*types.TxResult, error) { +func (b *Backend) GetTxByTxIndex(height int64, index uint) (*servertypes.TxResult, error) { int32Index := int32(index) //#nosec G115 -- checked for int overflow already if b.Indexer != nil { return b.Indexer.GetByBlockAndIndex(height, int32Index) @@ -331,7 +332,7 @@ func (b *Backend) GetTxByTxIndex(height int64, index uint) (*types.TxResult, err } // QueryCometTxIndexer query tx in CometBFT tx indexer -func (b *Backend) QueryCometTxIndexer(query string, txGetter func(*rpctypes.ParsedTxs) *rpctypes.ParsedTx) (*types.TxResult, error) { +func (b *Backend) QueryCometTxIndexer(query string, txGetter func(*rpctypes.ParsedTxs) *rpctypes.ParsedTx) (*servertypes.TxResult, error) { resTxs, err := b.ClientCtx.Client.TxSearch(b.Ctx, query, false, nil, nil, "") if err != nil { return nil, err diff --git a/rpc/backend/utils.go b/rpc/backend/utils.go index 6fbfd3922..d236e4cd0 100644 --- a/rpc/backend/utils.go +++ b/rpc/backend/utils.go @@ -18,7 +18,6 @@ import ( cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" "github.com/cosmos/evm/rpc/types" - cosmosevmtypes "github.com/cosmos/evm/types" "github.com/cosmos/evm/utils" feemarkettypes "github.com/cosmos/evm/x/feemarket/types" evmtypes "github.com/cosmos/evm/x/vm/types" @@ -171,7 +170,7 @@ func (b *Backend) ProcessBlock( if err != nil { return err } - nextBaseFee, err := utils.CalcBaseFee(cfg, &header, params.Params) + nextBaseFee, err := types.CalcBaseFee(cfg, &header, params.Params) if err != nil { return err } @@ -260,7 +259,7 @@ func ShouldIgnoreGasUsed(res *abci.ExecTxResult) bool { // GetLogsFromBlockResults returns the list of event logs from the CometBFT block result response func GetLogsFromBlockResults(blockRes *cmtrpctypes.ResultBlockResults) ([][]*ethtypes.Log, error) { - height, err := cosmosevmtypes.SafeUint64(blockRes.Height) + height, err := utils.SafeUint64(blockRes.Height) if err != nil { return nil, err } diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index cc580230d..a7af7594d 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -13,7 +13,6 @@ import ( "github.com/cosmos/evm/rpc/backend" rpctypes "github.com/cosmos/evm/rpc/types" - "github.com/cosmos/evm/types" evmtypes "github.com/cosmos/evm/x/vm/types" "cosmossdk.io/log" @@ -313,7 +312,7 @@ func (e *PublicAPI) Call( // ProtocolVersion returns the supported Ethereum protocol version. func (e *PublicAPI) ProtocolVersion() hexutil.Uint { e.logger.Debug("eth_protocolVersion") - return hexutil.Uint(types.ProtocolVersion) + return hexutil.Uint(rpctypes.ProtocolVersion) } // GasPrice returns the current gas price based on Cosmos EVM's gas price oracle. diff --git a/rpc/namespaces/ethereum/personal/api.go b/rpc/namespaces/ethereum/personal/api.go index 7fc22c350..51a5b73c6 100644 --- a/rpc/namespaces/ethereum/personal/api.go +++ b/rpc/namespaces/ethereum/personal/api.go @@ -13,7 +13,6 @@ import ( "github.com/cosmos/evm/crypto/hd" "github.com/cosmos/evm/rpc/backend" - "github.com/cosmos/evm/types" evmtypes "github.com/cosmos/evm/x/vm/types" "cosmossdk.io/log" @@ -26,7 +25,7 @@ import ( type PrivateAccountAPI struct { backend backend.EVMBackend logger log.Logger - hdPathIter types.HDPathIterator + hdPathIter hd.PathIterator } // NewAPI creates an instance of the public Personal Eth API. @@ -37,7 +36,7 @@ func NewAPI( cfg := sdk.GetConfig() basePath := cfg.GetFullBIP44Path() - iterator, err := types.NewHDPathIterator(basePath, true) + iterator, err := hd.NewHDPathIterator(basePath, true) if err != nil { panic(err) } diff --git a/rpc/stream/rpc.go b/rpc/stream/rpc.go index d7f724e58..49b8b611b 100644 --- a/rpc/stream/rpc.go +++ b/rpc/stream/rpc.go @@ -14,7 +14,7 @@ import ( cmttypes "github.com/cometbft/cometbft/types" "github.com/cosmos/evm/rpc/types" - cosmosevmtypes "github.com/cosmos/evm/types" + "github.com/cosmos/evm/utils" evmtypes "github.com/cosmos/evm/x/vm/types" "cosmossdk.io/log" @@ -184,7 +184,7 @@ func (s *RPCStream) start( s.logger.Error("event data type mismatch", "type", fmt.Sprintf("%T", ev.Data)) continue } - height, err := cosmosevmtypes.SafeUint64(dataTx.Height) + height, err := utils.SafeUint64(dataTx.Height) if err != nil { continue } diff --git a/rpc/types/block.go b/rpc/types/block.go index c0d686c52..3f34bf393 100644 --- a/rpc/types/block.go +++ b/rpc/types/block.go @@ -14,7 +14,7 @@ import ( "github.com/spf13/cast" "google.golang.org/grpc/metadata" - "github.com/cosmos/evm/types" + "github.com/cosmos/evm/utils" grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" ) @@ -184,7 +184,7 @@ func (bnh *BlockNumberOrHash) decodeFromString(input string) error { return err } - bnInt, err := types.SafeInt64(blockNumber) + bnInt, err := utils.SafeInt64(blockNumber) if err != nil { return err } diff --git a/rpc/types/events.go b/rpc/types/events.go index 749a50bd3..34761d811 100644 --- a/rpc/types/events.go +++ b/rpc/types/events.go @@ -9,7 +9,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" - "github.com/cosmos/evm/types" + "github.com/cosmos/evm/server/types" evmtypes "github.com/cosmos/evm/x/vm/types" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/types/protocol.go b/rpc/types/protocol.go similarity index 100% rename from types/protocol.go rename to rpc/types/protocol.go diff --git a/rpc/types/utils.go b/rpc/types/utils.go index c99df86ad..aa7494073 100644 --- a/rpc/types/utils.go +++ b/rpc/types/utils.go @@ -11,11 +11,13 @@ import ( "github.com/ethereum/go-ethereum/consensus/misc/eip1559" ethtypes "github.com/ethereum/go-ethereum/core/types" ethparams "github.com/ethereum/go-ethereum/params" + "github.com/pkg/errors" abci "github.com/cometbft/cometbft/abci/types" cmtrpcclient "github.com/cometbft/cometbft/rpc/client" cmttypes "github.com/cometbft/cometbft/types" + feemarkettypes "github.com/cosmos/evm/x/feemarket/types" evmtypes "github.com/cosmos/evm/x/vm/types" errorsmod "cosmossdk.io/errors" @@ -353,6 +355,25 @@ func TxSucessOrExpectedFailure(res *abci.ExecTxResult) bool { return res.Code == 0 || TxExceedBlockGasLimit(res) || TxStateDBCommitError(res) } +// CalcBaseFee calculates the basefee of the header. +func CalcBaseFee(config *ethparams.ChainConfig, parent *ethtypes.Header, p feemarkettypes.Params) (*big.Int, error) { + // If the current block is the first EIP-1559 block, return the InitialBaseFee. + if !config.IsLondon(parent.Number) { + return new(big.Int).SetUint64(ethparams.InitialBaseFee), nil + } + if p.ElasticityMultiplier == 0 { + return nil, errors.New("ElasticityMultiplier cannot be 0 as it's checked in the params validation") + } + parentGasTarget := parent.GasLimit / uint64(p.ElasticityMultiplier) + + factor := evmtypes.GetEVMCoinDecimals().ConversionFactor() + minGasPrice := p.MinGasPrice.Mul(sdkmath.LegacyNewDecFromInt(factor)) + return feemarkettypes.CalcGasBaseFee( + parent.GasUsed, parentGasTarget, uint64(p.BaseFeeChangeDenominator), + sdkmath.LegacyNewDecFromBigInt(parent.BaseFee), sdkmath.LegacyOneDec(), minGasPrice, + ).TruncateInt().BigInt(), nil +} + // RPCMarshalHeader converts the given header to the RPC output . // // This method refers to internal package method of go-ethereum v1.16.3 - RPCMarshalHeader diff --git a/server/indexer_service.go b/server/indexer_service.go index 6cfad6f56..ecd797e70 100644 --- a/server/indexer_service.go +++ b/server/indexer_service.go @@ -9,7 +9,7 @@ import ( coretypes "github.com/cometbft/cometbft/rpc/core/types" "github.com/cometbft/cometbft/types" - cosmosevmtypes "github.com/cosmos/evm/types" + servertypes "github.com/cosmos/evm/server/types" ) const ( @@ -22,13 +22,13 @@ const ( type EVMIndexerService struct { service.BaseService - txIdxr cosmosevmtypes.EVMTxIndexer + txIdxr servertypes.EVMTxIndexer client rpcclient.Client } // NewEVMIndexerService returns a new service instance. func NewEVMIndexerService( - txIdxr cosmosevmtypes.EVMTxIndexer, + txIdxr servertypes.EVMTxIndexer, client rpcclient.Client, ) *EVMIndexerService { is := &EVMIndexerService{txIdxr: txIdxr, client: client} diff --git a/server/json_rpc.go b/server/json_rpc.go index 802e986e0..c490d342d 100644 --- a/server/json_rpc.go +++ b/server/json_rpc.go @@ -19,7 +19,7 @@ import ( "github.com/cosmos/evm/rpc" "github.com/cosmos/evm/rpc/stream" serverconfig "github.com/cosmos/evm/server/config" - cosmosevmtypes "github.com/cosmos/evm/types" + "github.com/cosmos/evm/server/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" @@ -38,7 +38,7 @@ func StartJSONRPC( clientCtx client.Context, g *errgroup.Group, config *serverconfig.Config, - indexer cosmosevmtypes.EVMTxIndexer, + indexer types.EVMTxIndexer, app AppWithPendingTxStream, mempool *evmmempool.ExperimentalEVMMempool, ) (*http.Server, error) { diff --git a/server/start.go b/server/start.go index 9c0d17763..edbd9a8b1 100644 --- a/server/start.go +++ b/server/start.go @@ -33,7 +33,7 @@ import ( ethdebug "github.com/cosmos/evm/rpc/namespaces/ethereum/debug" cosmosevmserverconfig "github.com/cosmos/evm/server/config" srvflags "github.com/cosmos/evm/server/flags" - cosmosevmtypes "github.com/cosmos/evm/types" + servertypes "github.com/cosmos/evm/server/types" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" @@ -467,7 +467,7 @@ func startInProcess(svrCtx *server.Context, clientCtx client.Context, opts Start ethmetricsexp.Setup(config.JSONRPC.MetricsAddress) } - var idxer cosmosevmtypes.EVMTxIndexer + var idxer servertypes.EVMTxIndexer if config.JSONRPC.EnableIndexer { idxDB, err := OpenIndexerDB(home, server.GetAppDBBackend(svrCtx.Viper)) if err != nil { diff --git a/types/indexer.go b/server/types/indexer.go similarity index 100% rename from types/indexer.go rename to server/types/indexer.go diff --git a/types/indexer.pb.go b/server/types/indexer.pb.go similarity index 83% rename from types/indexer.pb.go rename to server/types/indexer.pb.go index 93ccbc8a5..b8f42d0b2 100644 --- a/types/indexer.pb.go +++ b/server/types/indexer.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/evm/types/v1/indexer.proto +// source: cosmos/evm/server/v1/indexer.proto package types @@ -48,7 +48,7 @@ func (m *TxResult) Reset() { *m = TxResult{} } func (m *TxResult) String() string { return proto.CompactTextString(m) } func (*TxResult) ProtoMessage() {} func (*TxResult) Descriptor() ([]byte, []int) { - return fileDescriptor_b69626dfe9e578b6, []int{0} + return fileDescriptor_4195a4d4cee0e673, []int{0} } func (m *TxResult) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -78,32 +78,34 @@ func (m *TxResult) XXX_DiscardUnknown() { var xxx_messageInfo_TxResult proto.InternalMessageInfo func init() { - proto.RegisterType((*TxResult)(nil), "cosmos.evm.types.v1.TxResult") + proto.RegisterType((*TxResult)(nil), "cosmos.evm.server.v1.TxResult") } -func init() { proto.RegisterFile("cosmos/evm/types/v1/indexer.proto", fileDescriptor_b69626dfe9e578b6) } +func init() { + proto.RegisterFile("cosmos/evm/server/v1/indexer.proto", fileDescriptor_4195a4d4cee0e673) +} -var fileDescriptor_b69626dfe9e578b6 = []byte{ - // 295 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0x31, 0x4b, 0xc3, 0x40, - 0x18, 0x86, 0x73, 0xb6, 0x4d, 0xe3, 0xa1, 0x83, 0xa9, 0x94, 0x68, 0xe1, 0x3c, 0x9d, 0x32, 0xdd, - 0x51, 0xc4, 0xc5, 0xd1, 0x45, 0x5c, 0x8f, 0xba, 0xb8, 0x84, 0xb4, 0xf9, 0xbc, 0x04, 0x7a, 0x5e, - 0xe9, 0x5d, 0x42, 0xfc, 0x07, 0x8e, 0xfe, 0x04, 0x7f, 0x8e, 0x63, 0x47, 0x47, 0x69, 0xf1, 0x7f, - 0x48, 0x2e, 0xa1, 0x82, 0xdb, 0xf7, 0xf2, 0x3c, 0x1f, 0x2f, 0xbc, 0xf8, 0x72, 0xa1, 0x8d, 0xd2, - 0x86, 0x43, 0xa5, 0xb8, 0x7d, 0x5d, 0x81, 0xe1, 0xd5, 0x94, 0x17, 0x2f, 0x19, 0xd4, 0xb0, 0x66, - 0xab, 0xb5, 0xb6, 0x3a, 0x1c, 0xb5, 0x0a, 0x83, 0x4a, 0x31, 0xa7, 0xb0, 0x6a, 0x7a, 0x7e, 0x2a, - 0xb5, 0xd4, 0x8e, 0xf3, 0xe6, 0x6a, 0xd5, 0xab, 0x1f, 0x84, 0x83, 0x59, 0x2d, 0xc0, 0x94, 0x4b, - 0x1b, 0x8e, 0xb1, 0x9f, 0x43, 0x21, 0x73, 0x1b, 0x21, 0x8a, 0xe2, 0x9e, 0xe8, 0x52, 0x78, 0x86, - 0x03, 0x5b, 0x27, 0xae, 0x23, 0x3a, 0xa0, 0x28, 0x3e, 0x16, 0x43, 0x5b, 0x3f, 0x34, 0x31, 0x9c, - 0xe0, 0x43, 0x65, 0x64, 0xc7, 0x7a, 0x8e, 0x05, 0xca, 0xc8, 0x16, 0x52, 0x7c, 0x04, 0x36, 0x4f, - 0xf6, 0xbf, 0x7d, 0x8a, 0xe2, 0x81, 0xc0, 0x60, 0xf3, 0x59, 0xf7, 0x3e, 0xc6, 0xfe, 0x73, 0x5a, - 0x2c, 0x21, 0x8b, 0x06, 0x14, 0xc5, 0x81, 0xe8, 0x52, 0xd3, 0x28, 0x53, 0x93, 0x94, 0x06, 0xb2, - 0xc8, 0xa7, 0x28, 0xee, 0x8b, 0xa1, 0x4c, 0xcd, 0xa3, 0x81, 0x2c, 0x64, 0x78, 0xb4, 0x28, 0x55, - 0xb9, 0x4c, 0x6d, 0x51, 0x41, 0xb2, 0xb7, 0x86, 0xce, 0x3a, 0xf9, 0x43, 0xf7, 0xad, 0x7f, 0xdb, - 0x7f, 0xfb, 0xb8, 0xf0, 0xee, 0x6e, 0x3e, 0xb7, 0x04, 0x6d, 0xb6, 0x04, 0x7d, 0x6f, 0x09, 0x7a, - 0xdf, 0x11, 0x6f, 0xb3, 0x23, 0xde, 0xd7, 0x8e, 0x78, 0x4f, 0x13, 0x59, 0xd8, 0xbc, 0x9c, 0xb3, - 0x85, 0x56, 0xfc, 0xff, 0xb4, 0x73, 0xdf, 0xad, 0x74, 0xfd, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x05, - 0x03, 0xd2, 0x18, 0x75, 0x01, 0x00, 0x00, +var fileDescriptor_4195a4d4cee0e673 = []byte{ + // 301 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xbf, 0x4e, 0xf3, 0x30, + 0x14, 0xc5, 0xe3, 0xaf, 0x6d, 0x9a, 0xcf, 0x82, 0x81, 0x50, 0x55, 0x01, 0x24, 0x63, 0x75, 0xca, + 0x64, 0xab, 0x62, 0x43, 0x4c, 0x2c, 0x88, 0xd5, 0x2a, 0x0b, 0x4b, 0x94, 0x36, 0x17, 0x27, 0x52, + 0x8d, 0xab, 0xd8, 0xb1, 0xc2, 0x1b, 0x30, 0xf2, 0x08, 0x3c, 0x0e, 0x63, 0x47, 0x46, 0xd4, 0x8a, + 0xf7, 0x40, 0xf9, 0xa3, 0x32, 0xb0, 0xdd, 0xa3, 0xdf, 0xef, 0xea, 0x48, 0x07, 0xcf, 0x56, 0xda, + 0x28, 0x6d, 0x38, 0x38, 0xc5, 0x0d, 0x94, 0x0e, 0x4a, 0xee, 0xe6, 0xbc, 0x78, 0xce, 0xa0, 0x86, + 0x92, 0x6d, 0x4a, 0x6d, 0x75, 0x38, 0xe9, 0x1c, 0x06, 0x4e, 0xb1, 0xce, 0x61, 0x6e, 0x7e, 0x3e, + 0x91, 0x5a, 0xea, 0x56, 0xe0, 0xcd, 0xd5, 0xb9, 0xb3, 0x6f, 0x84, 0x83, 0x45, 0x2d, 0xc0, 0x54, + 0x6b, 0x1b, 0x4e, 0xb1, 0x9f, 0x43, 0x21, 0x73, 0x1b, 0x21, 0x8a, 0xe2, 0x81, 0xe8, 0x53, 0x78, + 0x86, 0x03, 0x5b, 0x27, 0x6d, 0x49, 0xf4, 0x8f, 0xa2, 0xf8, 0x58, 0x8c, 0x6d, 0x7d, 0xdf, 0xc4, + 0xf0, 0x02, 0xff, 0x57, 0x46, 0xf6, 0x6c, 0xd0, 0xb2, 0x40, 0x19, 0xd9, 0x41, 0x8a, 0x8f, 0xc0, + 0xe6, 0xc9, 0xe1, 0x77, 0x48, 0x51, 0x3c, 0x12, 0x18, 0x6c, 0xbe, 0xe8, 0xdf, 0xa7, 0xd8, 0x7f, + 0x4a, 0x8b, 0x35, 0x64, 0xd1, 0x88, 0xa2, 0x38, 0x10, 0x7d, 0x6a, 0x1a, 0x65, 0x6a, 0x92, 0xca, + 0x40, 0x16, 0xf9, 0x14, 0xc5, 0x43, 0x31, 0x96, 0xa9, 0x79, 0x30, 0x90, 0x85, 0x0c, 0x9f, 0xae, + 0x2a, 0x55, 0xad, 0x53, 0x5b, 0x38, 0x48, 0x0e, 0xd6, 0xb8, 0xb5, 0x4e, 0x7e, 0xd1, 0x5d, 0xe7, + 0x5f, 0x0f, 0x5f, 0xdf, 0x2f, 0xbd, 0xdb, 0x9b, 0x8f, 0x1d, 0x41, 0xdb, 0x1d, 0x41, 0x5f, 0x3b, + 0x82, 0xde, 0xf6, 0xc4, 0xdb, 0xee, 0x89, 0xf7, 0xb9, 0x27, 0xde, 0xe3, 0x4c, 0x16, 0x36, 0xaf, + 0x96, 0x6c, 0xa5, 0x15, 0xff, 0x3b, 0xae, 0x7d, 0xd9, 0x80, 0x59, 0xfa, 0xed, 0x58, 0x57, 0x3f, + 0x01, 0x00, 0x00, 0xff, 0xff, 0xa0, 0x6a, 0x21, 0x97, 0x7e, 0x01, 0x00, 0x00, } func (m *TxResult) Marshal() (dAtA []byte, err error) { diff --git a/tests/integration/ante/test_evm_antehandler_benchmark.go b/tests/integration/ante/test_evm_antehandler_benchmark.go index 7476c7382..e46e5cffc 100644 --- a/tests/integration/ante/test_evm_antehandler_benchmark.go +++ b/tests/integration/ante/test_evm_antehandler_benchmark.go @@ -6,12 +6,12 @@ import ( "testing" "github.com/cosmos/evm/ante" + antetypes "github.com/cosmos/evm/ante/types" basefactory "github.com/cosmos/evm/testutil/integration/base/factory" "github.com/cosmos/evm/testutil/integration/evm/factory" "github.com/cosmos/evm/testutil/integration/evm/grpc" "github.com/cosmos/evm/testutil/integration/evm/network" testkeyring "github.com/cosmos/evm/testutil/keyring" - cosmosevmtypes "github.com/cosmos/evm/types" evmtypes "github.com/cosmos/evm/x/vm/types" "cosmossdk.io/errors" @@ -145,7 +145,7 @@ func (s *benchmarkSuite) generateHandlerOptions() ante.HandlerOptions { Cdc: s.network.App.AppCodec(), AccountKeeper: s.network.App.GetAccountKeeper(), BankKeeper: s.network.App.GetBankKeeper(), - ExtensionOptionChecker: cosmosevmtypes.HasDynamicFeeExtensionOption, + ExtensionOptionChecker: antetypes.HasDynamicFeeExtensionOption, EvmKeeper: s.network.App.GetEVMKeeper(), FeegrantKeeper: s.network.App.GetFeeGrantKeeper(), IBCKeeper: s.network.App.GetIBCKeeper(), diff --git a/tests/integration/ante/test_evm_fee_market.go b/tests/integration/ante/test_evm_fee_market.go index dd1a3c59a..13053b162 100644 --- a/tests/integration/ante/test_evm_fee_market.go +++ b/tests/integration/ante/test_evm_fee_market.go @@ -6,11 +6,11 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/cosmos/evm/ante/evm" + "github.com/cosmos/evm/ante/types" "github.com/cosmos/evm/server/config" "github.com/cosmos/evm/testutil" testconstants "github.com/cosmos/evm/testutil/constants" utiltx "github.com/cosmos/evm/testutil/tx" - "github.com/cosmos/evm/types" evmtypes "github.com/cosmos/evm/x/vm/types" sdkmath "cosmossdk.io/math" diff --git a/tests/integration/ante/test_validate_handler_options.go b/tests/integration/ante/test_validate_handler_options.go index a1206a0cc..ccd2c1eea 100644 --- a/tests/integration/ante/test_validate_handler_options.go +++ b/tests/integration/ante/test_validate_handler_options.go @@ -7,8 +7,8 @@ import ( "github.com/stretchr/testify/require" "github.com/cosmos/evm/ante" + antetypes "github.com/cosmos/evm/ante/types" "github.com/cosmos/evm/testutil/integration/evm/network" - "github.com/cosmos/evm/types" ) //nolint:thelper // RunValidateHandlerOptionsTest is not a helper function; it's an externally called benchmark entry point @@ -121,7 +121,7 @@ func RunValidateHandlerOptionsTest(t *testing.T, create network.CreateEvmApp, op Cdc: nw.App.AppCodec(), AccountKeeper: nw.App.GetAccountKeeper(), BankKeeper: nw.App.GetBankKeeper(), - ExtensionOptionChecker: types.HasDynamicFeeExtensionOption, + ExtensionOptionChecker: antetypes.HasDynamicFeeExtensionOption, EvmKeeper: nw.App.GetEVMKeeper(), FeegrantKeeper: nw.App.GetFeeGrantKeeper(), IBCKeeper: nw.App.GetIBCKeeper(), @@ -140,7 +140,7 @@ func RunValidateHandlerOptionsTest(t *testing.T, create network.CreateEvmApp, op Cdc: nw.App.AppCodec(), AccountKeeper: nw.App.GetAccountKeeper(), BankKeeper: nw.App.GetBankKeeper(), - ExtensionOptionChecker: types.HasDynamicFeeExtensionOption, + ExtensionOptionChecker: antetypes.HasDynamicFeeExtensionOption, EvmKeeper: nw.App.GetEVMKeeper(), FeegrantKeeper: nw.App.GetFeeGrantKeeper(), IBCKeeper: nw.App.GetIBCKeeper(), diff --git a/tests/integration/rpc/backend/test_tx_info.go b/tests/integration/rpc/backend/test_tx_info.go index dc078ae29..0d6efea5f 100644 --- a/tests/integration/rpc/backend/test_tx_info.go +++ b/tests/integration/rpc/backend/test_tx_info.go @@ -17,7 +17,7 @@ import ( "github.com/cosmos/evm/indexer" "github.com/cosmos/evm/rpc/backend/mocks" rpctypes "github.com/cosmos/evm/rpc/types" - cosmosevmtypes "github.com/cosmos/evm/types" + cosmosevmtypes "github.com/cosmos/evm/server/types" evmtypes "github.com/cosmos/evm/x/vm/types" "cosmossdk.io/log" diff --git a/types/genesis.go b/testutil/genesis.go similarity index 88% rename from types/genesis.go rename to testutil/genesis.go index 1697c7fff..33febd28e 100644 --- a/types/genesis.go +++ b/testutil/genesis.go @@ -1,9 +1,9 @@ -package types +package testutil import "encoding/json" // GenesisState of the blockchain is represented here as a map of raw json -// messages key'd by a identifier string. +// messages key'd by an identifier string. // The identifier is used to determine which module genesis information belongs // to so it may be appropriately routed during init chain. // Within this application default genesis information is retrieved from diff --git a/testutil/integration/evm/network/amounts.go b/testutil/integration/evm/network/amounts.go index 919465091..8b8d88b71 100644 --- a/testutil/integration/evm/network/amounts.go +++ b/testutil/integration/evm/network/amounts.go @@ -4,7 +4,7 @@ import ( "math/big" testconstants "github.com/cosmos/evm/testutil/constants" - "github.com/cosmos/evm/types" + "github.com/cosmos/evm/utils" evmtypes "github.com/cosmos/evm/x/vm/types" "cosmossdk.io/math" @@ -54,7 +54,7 @@ func GetInitialBondedAmount(decimals evmtypes.Decimals) math.Int { // initialBondedAmount represents the amount of tokens that each validator will // have initially bonded expressed in the 18 decimals representation. sdk.DefaultPowerReduction = math.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(int64(decimals)), nil)) - initialBondedAmount := sdk.TokensFromConsensusPower(1, types.AttoPowerReduction) + initialBondedAmount := sdk.TokensFromConsensusPower(1, utils.AttoPowerReduction) return initialBondedAmount.Quo(decimals.ConversionFactor()) } diff --git a/testutil/integration/evm/network/network.go b/testutil/integration/evm/network/network.go index 0721426bc..907af9894 100644 --- a/testutil/integration/evm/network/network.go +++ b/testutil/integration/evm/network/network.go @@ -18,7 +18,6 @@ import ( "github.com/cosmos/evm" "github.com/cosmos/evm/testutil/integration" basenetwork "github.com/cosmos/evm/testutil/integration/base/network" - "github.com/cosmos/evm/types" erc20types "github.com/cosmos/evm/x/erc20/types" feemarkettypes "github.com/cosmos/evm/x/feemarket/types" evmtypes "github.com/cosmos/evm/x/vm/types" @@ -252,7 +251,7 @@ func (n *IntegrationNetwork) configureAndInitChain(evmApp evm.EvmApp) error { n.app = evmApp n.ctx = n.ctx.WithConsensusParams(*consensusParams) - n.ctx = n.ctx.WithBlockGasMeter(types.NewInfiniteGasMeterWithLimit(blockMaxGas)) + n.ctx = n.ctx.WithBlockGasMeter(evmtypes.NewInfiniteGasMeterWithLimit(blockMaxGas)) n.validators = validators n.valSet = valSet diff --git a/testutil/integration/evm/network/setup.go b/testutil/integration/evm/network/setup.go index b30349102..5a7a74d98 100644 --- a/testutil/integration/evm/network/setup.go +++ b/testutil/integration/evm/network/setup.go @@ -9,9 +9,8 @@ import ( cmttypes "github.com/cometbft/cometbft/types" "github.com/cosmos/evm" - "github.com/cosmos/evm/config" + "github.com/cosmos/evm/testutil" testconstants "github.com/cosmos/evm/testutil/constants" - cosmosevmtypes "github.com/cosmos/evm/types" erc20types "github.com/cosmos/evm/x/erc20/types" feemarkettypes "github.com/cosmos/evm/x/feemarket/types" evmtypes "github.com/cosmos/evm/x/vm/types" @@ -35,7 +34,7 @@ import ( ) // genSetupFn is the type for the module genesis setup functions -type genSetupFn func(cosmosEVMApp evm.EvmApp, genesisState cosmosevmtypes.GenesisState, customGenesis interface{}) (cosmosevmtypes.GenesisState, error) +type genSetupFn func(cosmosEVMApp evm.EvmApp, genesisState testutil.GenesisState, customGenesis interface{}) (testutil.GenesisState, error) // defaultGenesisParams contains the params that are needed to // setup the default genesis for the testing setup @@ -60,7 +59,7 @@ var genesisSetupFunctions = map[string]genSetupFn{ minttypes.ModuleName: genStateSetter[*minttypes.GenesisState](minttypes.ModuleName), banktypes.ModuleName: setBankGenesisState, authtypes.ModuleName: setAuthGenesisState, - consensustypes.ModuleName: func(_ evm.EvmApp, genesisState cosmosevmtypes.GenesisState, _ interface{}) (cosmosevmtypes.GenesisState, error) { + consensustypes.ModuleName: func(_ evm.EvmApp, genesisState testutil.GenesisState, _ interface{}) (testutil.GenesisState, error) { // no-op. Consensus does not have a genesis state on the application // but the params are used on it // (e.g. block max gas, max bytes). @@ -71,7 +70,7 @@ var genesisSetupFunctions = map[string]genSetupFn{ // genStateSetter is a generic function to set module-specific genesis state func genStateSetter[T proto.Message](moduleName string) genSetupFn { - return func(cosmosEVMApp evm.EvmApp, genesisState cosmosevmtypes.GenesisState, customGenesis interface{}) (cosmosevmtypes.GenesisState, error) { + return func(cosmosEVMApp evm.EvmApp, genesisState testutil.GenesisState, customGenesis interface{}) (testutil.GenesisState, error) { moduleGenesis, ok := customGenesis.(T) if !ok { return nil, fmt.Errorf("invalid type %T for %s module genesis state", customGenesis, moduleName) @@ -280,7 +279,7 @@ type StakingCustomGenesisState struct { } // setDefaultStakingGenesisState sets the default staking genesis state -func setDefaultStakingGenesisState(cosmosEVMApp evm.EvmApp, genesisState cosmosevmtypes.GenesisState, overwriteParams StakingCustomGenesisState) cosmosevmtypes.GenesisState { +func setDefaultStakingGenesisState(cosmosEVMApp evm.EvmApp, genesisState testutil.GenesisState, overwriteParams StakingCustomGenesisState) testutil.GenesisState { // Set staking params stakingParams := stakingtypes.DefaultParams() stakingParams.BondDenom = overwriteParams.denom @@ -300,7 +299,7 @@ type BankCustomGenesisState struct { } // setDefaultBankGenesisState sets the default bank genesis state -func setDefaultBankGenesisState(cosmosEVMApp evm.EvmApp, genesisState cosmosevmtypes.GenesisState, overwriteParams BankCustomGenesisState, evmChainID uint64) cosmosevmtypes.GenesisState { +func setDefaultBankGenesisState(cosmosEVMApp evm.EvmApp, genesisState testutil.GenesisState, overwriteParams BankCustomGenesisState, evmChainID uint64) testutil.GenesisState { bankGenesis := banktypes.NewGenesisState( banktypes.DefaultGenesisState().Params, overwriteParams.balances, @@ -321,7 +320,7 @@ type SlashingCustomGenesisState struct { } // setDefaultSlashingGenesisState sets the default slashing genesis state -func setDefaultSlashingGenesisState(cosmosEVMApp evm.EvmApp, genesisState cosmosevmtypes.GenesisState, overwriteParams SlashingCustomGenesisState) cosmosevmtypes.GenesisState { +func setDefaultSlashingGenesisState(cosmosEVMApp evm.EvmApp, genesisState testutil.GenesisState, overwriteParams SlashingCustomGenesisState) testutil.GenesisState { slashingGen := slashingtypes.DefaultGenesisState() slashingGen.SigningInfos = overwriteParams.signingInfo slashingGen.MissedBlocks = overwriteParams.missedBlocks @@ -331,7 +330,7 @@ func setDefaultSlashingGenesisState(cosmosEVMApp evm.EvmApp, genesisState cosmos } // setBankGenesisState updates the bank genesis state with custom genesis state -func setBankGenesisState(cosmosEVMApp evm.EvmApp, genesisState cosmosevmtypes.GenesisState, customGenesis interface{}) (cosmosevmtypes.GenesisState, error) { +func setBankGenesisState(cosmosEVMApp evm.EvmApp, genesisState testutil.GenesisState, customGenesis interface{}) (testutil.GenesisState, error) { customGen, ok := customGenesis.(*banktypes.GenesisState) if !ok { return nil, fmt.Errorf("invalid type %T for bank module genesis state", customGenesis) @@ -383,14 +382,14 @@ func addBondedModuleAccountToFundedBalances( } // setDefaultAuthGenesisState sets the default auth genesis state -func setDefaultAuthGenesisState(cosmosEVMApp evm.EvmApp, genesisState cosmosevmtypes.GenesisState, genAccs []authtypes.GenesisAccount) cosmosevmtypes.GenesisState { +func setDefaultAuthGenesisState(cosmosEVMApp evm.EvmApp, genesisState testutil.GenesisState, genAccs []authtypes.GenesisAccount) testutil.GenesisState { defaultAuthGen := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) genesisState[authtypes.ModuleName] = cosmosEVMApp.AppCodec().MustMarshalJSON(defaultAuthGen) return genesisState } // setAuthGenesisState updates the bank genesis state with custom genesis state -func setAuthGenesisState(cosmosEVMApp evm.EvmApp, genesisState cosmosevmtypes.GenesisState, customGenesis interface{}) (cosmosevmtypes.GenesisState, error) { +func setAuthGenesisState(cosmosEVMApp evm.EvmApp, genesisState testutil.GenesisState, customGenesis interface{}) (testutil.GenesisState, error) { customGen, ok := customGenesis.(*authtypes.GenesisState) if !ok { return nil, fmt.Errorf("invalid type %T for auth module genesis state", customGenesis) @@ -415,13 +414,13 @@ type GovCustomGenesisState struct { } // setDefaultGovGenesisState sets the default gov genesis state -func setDefaultGovGenesisState(cosmosEVMApp evm.EvmApp, genesisState cosmosevmtypes.GenesisState, overwriteParams GovCustomGenesisState, evmChainID uint64) cosmosevmtypes.GenesisState { +func setDefaultGovGenesisState(cosmosEVMApp evm.EvmApp, genesisState testutil.GenesisState, overwriteParams GovCustomGenesisState) testutil.GenesisState { govGen := govtypesv1.DefaultGenesisState() - denomConfig := config.ChainsCoinInfo[evmChainID] + denomConfig := DefaultChainCoins() updatedParams := govGen.Params - minDepositAmt := sdkmath.NewInt(1e18).Quo(evmtypes.Decimals(denomConfig.Decimals).ConversionFactor()) + minDepositAmt := sdkmath.NewInt(1e18).Quo(denomConfig.BaseDecimals().ConversionFactor()) updatedParams.MinDeposit = sdktypes.NewCoins(sdktypes.NewCoin(overwriteParams.denom, minDepositAmt)) updatedParams.ExpeditedMinDeposit = sdktypes.NewCoins(sdktypes.NewCoin(overwriteParams.denom, minDepositAmt)) govGen.Params = updatedParams @@ -435,7 +434,7 @@ type FeeMarketCustomGenesisState struct { } // setDefaultFeeMarketGenesisState sets the default fee market genesis state -func setDefaultFeeMarketGenesisState(cosmosEVMApp evm.EvmApp, genesisState cosmosevmtypes.GenesisState, overwriteParams FeeMarketCustomGenesisState) cosmosevmtypes.GenesisState { +func setDefaultFeeMarketGenesisState(cosmosEVMApp evm.EvmApp, genesisState testutil.GenesisState, overwriteParams FeeMarketCustomGenesisState) testutil.GenesisState { fmGen := feemarkettypes.DefaultGenesisState() fmGen.Params.BaseFee = overwriteParams.baseFee genesisState[feemarkettypes.ModuleName] = cosmosEVMApp.AppCodec().MustMarshalJSON(fmGen) @@ -452,7 +451,7 @@ type MintCustomGenesisState struct { // setDefaultGovGenesisState sets the default gov genesis state // // NOTE: for the testing network we don't want to have any minting -func setDefaultMintGenesisState(cosmosEVMApp evm.EvmApp, genesisState cosmosevmtypes.GenesisState, overwriteParams MintCustomGenesisState) cosmosevmtypes.GenesisState { +func setDefaultMintGenesisState(cosmosEVMApp evm.EvmApp, genesisState testutil.GenesisState, overwriteParams MintCustomGenesisState) testutil.GenesisState { mintGen := minttypes.DefaultGenesisState() updatedParams := mintGen.Params updatedParams.MintDenom = overwriteParams.denom @@ -464,7 +463,7 @@ func setDefaultMintGenesisState(cosmosEVMApp evm.EvmApp, genesisState cosmosevmt return genesisState } -func setDefaultErc20GenesisState(cosmosEVMApp evm.EvmApp, evmChainID uint64, genesisState cosmosevmtypes.GenesisState) cosmosevmtypes.GenesisState { +func setDefaultErc20GenesisState(cosmosEVMApp evm.EvmApp, evmChainID uint64, genesisState testutil.GenesisState) testutil.GenesisState { // NOTE: here we are using the setup from the example chain erc20Gen := newErc20GenesisState() updatedErc20Gen := updateErc20GenesisStateForChainID(testconstants.ChainID{ @@ -489,7 +488,7 @@ func newErc20GenesisState() *erc20types.GenesisState { return erc20GenState } -func setDefaultVMGenesisState(cosmosEVMApp evm.EvmApp, evmChainID uint64, genesisState cosmosevmtypes.GenesisState) cosmosevmtypes.GenesisState { +func setDefaultVMGenesisState(cosmosEVMApp evm.EvmApp, evmChainID uint64, genesisState testutil.GenesisState) testutil.GenesisState { // NOTE: here we are using the setup from the example chain var vmGen evmtypes.GenesisState cosmosEVMApp.AppCodec().MustUnmarshalJSON(genesisState[evmtypes.ModuleName], &vmGen) @@ -504,13 +503,13 @@ func setDefaultVMGenesisState(cosmosEVMApp evm.EvmApp, evmChainID uint64, genesi // defaultAuthGenesisState sets the default genesis state // for the testing setup -func newDefaultGenesisState(cosmosEVMApp evm.EvmApp, evmChainID uint64, params defaultGenesisParams) cosmosevmtypes.GenesisState { +func newDefaultGenesisState(cosmosEVMApp evm.EvmApp, evmChainID uint64, params defaultGenesisParams) testutil.GenesisState { genesisState := cosmosEVMApp.DefaultGenesis() genesisState = setDefaultAuthGenesisState(cosmosEVMApp, genesisState, params.genAccounts) genesisState = setDefaultStakingGenesisState(cosmosEVMApp, genesisState, params.staking) genesisState = setDefaultBankGenesisState(cosmosEVMApp, genesisState, params.bank, evmChainID) - genesisState = setDefaultGovGenesisState(cosmosEVMApp, genesisState, params.gov, evmChainID) + genesisState = setDefaultGovGenesisState(cosmosEVMApp, genesisState, params.gov) genesisState = setDefaultFeeMarketGenesisState(cosmosEVMApp, genesisState, params.feemarket) genesisState = setDefaultSlashingGenesisState(cosmosEVMApp, genesisState, params.slashing) genesisState = setDefaultMintGenesisState(cosmosEVMApp, genesisState, params.mint) @@ -522,7 +521,7 @@ func newDefaultGenesisState(cosmosEVMApp evm.EvmApp, evmChainID uint64, params d // customizeGenesis modifies genesis state if there are any custom genesis state // for specific modules -func customizeGenesis(cosmosEVMApp evm.EvmApp, customGen CustomGenesisState, genesisState cosmosevmtypes.GenesisState) (cosmosevmtypes.GenesisState, error) { +func customizeGenesis(cosmosEVMApp evm.EvmApp, customGen CustomGenesisState, genesisState testutil.GenesisState) (testutil.GenesisState, error) { var err error for mod, modGenState := range customGen { if fn, found := genesisSetupFunctions[mod]; found { diff --git a/testutil/tx/eip712.go b/testutil/tx/eip712.go index 009a658ed..89b4a57ae 100644 --- a/testutil/tx/eip712.go +++ b/testutil/tx/eip712.go @@ -9,7 +9,6 @@ import ( "github.com/cosmos/evm" cryptocodec "github.com/cosmos/evm/crypto/codec" "github.com/cosmos/evm/ethereum/eip712" - "github.com/cosmos/evm/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" @@ -164,7 +163,7 @@ func signCosmosEIP712Tx( func createTypedData(args typedDataArgs, useLegacy bool) (apitypes.TypedData, error) { if useLegacy { registry := codectypes.NewInterfaceRegistry() - types.RegisterInterfaces(registry) + eip712.RegisterInterfaces(registry) cryptocodec.RegisterInterfaces(registry) evmCodec := codec.NewProtoCodec(registry) diff --git a/types/errors.go b/types/errors.go deleted file mode 100644 index 37dacc870..000000000 --- a/types/errors.go +++ /dev/null @@ -1,11 +0,0 @@ -package types - -import ( - errorsmod "cosmossdk.io/errors" -) - -// RootCodespace is the codespace for all errors defined in this package -const RootCodespace = "Cosmos EVM" - -// ErrInvalidChainID returns an error resulting from an invalid chain ID. -var ErrInvalidChainID = errorsmod.Register(RootCodespace, 3, "invalid chain ID") diff --git a/types/int.go b/utils/int.go similarity index 99% rename from types/int.go rename to utils/int.go index 941963eac..b9ad3d1c0 100644 --- a/types/int.go +++ b/utils/int.go @@ -1,4 +1,4 @@ -package types +package utils import ( fmt "fmt" diff --git a/types/power.go b/utils/power.go similarity index 96% rename from types/power.go rename to utils/power.go index 7f6311eae..72c90fd3c 100644 --- a/types/power.go +++ b/utils/power.go @@ -1,4 +1,4 @@ -package types +package utils import ( "math/big" diff --git a/utils/utils.go b/utils/utils.go index 543339ba0..b7db88bfc 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -8,18 +8,12 @@ import ( "strings" "github.com/ethereum/go-ethereum/common" - ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" "github.com/holiman/uint256" - "github.com/pkg/errors" "github.com/cosmos/evm/crypto/ethsecp256k1" - feemarkettypes "github.com/cosmos/evm/x/feemarket/types" - evmtypes "github.com/cosmos/evm/x/vm/types" ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types" errorsmod "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -214,52 +208,6 @@ func Uint256FromBigInt(i *big.Int) (*uint256.Int, error) { return result, nil } -// CalcBaseFee calculates the basefee of the header. -func CalcBaseFee(config *params.ChainConfig, parent *ethtypes.Header, p feemarkettypes.Params) (*big.Int, error) { - // If the current block is the first EIP-1559 block, return the InitialBaseFee. - if !config.IsLondon(parent.Number) { - return new(big.Int).SetUint64(params.InitialBaseFee), nil - } - if p.ElasticityMultiplier == 0 { - return nil, errors.New("ElasticityMultiplier cannot be 0 as it's checked in the params validation") - } - parentGasTarget := parent.GasLimit / uint64(p.ElasticityMultiplier) - - factor := evmtypes.GetEVMCoinDecimals().ConversionFactor() - minGasPrice := p.MinGasPrice.Mul(sdkmath.LegacyNewDecFromInt(factor)) - return CalcGasBaseFee( - parent.GasUsed, parentGasTarget, uint64(p.BaseFeeChangeDenominator), - sdkmath.LegacyNewDecFromBigInt(parent.BaseFee), sdkmath.LegacyOneDec(), minGasPrice, - ).TruncateInt().BigInt(), nil -} - -func CalcGasBaseFee(gasUsed, gasTarget, baseFeeChangeDenom uint64, baseFee, minUnitGas, minGasPrice sdkmath.LegacyDec) sdkmath.LegacyDec { - // If the parent gasUsed is the same as the target, the baseFee remains unchanged. - if gasUsed == gasTarget { - return baseFee - } - - if gasTarget == 0 { - return sdkmath.LegacyZeroDec() - } - - num := sdkmath.LegacyNewDecFromInt(sdkmath.NewIntFromUint64(gasUsed).Sub(sdkmath.NewIntFromUint64(gasTarget)).Abs()) - num = num.Mul(baseFee) - num = num.QuoInt(sdkmath.NewIntFromUint64(gasTarget)) - num = num.QuoInt(sdkmath.NewIntFromUint64(baseFeeChangeDenom)) - - if gasUsed > gasTarget { - // If the parent block used more gas than its target, the baseFee should increase. - // max(1, parentBaseFee * gasUsedDelta / parentGasTarget / baseFeeChangeDenominator) - baseFeeDelta := sdkmath.LegacyMaxDec(num, minUnitGas) - return baseFee.Add(baseFeeDelta) - } - - // Otherwise if the parent block used less gas than its target, the baseFee should decrease. - // max(minGasPrice, parentBaseFee * gasUsedDelta / parentGasTarget / baseFeeChangeDenominator) - return sdkmath.LegacyMaxDec(baseFee.Sub(num), minGasPrice) -} - // Bytes32ToString converts a bytes32 value to string by trimming null bytes func Bytes32ToString(data [32]byte) string { // Find the first null byte diff --git a/utils/utils_test.go b/utils/utils_test.go index b0e8c9f4f..f3f152ae7 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -14,8 +14,8 @@ import ( cryptocodec "github.com/cosmos/evm/crypto/codec" "github.com/cosmos/evm/crypto/ethsecp256k1" "github.com/cosmos/evm/crypto/hd" + "github.com/cosmos/evm/rpc/types" "github.com/cosmos/evm/testutil/constants" - "github.com/cosmos/evm/types" "github.com/cosmos/evm/utils" feemarkettypes "github.com/cosmos/evm/x/feemarket/types" evmtypes "github.com/cosmos/evm/x/vm/types" @@ -433,7 +433,7 @@ func TestAccountEquivalence(t *testing.T) { // account using ethsecp // and coin type 60 - evmKey, err := kb.NewAccount(uid, mnemonic, keyring.DefaultBIP39Passphrase, types.BIP44HDPath, algoEvm) + evmKey, err := kb.NewAccount(uid, mnemonic, keyring.DefaultBIP39Passphrase, hd.BIP44HDPath, algoEvm) require.NoError(t, err) // verify that none of these three keys are equal @@ -770,7 +770,7 @@ func TestCalcBaseFee(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - result, err := utils.CalcBaseFee(tc.config, tc.parent, tc.params) + result, err := types.CalcBaseFee(tc.config, tc.parent, tc.params) if tc.expectedError != "" { require.Error(t, err) diff --git a/types/validation.go b/utils/validation.go similarity index 98% rename from types/validation.go rename to utils/validation.go index 2bacefc4b..346f45973 100644 --- a/types/validation.go +++ b/utils/validation.go @@ -1,4 +1,4 @@ -package types +package utils import ( "bytes" diff --git a/types/validation_test.go b/utils/validation_test.go similarity index 87% rename from types/validation_test.go rename to utils/validation_test.go index 39d49a9e9..fae0aa0dc 100644 --- a/types/validation_test.go +++ b/utils/validation_test.go @@ -1,4 +1,4 @@ -package types_test +package utils_test import ( "testing" @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/require" utiltx "github.com/cosmos/evm/testutil/tx" - "github.com/cosmos/evm/types" + "github.com/cosmos/evm/utils" ) func TestIsEmptyHash(t *testing.T) { @@ -29,7 +29,7 @@ func TestIsEmptyHash(t *testing.T) { } for _, tc := range testCases { - require.Equal(t, tc.expEmpty, types.IsEmptyHash(tc.hash), tc.name) + require.Equal(t, tc.expEmpty, utils.IsEmptyHash(tc.hash), tc.name) } } @@ -52,7 +52,7 @@ func TestIsZeroAddress(t *testing.T) { } for _, tc := range testCases { - require.Equal(t, tc.expEmpty, types.IsZeroAddress(tc.address), tc.name) + require.Equal(t, tc.expEmpty, utils.IsZeroAddress(tc.address), tc.name) } } @@ -77,7 +77,7 @@ func TestValidateAddress(t *testing.T) { } for _, tc := range testCases { - err := types.ValidateAddress(tc.address) + err := utils.ValidateAddress(tc.address) if tc.expError { require.Error(t, err, tc.name) @@ -108,7 +108,7 @@ func TestValidateNonZeroAddress(t *testing.T) { } for _, tc := range testCases { - err := types.ValidateNonZeroAddress(tc.address) + err := utils.ValidateNonZeroAddress(tc.address) if tc.expError { require.Error(t, err, tc.name) @@ -133,7 +133,7 @@ func TestSafeInt64(t *testing.T) { } for _, tc := range testCases { - value, err := types.SafeInt64(tc.value) + value, err := utils.SafeInt64(tc.value) if tc.expError { require.Error(t, err, tc.name) continue diff --git a/x/erc20/client/cli/tx.go b/x/erc20/client/cli/tx.go index 647630ddd..34b1b8e7a 100644 --- a/x/erc20/client/cli/tx.go +++ b/x/erc20/client/cli/tx.go @@ -6,7 +6,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/spf13/cobra" - cosmosevmtypes "github.com/cosmos/evm/types" + "github.com/cosmos/evm/utils" "github.com/cosmos/evm/x/erc20/types" "cosmossdk.io/math" @@ -48,7 +48,7 @@ func NewConvertERC20Cmd() *cobra.Command { } contract := args[0] - if err := cosmosevmtypes.ValidateAddress(contract); err != nil { + if err := utils.ValidateAddress(contract); err != nil { return fmt.Errorf("invalid ERC20 contract address %w", err) } @@ -104,7 +104,7 @@ func NewConvertCoinCmd() *cobra.Command { if len(args) == 2 { receiver = args[1] - if err := cosmosevmtypes.ValidateAddress(receiver); err != nil { + if err := utils.ValidateAddress(receiver); err != nil { return fmt.Errorf("invalid receiver hex address %w", err) } } else { @@ -141,7 +141,7 @@ func NewMsgRegisterERC20Cmd() *cobra.Command { } for _, contract := range args { - if err := cosmosevmtypes.ValidateAddress(contract); err != nil { + if err := utils.ValidateAddress(contract); err != nil { return fmt.Errorf("invalid ERC20 contract address %w", err) } } diff --git a/x/erc20/keeper/grpc_query.go b/x/erc20/keeper/grpc_query.go index 8932de2ba..8ca7191df 100644 --- a/x/erc20/keeper/grpc_query.go +++ b/x/erc20/keeper/grpc_query.go @@ -6,7 +6,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - cosmosevmtypes "github.com/cosmos/evm/types" + "github.com/cosmos/evm/utils" "github.com/cosmos/evm/x/erc20/types" "cosmossdk.io/store/prefix" @@ -55,7 +55,7 @@ func (k Keeper) TokenPair(c context.Context, req *types.QueryTokenPairRequest) ( // check if the token is a hex address, if not, check if it is a valid SDK // denom - if err := cosmosevmtypes.ValidateAddress(req.Token); err != nil { + if err := utils.ValidateAddress(req.Token); err != nil { if err := sdk.ValidateDenom(req.Token); err != nil { return nil, status.Errorf( codes.InvalidArgument, diff --git a/x/erc20/types/proposal.go b/x/erc20/types/proposal.go index ac1d44b84..7f3f97a88 100644 --- a/x/erc20/types/proposal.go +++ b/x/erc20/types/proposal.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - cosmosevmtypes "github.com/cosmos/evm/types" + "github.com/cosmos/evm/utils" errorsmod "cosmossdk.io/errors" @@ -53,7 +53,7 @@ func ValidateErc20Denom(denom string) error { if len(trimmed) == 0 { return fmt.Errorf("invalid denom (given: %s): missing address after prefix %s", denom, Erc20NativeCoinDenomPrefix) } - return cosmosevmtypes.ValidateAddress(trimmed) + return utils.ValidateAddress(trimmed) } return fmt.Errorf("invalid denom (given: %s): denomination should be prefixed with %s", denom, Erc20NativeCoinDenomPrefix) @@ -79,7 +79,7 @@ func (*RegisterERC20Proposal) ProposalType() string { // ValidateBasic performs a stateless check of the proposal fields func (rtbp *RegisterERC20Proposal) ValidateBasic() error { for _, address := range rtbp.Erc20Addresses { - if err := cosmosevmtypes.ValidateAddress(address); err != nil { + if err := utils.ValidateAddress(address); err != nil { return errorsmod.Wrap(err, "ERC20 address") } } @@ -108,7 +108,7 @@ func (*ToggleTokenConversionProposal) ProposalType() string { func (ttcp *ToggleTokenConversionProposal) ValidateBasic() error { // check if the token is a hex address, if not, check if it is a valid SDK // denom - if err := cosmosevmtypes.ValidateAddress(ttcp.Token); err != nil { + if err := utils.ValidateAddress(ttcp.Token); err != nil { if err := sdk.ValidateDenom(ttcp.Token); err != nil { return err } diff --git a/x/erc20/types/token_pair.go b/x/erc20/types/token_pair.go index 0b19df00f..4da8ba4b4 100644 --- a/x/erc20/types/token_pair.go +++ b/x/erc20/types/token_pair.go @@ -5,7 +5,6 @@ import ( "github.com/cometbft/cometbft/crypto/tmhash" - cosmosevmtypes "github.com/cosmos/evm/types" "github.com/cosmos/evm/utils" sdk "github.com/cosmos/cosmos-sdk/types" @@ -56,7 +55,7 @@ func (tp TokenPair) Validate() error { return err } - return cosmosevmtypes.ValidateAddress(tp.Erc20Address) + return utils.ValidateAddress(tp.Erc20Address) } // IsNativeCoin returns true if the owner of the ERC20 contract is the diff --git a/x/feemarket/keeper/eip1559.go b/x/feemarket/keeper/eip1559.go index d2f1d3944..21e3546b7 100644 --- a/x/feemarket/keeper/eip1559.go +++ b/x/feemarket/keeper/eip1559.go @@ -3,7 +3,7 @@ package keeper import ( "math" - "github.com/cosmos/evm/utils" + "github.com/cosmos/evm/x/feemarket/types" evmtypes "github.com/cosmos/evm/x/vm/types" sdkmath "cosmossdk.io/math" @@ -58,7 +58,7 @@ func (k Keeper) CalculateBaseFee(ctx sdk.Context) sdkmath.LegacyDec { } factor := evmtypes.GetEVMCoinDecimals().ConversionFactor() - return utils.CalcGasBaseFee( + return types.CalcGasBaseFee( parentGasUsed, parentGasTargetInt.Uint64(), uint64(params.BaseFeeChangeDenominator), diff --git a/x/feemarket/types/utils.go b/x/feemarket/types/utils.go new file mode 100644 index 000000000..cc07a1cef --- /dev/null +++ b/x/feemarket/types/utils.go @@ -0,0 +1,30 @@ +package types + +import "cosmossdk.io/math" + +func CalcGasBaseFee(gasUsed, gasTarget, baseFeeChangeDenom uint64, baseFee, minUnitGas, minGasPrice math.LegacyDec) math.LegacyDec { + // If the parent gasUsed is the same as the target, the baseFee remains unchanged. + if gasUsed == gasTarget { + return baseFee + } + + if gasTarget == 0 { + return math.LegacyZeroDec() + } + + num := math.LegacyNewDecFromInt(math.NewIntFromUint64(gasUsed).Sub(math.NewIntFromUint64(gasTarget)).Abs()) + num = num.Mul(baseFee) + num = num.QuoInt(math.NewIntFromUint64(gasTarget)) + num = num.QuoInt(math.NewIntFromUint64(baseFeeChangeDenom)) + + if gasUsed > gasTarget { + // If the parent block used more gas than its target, the baseFee should increase. + // max(1, parentBaseFee * gasUsedDelta / parentGasTarget / baseFeeChangeDenominator) + baseFeeDelta := math.LegacyMaxDec(num, minUnitGas) + return baseFee.Add(baseFeeDelta) + } + + // Otherwise if the parent block used less gas than its target, the baseFee should decrease. + // max(minGasPrice, parentBaseFee * gasUsedDelta / parentGasTarget / baseFeeChangeDenominator) + return math.LegacyMaxDec(baseFee.Sub(num), minGasPrice) +} diff --git a/x/ibc/callbacks/keeper/keeper.go b/x/ibc/callbacks/keeper/keeper.go index eab3a6d87..a19f45e3f 100644 --- a/x/ibc/callbacks/keeper/keeper.go +++ b/x/ibc/callbacks/keeper/keeper.go @@ -8,11 +8,11 @@ import ( "github.com/cosmos/evm/contracts" "github.com/cosmos/evm/ibc" callbacksabi "github.com/cosmos/evm/precompiles/callbacks" - types2 "github.com/cosmos/evm/types" "github.com/cosmos/evm/utils" erc20types "github.com/cosmos/evm/x/erc20/types" "github.com/cosmos/evm/x/ibc/callbacks/types" evmante "github.com/cosmos/evm/x/vm/ante" + evmtypes "github.com/cosmos/evm/x/vm/types" callbacktypes "github.com/cosmos/ibc-go/v10/modules/apps/callbacks/types" transfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" @@ -128,7 +128,7 @@ func (k ContractKeeper) IBCReceivePacketCallback( // with the gas retrieved from the EVM message result. cachedCtx, writeFn := ctx.CacheContext() cachedCtx = evmante.BuildEvmExecutionCtx(cachedCtx). - WithGasMeter(types2.NewInfiniteGasMeterWithLimit(cbData.CommitGasLimit)) + WithGasMeter(evmtypes.NewInfiniteGasMeterWithLimit(cbData.CommitGasLimit)) // receiver := sdk.MustAccAddressFromBech32(data.Receiver) receiver, err := sdk.AccAddressFromBech32(data.Receiver) @@ -297,7 +297,7 @@ func (k ContractKeeper) IBCOnAcknowledgementPacketCallback( // with the gas retrieved from the EVM message result. cachedCtx, writeFn := ctx.CacheContext() cachedCtx = evmante.BuildEvmExecutionCtx(cachedCtx). - WithGasMeter(types2.NewInfiniteGasMeterWithLimit(cbData.CommitGasLimit)) + WithGasMeter(evmtypes.NewInfiniteGasMeterWithLimit(cbData.CommitGasLimit)) if len(cbData.Calldata) != 0 { return errorsmod.Wrap(types.ErrInvalidCalldata, "acknowledgement callback data should not contain calldata") @@ -398,7 +398,7 @@ func (k ContractKeeper) IBCOnTimeoutPacketCallback( // with the gas retrieved from the EVM message result. cachedCtx, writeFn := ctx.CacheContext() cachedCtx = evmante.BuildEvmExecutionCtx(cachedCtx). - WithGasMeter(types2.NewInfiniteGasMeterWithLimit(cbData.CommitGasLimit)) + WithGasMeter(evmtypes.NewInfiniteGasMeterWithLimit(cbData.CommitGasLimit)) if len(cbData.Calldata) != 0 { return errorsmod.Wrap(types.ErrInvalidCalldata, "timeout callback data should not contain calldata") diff --git a/x/vm/keeper/grpc_query.go b/x/vm/keeper/grpc_query.go index f1c4058fa..f1a7be3b6 100644 --- a/x/vm/keeper/grpc_query.go +++ b/x/vm/keeper/grpc_query.go @@ -22,7 +22,7 @@ import ( tmproto "github.com/cometbft/cometbft/proto/tendermint/types" rpctypes "github.com/cosmos/evm/rpc/types" - cosmosevmtypes "github.com/cosmos/evm/types" + "github.com/cosmos/evm/utils" evmante "github.com/cosmos/evm/x/vm/ante" "github.com/cosmos/evm/x/vm/statedb" "github.com/cosmos/evm/x/vm/types" @@ -51,7 +51,7 @@ func (k Keeper) Account(c context.Context, req *types.QueryAccountRequest) (*typ return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := cosmosevmtypes.ValidateAddress(req.Address); err != nil { + if err := utils.ValidateAddress(req.Address); err != nil { return nil, status.Error( codes.InvalidArgument, err.Error(), ) @@ -74,7 +74,7 @@ func (k Keeper) CosmosAccount(c context.Context, req *types.QueryCosmosAccountRe return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := cosmosevmtypes.ValidateAddress(req.Address); err != nil { + if err := utils.ValidateAddress(req.Address); err != nil { return nil, status.Error( codes.InvalidArgument, err.Error(), ) @@ -144,7 +144,7 @@ func (k Keeper) Balance(c context.Context, req *types.QueryBalanceRequest) (*typ return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := cosmosevmtypes.ValidateAddress(req.Address); err != nil { + if err := utils.ValidateAddress(req.Address); err != nil { return nil, status.Error( codes.InvalidArgument, types.ErrZeroAddress.Error(), @@ -166,7 +166,7 @@ func (k Keeper) Storage(c context.Context, req *types.QueryStorageRequest) (*typ return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := cosmosevmtypes.ValidateAddress(req.Address); err != nil { + if err := utils.ValidateAddress(req.Address); err != nil { return nil, status.Error( codes.InvalidArgument, types.ErrZeroAddress.Error(), @@ -192,7 +192,7 @@ func (k Keeper) Code(c context.Context, req *types.QueryCodeRequest) (*types.Que return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := cosmosevmtypes.ValidateAddress(req.Address); err != nil { + if err := utils.ValidateAddress(req.Address); err != nil { return nil, status.Error( codes.InvalidArgument, types.ErrZeroAddress.Error(), @@ -793,5 +793,5 @@ func (k Keeper) Config(_ context.Context, _ *types.QueryConfigRequest) (*types.Q // 2. calling BuildEvmExecutionCtx to set up gas configs consistent with Ethereum transaction execution. func buildTraceCtx(ctx sdk.Context, gasLimit uint64) sdk.Context { return evmante.BuildEvmExecutionCtx(ctx). - WithGasMeter(cosmosevmtypes.NewInfiniteGasMeterWithLimit(gasLimit)) + WithGasMeter(types.NewInfiniteGasMeterWithLimit(gasLimit)) } diff --git a/x/vm/keeper/state_transition.go b/x/vm/keeper/state_transition.go index f9ceca246..eb8975cf2 100644 --- a/x/vm/keeper/state_transition.go +++ b/x/vm/keeper/state_transition.go @@ -14,8 +14,8 @@ import ( cmttypes "github.com/cometbft/cometbft/types" + antetypes "github.com/cosmos/evm/ante/types" rpctypes "github.com/cosmos/evm/rpc/types" - cosmosevmtypes "github.com/cosmos/evm/types" "github.com/cosmos/evm/utils" "github.com/cosmos/evm/x/vm/statedb" "github.com/cosmos/evm/x/vm/types" @@ -47,7 +47,7 @@ func (k *Keeper) NewEVMWithOverridePrecompiles( Transfer: core.Transfer, GetHash: k.GetHashFn(ctx), Coinbase: cfg.CoinBase, - GasLimit: cosmosevmtypes.BlockGasLimit(ctx), + GasLimit: antetypes.BlockGasLimit(ctx), BlockNumber: big.NewInt(ctx.BlockHeight()), Time: uint64(ctx.BlockHeader().Time.Unix()), //#nosec G115 -- int overflow is not a concern here Difficulty: big.NewInt(0), // unused. Only required in PoW context @@ -116,7 +116,7 @@ func (k *Keeper) NewEVM( // 3. The requested height is from a height greater than the latest one func (k Keeper) GetHashFn(ctx sdk.Context) vm.GetHashFunc { return func(height uint64) common.Hash { - h, err := cosmosevmtypes.SafeInt64(height) + h, err := utils.SafeInt64(height) if err != nil { k.Logger(ctx).Error("failed to cast height to int64", "error", err) return common.Hash{} diff --git a/types/gasmeter.go b/x/vm/types/gasmeter.go similarity index 100% rename from types/gasmeter.go rename to x/vm/types/gasmeter.go diff --git a/x/vm/types/genesis.go b/x/vm/types/genesis.go index f7190d294..039b8f580 100644 --- a/x/vm/types/genesis.go +++ b/x/vm/types/genesis.go @@ -3,12 +3,12 @@ package types import ( "fmt" - "github.com/cosmos/evm/types" + "github.com/cosmos/evm/utils" ) // Validate performs a basic validation of a GenesisAccount fields. func (ga GenesisAccount) Validate() error { - if err := types.ValidateAddress(ga.Address); err != nil { + if err := utils.ValidateAddress(ga.Address); err != nil { return err } return ga.Storage.Validate() diff --git a/x/vm/types/logs.go b/x/vm/types/logs.go index 5409a2097..7d14f1a4f 100644 --- a/x/vm/types/logs.go +++ b/x/vm/types/logs.go @@ -7,7 +7,7 @@ import ( "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - cosmosevmtypes "github.com/cosmos/evm/types" + "github.com/cosmos/evm/utils" ) // NewTransactionLogs creates a new NewTransactionLogs instance. @@ -28,7 +28,7 @@ func NewTransactionLogsFromEth(hash common.Hash, ethlogs []*ethtypes.Log) Transa // Validate performs a basic validation of a GenesisAccount fields. func (tx TransactionLogs) Validate() error { - if cosmosevmtypes.IsEmptyHash(tx.Hash) { + if utils.IsEmptyHash(tx.Hash) { return fmt.Errorf("hash cannot be the empty %s", tx.Hash) } @@ -53,16 +53,16 @@ func (tx TransactionLogs) EthLogs() []*ethtypes.Log { // Validate performs a basic validation of an ethereum Log fields. func (log *Log) Validate() error { - if err := cosmosevmtypes.ValidateAddress(log.Address); err != nil { + if err := utils.ValidateAddress(log.Address); err != nil { return fmt.Errorf("invalid log address %w", err) } - if cosmosevmtypes.IsEmptyHash(log.BlockHash) { + if utils.IsEmptyHash(log.BlockHash) { return fmt.Errorf("block hash cannot be the empty %s", log.BlockHash) } if log.BlockNumber == 0 { return errors.New("block number cannot be zero") } - if cosmosevmtypes.IsEmptyHash(log.TxHash) { + if utils.IsEmptyHash(log.TxHash) { return fmt.Errorf("tx hash cannot be the empty %s", log.TxHash) } return nil diff --git a/x/vm/types/params.go b/x/vm/types/params.go index d6991ae92..b861ea0c9 100644 --- a/x/vm/types/params.go +++ b/x/vm/types/params.go @@ -9,7 +9,7 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/params" - "github.com/cosmos/evm/types" + "github.com/cosmos/evm/utils" channeltypes "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v10/modules/core/24-host" @@ -172,7 +172,7 @@ func validateAllowlistAddresses(i interface{}) error { } for _, address := range addresses { - if err := types.ValidateAddress(address); err != nil { + if err := utils.ValidateAddress(address); err != nil { return fmt.Errorf("invalid whitelist address: %s", address) } } @@ -215,7 +215,7 @@ func ValidatePrecompiles(i interface{}) error { return fmt.Errorf("duplicate precompile %s", precompile) } - if err := types.ValidateAddress(precompile); err != nil { + if err := utils.ValidateAddress(precompile); err != nil { return fmt.Errorf("invalid precompile %s", precompile) }