From a1096d3239f02a5e83f39d2ff0d2b2d72df1621d Mon Sep 17 00:00:00 2001 From: Devon Bear Date: Thu, 1 Jun 2023 18:58:33 -0400 Subject: [PATCH] refactor(evm): Deprecate `x/bank` (#767) Co-authored-by: Cal Bera --- contracts/lib/forge-std | 2 +- .../api/polaris/evm/storage/v1/slot.pulsar.go | 665 ------ .../polaris/evm/v1alpha1/genesis.pulsar.go | 2089 ----------------- .../api/polaris/evm/v1alpha1/params.pulsar.go | 868 ------- .../api/polaris/evm/v1alpha1/query.pulsar.go | 1026 -------- .../api/polaris/evm/v1alpha1/query_grpc.pb.go | 131 -- cosmos/api/polaris/evm/v1alpha1/tx.pulsar.go | 1083 +-------- cosmos/api/polaris/evm/v1alpha1/tx_grpc.pb.go | 45 - cosmos/docker/local/config/polaris.toml | 2 +- cosmos/docker/local/docker-init.sh | 6 - cosmos/init.sh | 5 - cosmos/precompile/auth/auth_test.go | 38 +- .../proto/polaris/evm/storage/v1/slot.proto | 34 - .../proto/polaris/evm/v1alpha1/genesis.proto | 48 - .../proto/polaris/evm/v1alpha1/params.proto | 43 - cosmos/proto/polaris/evm/v1alpha1/query.proto | 45 - cosmos/proto/polaris/evm/v1alpha1/tx.proto | 32 - .../distribution/distribution_test.go | 31 +- .../precompile/gov/governance_test.go | 7 - .../precompile/staking/staking_test.go | 26 +- cosmos/testing/network/network.go | 22 +- cosmos/x/erc20/types/params.go | 5 - cosmos/x/evm/depinject.go | 4 +- cosmos/x/evm/genesis.go | 40 +- cosmos/x/evm/keeper/genesis.go | 10 +- cosmos/x/evm/keeper/host.go | 6 +- cosmos/x/evm/keeper/keeper.go | 6 +- cosmos/x/evm/keeper/msg_server.go | 24 - cosmos/x/evm/keeper/processor_test.go | 20 +- cosmos/x/evm/module.go | 7 +- cosmos/x/evm/plugins/base.go | 6 +- cosmos/x/evm/plugins/block/plugin.go | 2 + cosmos/x/evm/plugins/configuration/genesis.go | 10 +- cosmos/x/evm/plugins/configuration/plugin.go | 27 +- .../evm/plugins/configuration/plugin_test.go | 40 +- cosmos/x/evm/plugins/configuration/store.go | 25 +- .../x/evm/plugins/configuration/store_test.go | 98 +- cosmos/x/evm/plugins/state/genesis.go | 87 +- cosmos/x/evm/plugins/state/genesis_test.go | 69 +- cosmos/x/evm/plugins/state/interfaces.go | 16 - cosmos/x/evm/plugins/state/keys.go | 17 +- cosmos/x/evm/plugins/state/keys_test.go | 10 - cosmos/x/evm/plugins/state/plugin.go | 70 +- .../plugins/state/plugin_benchmark_test.go | 4 +- cosmos/x/evm/plugins/state/plugin_test.go | 62 +- cosmos/x/evm/plugins/state/storage/errors.go | 25 - cosmos/x/evm/plugins/state/storage/slot.pb.go | 370 --- .../x/evm/plugins/state/storage/slot_test.go | 89 - cosmos/x/evm/plugins/state/storage/storage.go | 73 - .../evm/plugins/state/storage/storage_test.go | 94 - .../plugins/txpool/mempool/mempool_test.go | 10 +- cosmos/x/evm/plugins/txpool/plugin.go | 8 +- cosmos/x/evm/plugins/txpool/serializer.go | 22 +- cosmos/x/evm/types/codec.go | 1 - cosmos/x/evm/types/errors.go | 29 - cosmos/x/evm/types/genesis.go | 69 - cosmos/x/evm/types/genesis.pb.go | 1016 -------- cosmos/x/evm/types/genesis_test.go | 81 - cosmos/x/evm/types/keys.go | 3 + cosmos/x/evm/types/params.go | 67 - cosmos/x/evm/types/params.pb.go | 490 ---- cosmos/x/evm/types/params_test.go | 36 - cosmos/x/evm/types/query.pb.go | 536 ----- cosmos/x/evm/types/query.pb.gw.go | 153 -- cosmos/x/evm/types/tx.pb.go | 468 +--- cosmos/x/evm/types/update_params.go | 46 - .../docs/for-frontend-devs/chain-config.mdx | 54 +- .../for-frontend-devs/staking-example.mdx | 1611 ++++++------- docs/web/pages/docs/using-metamask.mdx | 21 +- eth/common/hexutil/imported.go | 2 + eth/core/chain_resources.go | 2 +- eth/core/chain_writer.go | 3 +- .../storage/slot.go => eth/core/genesis.go | 63 +- eth/core/host.go | 2 - eth/core/mock/config_plugin.go | 3 - eth/core/mock/config_plugin.mock.go | 37 - eth/core/processor.go | 1 - eth/core/processor_test.go | 2 +- eth/core/state/mock/state.go | 2 +- eth/polar/backend.go | 4 + go.work.sum | 1 + 81 files changed, 1317 insertions(+), 11090 deletions(-) delete mode 100644 cosmos/api/polaris/evm/storage/v1/slot.pulsar.go delete mode 100644 cosmos/api/polaris/evm/v1alpha1/genesis.pulsar.go delete mode 100644 cosmos/api/polaris/evm/v1alpha1/params.pulsar.go delete mode 100644 cosmos/api/polaris/evm/v1alpha1/query.pulsar.go delete mode 100644 cosmos/api/polaris/evm/v1alpha1/query_grpc.pb.go delete mode 100644 cosmos/proto/polaris/evm/storage/v1/slot.proto delete mode 100644 cosmos/proto/polaris/evm/v1alpha1/genesis.proto delete mode 100644 cosmos/proto/polaris/evm/v1alpha1/params.proto delete mode 100644 cosmos/proto/polaris/evm/v1alpha1/query.proto delete mode 100644 cosmos/x/evm/plugins/state/storage/errors.go delete mode 100644 cosmos/x/evm/plugins/state/storage/slot.pb.go delete mode 100644 cosmos/x/evm/plugins/state/storage/slot_test.go delete mode 100644 cosmos/x/evm/plugins/state/storage/storage.go delete mode 100644 cosmos/x/evm/plugins/state/storage/storage_test.go delete mode 100644 cosmos/x/evm/types/errors.go delete mode 100644 cosmos/x/evm/types/genesis.go delete mode 100644 cosmos/x/evm/types/genesis.pb.go delete mode 100644 cosmos/x/evm/types/genesis_test.go delete mode 100644 cosmos/x/evm/types/params.go delete mode 100644 cosmos/x/evm/types/params.pb.go delete mode 100644 cosmos/x/evm/types/params_test.go delete mode 100644 cosmos/x/evm/types/query.pb.go delete mode 100644 cosmos/x/evm/types/query.pb.gw.go delete mode 100644 cosmos/x/evm/types/update_params.go rename cosmos/x/evm/plugins/state/storage/slot.go => eth/core/genesis.go (51%) diff --git a/contracts/lib/forge-std b/contracts/lib/forge-std index fc560fa34..9fec3a496 160000 --- a/contracts/lib/forge-std +++ b/contracts/lib/forge-std @@ -1 +1 @@ -Subproject commit fc560fa34fa12a335a50c35d92e55a6628ca467c +Subproject commit 9fec3a49630d8086cac96ea8ff3a2137a23f96ed diff --git a/cosmos/api/polaris/evm/storage/v1/slot.pulsar.go b/cosmos/api/polaris/evm/storage/v1/slot.pulsar.go deleted file mode 100644 index dfb56e34a..000000000 --- a/cosmos/api/polaris/evm/storage/v1/slot.pulsar.go +++ /dev/null @@ -1,665 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package storagev1 - -import ( - fmt "fmt" - runtime "github.com/cosmos/cosmos-proto/runtime" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_Slot protoreflect.MessageDescriptor - fd_Slot_key protoreflect.FieldDescriptor - fd_Slot_value protoreflect.FieldDescriptor -) - -func init() { - file_polaris_evm_storage_v1_slot_proto_init() - md_Slot = File_polaris_evm_storage_v1_slot_proto.Messages().ByName("Slot") - fd_Slot_key = md_Slot.Fields().ByName("key") - fd_Slot_value = md_Slot.Fields().ByName("value") -} - -var _ protoreflect.Message = (*fastReflection_Slot)(nil) - -type fastReflection_Slot Slot - -func (x *Slot) ProtoReflect() protoreflect.Message { - return (*fastReflection_Slot)(x) -} - -func (x *Slot) slowProtoReflect() protoreflect.Message { - mi := &file_polaris_evm_storage_v1_slot_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_Slot_messageType fastReflection_Slot_messageType -var _ protoreflect.MessageType = fastReflection_Slot_messageType{} - -type fastReflection_Slot_messageType struct{} - -func (x fastReflection_Slot_messageType) Zero() protoreflect.Message { - return (*fastReflection_Slot)(nil) -} -func (x fastReflection_Slot_messageType) New() protoreflect.Message { - return new(fastReflection_Slot) -} -func (x fastReflection_Slot_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Slot -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Slot) Descriptor() protoreflect.MessageDescriptor { - return md_Slot -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_Slot) Type() protoreflect.MessageType { - return _fastReflection_Slot_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Slot) New() protoreflect.Message { - return new(fastReflection_Slot) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Slot) Interface() protoreflect.ProtoMessage { - return (*Slot)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_Slot) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Key != "" { - value := protoreflect.ValueOfString(x.Key) - if !f(fd_Slot_key, value) { - return - } - } - if x.Value != "" { - value := protoreflect.ValueOfString(x.Value) - if !f(fd_Slot_value, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_Slot) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "polaris.evm.storage.v1.Slot.key": - return x.Key != "" - case "polaris.evm.storage.v1.Slot.value": - return x.Value != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.storage.v1.Slot")) - } - panic(fmt.Errorf("message polaris.evm.storage.v1.Slot does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Slot) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "polaris.evm.storage.v1.Slot.key": - x.Key = "" - case "polaris.evm.storage.v1.Slot.value": - x.Value = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.storage.v1.Slot")) - } - panic(fmt.Errorf("message polaris.evm.storage.v1.Slot does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_Slot) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "polaris.evm.storage.v1.Slot.key": - value := x.Key - return protoreflect.ValueOfString(value) - case "polaris.evm.storage.v1.Slot.value": - value := x.Value - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.storage.v1.Slot")) - } - panic(fmt.Errorf("message polaris.evm.storage.v1.Slot does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Slot) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "polaris.evm.storage.v1.Slot.key": - x.Key = value.Interface().(string) - case "polaris.evm.storage.v1.Slot.value": - x.Value = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.storage.v1.Slot")) - } - panic(fmt.Errorf("message polaris.evm.storage.v1.Slot does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Slot) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "polaris.evm.storage.v1.Slot.key": - panic(fmt.Errorf("field key of message polaris.evm.storage.v1.Slot is not mutable")) - case "polaris.evm.storage.v1.Slot.value": - panic(fmt.Errorf("field value of message polaris.evm.storage.v1.Slot is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.storage.v1.Slot")) - } - panic(fmt.Errorf("message polaris.evm.storage.v1.Slot does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_Slot) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "polaris.evm.storage.v1.Slot.key": - return protoreflect.ValueOfString("") - case "polaris.evm.storage.v1.Slot.value": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.storage.v1.Slot")) - } - panic(fmt.Errorf("message polaris.evm.storage.v1.Slot does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_Slot) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in polaris.evm.storage.v1.Slot", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_Slot) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Slot) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_Slot) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_Slot) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Slot) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Key) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Value) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Slot) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Value) > 0 { - i -= len(x.Value) - copy(dAtA[i:], x.Value) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Value))) - i-- - dAtA[i] = 0x12 - } - if len(x.Key) > 0 { - i -= len(x.Key) - copy(dAtA[i:], x.Key) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Key))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Slot) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Slot: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Slot: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: polaris/evm/storage/v1/slot.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// `Slot` represents a single key/value pair of evm state data. -type Slot struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // `key` is the stored key. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // `value` is the stored value for the given key. - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *Slot) Reset() { - *x = Slot{} - if protoimpl.UnsafeEnabled { - mi := &file_polaris_evm_storage_v1_slot_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Slot) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Slot) ProtoMessage() {} - -// Deprecated: Use Slot.ProtoReflect.Descriptor instead. -func (*Slot) Descriptor() ([]byte, []int) { - return file_polaris_evm_storage_v1_slot_proto_rawDescGZIP(), []int{0} -} - -func (x *Slot) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *Slot) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -var File_polaris_evm_storage_v1_slot_proto protoreflect.FileDescriptor - -var file_polaris_evm_storage_v1_slot_proto_rawDesc = []byte{ - 0x0a, 0x21, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x73, 0x74, - 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x6c, 0x6f, 0x74, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, - 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x22, 0x2e, 0x0a, 0x04, 0x53, - 0x6c, 0x6f, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0xd5, 0x01, 0x0a, 0x1a, - 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, - 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x09, 0x53, 0x6c, 0x6f, 0x74, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, - 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, - 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x31, - 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x50, 0x45, 0x53, - 0xaa, 0x02, 0x16, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, 0x53, - 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x16, 0x50, 0x6f, 0x6c, 0x61, - 0x72, 0x69, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5c, - 0x56, 0x31, 0xe2, 0x02, 0x22, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x5c, 0x45, 0x76, 0x6d, - 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, - 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x6d, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x3a, - 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_polaris_evm_storage_v1_slot_proto_rawDescOnce sync.Once - file_polaris_evm_storage_v1_slot_proto_rawDescData = file_polaris_evm_storage_v1_slot_proto_rawDesc -) - -func file_polaris_evm_storage_v1_slot_proto_rawDescGZIP() []byte { - file_polaris_evm_storage_v1_slot_proto_rawDescOnce.Do(func() { - file_polaris_evm_storage_v1_slot_proto_rawDescData = protoimpl.X.CompressGZIP(file_polaris_evm_storage_v1_slot_proto_rawDescData) - }) - return file_polaris_evm_storage_v1_slot_proto_rawDescData -} - -var file_polaris_evm_storage_v1_slot_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_polaris_evm_storage_v1_slot_proto_goTypes = []interface{}{ - (*Slot)(nil), // 0: polaris.evm.storage.v1.Slot -} -var file_polaris_evm_storage_v1_slot_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 - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_polaris_evm_storage_v1_slot_proto_init() } -func file_polaris_evm_storage_v1_slot_proto_init() { - if File_polaris_evm_storage_v1_slot_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_polaris_evm_storage_v1_slot_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Slot); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_polaris_evm_storage_v1_slot_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_polaris_evm_storage_v1_slot_proto_goTypes, - DependencyIndexes: file_polaris_evm_storage_v1_slot_proto_depIdxs, - MessageInfos: file_polaris_evm_storage_v1_slot_proto_msgTypes, - }.Build() - File_polaris_evm_storage_v1_slot_proto = out.File - file_polaris_evm_storage_v1_slot_proto_rawDesc = nil - file_polaris_evm_storage_v1_slot_proto_goTypes = nil - file_polaris_evm_storage_v1_slot_proto_depIdxs = nil -} diff --git a/cosmos/api/polaris/evm/v1alpha1/genesis.pulsar.go b/cosmos/api/polaris/evm/v1alpha1/genesis.pulsar.go deleted file mode 100644 index 2fdbd0ab1..000000000 --- a/cosmos/api/polaris/evm/v1alpha1/genesis.pulsar.go +++ /dev/null @@ -1,2089 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package evmv1alpha1 - -import ( - fmt "fmt" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sort "sort" - sync "sync" -) - -var _ protoreflect.Map = (*_GenesisState_2_map)(nil) - -type _GenesisState_2_map struct { - m *map[string]*Contract -} - -func (x *_GenesisState_2_map) Len() int { - if x.m == nil { - return 0 - } - return len(*x.m) -} - -func (x *_GenesisState_2_map) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) { - if x.m == nil { - return - } - for k, v := range *x.m { - mapKey := (protoreflect.MapKey)(protoreflect.ValueOfString(k)) - mapValue := protoreflect.ValueOfMessage(v.ProtoReflect()) - if !f(mapKey, mapValue) { - break - } - } -} - -func (x *_GenesisState_2_map) Has(key protoreflect.MapKey) bool { - if x.m == nil { - return false - } - keyUnwrapped := key.String() - concreteValue := keyUnwrapped - _, ok := (*x.m)[concreteValue] - return ok -} - -func (x *_GenesisState_2_map) Clear(key protoreflect.MapKey) { - if x.m == nil { - return - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - delete(*x.m, concreteKey) -} - -func (x *_GenesisState_2_map) Get(key protoreflect.MapKey) protoreflect.Value { - if x.m == nil { - return protoreflect.Value{} - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - v, ok := (*x.m)[concreteKey] - if !ok { - return protoreflect.Value{} - } - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GenesisState_2_map) Set(key protoreflect.MapKey, value protoreflect.Value) { - if !key.IsValid() || !value.IsValid() { - panic("invalid key or value provided") - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Contract) - (*x.m)[concreteKey] = concreteValue -} - -func (x *_GenesisState_2_map) Mutable(key protoreflect.MapKey) protoreflect.Value { - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - v, ok := (*x.m)[concreteKey] - if ok { - return protoreflect.ValueOfMessage(v.ProtoReflect()) - } - newValue := new(Contract) - (*x.m)[concreteKey] = newValue - return protoreflect.ValueOfMessage(newValue.ProtoReflect()) -} - -func (x *_GenesisState_2_map) NewValue() protoreflect.Value { - v := new(Contract) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GenesisState_2_map) IsValid() bool { - return x.m != nil -} - -var _ protoreflect.Map = (*_GenesisState_3_map)(nil) - -type _GenesisState_3_map struct { - m *map[string]string -} - -func (x *_GenesisState_3_map) Len() int { - if x.m == nil { - return 0 - } - return len(*x.m) -} - -func (x *_GenesisState_3_map) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) { - if x.m == nil { - return - } - for k, v := range *x.m { - mapKey := (protoreflect.MapKey)(protoreflect.ValueOfString(k)) - mapValue := protoreflect.ValueOfString(v) - if !f(mapKey, mapValue) { - break - } - } -} - -func (x *_GenesisState_3_map) Has(key protoreflect.MapKey) bool { - if x.m == nil { - return false - } - keyUnwrapped := key.String() - concreteValue := keyUnwrapped - _, ok := (*x.m)[concreteValue] - return ok -} - -func (x *_GenesisState_3_map) Clear(key protoreflect.MapKey) { - if x.m == nil { - return - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - delete(*x.m, concreteKey) -} - -func (x *_GenesisState_3_map) Get(key protoreflect.MapKey) protoreflect.Value { - if x.m == nil { - return protoreflect.Value{} - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - v, ok := (*x.m)[concreteKey] - if !ok { - return protoreflect.Value{} - } - return protoreflect.ValueOfString(v) -} - -func (x *_GenesisState_3_map) Set(key protoreflect.MapKey, value protoreflect.Value) { - if !key.IsValid() || !value.IsValid() { - panic("invalid key or value provided") - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - (*x.m)[concreteKey] = concreteValue -} - -func (x *_GenesisState_3_map) Mutable(key protoreflect.MapKey) protoreflect.Value { - panic("should not call Mutable on protoreflect.Map whose value is not of type protoreflect.Message") -} - -func (x *_GenesisState_3_map) NewValue() protoreflect.Value { - v := "" - return protoreflect.ValueOfString(v) -} - -func (x *_GenesisState_3_map) IsValid() bool { - return x.m != nil -} - -var ( - md_GenesisState protoreflect.MessageDescriptor - fd_GenesisState_params protoreflect.FieldDescriptor - fd_GenesisState_address_to_contract protoreflect.FieldDescriptor - fd_GenesisState_hash_to_code protoreflect.FieldDescriptor -) - -func init() { - file_polaris_evm_v1alpha1_genesis_proto_init() - md_GenesisState = File_polaris_evm_v1alpha1_genesis_proto.Messages().ByName("GenesisState") - fd_GenesisState_params = md_GenesisState.Fields().ByName("params") - fd_GenesisState_address_to_contract = md_GenesisState.Fields().ByName("address_to_contract") - fd_GenesisState_hash_to_code = md_GenesisState.Fields().ByName("hash_to_code") -} - -var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) - -type fastReflection_GenesisState GenesisState - -func (x *GenesisState) ProtoReflect() protoreflect.Message { - return (*fastReflection_GenesisState)(x) -} - -func (x *GenesisState) slowProtoReflect() protoreflect.Message { - mi := &file_polaris_evm_v1alpha1_genesis_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType -var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} - -type fastReflection_GenesisState_messageType struct{} - -func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { - return (*fastReflection_GenesisState)(nil) -} -func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { - return new(fastReflection_GenesisState) -} -func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GenesisState -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { - return md_GenesisState -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_GenesisState) Type() protoreflect.MessageType { - return _fastReflection_GenesisState_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GenesisState) New() protoreflect.Message { - return new(fastReflection_GenesisState) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { - return (*GenesisState)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Params != nil { - value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - if !f(fd_GenesisState_params, value) { - return - } - } - if len(x.AddressToContract) != 0 { - value := protoreflect.ValueOfMap(&_GenesisState_2_map{m: &x.AddressToContract}) - if !f(fd_GenesisState_address_to_contract, value) { - return - } - } - if len(x.HashToCode) != 0 { - value := protoreflect.ValueOfMap(&_GenesisState_3_map{m: &x.HashToCode}) - if !f(fd_GenesisState_hash_to_code, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "polaris.evm.v1alpha1.GenesisState.params": - return x.Params != nil - case "polaris.evm.v1alpha1.GenesisState.address_to_contract": - return len(x.AddressToContract) != 0 - case "polaris.evm.v1alpha1.GenesisState.hash_to_code": - return len(x.HashToCode) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.GenesisState")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "polaris.evm.v1alpha1.GenesisState.params": - x.Params = nil - case "polaris.evm.v1alpha1.GenesisState.address_to_contract": - x.AddressToContract = nil - case "polaris.evm.v1alpha1.GenesisState.hash_to_code": - x.HashToCode = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.GenesisState")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "polaris.evm.v1alpha1.GenesisState.params": - value := x.Params - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "polaris.evm.v1alpha1.GenesisState.address_to_contract": - if len(x.AddressToContract) == 0 { - return protoreflect.ValueOfMap(&_GenesisState_2_map{}) - } - mapValue := &_GenesisState_2_map{m: &x.AddressToContract} - return protoreflect.ValueOfMap(mapValue) - case "polaris.evm.v1alpha1.GenesisState.hash_to_code": - if len(x.HashToCode) == 0 { - return protoreflect.ValueOfMap(&_GenesisState_3_map{}) - } - mapValue := &_GenesisState_3_map{m: &x.HashToCode} - return protoreflect.ValueOfMap(mapValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.GenesisState")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.GenesisState does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "polaris.evm.v1alpha1.GenesisState.params": - x.Params = value.Message().Interface().(*Params) - case "polaris.evm.v1alpha1.GenesisState.address_to_contract": - mv := value.Map() - cmv := mv.(*_GenesisState_2_map) - x.AddressToContract = *cmv.m - case "polaris.evm.v1alpha1.GenesisState.hash_to_code": - mv := value.Map() - cmv := mv.(*_GenesisState_3_map) - x.HashToCode = *cmv.m - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.GenesisState")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "polaris.evm.v1alpha1.GenesisState.params": - if x.Params == nil { - x.Params = new(Params) - } - return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - case "polaris.evm.v1alpha1.GenesisState.address_to_contract": - if x.AddressToContract == nil { - x.AddressToContract = make(map[string]*Contract) - } - value := &_GenesisState_2_map{m: &x.AddressToContract} - return protoreflect.ValueOfMap(value) - case "polaris.evm.v1alpha1.GenesisState.hash_to_code": - if x.HashToCode == nil { - x.HashToCode = make(map[string]string) - } - value := &_GenesisState_3_map{m: &x.HashToCode} - return protoreflect.ValueOfMap(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.GenesisState")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "polaris.evm.v1alpha1.GenesisState.params": - m := new(Params) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "polaris.evm.v1alpha1.GenesisState.address_to_contract": - m := make(map[string]*Contract) - return protoreflect.ValueOfMap(&_GenesisState_2_map{m: &m}) - case "polaris.evm.v1alpha1.GenesisState.hash_to_code": - m := make(map[string]string) - return protoreflect.ValueOfMap(&_GenesisState_3_map{m: &m}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.GenesisState")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in polaris.evm.v1alpha1.GenesisState", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_GenesisState) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GenesisState) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Params != nil { - l = options.Size(x.Params) - n += 1 + l + runtime.Sov(uint64(l)) - } - if len(x.AddressToContract) > 0 { - SiZeMaP := func(k string, v *Contract) { - l := 0 - if v != nil { - l = options.Size(v) - } - l += 1 + runtime.Sov(uint64(l)) - mapEntrySize := 1 + len(k) + runtime.Sov(uint64(len(k))) + l - n += mapEntrySize + 1 + runtime.Sov(uint64(mapEntrySize)) - } - if options.Deterministic { - sortme := make([]string, 0, len(x.AddressToContract)) - for k := range x.AddressToContract { - sortme = append(sortme, k) - } - sort.Strings(sortme) - for _, k := range sortme { - v := x.AddressToContract[k] - SiZeMaP(k, v) - } - } else { - for k, v := range x.AddressToContract { - SiZeMaP(k, v) - } - } - } - if len(x.HashToCode) > 0 { - SiZeMaP := func(k string, v string) { - mapEntrySize := 1 + len(k) + runtime.Sov(uint64(len(k))) + 1 + len(v) + runtime.Sov(uint64(len(v))) - n += mapEntrySize + 1 + runtime.Sov(uint64(mapEntrySize)) - } - if options.Deterministic { - sortme := make([]string, 0, len(x.HashToCode)) - for k := range x.HashToCode { - sortme = append(sortme, k) - } - sort.Strings(sortme) - for _, k := range sortme { - v := x.HashToCode[k] - SiZeMaP(k, v) - } - } else { - for k, v := range x.HashToCode { - SiZeMaP(k, v) - } - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GenesisState) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.HashToCode) > 0 { - MaRsHaLmAp := func(k string, v string) (protoiface.MarshalOutput, error) { - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = runtime.EncodeVarint(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = runtime.EncodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = runtime.EncodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x1a - return protoiface.MarshalOutput{}, nil - } - if options.Deterministic { - keysForHashToCode := make([]string, 0, len(x.HashToCode)) - for k := range x.HashToCode { - keysForHashToCode = append(keysForHashToCode, string(k)) - } - sort.Slice(keysForHashToCode, func(i, j int) bool { - return keysForHashToCode[i] < keysForHashToCode[j] - }) - for iNdEx := len(keysForHashToCode) - 1; iNdEx >= 0; iNdEx-- { - v := x.HashToCode[string(keysForHashToCode[iNdEx])] - out, err := MaRsHaLmAp(keysForHashToCode[iNdEx], v) - if err != nil { - return out, err - } - } - } else { - for k := range x.HashToCode { - v := x.HashToCode[k] - out, err := MaRsHaLmAp(k, v) - if err != nil { - return out, err - } - } - } - } - if len(x.AddressToContract) > 0 { - MaRsHaLmAp := func(k string, v *Contract) (protoiface.MarshalOutput, error) { - baseI := i - encoded, err := options.Marshal(v) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = runtime.EncodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = runtime.EncodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x12 - return protoiface.MarshalOutput{}, nil - } - if options.Deterministic { - keysForAddressToContract := make([]string, 0, len(x.AddressToContract)) - for k := range x.AddressToContract { - keysForAddressToContract = append(keysForAddressToContract, string(k)) - } - sort.Slice(keysForAddressToContract, func(i, j int) bool { - return keysForAddressToContract[i] < keysForAddressToContract[j] - }) - for iNdEx := len(keysForAddressToContract) - 1; iNdEx >= 0; iNdEx-- { - v := x.AddressToContract[string(keysForAddressToContract[iNdEx])] - out, err := MaRsHaLmAp(keysForAddressToContract[iNdEx], v) - if err != nil { - return out, err - } - } - } else { - for k := range x.AddressToContract { - v := x.AddressToContract[k] - out, err := MaRsHaLmAp(k, v) - if err != nil { - return out, err - } - } - } - } - if x.Params != nil { - encoded, err := options.Marshal(x.Params) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GenesisState) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Params == nil { - x.Params = &Params{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AddressToContract", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.AddressToContract == nil { - x.AddressToContract = make(map[string]*Contract) - } - var mapkey string - var mapvalue *Contract - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postStringIndexmapkey > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postmsgIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - mapvalue = &Contract{} - if err := options.Unmarshal(dAtA[iNdEx:postmsgIndex], mapvalue); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > postIndex { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - x.AddressToContract[mapkey] = mapvalue - iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field HashToCode", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.HashToCode == nil { - x.HashToCode = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postStringIndexmapkey > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postStringIndexmapvalue > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > postIndex { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - x.HashToCode[mapkey] = mapvalue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.Map = (*_Contract_2_map)(nil) - -type _Contract_2_map struct { - m *map[string]string -} - -func (x *_Contract_2_map) Len() int { - if x.m == nil { - return 0 - } - return len(*x.m) -} - -func (x *_Contract_2_map) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) { - if x.m == nil { - return - } - for k, v := range *x.m { - mapKey := (protoreflect.MapKey)(protoreflect.ValueOfString(k)) - mapValue := protoreflect.ValueOfString(v) - if !f(mapKey, mapValue) { - break - } - } -} - -func (x *_Contract_2_map) Has(key protoreflect.MapKey) bool { - if x.m == nil { - return false - } - keyUnwrapped := key.String() - concreteValue := keyUnwrapped - _, ok := (*x.m)[concreteValue] - return ok -} - -func (x *_Contract_2_map) Clear(key protoreflect.MapKey) { - if x.m == nil { - return - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - delete(*x.m, concreteKey) -} - -func (x *_Contract_2_map) Get(key protoreflect.MapKey) protoreflect.Value { - if x.m == nil { - return protoreflect.Value{} - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - v, ok := (*x.m)[concreteKey] - if !ok { - return protoreflect.Value{} - } - return protoreflect.ValueOfString(v) -} - -func (x *_Contract_2_map) Set(key protoreflect.MapKey, value protoreflect.Value) { - if !key.IsValid() || !value.IsValid() { - panic("invalid key or value provided") - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - (*x.m)[concreteKey] = concreteValue -} - -func (x *_Contract_2_map) Mutable(key protoreflect.MapKey) protoreflect.Value { - panic("should not call Mutable on protoreflect.Map whose value is not of type protoreflect.Message") -} - -func (x *_Contract_2_map) NewValue() protoreflect.Value { - v := "" - return protoreflect.ValueOfString(v) -} - -func (x *_Contract_2_map) IsValid() bool { - return x.m != nil -} - -var ( - md_Contract protoreflect.MessageDescriptor - fd_Contract_code_hash protoreflect.FieldDescriptor - fd_Contract_slot_to_value protoreflect.FieldDescriptor -) - -func init() { - file_polaris_evm_v1alpha1_genesis_proto_init() - md_Contract = File_polaris_evm_v1alpha1_genesis_proto.Messages().ByName("Contract") - fd_Contract_code_hash = md_Contract.Fields().ByName("code_hash") - fd_Contract_slot_to_value = md_Contract.Fields().ByName("slot_to_value") -} - -var _ protoreflect.Message = (*fastReflection_Contract)(nil) - -type fastReflection_Contract Contract - -func (x *Contract) ProtoReflect() protoreflect.Message { - return (*fastReflection_Contract)(x) -} - -func (x *Contract) slowProtoReflect() protoreflect.Message { - mi := &file_polaris_evm_v1alpha1_genesis_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_Contract_messageType fastReflection_Contract_messageType -var _ protoreflect.MessageType = fastReflection_Contract_messageType{} - -type fastReflection_Contract_messageType struct{} - -func (x fastReflection_Contract_messageType) Zero() protoreflect.Message { - return (*fastReflection_Contract)(nil) -} -func (x fastReflection_Contract_messageType) New() protoreflect.Message { - return new(fastReflection_Contract) -} -func (x fastReflection_Contract_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Contract -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Contract) Descriptor() protoreflect.MessageDescriptor { - return md_Contract -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_Contract) Type() protoreflect.MessageType { - return _fastReflection_Contract_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Contract) New() protoreflect.Message { - return new(fastReflection_Contract) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Contract) Interface() protoreflect.ProtoMessage { - return (*Contract)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_Contract) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.CodeHash != "" { - value := protoreflect.ValueOfString(x.CodeHash) - if !f(fd_Contract_code_hash, value) { - return - } - } - if len(x.SlotToValue) != 0 { - value := protoreflect.ValueOfMap(&_Contract_2_map{m: &x.SlotToValue}) - if !f(fd_Contract_slot_to_value, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_Contract) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "polaris.evm.v1alpha1.Contract.code_hash": - return x.CodeHash != "" - case "polaris.evm.v1alpha1.Contract.slot_to_value": - return len(x.SlotToValue) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.Contract")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.Contract does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Contract) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "polaris.evm.v1alpha1.Contract.code_hash": - x.CodeHash = "" - case "polaris.evm.v1alpha1.Contract.slot_to_value": - x.SlotToValue = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.Contract")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.Contract does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_Contract) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "polaris.evm.v1alpha1.Contract.code_hash": - value := x.CodeHash - return protoreflect.ValueOfString(value) - case "polaris.evm.v1alpha1.Contract.slot_to_value": - if len(x.SlotToValue) == 0 { - return protoreflect.ValueOfMap(&_Contract_2_map{}) - } - mapValue := &_Contract_2_map{m: &x.SlotToValue} - return protoreflect.ValueOfMap(mapValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.Contract")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.Contract does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Contract) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "polaris.evm.v1alpha1.Contract.code_hash": - x.CodeHash = value.Interface().(string) - case "polaris.evm.v1alpha1.Contract.slot_to_value": - mv := value.Map() - cmv := mv.(*_Contract_2_map) - x.SlotToValue = *cmv.m - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.Contract")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.Contract does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Contract) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "polaris.evm.v1alpha1.Contract.slot_to_value": - if x.SlotToValue == nil { - x.SlotToValue = make(map[string]string) - } - value := &_Contract_2_map{m: &x.SlotToValue} - return protoreflect.ValueOfMap(value) - case "polaris.evm.v1alpha1.Contract.code_hash": - panic(fmt.Errorf("field code_hash of message polaris.evm.v1alpha1.Contract is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.Contract")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.Contract does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_Contract) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "polaris.evm.v1alpha1.Contract.code_hash": - return protoreflect.ValueOfString("") - case "polaris.evm.v1alpha1.Contract.slot_to_value": - m := make(map[string]string) - return protoreflect.ValueOfMap(&_Contract_2_map{m: &m}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.Contract")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.Contract does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_Contract) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in polaris.evm.v1alpha1.Contract", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_Contract) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Contract) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_Contract) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_Contract) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Contract) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.CodeHash) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if len(x.SlotToValue) > 0 { - SiZeMaP := func(k string, v string) { - mapEntrySize := 1 + len(k) + runtime.Sov(uint64(len(k))) + 1 + len(v) + runtime.Sov(uint64(len(v))) - n += mapEntrySize + 1 + runtime.Sov(uint64(mapEntrySize)) - } - if options.Deterministic { - sortme := make([]string, 0, len(x.SlotToValue)) - for k := range x.SlotToValue { - sortme = append(sortme, k) - } - sort.Strings(sortme) - for _, k := range sortme { - v := x.SlotToValue[k] - SiZeMaP(k, v) - } - } else { - for k, v := range x.SlotToValue { - SiZeMaP(k, v) - } - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Contract) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.SlotToValue) > 0 { - MaRsHaLmAp := func(k string, v string) (protoiface.MarshalOutput, error) { - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = runtime.EncodeVarint(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = runtime.EncodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = runtime.EncodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x12 - return protoiface.MarshalOutput{}, nil - } - if options.Deterministic { - keysForSlotToValue := make([]string, 0, len(x.SlotToValue)) - for k := range x.SlotToValue { - keysForSlotToValue = append(keysForSlotToValue, string(k)) - } - sort.Slice(keysForSlotToValue, func(i, j int) bool { - return keysForSlotToValue[i] < keysForSlotToValue[j] - }) - for iNdEx := len(keysForSlotToValue) - 1; iNdEx >= 0; iNdEx-- { - v := x.SlotToValue[string(keysForSlotToValue[iNdEx])] - out, err := MaRsHaLmAp(keysForSlotToValue[iNdEx], v) - if err != nil { - return out, err - } - } - } else { - for k := range x.SlotToValue { - v := x.SlotToValue[k] - out, err := MaRsHaLmAp(k, v) - if err != nil { - return out, err - } - } - } - } - if len(x.CodeHash) > 0 { - i -= len(x.CodeHash) - copy(dAtA[i:], x.CodeHash) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.CodeHash))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Contract) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Contract: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Contract: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.CodeHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SlotToValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.SlotToValue == nil { - x.SlotToValue = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postStringIndexmapkey > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postStringIndexmapvalue > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > postIndex { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - x.SlotToValue[mapkey] = mapvalue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: polaris/evm/v1alpha1/genesis.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// GenesisState defines the evm module's genesis state. -type GenesisState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // params defines all the parameters of the module. - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` - // `address_to_contract` is a map of address to contract. - AddressToContract map[string]*Contract `protobuf:"bytes,2,rep,name=address_to_contract,json=addressToContract,proto3" json:"address_to_contract,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // `hash_to_code` is a map of code hash to code. - HashToCode map[string]string `protobuf:"bytes,3,rep,name=hash_to_code,json=hashToCode,proto3" json:"hash_to_code,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *GenesisState) Reset() { - *x = GenesisState{} - if protoimpl.UnsafeEnabled { - mi := &file_polaris_evm_v1alpha1_genesis_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GenesisState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GenesisState) ProtoMessage() {} - -// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. -func (*GenesisState) Descriptor() ([]byte, []int) { - return file_polaris_evm_v1alpha1_genesis_proto_rawDescGZIP(), []int{0} -} - -func (x *GenesisState) GetParams() *Params { - if x != nil { - return x.Params - } - return nil -} - -func (x *GenesisState) GetAddressToContract() map[string]*Contract { - if x != nil { - return x.AddressToContract - } - return nil -} - -func (x *GenesisState) GetHashToCode() map[string]string { - if x != nil { - return x.HashToCode - } - return nil -} - -// `Contract` defines the contract state. -type Contract struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // `code_hash` is the hash of the contract code. - CodeHash string `protobuf:"bytes,1,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` - // `slot_to_value` is a map of slot to value. - SlotToValue map[string]string `protobuf:"bytes,2,rep,name=slot_to_value,json=slotToValue,proto3" json:"slot_to_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *Contract) Reset() { - *x = Contract{} - if protoimpl.UnsafeEnabled { - mi := &file_polaris_evm_v1alpha1_genesis_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Contract) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Contract) ProtoMessage() {} - -// Deprecated: Use Contract.ProtoReflect.Descriptor instead. -func (*Contract) Descriptor() ([]byte, []int) { - return file_polaris_evm_v1alpha1_genesis_proto_rawDescGZIP(), []int{1} -} - -func (x *Contract) GetCodeHash() string { - if x != nil { - return x.CodeHash - } - return "" -} - -func (x *Contract) GetSlotToValue() map[string]string { - if x != nil { - return x.SlotToValue - } - return nil -} - -var File_polaris_evm_v1alpha1_genesis_proto protoreflect.FileDescriptor - -var file_polaris_evm_v1alpha1_genesis_proto_rawDesc = []byte{ - 0x0a, 0x22, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, - 0x6d, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x21, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0xb0, 0x03, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x12, 0x3a, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, - 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x12, 0x69, 0x0a, 0x13, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x39, 0x2e, - 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x43, 0x6f, 0x6e, 0x74, 0x72, - 0x61, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x54, 0x6f, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x12, 0x54, 0x0a, 0x0c, 0x68, - 0x61, 0x73, 0x68, 0x5f, 0x74, 0x6f, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x32, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x48, 0x61, 0x73, 0x68, 0x54, 0x6f, 0x43, 0x6f, 0x64, 0x65, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x68, 0x61, 0x73, 0x68, 0x54, 0x6f, 0x43, 0x6f, 0x64, - 0x65, 0x1a, 0x64, 0x0a, 0x16, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x43, 0x6f, - 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x34, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, - 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3d, 0x0a, 0x0f, 0x48, 0x61, 0x73, 0x68, 0x54, - 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xbc, 0x01, 0x0a, 0x08, 0x43, 0x6f, 0x6e, 0x74, 0x72, - 0x61, 0x63, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x68, 0x61, 0x73, 0x68, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x64, 0x65, 0x48, 0x61, 0x73, 0x68, - 0x12, 0x53, 0x0a, 0x0d, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x74, 0x6f, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, - 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, - 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x54, 0x6f, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x73, 0x6c, 0x6f, 0x74, 0x54, 0x6f, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x3e, 0x0a, 0x10, 0x53, 0x6c, 0x6f, 0x74, 0x54, 0x6f, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0xcd, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, - 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x31, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2f, 0x65, 0x76, 0x6d, - 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x65, 0x76, 0x6d, 0x76, 0x31, 0x61, - 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x50, 0x45, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, - 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x31, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x5c, 0x45, 0x76, 0x6d, - 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6c, 0x61, - 0x72, 0x69, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x50, - 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x6d, 0x3a, 0x3a, 0x56, 0x31, 0x61, - 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_polaris_evm_v1alpha1_genesis_proto_rawDescOnce sync.Once - file_polaris_evm_v1alpha1_genesis_proto_rawDescData = file_polaris_evm_v1alpha1_genesis_proto_rawDesc -) - -func file_polaris_evm_v1alpha1_genesis_proto_rawDescGZIP() []byte { - file_polaris_evm_v1alpha1_genesis_proto_rawDescOnce.Do(func() { - file_polaris_evm_v1alpha1_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_polaris_evm_v1alpha1_genesis_proto_rawDescData) - }) - return file_polaris_evm_v1alpha1_genesis_proto_rawDescData -} - -var file_polaris_evm_v1alpha1_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_polaris_evm_v1alpha1_genesis_proto_goTypes = []interface{}{ - (*GenesisState)(nil), // 0: polaris.evm.v1alpha1.GenesisState - (*Contract)(nil), // 1: polaris.evm.v1alpha1.Contract - nil, // 2: polaris.evm.v1alpha1.GenesisState.AddressToContractEntry - nil, // 3: polaris.evm.v1alpha1.GenesisState.HashToCodeEntry - nil, // 4: polaris.evm.v1alpha1.Contract.SlotToValueEntry - (*Params)(nil), // 5: polaris.evm.v1alpha1.Params -} -var file_polaris_evm_v1alpha1_genesis_proto_depIdxs = []int32{ - 5, // 0: polaris.evm.v1alpha1.GenesisState.params:type_name -> polaris.evm.v1alpha1.Params - 2, // 1: polaris.evm.v1alpha1.GenesisState.address_to_contract:type_name -> polaris.evm.v1alpha1.GenesisState.AddressToContractEntry - 3, // 2: polaris.evm.v1alpha1.GenesisState.hash_to_code:type_name -> polaris.evm.v1alpha1.GenesisState.HashToCodeEntry - 4, // 3: polaris.evm.v1alpha1.Contract.slot_to_value:type_name -> polaris.evm.v1alpha1.Contract.SlotToValueEntry - 1, // 4: polaris.evm.v1alpha1.GenesisState.AddressToContractEntry.value:type_name -> polaris.evm.v1alpha1.Contract - 5, // [5:5] is the sub-list for method output_type - 5, // [5:5] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name -} - -func init() { file_polaris_evm_v1alpha1_genesis_proto_init() } -func file_polaris_evm_v1alpha1_genesis_proto_init() { - if File_polaris_evm_v1alpha1_genesis_proto != nil { - return - } - file_polaris_evm_v1alpha1_params_proto_init() - if !protoimpl.UnsafeEnabled { - file_polaris_evm_v1alpha1_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GenesisState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_polaris_evm_v1alpha1_genesis_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Contract); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_polaris_evm_v1alpha1_genesis_proto_rawDesc, - NumEnums: 0, - NumMessages: 5, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_polaris_evm_v1alpha1_genesis_proto_goTypes, - DependencyIndexes: file_polaris_evm_v1alpha1_genesis_proto_depIdxs, - MessageInfos: file_polaris_evm_v1alpha1_genesis_proto_msgTypes, - }.Build() - File_polaris_evm_v1alpha1_genesis_proto = out.File - file_polaris_evm_v1alpha1_genesis_proto_rawDesc = nil - file_polaris_evm_v1alpha1_genesis_proto_goTypes = nil - file_polaris_evm_v1alpha1_genesis_proto_depIdxs = nil -} diff --git a/cosmos/api/polaris/evm/v1alpha1/params.pulsar.go b/cosmos/api/polaris/evm/v1alpha1/params.pulsar.go deleted file mode 100644 index 56ef1797e..000000000 --- a/cosmos/api/polaris/evm/v1alpha1/params.pulsar.go +++ /dev/null @@ -1,868 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package evmv1alpha1 - -import ( - fmt "fmt" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var _ protoreflect.List = (*_Params_2_list)(nil) - -type _Params_2_list struct { - list *[]int64 -} - -func (x *_Params_2_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_Params_2_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfInt64((*x.list)[i]) -} - -func (x *_Params_2_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Int() - concreteValue := valueUnwrapped - (*x.list)[i] = concreteValue -} - -func (x *_Params_2_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Int() - concreteValue := valueUnwrapped - *x.list = append(*x.list, concreteValue) -} - -func (x *_Params_2_list) AppendMutable() protoreflect.Value { - panic(fmt.Errorf("AppendMutable can not be called on message Params at list field ExtraEips as it is not of Message kind")) -} - -func (x *_Params_2_list) Truncate(n int) { - *x.list = (*x.list)[:n] -} - -func (x *_Params_2_list) NewElement() protoreflect.Value { - v := int64(0) - return protoreflect.ValueOfInt64(v) -} - -func (x *_Params_2_list) IsValid() bool { - return x.list != nil -} - -var ( - md_Params protoreflect.MessageDescriptor - fd_Params_evm_denom protoreflect.FieldDescriptor - fd_Params_extra_eips protoreflect.FieldDescriptor - fd_Params_chain_config protoreflect.FieldDescriptor -) - -func init() { - file_polaris_evm_v1alpha1_params_proto_init() - md_Params = File_polaris_evm_v1alpha1_params_proto.Messages().ByName("Params") - fd_Params_evm_denom = md_Params.Fields().ByName("evm_denom") - fd_Params_extra_eips = md_Params.Fields().ByName("extra_eips") - fd_Params_chain_config = md_Params.Fields().ByName("chain_config") -} - -var _ protoreflect.Message = (*fastReflection_Params)(nil) - -type fastReflection_Params Params - -func (x *Params) ProtoReflect() protoreflect.Message { - return (*fastReflection_Params)(x) -} - -func (x *Params) slowProtoReflect() protoreflect.Message { - mi := &file_polaris_evm_v1alpha1_params_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_Params_messageType fastReflection_Params_messageType -var _ protoreflect.MessageType = fastReflection_Params_messageType{} - -type fastReflection_Params_messageType struct{} - -func (x fastReflection_Params_messageType) Zero() protoreflect.Message { - return (*fastReflection_Params)(nil) -} -func (x fastReflection_Params_messageType) New() protoreflect.Message { - return new(fastReflection_Params) -} -func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Params -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { - return md_Params -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_Params) Type() protoreflect.MessageType { - return _fastReflection_Params_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Params) New() protoreflect.Message { - return new(fastReflection_Params) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { - return (*Params)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.EvmDenom != "" { - value := protoreflect.ValueOfString(x.EvmDenom) - if !f(fd_Params_evm_denom, value) { - return - } - } - if len(x.ExtraEips) != 0 { - value := protoreflect.ValueOfList(&_Params_2_list{list: &x.ExtraEips}) - if !f(fd_Params_extra_eips, value) { - return - } - } - if x.ChainConfig != "" { - value := protoreflect.ValueOfString(x.ChainConfig) - if !f(fd_Params_chain_config, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "polaris.evm.v1alpha1.Params.evm_denom": - return x.EvmDenom != "" - case "polaris.evm.v1alpha1.Params.extra_eips": - return len(x.ExtraEips) != 0 - case "polaris.evm.v1alpha1.Params.chain_config": - return x.ChainConfig != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.Params")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.Params does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "polaris.evm.v1alpha1.Params.evm_denom": - x.EvmDenom = "" - case "polaris.evm.v1alpha1.Params.extra_eips": - x.ExtraEips = nil - case "polaris.evm.v1alpha1.Params.chain_config": - x.ChainConfig = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.Params")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.Params does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "polaris.evm.v1alpha1.Params.evm_denom": - value := x.EvmDenom - return protoreflect.ValueOfString(value) - case "polaris.evm.v1alpha1.Params.extra_eips": - if len(x.ExtraEips) == 0 { - return protoreflect.ValueOfList(&_Params_2_list{}) - } - listValue := &_Params_2_list{list: &x.ExtraEips} - return protoreflect.ValueOfList(listValue) - case "polaris.evm.v1alpha1.Params.chain_config": - value := x.ChainConfig - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.Params")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.Params does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "polaris.evm.v1alpha1.Params.evm_denom": - x.EvmDenom = value.Interface().(string) - case "polaris.evm.v1alpha1.Params.extra_eips": - lv := value.List() - clv := lv.(*_Params_2_list) - x.ExtraEips = *clv.list - case "polaris.evm.v1alpha1.Params.chain_config": - x.ChainConfig = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.Params")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.Params does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "polaris.evm.v1alpha1.Params.extra_eips": - if x.ExtraEips == nil { - x.ExtraEips = []int64{} - } - value := &_Params_2_list{list: &x.ExtraEips} - return protoreflect.ValueOfList(value) - case "polaris.evm.v1alpha1.Params.evm_denom": - panic(fmt.Errorf("field evm_denom of message polaris.evm.v1alpha1.Params is not mutable")) - case "polaris.evm.v1alpha1.Params.chain_config": - panic(fmt.Errorf("field chain_config of message polaris.evm.v1alpha1.Params is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.Params")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.Params does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "polaris.evm.v1alpha1.Params.evm_denom": - return protoreflect.ValueOfString("") - case "polaris.evm.v1alpha1.Params.extra_eips": - list := []int64{} - return protoreflect.ValueOfList(&_Params_2_list{list: &list}) - case "polaris.evm.v1alpha1.Params.chain_config": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.Params")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.Params does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in polaris.evm.v1alpha1.Params", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_Params) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_Params) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Params) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.EvmDenom) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if len(x.ExtraEips) > 0 { - l = 0 - for _, e := range x.ExtraEips { - l += runtime.Sov(uint64(e)) - } - n += 1 + runtime.Sov(uint64(l)) + l - } - l = len(x.ChainConfig) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Params) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.ChainConfig) > 0 { - i -= len(x.ChainConfig) - copy(dAtA[i:], x.ChainConfig) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ChainConfig))) - i-- - dAtA[i] = 0x1a - } - if len(x.ExtraEips) > 0 { - var pksize2 int - for _, num := range x.ExtraEips { - pksize2 += runtime.Sov(uint64(num)) - } - i -= pksize2 - j1 := i - for _, num1 := range x.ExtraEips { - num := uint64(num1) - for num >= 1<<7 { - dAtA[j1] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j1++ - } - dAtA[j1] = uint8(num) - j1++ - } - i = runtime.EncodeVarint(dAtA, i, uint64(pksize2)) - i-- - dAtA[i] = 0x12 - } - if len(x.EvmDenom) > 0 { - i -= len(x.EvmDenom) - copy(dAtA[i:], x.EvmDenom) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.EvmDenom))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Params) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field EvmDenom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.EvmDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType == 0 { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - x.ExtraEips = append(x.ExtraEips, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(x.ExtraEips) == 0 { - x.ExtraEips = make([]int64, 0, elementCount) - } - for iNdEx < postIndex { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - x.ExtraEips = append(x.ExtraEips, v) - } - } else { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ExtraEips", wireType) - } - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ChainConfig", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.ChainConfig = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: polaris/evm/v1alpha1/params.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// `Params` defines the parameters for the x/evm module. -type Params struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // `evm_denom` represents the token denomination used as the native token - // within the EVM. - EvmDenom string `protobuf:"bytes,1,opt,name=evm_denom,json=evmDenom,proto3" json:"evm_denom,omitempty"` - // `extra_eips` defines a list of additional EIPs for the vm.Config - ExtraEips []int64 `protobuf:"varint,2,rep,packed,name=extra_eips,json=extraEips,proto3" json:"extra_eips,omitempty"` - // `chain_config` represents the ethereum chain config for the polaris - // EVM - ChainConfig string `protobuf:"bytes,3,opt,name=chain_config,json=chainConfig,proto3" json:"chain_config,omitempty"` -} - -func (x *Params) Reset() { - *x = Params{} - if protoimpl.UnsafeEnabled { - mi := &file_polaris_evm_v1alpha1_params_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Params) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Params) ProtoMessage() {} - -// Deprecated: Use Params.ProtoReflect.Descriptor instead. -func (*Params) Descriptor() ([]byte, []int) { - return file_polaris_evm_v1alpha1_params_proto_rawDescGZIP(), []int{0} -} - -func (x *Params) GetEvmDenom() string { - if x != nil { - return x.EvmDenom - } - return "" -} - -func (x *Params) GetExtraEips() []int64 { - if x != nil { - return x.ExtraEips - } - return nil -} - -func (x *Params) GetChainConfig() string { - if x != nil { - return x.ChainConfig - } - return "" -} - -var File_polaris_evm_v1alpha1_params_proto protoreflect.FileDescriptor - -var file_polaris_evm_v1alpha1_params_proto_rawDesc = []byte{ - 0x0a, 0x21, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, - 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0xba, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x31, 0x0a, 0x09, 0x65, 0x76, - 0x6d, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x14, 0xf2, - 0xde, 0x1f, 0x10, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x65, 0x76, 0x6d, 0x5f, 0x64, 0x65, 0x6e, - 0x6f, 0x6d, 0x22, 0x52, 0x08, 0x65, 0x76, 0x6d, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x41, 0x0a, - 0x0a, 0x65, 0x78, 0x74, 0x72, 0x61, 0x5f, 0x65, 0x69, 0x70, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x03, 0x42, 0x22, 0xe2, 0xde, 0x1f, 0x09, 0x45, 0x78, 0x74, 0x72, 0x61, 0x45, 0x49, 0x50, 0x73, - 0xf2, 0xde, 0x1f, 0x11, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x65, 0x78, 0x74, 0x72, 0x61, 0x5f, - 0x65, 0x69, 0x70, 0x73, 0x22, 0x52, 0x09, 0x65, 0x78, 0x74, 0x72, 0x61, 0x45, 0x69, 0x70, 0x73, - 0x12, 0x3a, 0x0a, 0x0c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x17, 0xf2, 0xde, 0x1f, 0x13, 0x79, 0x61, 0x6d, 0x6c, - 0x3a, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x52, - 0x0b, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0xcc, 0x01, 0x0a, - 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, - 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6c, 0x61, 0x72, - 0x69, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, - 0x65, 0x76, 0x6d, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x50, 0x45, - 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, - 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6c, 0x61, 0x72, - 0x69, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, - 0x02, 0x20, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x56, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x16, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x3a, 0x3a, 0x45, 0x76, - 0x6d, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_polaris_evm_v1alpha1_params_proto_rawDescOnce sync.Once - file_polaris_evm_v1alpha1_params_proto_rawDescData = file_polaris_evm_v1alpha1_params_proto_rawDesc -) - -func file_polaris_evm_v1alpha1_params_proto_rawDescGZIP() []byte { - file_polaris_evm_v1alpha1_params_proto_rawDescOnce.Do(func() { - file_polaris_evm_v1alpha1_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_polaris_evm_v1alpha1_params_proto_rawDescData) - }) - return file_polaris_evm_v1alpha1_params_proto_rawDescData -} - -var file_polaris_evm_v1alpha1_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_polaris_evm_v1alpha1_params_proto_goTypes = []interface{}{ - (*Params)(nil), // 0: polaris.evm.v1alpha1.Params -} -var file_polaris_evm_v1alpha1_params_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 - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_polaris_evm_v1alpha1_params_proto_init() } -func file_polaris_evm_v1alpha1_params_proto_init() { - if File_polaris_evm_v1alpha1_params_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_polaris_evm_v1alpha1_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Params); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_polaris_evm_v1alpha1_params_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_polaris_evm_v1alpha1_params_proto_goTypes, - DependencyIndexes: file_polaris_evm_v1alpha1_params_proto_depIdxs, - MessageInfos: file_polaris_evm_v1alpha1_params_proto_msgTypes, - }.Build() - File_polaris_evm_v1alpha1_params_proto = out.File - file_polaris_evm_v1alpha1_params_proto_rawDesc = nil - file_polaris_evm_v1alpha1_params_proto_goTypes = nil - file_polaris_evm_v1alpha1_params_proto_depIdxs = nil -} diff --git a/cosmos/api/polaris/evm/v1alpha1/query.pulsar.go b/cosmos/api/polaris/evm/v1alpha1/query.pulsar.go deleted file mode 100644 index 41cec298b..000000000 --- a/cosmos/api/polaris/evm/v1alpha1/query.pulsar.go +++ /dev/null @@ -1,1026 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package evmv1alpha1 - -import ( - fmt "fmt" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_ParamsRequest protoreflect.MessageDescriptor -) - -func init() { - file_polaris_evm_v1alpha1_query_proto_init() - md_ParamsRequest = File_polaris_evm_v1alpha1_query_proto.Messages().ByName("ParamsRequest") -} - -var _ protoreflect.Message = (*fastReflection_ParamsRequest)(nil) - -type fastReflection_ParamsRequest ParamsRequest - -func (x *ParamsRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_ParamsRequest)(x) -} - -func (x *ParamsRequest) slowProtoReflect() protoreflect.Message { - mi := &file_polaris_evm_v1alpha1_query_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_ParamsRequest_messageType fastReflection_ParamsRequest_messageType -var _ protoreflect.MessageType = fastReflection_ParamsRequest_messageType{} - -type fastReflection_ParamsRequest_messageType struct{} - -func (x fastReflection_ParamsRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_ParamsRequest)(nil) -} -func (x fastReflection_ParamsRequest_messageType) New() protoreflect.Message { - return new(fastReflection_ParamsRequest) -} -func (x fastReflection_ParamsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_ParamsRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_ParamsRequest) Descriptor() protoreflect.MessageDescriptor { - return md_ParamsRequest -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_ParamsRequest) Type() protoreflect.MessageType { - return _fastReflection_ParamsRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_ParamsRequest) New() protoreflect.Message { - return new(fastReflection_ParamsRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_ParamsRequest) Interface() protoreflect.ProtoMessage { - return (*ParamsRequest)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_ParamsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_ParamsRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.ParamsRequest")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.ParamsRequest does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.ParamsRequest")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.ParamsRequest does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_ParamsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.ParamsRequest")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.ParamsRequest does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.ParamsRequest")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.ParamsRequest does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.ParamsRequest")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.ParamsRequest does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_ParamsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.ParamsRequest")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.ParamsRequest does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_ParamsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in polaris.evm.v1alpha1.ParamsRequest", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_ParamsRequest) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsRequest) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_ParamsRequest) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_ParamsRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*ParamsRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*ParamsRequest) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*ParamsRequest) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_ParamsResponse protoreflect.MessageDescriptor - fd_ParamsResponse_params protoreflect.FieldDescriptor -) - -func init() { - file_polaris_evm_v1alpha1_query_proto_init() - md_ParamsResponse = File_polaris_evm_v1alpha1_query_proto.Messages().ByName("ParamsResponse") - fd_ParamsResponse_params = md_ParamsResponse.Fields().ByName("params") -} - -var _ protoreflect.Message = (*fastReflection_ParamsResponse)(nil) - -type fastReflection_ParamsResponse ParamsResponse - -func (x *ParamsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_ParamsResponse)(x) -} - -func (x *ParamsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_polaris_evm_v1alpha1_query_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_ParamsResponse_messageType fastReflection_ParamsResponse_messageType -var _ protoreflect.MessageType = fastReflection_ParamsResponse_messageType{} - -type fastReflection_ParamsResponse_messageType struct{} - -func (x fastReflection_ParamsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_ParamsResponse)(nil) -} -func (x fastReflection_ParamsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_ParamsResponse) -} -func (x fastReflection_ParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_ParamsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_ParamsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_ParamsResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_ParamsResponse) Type() protoreflect.MessageType { - return _fastReflection_ParamsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_ParamsResponse) New() protoreflect.Message { - return new(fastReflection_ParamsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_ParamsResponse) Interface() protoreflect.ProtoMessage { - return (*ParamsResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_ParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Params != nil { - value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - if !f(fd_ParamsResponse_params, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_ParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "polaris.evm.v1alpha1.ParamsResponse.params": - return x.Params != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.ParamsResponse")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.ParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "polaris.evm.v1alpha1.ParamsResponse.params": - x.Params = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.ParamsResponse")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.ParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_ParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "polaris.evm.v1alpha1.ParamsResponse.params": - value := x.Params - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.ParamsResponse")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.ParamsResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "polaris.evm.v1alpha1.ParamsResponse.params": - x.Params = value.Message().Interface().(*Params) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.ParamsResponse")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.ParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "polaris.evm.v1alpha1.ParamsResponse.params": - if x.Params == nil { - x.Params = new(Params) - } - return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.ParamsResponse")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.ParamsResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_ParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "polaris.evm.v1alpha1.ParamsResponse.params": - m := new(Params) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.ParamsResponse")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.ParamsResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_ParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in polaris.evm.v1alpha1.ParamsResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_ParamsResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_ParamsResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_ParamsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*ParamsResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Params != nil { - l = options.Size(x.Params) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*ParamsResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Params != nil { - encoded, err := options.Marshal(x.Params) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*ParamsResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Params == nil { - x.Params = &Params{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: polaris/evm/v1alpha1/query.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// `ParamsRequest` is the request type for the Query/Params RPC method. -type ParamsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ParamsRequest) Reset() { - *x = ParamsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_polaris_evm_v1alpha1_query_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParamsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParamsRequest) ProtoMessage() {} - -// Deprecated: Use ParamsRequest.ProtoReflect.Descriptor instead. -func (*ParamsRequest) Descriptor() ([]byte, []int) { - return file_polaris_evm_v1alpha1_query_proto_rawDescGZIP(), []int{0} -} - -// `ParamsResponse` is the response type for the Query/Params RPC method. -type ParamsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // params defines the parameters of the module. - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` -} - -func (x *ParamsResponse) Reset() { - *x = ParamsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_polaris_evm_v1alpha1_query_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParamsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParamsResponse) ProtoMessage() {} - -// Deprecated: Use ParamsResponse.ProtoReflect.Descriptor instead. -func (*ParamsResponse) Descriptor() ([]byte, []int) { - return file_polaris_evm_v1alpha1_query_proto_rawDescGZIP(), []int{1} -} - -func (x *ParamsResponse) GetParams() *Params { - if x != nil { - return x.Params - } - return nil -} - -var File_polaris_evm_v1alpha1_query_proto protoreflect.FileDescriptor - -var file_polaris_evm_v1alpha1_query_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x14, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x70, 0x6f, - 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x0f, 0x0a, 0x0d, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x22, 0x4c, 0x0a, 0x0e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, - 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x89, - 0x01, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x79, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6c, 0x61, - 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, - 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, - 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x61, - 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, 0x70, - 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xcb, 0x01, 0x0a, 0x18, 0x63, - 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, - 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, - 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2f, - 0x65, 0x76, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x65, 0x76, 0x6d, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x50, 0x45, 0x58, 0xaa, 0x02, - 0x14, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, 0x56, 0x31, 0x61, - 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x5c, - 0x45, 0x76, 0x6d, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x20, 0x50, - 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x16, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x6d, 0x3a, 0x3a, - 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_polaris_evm_v1alpha1_query_proto_rawDescOnce sync.Once - file_polaris_evm_v1alpha1_query_proto_rawDescData = file_polaris_evm_v1alpha1_query_proto_rawDesc -) - -func file_polaris_evm_v1alpha1_query_proto_rawDescGZIP() []byte { - file_polaris_evm_v1alpha1_query_proto_rawDescOnce.Do(func() { - file_polaris_evm_v1alpha1_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_polaris_evm_v1alpha1_query_proto_rawDescData) - }) - return file_polaris_evm_v1alpha1_query_proto_rawDescData -} - -var file_polaris_evm_v1alpha1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_polaris_evm_v1alpha1_query_proto_goTypes = []interface{}{ - (*ParamsRequest)(nil), // 0: polaris.evm.v1alpha1.ParamsRequest - (*ParamsResponse)(nil), // 1: polaris.evm.v1alpha1.ParamsResponse - (*Params)(nil), // 2: polaris.evm.v1alpha1.Params -} -var file_polaris_evm_v1alpha1_query_proto_depIdxs = []int32{ - 2, // 0: polaris.evm.v1alpha1.ParamsResponse.params:type_name -> polaris.evm.v1alpha1.Params - 0, // 1: polaris.evm.v1alpha1.QueryService.Params:input_type -> polaris.evm.v1alpha1.ParamsRequest - 1, // 2: polaris.evm.v1alpha1.QueryService.Params:output_type -> polaris.evm.v1alpha1.ParamsResponse - 2, // [2:3] is the sub-list for method output_type - 1, // [1:2] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_polaris_evm_v1alpha1_query_proto_init() } -func file_polaris_evm_v1alpha1_query_proto_init() { - if File_polaris_evm_v1alpha1_query_proto != nil { - return - } - file_polaris_evm_v1alpha1_params_proto_init() - if !protoimpl.UnsafeEnabled { - file_polaris_evm_v1alpha1_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParamsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_polaris_evm_v1alpha1_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParamsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_polaris_evm_v1alpha1_query_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_polaris_evm_v1alpha1_query_proto_goTypes, - DependencyIndexes: file_polaris_evm_v1alpha1_query_proto_depIdxs, - MessageInfos: file_polaris_evm_v1alpha1_query_proto_msgTypes, - }.Build() - File_polaris_evm_v1alpha1_query_proto = out.File - file_polaris_evm_v1alpha1_query_proto_rawDesc = nil - file_polaris_evm_v1alpha1_query_proto_goTypes = nil - file_polaris_evm_v1alpha1_query_proto_depIdxs = nil -} diff --git a/cosmos/api/polaris/evm/v1alpha1/query_grpc.pb.go b/cosmos/api/polaris/evm/v1alpha1/query_grpc.pb.go deleted file mode 100644 index 469441e55..000000000 --- a/cosmos/api/polaris/evm/v1alpha1/query_grpc.pb.go +++ /dev/null @@ -1,131 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc (unknown) -// source: polaris/evm/v1alpha1/query.proto - -package evmv1alpha1 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - QueryService_Params_FullMethodName = "/polaris.evm.v1alpha1.QueryService/Params" -) - -// QueryServiceClient is the client API for QueryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type QueryServiceClient interface { - // Params returns the total set of evm parameters. - Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) -} - -type queryServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewQueryServiceClient(cc grpc.ClientConnInterface) QueryServiceClient { - return &queryServiceClient{cc} -} - -func (c *queryServiceClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { - out := new(ParamsResponse) - err := c.cc.Invoke(ctx, QueryService_Params_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServiceServer is the server API for QueryService service. -// All implementations must embed UnimplementedQueryServiceServer -// for forward compatibility -type QueryServiceServer interface { - // Params returns the total set of evm parameters. - Params(context.Context, *ParamsRequest) (*ParamsResponse, error) - mustEmbedUnimplementedQueryServiceServer() -} - -// UnimplementedQueryServiceServer must be embedded to have forward compatible implementations. -type UnimplementedQueryServiceServer struct { -} - -func (UnimplementedQueryServiceServer) Params(context.Context, *ParamsRequest) (*ParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (UnimplementedQueryServiceServer) mustEmbedUnimplementedQueryServiceServer() {} - -// UnsafeQueryServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to QueryServiceServer will -// result in compilation errors. -type UnsafeQueryServiceServer interface { - mustEmbedUnimplementedQueryServiceServer() -} - -func RegisterQueryServiceServer(s grpc.ServiceRegistrar, srv QueryServiceServer) { - s.RegisterService(&QueryService_ServiceDesc, srv) -} - -func _QueryService_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServiceServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: QueryService_Params_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServiceServer).Params(ctx, req.(*ParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// QueryService_ServiceDesc is the grpc.ServiceDesc for QueryService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var QueryService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "polaris.evm.v1alpha1.QueryService", - HandlerType: (*QueryServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _QueryService_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "polaris/evm/v1alpha1/query.proto", -} diff --git a/cosmos/api/polaris/evm/v1alpha1/tx.pulsar.go b/cosmos/api/polaris/evm/v1alpha1/tx.pulsar.go index 27674a2e0..8cd4f28e1 100644 --- a/cosmos/api/polaris/evm/v1alpha1/tx.pulsar.go +++ b/cosmos/api/polaris/evm/v1alpha1/tx.pulsar.go @@ -4,9 +4,7 @@ package evmv1alpha1 import ( _ "cosmossdk.io/api/cosmos/msg/v1" fmt "fmt" - _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -1035,861 +1033,6 @@ func (x *fastReflection_WrappedEthereumTransactionResult) ProtoMethods() *protoi } } -var ( - md_UpdateParamsRequest protoreflect.MessageDescriptor - fd_UpdateParamsRequest_authority protoreflect.FieldDescriptor - fd_UpdateParamsRequest_params protoreflect.FieldDescriptor -) - -func init() { - file_polaris_evm_v1alpha1_tx_proto_init() - md_UpdateParamsRequest = File_polaris_evm_v1alpha1_tx_proto.Messages().ByName("UpdateParamsRequest") - fd_UpdateParamsRequest_authority = md_UpdateParamsRequest.Fields().ByName("authority") - fd_UpdateParamsRequest_params = md_UpdateParamsRequest.Fields().ByName("params") -} - -var _ protoreflect.Message = (*fastReflection_UpdateParamsRequest)(nil) - -type fastReflection_UpdateParamsRequest UpdateParamsRequest - -func (x *UpdateParamsRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_UpdateParamsRequest)(x) -} - -func (x *UpdateParamsRequest) slowProtoReflect() protoreflect.Message { - mi := &file_polaris_evm_v1alpha1_tx_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_UpdateParamsRequest_messageType fastReflection_UpdateParamsRequest_messageType -var _ protoreflect.MessageType = fastReflection_UpdateParamsRequest_messageType{} - -type fastReflection_UpdateParamsRequest_messageType struct{} - -func (x fastReflection_UpdateParamsRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_UpdateParamsRequest)(nil) -} -func (x fastReflection_UpdateParamsRequest_messageType) New() protoreflect.Message { - return new(fastReflection_UpdateParamsRequest) -} -func (x fastReflection_UpdateParamsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_UpdateParamsRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_UpdateParamsRequest) Descriptor() protoreflect.MessageDescriptor { - return md_UpdateParamsRequest -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_UpdateParamsRequest) Type() protoreflect.MessageType { - return _fastReflection_UpdateParamsRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_UpdateParamsRequest) New() protoreflect.Message { - return new(fastReflection_UpdateParamsRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_UpdateParamsRequest) Interface() protoreflect.ProtoMessage { - return (*UpdateParamsRequest)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_UpdateParamsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Authority != "" { - value := protoreflect.ValueOfString(x.Authority) - if !f(fd_UpdateParamsRequest_authority, value) { - return - } - } - if x.Params != nil { - value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - if !f(fd_UpdateParamsRequest_params, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_UpdateParamsRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "polaris.evm.v1alpha1.UpdateParamsRequest.authority": - return x.Authority != "" - case "polaris.evm.v1alpha1.UpdateParamsRequest.params": - return x.Params != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.UpdateParamsRequest")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.UpdateParamsRequest does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_UpdateParamsRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "polaris.evm.v1alpha1.UpdateParamsRequest.authority": - x.Authority = "" - case "polaris.evm.v1alpha1.UpdateParamsRequest.params": - x.Params = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.UpdateParamsRequest")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.UpdateParamsRequest does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_UpdateParamsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "polaris.evm.v1alpha1.UpdateParamsRequest.authority": - value := x.Authority - return protoreflect.ValueOfString(value) - case "polaris.evm.v1alpha1.UpdateParamsRequest.params": - value := x.Params - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.UpdateParamsRequest")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.UpdateParamsRequest does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_UpdateParamsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "polaris.evm.v1alpha1.UpdateParamsRequest.authority": - x.Authority = value.Interface().(string) - case "polaris.evm.v1alpha1.UpdateParamsRequest.params": - x.Params = value.Message().Interface().(*Params) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.UpdateParamsRequest")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.UpdateParamsRequest does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_UpdateParamsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "polaris.evm.v1alpha1.UpdateParamsRequest.params": - if x.Params == nil { - x.Params = new(Params) - } - return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - case "polaris.evm.v1alpha1.UpdateParamsRequest.authority": - panic(fmt.Errorf("field authority of message polaris.evm.v1alpha1.UpdateParamsRequest is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.UpdateParamsRequest")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.UpdateParamsRequest does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_UpdateParamsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "polaris.evm.v1alpha1.UpdateParamsRequest.authority": - return protoreflect.ValueOfString("") - case "polaris.evm.v1alpha1.UpdateParamsRequest.params": - m := new(Params) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.UpdateParamsRequest")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.UpdateParamsRequest does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_UpdateParamsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in polaris.evm.v1alpha1.UpdateParamsRequest", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_UpdateParamsRequest) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_UpdateParamsRequest) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_UpdateParamsRequest) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_UpdateParamsRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*UpdateParamsRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Authority) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Params != nil { - l = options.Size(x.Params) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*UpdateParamsRequest) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Params != nil { - encoded, err := options.Marshal(x.Params) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - if len(x.Authority) > 0 { - i -= len(x.Authority) - copy(dAtA[i:], x.Authority) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*UpdateParamsRequest) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: UpdateParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: UpdateParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Params == nil { - x.Params = &Params{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_UpdateParamsResponse protoreflect.MessageDescriptor -) - -func init() { - file_polaris_evm_v1alpha1_tx_proto_init() - md_UpdateParamsResponse = File_polaris_evm_v1alpha1_tx_proto.Messages().ByName("UpdateParamsResponse") -} - -var _ protoreflect.Message = (*fastReflection_UpdateParamsResponse)(nil) - -type fastReflection_UpdateParamsResponse UpdateParamsResponse - -func (x *UpdateParamsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_UpdateParamsResponse)(x) -} - -func (x *UpdateParamsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_polaris_evm_v1alpha1_tx_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_UpdateParamsResponse_messageType fastReflection_UpdateParamsResponse_messageType -var _ protoreflect.MessageType = fastReflection_UpdateParamsResponse_messageType{} - -type fastReflection_UpdateParamsResponse_messageType struct{} - -func (x fastReflection_UpdateParamsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_UpdateParamsResponse)(nil) -} -func (x fastReflection_UpdateParamsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_UpdateParamsResponse) -} -func (x fastReflection_UpdateParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_UpdateParamsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_UpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_UpdateParamsResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_UpdateParamsResponse) Type() protoreflect.MessageType { - return _fastReflection_UpdateParamsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_UpdateParamsResponse) New() protoreflect.Message { - return new(fastReflection_UpdateParamsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_UpdateParamsResponse) Interface() protoreflect.ProtoMessage { - return (*UpdateParamsResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_UpdateParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_UpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.UpdateParamsResponse")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.UpdateParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_UpdateParamsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.UpdateParamsResponse")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.UpdateParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_UpdateParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.UpdateParamsResponse")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.UpdateParamsResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_UpdateParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.UpdateParamsResponse")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.UpdateParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_UpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.UpdateParamsResponse")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.UpdateParamsResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_UpdateParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: polaris.evm.v1alpha1.UpdateParamsResponse")) - } - panic(fmt.Errorf("message polaris.evm.v1alpha1.UpdateParamsResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_UpdateParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in polaris.evm.v1alpha1.UpdateParamsResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_UpdateParamsResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_UpdateParamsResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_UpdateParamsResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_UpdateParamsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*UpdateParamsResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*UpdateParamsResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*UpdateParamsResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: UpdateParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: UpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - // SPDX-License-Identifier: BUSL-1.1 // // Copyright (C) 2023, Berachain Foundation. All rights reserved. @@ -2024,86 +1167,6 @@ func (x *WrappedEthereumTransactionResult) GetReturnData() []byte { return nil } -// `UpdateParamsRequest` is the Msg/UpdateParams request type. -// -// Since: cosmos-sdk 0.47 -type UpdateParamsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // authority is the address that controls the module (defaults to x/gov unless overwritten). - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the x/evm parameters to update. - // - // NOTE: All parameters must be supplied. - Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` -} - -func (x *UpdateParamsRequest) Reset() { - *x = UpdateParamsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_polaris_evm_v1alpha1_tx_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateParamsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateParamsRequest) ProtoMessage() {} - -// Deprecated: Use UpdateParamsRequest.ProtoReflect.Descriptor instead. -func (*UpdateParamsRequest) Descriptor() ([]byte, []int) { - return file_polaris_evm_v1alpha1_tx_proto_rawDescGZIP(), []int{2} -} - -func (x *UpdateParamsRequest) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -func (x *UpdateParamsRequest) GetParams() *Params { - if x != nil { - return x.Params - } - return nil -} - -// `UpdateParamsResponse` defines the response structure for executing a -// UpdateParamsResponse message. -// -// Since: cosmos-sdk 0.47 -type UpdateParamsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *UpdateParamsResponse) Reset() { - *x = UpdateParamsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_polaris_evm_v1alpha1_tx_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateParamsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateParamsResponse) ProtoMessage() {} - -// Deprecated: Use UpdateParamsResponse.ProtoReflect.Descriptor instead. -func (*UpdateParamsResponse) Descriptor() ([]byte, []int) { - return file_polaris_evm_v1alpha1_tx_proto_rawDescGZIP(), []int{3} -} - var File_polaris_evm_v1alpha1_tx_proto protoreflect.FileDescriptor var file_polaris_evm_v1alpha1_tx_proto_rawDesc = []byte{ @@ -2111,69 +1174,46 @@ var file_polaris_evm_v1alpha1_tx_proto_rawDesc = []byte{ 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, - 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 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, 0x1a, - 0x21, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x76, 0x31, 0x61, - 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x86, 0x01, 0x0a, 0x1a, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x45, 0x74, + 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x82, + 0x01, 0x0a, 0x1a, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, + 0x75, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x12, 0x33, 0x0a, 0x16, 0x68, 0x61, 0x63, 0x6b, 0x79, 0x5f, 0x66, 0x69, 0x78, 0x5f, 0x63, + 0x61, 0x75, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x13, 0x68, 0x61, 0x63, 0x6b, 0x79, 0x46, 0x69, 0x78, 0x43, 0x61, 0x75, 0x73, 0x65, + 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x1b, 0x82, 0xe7, 0xb0, 0x2a, 0x16, 0x68, 0x61, 0x63, + 0x6b, 0x79, 0x5f, 0x66, 0x69, 0x78, 0x5f, 0x63, 0x61, 0x75, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x22, 0x79, 0x0a, 0x20, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x45, 0x74, + 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x61, 0x73, 0x5f, 0x75, + 0x73, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x67, 0x61, 0x73, 0x55, 0x73, + 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x76, 0x6d, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x1f, 0x0a, + 0x0b, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x0a, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x32, 0x8f, + 0x01, 0x0a, 0x0a, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7a, 0x0a, + 0x0e, 0x45, 0x74, 0x68, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x33, 0x0a, 0x16, 0x68, 0x61, 0x63, 0x6b, 0x79, 0x5f, 0x66, - 0x69, 0x78, 0x5f, 0x63, 0x61, 0x75, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x68, 0x61, 0x63, 0x6b, 0x79, 0x46, 0x69, 0x78, 0x43, - 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x1f, 0x88, 0xa0, 0x1f, 0x00, - 0x82, 0xe7, 0xb0, 0x2a, 0x16, 0x68, 0x61, 0x63, 0x6b, 0x79, 0x5f, 0x66, 0x69, 0x78, 0x5f, 0x63, - 0x61, 0x75, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x22, 0x7f, 0x0a, 0x20, 0x57, - 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x54, 0x72, - 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, - 0x19, 0x0a, 0x08, 0x67, 0x61, 0x73, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x07, 0x67, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x76, 0x6d, - 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x6d, - 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x5f, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, 0x22, 0x99, 0x01, 0x0a, - 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x3a, 0x0a, 0x06, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, - 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, - 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x16, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x32, 0xf6, 0x01, 0x0a, 0x0a, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x7a, 0x0a, 0x0e, 0x45, 0x74, 0x68, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, + 0x6e, 0x1a, 0x36, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x1a, 0x36, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, - 0x6d, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x57, 0x72, 0x61, 0x70, 0x70, - 0x65, 0x64, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x65, 0x0a, 0x0c, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x29, 0x2e, 0x70, 0x6f, - 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, - 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xc8, 0x01, 0x0a, 0x18, 0x63, 0x6f, - 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x31, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x65, 0x76, 0x6d, 0x76, 0x31, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x50, 0x45, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6c, - 0x61, 0x72, 0x69, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, - 0x31, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, - 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6c, 0x61, 0x72, - 0x69, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x50, 0x6f, - 0x6c, 0x61, 0x72, 0x69, 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x6d, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, + 0x42, 0xc8, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, + 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x07, 0x54, + 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6c, 0x61, 0x72, + 0x69, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, + 0x65, 0x76, 0x6d, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x50, 0x45, + 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, + 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6c, 0x61, 0x72, + 0x69, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, + 0x02, 0x20, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x56, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x16, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x3a, 0x3a, 0x45, 0x76, + 0x6d, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -2188,25 +1228,19 @@ func file_polaris_evm_v1alpha1_tx_proto_rawDescGZIP() []byte { return file_polaris_evm_v1alpha1_tx_proto_rawDescData } -var file_polaris_evm_v1alpha1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_polaris_evm_v1alpha1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_polaris_evm_v1alpha1_tx_proto_goTypes = []interface{}{ (*WrappedEthereumTransaction)(nil), // 0: polaris.evm.v1alpha1.WrappedEthereumTransaction (*WrappedEthereumTransactionResult)(nil), // 1: polaris.evm.v1alpha1.WrappedEthereumTransactionResult - (*UpdateParamsRequest)(nil), // 2: polaris.evm.v1alpha1.UpdateParamsRequest - (*UpdateParamsResponse)(nil), // 3: polaris.evm.v1alpha1.UpdateParamsResponse - (*Params)(nil), // 4: polaris.evm.v1alpha1.Params } var file_polaris_evm_v1alpha1_tx_proto_depIdxs = []int32{ - 4, // 0: polaris.evm.v1alpha1.UpdateParamsRequest.params:type_name -> polaris.evm.v1alpha1.Params - 0, // 1: polaris.evm.v1alpha1.MsgService.EthTransaction:input_type -> polaris.evm.v1alpha1.WrappedEthereumTransaction - 2, // 2: polaris.evm.v1alpha1.MsgService.UpdateParams:input_type -> polaris.evm.v1alpha1.UpdateParamsRequest - 1, // 3: polaris.evm.v1alpha1.MsgService.EthTransaction:output_type -> polaris.evm.v1alpha1.WrappedEthereumTransactionResult - 3, // 4: polaris.evm.v1alpha1.MsgService.UpdateParams:output_type -> polaris.evm.v1alpha1.UpdateParamsResponse - 3, // [3:5] is the sub-list for method output_type - 1, // [1:3] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 0, // 0: polaris.evm.v1alpha1.MsgService.EthTransaction:input_type -> polaris.evm.v1alpha1.WrappedEthereumTransaction + 1, // 1: polaris.evm.v1alpha1.MsgService.EthTransaction:output_type -> polaris.evm.v1alpha1.WrappedEthereumTransactionResult + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_polaris_evm_v1alpha1_tx_proto_init() } @@ -2214,7 +1248,6 @@ func file_polaris_evm_v1alpha1_tx_proto_init() { if File_polaris_evm_v1alpha1_tx_proto != nil { return } - file_polaris_evm_v1alpha1_params_proto_init() if !protoimpl.UnsafeEnabled { file_polaris_evm_v1alpha1_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WrappedEthereumTransaction); i { @@ -2240,30 +1273,6 @@ func file_polaris_evm_v1alpha1_tx_proto_init() { return nil } } - file_polaris_evm_v1alpha1_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateParamsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_polaris_evm_v1alpha1_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateParamsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } type x struct{} out := protoimpl.TypeBuilder{ @@ -2271,7 +1280,7 @@ func file_polaris_evm_v1alpha1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_polaris_evm_v1alpha1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 2, NumExtensions: 0, NumServices: 1, }, diff --git a/cosmos/api/polaris/evm/v1alpha1/tx_grpc.pb.go b/cosmos/api/polaris/evm/v1alpha1/tx_grpc.pb.go index a94f3b9d6..820c37827 100644 --- a/cosmos/api/polaris/evm/v1alpha1/tx_grpc.pb.go +++ b/cosmos/api/polaris/evm/v1alpha1/tx_grpc.pb.go @@ -40,7 +40,6 @@ const _ = grpc.SupportPackageIsVersion7 const ( MsgService_EthTransaction_FullMethodName = "/polaris.evm.v1alpha1.MsgService/EthTransaction" - MsgService_UpdateParams_FullMethodName = "/polaris.evm.v1alpha1.MsgService/UpdateParams" ) // MsgServiceClient is the client API for MsgService service. @@ -49,11 +48,6 @@ const ( type MsgServiceClient interface { // EthTransaction defines a method submitting Ethereum transactions. EthTransaction(ctx context.Context, in *WrappedEthereumTransaction, opts ...grpc.CallOption) (*WrappedEthereumTransactionResult, error) - // `UpdateParams` defines a governance operation for updating the x/evm module - // parameters. The authority is defaults to the x/gov module account. - // - // Since: cosmos-sdk 0.47 - UpdateParams(ctx context.Context, in *UpdateParamsRequest, opts ...grpc.CallOption) (*UpdateParamsResponse, error) } type msgServiceClient struct { @@ -73,26 +67,12 @@ func (c *msgServiceClient) EthTransaction(ctx context.Context, in *WrappedEthere return out, nil } -func (c *msgServiceClient) UpdateParams(ctx context.Context, in *UpdateParamsRequest, opts ...grpc.CallOption) (*UpdateParamsResponse, error) { - out := new(UpdateParamsResponse) - err := c.cc.Invoke(ctx, MsgService_UpdateParams_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // MsgServiceServer is the server API for MsgService service. // All implementations must embed UnimplementedMsgServiceServer // for forward compatibility type MsgServiceServer interface { // EthTransaction defines a method submitting Ethereum transactions. EthTransaction(context.Context, *WrappedEthereumTransaction) (*WrappedEthereumTransactionResult, error) - // `UpdateParams` defines a governance operation for updating the x/evm module - // parameters. The authority is defaults to the x/gov module account. - // - // Since: cosmos-sdk 0.47 - UpdateParams(context.Context, *UpdateParamsRequest) (*UpdateParamsResponse, error) mustEmbedUnimplementedMsgServiceServer() } @@ -103,9 +83,6 @@ type UnimplementedMsgServiceServer struct { func (UnimplementedMsgServiceServer) EthTransaction(context.Context, *WrappedEthereumTransaction) (*WrappedEthereumTransactionResult, error) { return nil, status.Errorf(codes.Unimplemented, "method EthTransaction not implemented") } -func (UnimplementedMsgServiceServer) UpdateParams(context.Context, *UpdateParamsRequest) (*UpdateParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") -} func (UnimplementedMsgServiceServer) mustEmbedUnimplementedMsgServiceServer() {} // UnsafeMsgServiceServer may be embedded to opt out of forward compatibility for this service. @@ -137,24 +114,6 @@ func _MsgService_EthTransaction_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } -func _MsgService_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServiceServer).UpdateParams(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: MsgService_UpdateParams_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServiceServer).UpdateParams(ctx, req.(*UpdateParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - // MsgService_ServiceDesc is the grpc.ServiceDesc for MsgService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -166,10 +125,6 @@ var MsgService_ServiceDesc = grpc.ServiceDesc{ MethodName: "EthTransaction", Handler: _MsgService_EthTransaction_Handler, }, - { - MethodName: "UpdateParams", - Handler: _MsgService_UpdateParams_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "polaris/evm/v1alpha1/tx.proto", diff --git a/cosmos/docker/local/config/polaris.toml b/cosmos/docker/local/config/polaris.toml index 645573bd6..f38e4296c 100644 --- a/cosmos/docker/local/config/polaris.toml +++ b/cosmos/docker/local/config/polaris.toml @@ -32,4 +32,4 @@ MaxHeaderHistory = 192 MaxBlockHistory = 5000 Default = 1000000000 MaxPrice = 100000000000 -IgnorePrice = 0 +IgnorePrice = 1 diff --git a/cosmos/docker/local/docker-init.sh b/cosmos/docker/local/docker-init.sh index b75400777..9fdecb1ba 100644 --- a/cosmos/docker/local/docker-init.sh +++ b/cosmos/docker/local/docker-init.sh @@ -67,7 +67,6 @@ done jq '.app_state["staking"]["params"]["bond_denom"]="abera"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["crisis"]["constant_fee"]["denom"]="abera"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="abera"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" -jq '.app_state["evm"]["params"]["evm_denom"]="abera"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["mint"]["params"]["mint_denom"]="abera"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.consensus["params"]["block"]["max_gas"]="30000000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" @@ -76,11 +75,6 @@ for KEY in "${KEYS[@]}"; do polard genesis add-genesis-account $KEY 100000000000000000000000000abera --keyring-backend $KEYRING --home "$HOMEDIR" done -# Test Account -# absurd surge gather author blanket acquire proof struggle runway attract cereal quiz tattoo shed almost sudden survey boring film memory picnic favorite verb tank -# 0xfffdbb37105441e14b0ee6330d855d8504ff39e705c3afa8f859ac9865f99306 -polard genesis add-genesis-account polar1yrene6g2zwjttemf0c65fscg8w8c55w5vhc9hd 69000000000000000000000000abera --keyring-backend $KEYRING --home "$HOMEDIR" - # Sign genesis transaction polard genesis gentx ${KEYS[0]} 1000000000000000000000abera --keyring-backend $KEYRING --chain-id $CHAINID --home "$HOMEDIR" ## In case you want to create multiple validators at genesis diff --git a/cosmos/init.sh b/cosmos/init.sh index 79c101822..3cd986198 100755 --- a/cosmos/init.sh +++ b/cosmos/init.sh @@ -85,7 +85,6 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then jq '.app_state["staking"]["params"]["bond_denom"]="abera"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["crisis"]["constant_fee"]["denom"]="abera"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="abera"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" - jq '.app_state["evm"]["params"]["evm_denom"]="abera"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["mint"]["params"]["mint_denom"]="abera"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.consensus["params"]["block"]["max_gas"]="30000000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" @@ -94,10 +93,6 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then ./bin/polard genesis add-genesis-account $KEY 100000000000000000000000000abera --keyring-backend $KEYRING --home "$HOMEDIR" done - # Test Account - # absurd surge gather author blanket acquire proof struggle runway attract cereal quiz tattoo shed almost sudden survey boring film memory picnic favorite verb tank - # 0xfffdbb37105441e14b0ee6330d855d8504ff39e705c3afa8f859ac9865f99306 - ./bin/polard genesis add-genesis-account polar1yrene6g2zwjttemf0c65fscg8w8c55w5vhc9hd 69000000000000000000000000abera --keyring-backend $KEYRING --home "$HOMEDIR" # Sign genesis transaction ./bin/polard genesis gentx ${KEYS[0]} 1000000000000000000000abera --keyring-backend $KEYRING --chain-id $CHAINID --home "$HOMEDIR" diff --git a/cosmos/precompile/auth/auth_test.go b/cosmos/precompile/auth/auth_test.go index 2a1834ee2..bfd407b23 100644 --- a/cosmos/precompile/auth/auth_test.go +++ b/cosmos/precompile/auth/auth_test.go @@ -96,7 +96,7 @@ var _ = Describe("Address Precompile", func() { context.Background(), nil, common.Address{}, - big.NewInt(0), + new(big.Int), false, "invalid", ) @@ -109,7 +109,7 @@ var _ = Describe("Address Precompile", func() { context.Background(), nil, common.Address{}, - big.NewInt(0), + new(big.Int), false, common.BytesToAddress([]byte("test")), ) @@ -123,7 +123,7 @@ var _ = Describe("Address Precompile", func() { context.Background(), nil, common.Address{}, - big.NewInt(0), + new(big.Int), false, common.BytesToAddress([]byte("invalid")), ) @@ -136,7 +136,7 @@ var _ = Describe("Address Precompile", func() { context.Background(), nil, common.Address{}, - big.NewInt(0), + new(big.Int), false, "0xxxxx", ) @@ -149,7 +149,7 @@ var _ = Describe("Address Precompile", func() { context.Background(), nil, common.Address{}, - big.NewInt(0), + new(big.Int), false, cosmlib.AddressToAccAddress(common.BytesToAddress([]byte("test"))).String(), ) @@ -193,7 +193,7 @@ var _ = Describe("Address Precompile", func() { context.Background(), evm, common.Address{}, - big.NewInt(0), + new(big.Int), false, "invalid address", grantee, @@ -208,7 +208,7 @@ var _ = Describe("Address Precompile", func() { context.Background(), evm, common.Address{}, - big.NewInt(0), + new(big.Int), false, granter, "invalid address", @@ -223,7 +223,7 @@ var _ = Describe("Address Precompile", func() { context.Background(), evm, common.Address{}, - big.NewInt(0), + new(big.Int), false, granter, grantee, @@ -238,7 +238,7 @@ var _ = Describe("Address Precompile", func() { context.Background(), evm, common.Address{}, - big.NewInt(0), + new(big.Int), false, granter, grantee, @@ -253,7 +253,7 @@ var _ = Describe("Address Precompile", func() { context.Background(), evm, common.Address{}, - big.NewInt(0), + new(big.Int), false, granter, grantee, @@ -268,7 +268,7 @@ var _ = Describe("Address Precompile", func() { ctx, evm, common.Address{}, - big.NewInt(0), + new(big.Int), false, granter, grantee, @@ -283,12 +283,12 @@ var _ = Describe("Address Precompile", func() { ctx, evm, common.Address{}, - big.NewInt(0), + new(big.Int), false, granter, grantee, sdkCoinsToEvmCoins(limit), - big.NewInt(0), + new(big.Int), ) Expect(err).ToNot(HaveOccurred()) }) @@ -300,12 +300,12 @@ var _ = Describe("Address Precompile", func() { ctx, evm, common.Address{}, - big.NewInt(0), + new(big.Int), false, granter, grantee, sdkCoinsToEvmCoins(limit), - big.NewInt(0), + new(big.Int), ) Expect(err).ToNot(HaveOccurred()) }) @@ -315,7 +315,7 @@ var _ = Describe("Address Precompile", func() { ctx, evm, common.Address{}, - big.NewInt(0), + new(big.Int), true, "invalid address", grantee, @@ -329,7 +329,7 @@ var _ = Describe("Address Precompile", func() { ctx, evm, common.Address{}, - big.NewInt(0), + new(big.Int), true, granter, "invalid address", @@ -343,7 +343,7 @@ var _ = Describe("Address Precompile", func() { ctx, evm, common.Address{}, - big.NewInt(0), + new(big.Int), true, granter, grantee, @@ -357,7 +357,7 @@ var _ = Describe("Address Precompile", func() { ctx, evm, common.Address{}, - big.NewInt(0), + new(big.Int), true, granter, grantee, diff --git a/cosmos/proto/polaris/evm/storage/v1/slot.proto b/cosmos/proto/polaris/evm/storage/v1/slot.proto deleted file mode 100644 index eaa1c2875..000000000 --- a/cosmos/proto/polaris/evm/storage/v1/slot.proto +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -syntax = "proto3"; - -package polaris.evm.storage.v1; - -option go_package = "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state/storage"; - -// `Slot` represents a single key/value pair of evm state data. -message Slot { - // `key` is the stored key. - string key = 1; - - // `value` is the stored value for the given key. - string value = 2; -} diff --git a/cosmos/proto/polaris/evm/v1alpha1/genesis.proto b/cosmos/proto/polaris/evm/v1alpha1/genesis.proto deleted file mode 100644 index bea8b7385..000000000 --- a/cosmos/proto/polaris/evm/v1alpha1/genesis.proto +++ /dev/null @@ -1,48 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -syntax = "proto3"; -package polaris.evm.v1alpha1; - -import "gogoproto/gogo.proto"; -import "polaris/evm/v1alpha1/params.proto"; - -option go_package = "pkg.berachain.dev/polaris/cosmos/x/evm/types"; - -// GenesisState defines the evm module's genesis state. -message GenesisState { - // params defines all the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false]; - - // `address_to_contract` is a map of address to contract. - map address_to_contract = 2; - - // `hash_to_code` is a map of code hash to code. - map hash_to_code = 3; -} - -// `Contract` defines the contract state. -message Contract { - // `code_hash` is the hash of the contract code. - string code_hash = 1; - - // `slot_to_value` is a map of slot to value. - map slot_to_value = 2; -} diff --git a/cosmos/proto/polaris/evm/v1alpha1/params.proto b/cosmos/proto/polaris/evm/v1alpha1/params.proto deleted file mode 100644 index 3a17f713d..000000000 --- a/cosmos/proto/polaris/evm/v1alpha1/params.proto +++ /dev/null @@ -1,43 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -syntax = "proto3"; -package polaris.evm.v1alpha1; - -import "gogoproto/gogo.proto"; - -option go_package = "pkg.berachain.dev/polaris/cosmos/x/evm/types"; - -// `Params` defines the parameters for the x/evm module. -message Params { - // `evm_denom` represents the token denomination used as the native token - // within the EVM. - string evm_denom = 1 [(gogoproto.moretags) = "yaml:\"evm_denom\""]; - - // `extra_eips` defines a list of additional EIPs for the vm.Config - repeated int64 extra_eips = 2 [ - (gogoproto.customname) = "ExtraEIPs", - (gogoproto.moretags) = "yaml:\"extra_eips\"" - ]; - - // `chain_config` represents the ethereum chain config for the polaris - // EVM - string chain_config = 3 [(gogoproto.moretags) = "yaml:\"chain_config\""]; -} diff --git a/cosmos/proto/polaris/evm/v1alpha1/query.proto b/cosmos/proto/polaris/evm/v1alpha1/query.proto deleted file mode 100644 index 5c4103f61..000000000 --- a/cosmos/proto/polaris/evm/v1alpha1/query.proto +++ /dev/null @@ -1,45 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -syntax = "proto3"; -package polaris.evm.v1alpha1; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "polaris/evm/v1alpha1/params.proto"; - -option go_package = "pkg.berachain.dev/polaris/cosmos/x/evm/types"; - -// `QueryService` provides defines the gRPC querier service. -service QueryService { - // Params returns the total set of evm parameters. - rpc Params(ParamsRequest) returns (ParamsResponse) { - option (google.api.http).get = "/polaris/evm/v1alpha1/params"; - } -} - -// `ParamsRequest` is the request type for the Query/Params RPC method. -message ParamsRequest {} - -// `ParamsResponse` is the response type for the Query/Params RPC method. -message ParamsResponse { - // params defines the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false]; -} diff --git a/cosmos/proto/polaris/evm/v1alpha1/tx.proto b/cosmos/proto/polaris/evm/v1alpha1/tx.proto index 37bec0e69..d39ac48af 100644 --- a/cosmos/proto/polaris/evm/v1alpha1/tx.proto +++ b/cosmos/proto/polaris/evm/v1alpha1/tx.proto @@ -22,9 +22,6 @@ syntax = "proto3"; package polaris.evm.v1alpha1; import "cosmos/msg/v1/msg.proto"; -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "polaris/evm/v1alpha1/params.proto"; option go_package = "pkg.berachain.dev/polaris/cosmos/x/evm/types"; @@ -34,18 +31,11 @@ service MsgService { // EthTransaction defines a method submitting Ethereum transactions. rpc EthTransaction(WrappedEthereumTransaction) returns (WrappedEthereumTransactionResult); - - // `UpdateParams` defines a governance operation for updating the x/evm module - // parameters. The authority is defaults to the x/gov module account. - // - // Since: cosmos-sdk 0.47 - rpc UpdateParams(UpdateParamsRequest) returns (UpdateParamsResponse); } // WrappedEthereumTransaction encapsulates an Ethereum transaction as an SDK message. message WrappedEthereumTransaction { option (cosmos.msg.v1.signer) = "hacky_fix_cause_cosmos"; - option (gogoproto.goproto_getters) = false; // data is inner transaction data of the Ethereum transaction bytes data = 1; @@ -55,7 +45,6 @@ message WrappedEthereumTransaction { // WrappedEthereumTransactionResult defines the Msg/EthereumTx response type. message WrappedEthereumTransactionResult { - option (gogoproto.goproto_getters) = false; // `gas_used` represents the gas used by the virtual machine execution. uint64 gas_used = 1; @@ -65,24 +54,3 @@ message WrappedEthereumTransactionResult { // `return_data` contains the return data of the virtual machine execution. bytes return_data = 3; } - -// `UpdateParamsRequest` is the Msg/UpdateParams request type. -// -// Since: cosmos-sdk 0.47 -message UpdateParamsRequest { - option (cosmos.msg.v1.signer) = "authority"; - - // authority is the address that controls the module (defaults to x/gov unless overwritten). - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // params defines the x/evm parameters to update. - // - // NOTE: All parameters must be supplied. - Params params = 2 [(gogoproto.nullable) = false]; -} - -// `UpdateParamsResponse` defines the response structure for executing a -// UpdateParamsResponse message. -// -// Since: cosmos-sdk 0.47 -message UpdateParamsResponse {} diff --git a/cosmos/testing/integration/precompile/distribution/distribution_test.go b/cosmos/testing/integration/precompile/distribution/distribution_test.go index fc2f0d914..8817bacb6 100644 --- a/cosmos/testing/integration/precompile/distribution/distribution_test.go +++ b/cosmos/testing/integration/precompile/distribution/distribution_test.go @@ -25,7 +25,10 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + bbindings "pkg.berachain.dev/polaris/contracts/bindings/cosmos/precompile/bank" bindings "pkg.berachain.dev/polaris/contracts/bindings/cosmos/precompile/distribution" sbindings "pkg.berachain.dev/polaris/contracts/bindings/cosmos/precompile/staking" tbindings "pkg.berachain.dev/polaris/contracts/bindings/testing" @@ -47,6 +50,7 @@ var ( tf *integration.TestFixture precompile *bindings.DistributionModule stakingPrecompile *sbindings.StakingModule + bankPrecompile *bbindings.BankModule validator common.Address ) @@ -61,6 +65,10 @@ var _ = SynchronizedBeforeSuite(func() []byte { // Setup the staking precompile. stakingPrecompile, _ = sbindings.NewStakingModule( common.HexToAddress("0xd9A998CaC66092748FfEc7cFBD155Aae1737C2fF"), tf.EthClient) + bankPrecompile, _ = bbindings.NewBankModule( + cosmlib.AccAddressToEthAddress(authtypes.NewModuleAddress(banktypes.ModuleName)), + tf.EthClient, + ) // Set the validator address. validator = common.Address(tf.Network.Validators[0].Address.Bytes()) return nil @@ -77,7 +85,6 @@ var _ = Describe("Distribution Precompile", func() { txr := tf.GenerateTransactOpts("alice") tx, err := precompile.SetWithdrawAddress0(txr, addr.String()) Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) ExpectSuccessReceipt(tf.EthClient, tx) }) It("should be able to set withdraw address with ethereum address", func() { @@ -86,7 +93,6 @@ var _ = Describe("Distribution Precompile", func() { txr := tf.GenerateTransactOpts("alice") tx, err := precompile.SetWithdrawAddress(txr, ethAddr) Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) ExpectSuccessReceipt(tf.EthClient, tx) }) It("should be able to get delegator reward", func() { @@ -99,7 +105,6 @@ var _ = Describe("Distribution Precompile", func() { txr.Value = delegateAmt tx, err := stakingPrecompile.Delegate(txr, val, delegateAmt) Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) ExpectSuccessReceipt(tf.EthClient, tx) // Wait for the 2 block to be produced, to make sure there are rewards. @@ -112,7 +117,6 @@ var _ = Describe("Distribution Precompile", func() { txr = tf.GenerateTransactOpts("alice") tx, err = precompile.WithdrawDelegatorReward(txr, tf.Address("alice"), val) Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) ExpectSuccessReceipt(tf.EthClient, tx) }) @@ -125,19 +129,29 @@ var _ = Describe("Distribution Precompile", func() { common.HexToAddress("0xd9A998CaC66092748FfEc7cFBD155Aae1737C2fF"), ) Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) + ExpectSuccessReceipt(tf.EthClient, tx) + + txr := tf.GenerateTransactOpts("alice") + amt := big.NewInt(123450000000) + tx, err = bankPrecompile.Send(txr, tf.Address("alice"), contractAddress, []bbindings.CosmosCoin{ + { + Denom: "abera", + Amount: amt, + }, + }) + Expect(err).ToNot(HaveOccurred()) ExpectSuccessReceipt(tf.EthClient, tx) // Delegate some tokens to a validator. validators, err := stakingPrecompile.GetActiveValidators(nil) Expect(err).ToNot(HaveOccurred()) val := validators[0] - amt := big.NewInt(123450000000) - txr := tf.GenerateTransactOpts("alice") + amt = big.NewInt(123450000000) + txr = tf.GenerateTransactOpts("alice") txr.Value = amt + tx, err = contract.Delegate(txr, val) Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) ExpectSuccessReceipt(tf.EthClient, tx) // Wait for the 2 block to be produced, to make sure there are rewards. @@ -150,7 +164,6 @@ var _ = Describe("Distribution Precompile", func() { txr = tf.GenerateTransactOpts("alice") tx, err = contract.WithdrawRewards(txr, contractAddress, val) Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) ExpectSuccessReceipt(tf.EthClient, tx) // Get withdraw address enabled. diff --git a/cosmos/testing/integration/precompile/gov/governance_test.go b/cosmos/testing/integration/precompile/gov/governance_test.go index 5a600a80f..03b23085f 100644 --- a/cosmos/testing/integration/precompile/gov/governance_test.go +++ b/cosmos/testing/integration/precompile/gov/governance_test.go @@ -92,7 +92,6 @@ var _ = Describe("Call the Precompile Directly", func() { txr := tf.GenerateTransactOpts("alice") tx, err := precompile.SubmitProposal(txr, prop, msg) Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) ExpectSuccessReceipt(tf.EthClient, tx) // Send coins to the wrapper. @@ -105,7 +104,6 @@ var _ = Describe("Call the Precompile Directly", func() { txr = tf.GenerateTransactOpts("alice") tx, err = bankPrecompile.Send(txr, tf.Address("alice"), wrapperAddr, coins) Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) ExpectSuccessReceipt(tf.EthClient, tx) // Wrapper submits a proposal. @@ -113,7 +111,6 @@ var _ = Describe("Call the Precompile Directly", func() { txr = tf.GenerateTransactOpts("alice") tx, err = wrapper.Submit(txr, prop, msg, "stake", big.NewInt(amt.Int64())) Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) ExpectSuccessReceipt(tf.EthClient, tx) // Wait for next block. @@ -148,28 +145,24 @@ var _ = Describe("Call the Precompile Directly", func() { txr := tf.GenerateTransactOpts("alice") tx, err := precompile.Vote(txr, 1, 1, "metadata") Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) ExpectSuccessReceipt(tf.EthClient, tx) // Call via wrapper. txr = tf.GenerateTransactOpts("alice") tx, err = wrapper.Vote(txr, 1, 1, "metadata") Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) ExpectSuccessReceipt(tf.EthClient, tx) // Call directly. txr = tf.GenerateTransactOpts("alice") tx, err = precompile.CancelProposal(txr, 1) Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) ExpectSuccessReceipt(tf.EthClient, tx) // Call via wrapper. txr = tf.GenerateTransactOpts("alice") tx, err = wrapper.CancelProposal(txr, 2) Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) ExpectSuccessReceipt(tf.EthClient, tx) }) }) diff --git a/cosmos/testing/integration/precompile/staking/staking_test.go b/cosmos/testing/integration/precompile/staking/staking_test.go index 1b56c489d..bb3e20211 100644 --- a/cosmos/testing/integration/precompile/staking/staking_test.go +++ b/cosmos/testing/integration/precompile/staking/staking_test.go @@ -25,8 +25,13 @@ import ( "testing" "time" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + + bbindings "pkg.berachain.dev/polaris/contracts/bindings/cosmos/precompile/bank" bindings "pkg.berachain.dev/polaris/contracts/bindings/cosmos/precompile/staking" tbindings "pkg.berachain.dev/polaris/contracts/bindings/testing" + cosmlib "pkg.berachain.dev/polaris/cosmos/lib" "pkg.berachain.dev/polaris/cosmos/testing/integration" "pkg.berachain.dev/polaris/eth/common" @@ -43,6 +48,7 @@ func TestStakingPrecompile(t *testing.T) { var ( tf *integration.TestFixture stakingPrecompile *bindings.StakingModule + bankPrecompile *bbindings.BankModule validator common.Address delegateAmt = big.NewInt(123450000000) ) @@ -53,6 +59,10 @@ var _ = SynchronizedBeforeSuite(func() []byte { validator = common.Address(tf.Network.Validators[0].Address.Bytes()) stakingPrecompile, _ = bindings.NewStakingModule( common.HexToAddress("0xd9A998CaC66092748FfEc7cFBD155Aae1737C2fF"), tf.EthClient) + bankPrecompile, _ = bbindings.NewBankModule( + cosmlib.AccAddressToEthAddress(authtypes.NewModuleAddress(banktypes.ModuleName)), + tf.EthClient, + ) return nil }, func(data []byte) {}) @@ -70,7 +80,6 @@ var _ = Describe("Staking", func() { txr.Value = delegateAmt tx, err := stakingPrecompile.Delegate(txr, validator, delegateAmt) Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) ExpectSuccessReceipt(tf.EthClient, tx) delegated, err = stakingPrecompile.GetDelegation(nil, tf.Address("alice"), validator) @@ -106,7 +115,6 @@ var _ = Describe("Staking", func() { "MTK", ) Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) ExpectSuccessReceipt(tf.EthClient, tx) delegated, err := stakingPrecompile.GetDelegation(nil, contractAddr, validator) @@ -118,13 +126,23 @@ var _ = Describe("Staking", func() { Expect(addresses).To(HaveLen(1)) Expect(addresses[0]).To(Equal(validator)) - // Send tokens to the contract to delegate and mint LSD. txr := tf.GenerateTransactOpts("alice") + amt := big.NewInt(123450000000) + tx, err = bankPrecompile.Send(txr, tf.Address("alice"), contractAddr, []bbindings.CosmosCoin{ + { + Denom: "abera", + Amount: amt, + }, + }) + Expect(err).ToNot(HaveOccurred()) + ExpectSuccessReceipt(tf.EthClient, tx) + + // Send tokens to the contract to delegate and mint LSD. + txr = tf.GenerateTransactOpts("alice") txr.GasLimit = 0 txr.Value = delegateAmt tx, err = contract.Delegate(txr, delegateAmt) Expect(err).ToNot(HaveOccurred()) - ExpectMined(tf.EthClient, tx) ExpectSuccessReceipt(tf.EthClient, tx) // Wait for a couple blocks to query. diff --git a/cosmos/testing/network/network.go b/cosmos/testing/network/network.go index b594dea2a..c664ec916 100644 --- a/cosmos/testing/network/network.go +++ b/cosmos/testing/network/network.go @@ -23,6 +23,7 @@ package network import ( "encoding/json" "fmt" + "math/big" "time" cdb "github.com/cosmos/cosmos-db" @@ -46,6 +47,9 @@ import ( "pkg.berachain.dev/polaris/cosmos/crypto/keys/ethsecp256k1" runtime "pkg.berachain.dev/polaris/cosmos/runtime" config "pkg.berachain.dev/polaris/cosmos/runtime/config" + evmtypes "pkg.berachain.dev/polaris/cosmos/x/evm/types" + "pkg.berachain.dev/polaris/eth/common" + "pkg.berachain.dev/polaris/eth/core" ) type ( @@ -123,7 +127,7 @@ func DefaultConfig(keysMap map[string]*ethsecp256k1.PrivKey) network.Config { ChainID: "polaris-2061", NumValidators: 1, BondDenom: "abera", - MinGasPrices: fmt.Sprintf("0.00006%s", "abera"), + MinGasPrices: fmt.Sprintf("0.00000%s", "abera"), AccountTokens: sdk.TokensFromConsensusPower(thousand, sdk.DefaultPowerReduction), StakingTokens: sdk.TokensFromConsensusPower(fivehundred, sdk.DefaultPowerReduction), BondedTokens: sdk.TokensFromConsensusPower(onehundred, sdk.DefaultPowerReduction), @@ -140,12 +144,17 @@ func BuildGenesisState(keysMap map[string]*ethsecp256k1.PrivKey) map[string]json encoding := config.BuildPolarisEncodingConfig(runtime.ModuleBasics) genState := runtime.ModuleBasics.DefaultGenesis(encoding.Codec) - // Auth & Bank module + // Auth, Bank, EVM module var authState authtypes.GenesisState var bankState banktypes.GenesisState + // Set Eth Genesis Alloc + var ethGen core.Genesis encoding.Codec.MustUnmarshalJSON(genState[authtypes.ModuleName], &authState) encoding.Codec.MustUnmarshalJSON(genState[banktypes.ModuleName], &bankState) + if err := ethGen.UnmarshalJSON(genState[evmtypes.ModuleName]); err != nil { + panic(err) + } for mapKey, testKey := range keysMap { newAccount, err := authtypes.NewBaseAccountWithPubKey(testKey.PubKey()) @@ -161,6 +170,10 @@ func BuildGenesisState(keysMap map[string]*ethsecp256k1.PrivKey) map[string]json Address: newAccount.Address, Coins: getCoinsForAccount(mapKey), }) + + acc := ethGen.Alloc[common.BytesToAddress(newAccount.GetAddress())] + acc.Balance = big.NewInt(examoney) + ethGen.Alloc[common.BytesToAddress(newAccount.GetAddress())] = acc } bankState.DenomMetadata = getTestMetadata() @@ -181,6 +194,11 @@ func BuildGenesisState(keysMap map[string]*ethsecp256k1.PrivKey) map[string]json genState[authtypes.ModuleName] = encoding.Codec.MustMarshalJSON(&authState) genState[banktypes.ModuleName] = encoding.Codec.MustMarshalJSON(&bankState) + ethGenBytes, err := ethGen.MarshalJSON() + if err != nil { + panic(err) + } + genState[evmtypes.ModuleName] = ethGenBytes // Staking module var stakingState stakingtypes.GenesisState diff --git a/cosmos/x/erc20/types/params.go b/cosmos/x/erc20/types/params.go index b7efe8bd4..ce44d38cb 100644 --- a/cosmos/x/erc20/types/params.go +++ b/cosmos/x/erc20/types/params.go @@ -25,11 +25,6 @@ const ( DefaultEvmDenom = "abera" ) -var ( - // DefaultExtraEIPs is the default extra EIPs. - DefaultExtraEIPs = []int64{} -) - // DefaultParams contains the default values for all parameters. func DefaultParams() *Params { return &Params{} diff --git a/cosmos/x/evm/depinject.go b/cosmos/x/evm/depinject.go index 127c74620..a2e81c0f1 100644 --- a/cosmos/x/evm/depinject.go +++ b/cosmos/x/evm/depinject.go @@ -53,7 +53,6 @@ type DepInjectInput struct { CustomPrecompiles func() *ethprecompile.Injector `optional:"true"` AccountKeeper AccountKeeper - BankKeeper BankKeeper StakingKeeper StakingKeeper } @@ -80,7 +79,6 @@ func ProvideModule(in DepInjectInput) DepInjectOutput { k := keeper.NewKeeper( in.AccountKeeper, - in.BankKeeper, in.StakingKeeper, in.Key, authority.String(), @@ -88,7 +86,7 @@ func ProvideModule(in DepInjectInput) DepInjectOutput { in.CustomPrecompiles, ) - m := NewAppModule(k, in.AccountKeeper, in.BankKeeper) + m := NewAppModule(k, in.AccountKeeper) return DepInjectOutput{Keeper: k, Module: m} } diff --git a/cosmos/x/evm/genesis.go b/cosmos/x/evm/genesis.go index 4dd5c0ae8..7e3d3b51c 100644 --- a/cosmos/x/evm/genesis.go +++ b/cosmos/x/evm/genesis.go @@ -22,7 +22,6 @@ package evm import ( "encoding/json" - "fmt" abci "github.com/cometbft/cometbft/abci/types" @@ -30,30 +29,34 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "pkg.berachain.dev/polaris/cosmos/x/evm/types" + "pkg.berachain.dev/polaris/eth/core" ) // DefaultGenesis returns default genesis state as raw bytes for the evm // module. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) +func (AppModuleBasic) DefaultGenesis(_ codec.JSONCodec) json.RawMessage { + ethGen, err := core.DefaultGenesis.MarshalJSON() + if err != nil { + panic(err) + } + return ethGen } // ValidateGenesis performs genesis state validation for the evm module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { - var data types.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return types.ValidateGenesis(data) +func (AppModuleBasic) ValidateGenesis(_ codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { + ethGen := new(core.Genesis) + return ethGen.UnmarshalJSON(bz) // todo: improve } // InitGenesis performs genesis initialization for the evm module. It returns // no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { - var genesisState types.GenesisState - cdc.MustUnmarshalJSON(data, &genesisState) - if err := am.keeper.InitGenesis(ctx, genesisState); err != nil { +func (am AppModule) InitGenesis(ctx sdk.Context, _ codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var ethGen core.Genesis + if err := ethGen.UnmarshalJSON(data); err != nil { + panic(err) + } + + if err := am.keeper.InitGenesis(ctx, ðGen); err != nil { panic(err) } return []abci.ValidatorUpdate{} @@ -61,6 +64,11 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. // ExportGenesis returns the exported genesis state as raw bytes for the evm // module. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(am.keeper.ExportGenesis(ctx)) +func (am AppModule) ExportGenesis(ctx sdk.Context, _ codec.JSONCodec) json.RawMessage { + ethGen := am.keeper.ExportGenesis(ctx) + ethGenBz, err := ethGen.MarshalJSON() + if err != nil { + panic(err) + } + return ethGenBz } diff --git a/cosmos/x/evm/keeper/genesis.go b/cosmos/x/evm/keeper/genesis.go index 8eb55f30a..dcbd32686 100644 --- a/cosmos/x/evm/keeper/genesis.go +++ b/cosmos/x/evm/keeper/genesis.go @@ -24,17 +24,17 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins" - "pkg.berachain.dev/polaris/cosmos/x/evm/types" + "pkg.berachain.dev/polaris/eth/core" "pkg.berachain.dev/polaris/lib/utils" ) // InitGenesis is called during the InitGenesis. -func (k *Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) error { +func (k *Keeper) InitGenesis(ctx sdk.Context, genState *core.Genesis) error { // Initialize all the plugins. for _, plugin := range k.host.GetAllPlugins() { // checks whether plugin implements methods of HasGenesis and executes them if it does if plugin, ok := utils.GetAs[plugins.HasGenesis](plugin); ok { - plugin.InitGenesis(ctx, &genState) + plugin.InitGenesis(ctx, genState) } } @@ -43,8 +43,8 @@ func (k *Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) error } // ExportGenesis returns the exported genesis state. -func (k *Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - genesisState := new(types.GenesisState) +func (k *Keeper) ExportGenesis(ctx sdk.Context) *core.Genesis { + genesisState := new(core.Genesis) for _, plugin := range k.host.GetAllPlugins() { if plugin, ok := utils.GetAs[plugins.HasGenesis](plugin); ok { plugin.ExportGenesis(ctx, genesisState) diff --git a/cosmos/x/evm/keeper/host.go b/cosmos/x/evm/keeper/host.go index 04aee2f9b..4c6d9411e 100644 --- a/cosmos/x/evm/keeper/host.go +++ b/cosmos/x/evm/keeper/host.go @@ -53,7 +53,6 @@ type Host interface { storetypes.StoreKey, storetypes.StoreKey, state.AccountKeeper, - state.BankKeeper, func(height int64, prove bool) (sdk.Context, error), ) } @@ -85,7 +84,7 @@ func NewHost( h.bp = block.NewPlugin(storeKey, sk) h.cp = configuration.NewPlugin(storeKey) h.gp = gas.NewPlugin() - h.txp = txpool.NewPlugin(h.cp, utils.MustGetAs[*mempool.EthTxPool](ethTxMempool)) + h.txp = txpool.NewPlugin(utils.MustGetAs[*mempool.EthTxPool](ethTxMempool)) h.pcs = precompiles return h @@ -97,11 +96,10 @@ func (h *host) Setup( storeKey storetypes.StoreKey, offchainStoreKey storetypes.StoreKey, ak state.AccountKeeper, - bk state.BankKeeper, qc func(height int64, prove bool) (sdk.Context, error), ) { // Setup the state, precompile, historical, and txpool plugins - h.sp = state.NewPlugin(ak, bk, storeKey, h.cp, log.NewFactory(h.pcs().GetPrecompiles())) + h.sp = state.NewPlugin(ak, storeKey, log.NewFactory(h.pcs().GetPrecompiles())) h.pp = precompile.NewPlugin(h.pcs().GetPrecompiles(), h.sp) h.hp = historical.NewPlugin(h.bp, offchainStoreKey, storeKey) h.txp.SetNonceRetriever(h.sp) diff --git a/cosmos/x/evm/keeper/keeper.go b/cosmos/x/evm/keeper/keeper.go index 76e8161b5..0929c5e58 100644 --- a/cosmos/x/evm/keeper/keeper.go +++ b/cosmos/x/evm/keeper/keeper.go @@ -40,8 +40,6 @@ import ( type Keeper struct { // ak is the reference to the AccountKeeper. ak state.AccountKeeper - // bk is the reference to the BankKeeper. - bk state.BankKeeper // provider is the struct that houses the Polaris EVM. polaris *polar.Polaris // The (unexposed) key used to access the store from the Context. @@ -55,7 +53,6 @@ type Keeper struct { // NewKeeper creates new instances of the polaris Keeper. func NewKeeper( ak state.AccountKeeper, - bk state.BankKeeper, sk block.StakingKeeper, storeKey storetypes.StoreKey, authority string, @@ -65,7 +62,6 @@ func NewKeeper( // We setup the keeper with some Cosmos standard sauce. k := &Keeper{ ak: ak, - bk: bk, authority: authority, storeKey: storeKey, } @@ -88,7 +84,7 @@ func (k *Keeper) Setup( logger log.Logger, ) { // Setup plugins in the Host - k.host.Setup(k.storeKey, offchainStoreKey, k.ak, k.bk, qc) + k.host.Setup(k.storeKey, offchainStoreKey, k.ak, qc) // Build the Polaris EVM Provider cfg, err := polar.LoadConfigFromFilePath(polarisConfigPath) diff --git a/cosmos/x/evm/keeper/msg_server.go b/cosmos/x/evm/keeper/msg_server.go index 7d76025b1..fa88c4e56 100644 --- a/cosmos/x/evm/keeper/msg_server.go +++ b/cosmos/x/evm/keeper/msg_server.go @@ -25,11 +25,7 @@ import ( errorsmod "cosmossdk.io/errors" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - - "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/configuration" "pkg.berachain.dev/polaris/cosmos/x/evm/types" - "pkg.berachain.dev/polaris/lib/utils" ) // Compile-time check to ensure `Keeper` implements the `MsgServiceServer` interface. @@ -58,23 +54,3 @@ func (k *Keeper) EthTransaction( ReturnData: result.ReturnData, }, nil } - -// UpdateParams processes an incoming request and applies it to the Configuration plugin to -// update things about both the Polaris Chain as well as the EVM Module. -func (k *Keeper) UpdateParams( - ctx context.Context, req *types.UpdateParamsRequest, -) (*types.UpdateParamsResponse, error) { - // Ensure the authority is valid. - if k.authority != req.Authority { - return nil, errorsmod.Wrapf( - govtypes.ErrInvalidSigner, - "invalid authority, expected %s, got %s", k.authority, req.Authority, - ) - } - - // Update the params. - cp := utils.MustGetAs[configuration.Plugin](k.host.GetConfigurationPlugin()) - cp.Prepare(ctx) - cp.SetParams(&req.Params) - return &types.UpdateParamsResponse{}, nil -} diff --git a/cosmos/x/evm/keeper/processor_test.go b/cosmos/x/evm/keeper/processor_test.go index f257ffffc..dbed38d84 100644 --- a/cosmos/x/evm/keeper/processor_test.go +++ b/cosmos/x/evm/keeper/processor_test.go @@ -40,9 +40,9 @@ import ( "pkg.berachain.dev/polaris/cosmos/x/evm/plugins" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state" evmmempool "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/txpool/mempool" - "pkg.berachain.dev/polaris/cosmos/x/evm/types" "pkg.berachain.dev/polaris/eth/accounts/abi" "pkg.berachain.dev/polaris/eth/common" + "pkg.berachain.dev/polaris/eth/core" ethprecompile "pkg.berachain.dev/polaris/eth/core/precompile" coretypes "pkg.berachain.dev/polaris/eth/core/types" "pkg.berachain.dev/polaris/eth/crypto" @@ -65,7 +65,6 @@ var _ = Describe("Processor", func() { var ( k *keeper.Keeper ak state.AccountKeeper - bk state.BankKeeper sk stakingkeeper.Keeper ctx sdk.Context sc ethprecompile.StatefulImpl @@ -87,9 +86,9 @@ var _ = Describe("Processor", func() { } // before chain, init genesis state - ctx, ak, bk, sk = testutil.SetupMinimalKeepers() + ctx, ak, _, sk = testutil.SetupMinimalKeepers() k = keeper.NewKeeper( - ak, bk, sk, + ak, sk, storetypes.NewKVStoreKey("evm"), "authority", evmmempool.NewPolarisEthereumTxPool(), @@ -97,6 +96,12 @@ var _ = Describe("Processor", func() { return ethprecompile.NewPrecompiles([]ethprecompile.Registrable{sc}...) }, ) + for _, plugin := range k.GetHost().GetAllPlugins() { + plugin, hasInitGenesis := utils.GetAs[plugins.HasGenesis](plugin) + if hasInitGenesis { + plugin.InitGenesis(ctx, core.DefaultGenesis) + } + } validator, err := NewValidator(sdk.ValAddress(valAddr), PKs[0]) Expect(err).ToNot(HaveOccurred()) validator.Status = stakingtypes.Bonded @@ -104,12 +109,6 @@ var _ = Describe("Processor", func() { sc = staking.NewPrecompileContract(&sk) k.Setup(storetypes.NewKVStoreKey("offchain-evm"), nil, "", GinkgoT().TempDir(), log.NewNopLogger()) _ = sk.SetParams(ctx, stakingtypes.DefaultParams()) - for _, plugin := range k.GetHost().GetAllPlugins() { - plugin, hasInitGenesis := utils.GetAs[plugins.HasGenesis](plugin) - if hasInitGenesis { - plugin.InitGenesis(ctx, types.DefaultGenesis()) - } - } // Set validator with consensus address. consAddr, err := validator.GetConsAddr() @@ -159,6 +158,7 @@ var _ = Describe("Processor", func() { tx := coretypes.MustSignNewTx(key, signer, legacyTxData) addr, err := signer.Sender(tx) Expect(err).ToNot(HaveOccurred()) + k.GetHost().GetStatePlugin().Reset(ctx) k.GetHost().GetStatePlugin().CreateAccount(addr) k.GetHost().GetStatePlugin().AddBalance(addr, (&big.Int{}).Mul(big.NewInt(9000000000000000000), big.NewInt(999))) k.GetHost().GetStatePlugin().Finalize() diff --git a/cosmos/x/evm/module.go b/cosmos/x/evm/module.go index 0c32b563e..18d2d8e18 100644 --- a/cosmos/x/evm/module.go +++ b/cosmos/x/evm/module.go @@ -92,22 +92,19 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { // AppModule implements an application module for the evm module. type AppModule struct { AppModuleBasic - keeper *keeper.Keeper - accKeeper AccountKeeper - bankKeeper BankKeeper + keeper *keeper.Keeper + accKeeper AccountKeeper } // NewAppModule creates a new AppModule object. func NewAppModule( keeper *keeper.Keeper, ak AccountKeeper, - bk BankKeeper, ) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{}, keeper: keeper, accKeeper: ak, - bankKeeper: bk, } } diff --git a/cosmos/x/evm/plugins/base.go b/cosmos/x/evm/plugins/base.go index 3dbcea951..d799de83a 100644 --- a/cosmos/x/evm/plugins/base.go +++ b/cosmos/x/evm/plugins/base.go @@ -23,7 +23,7 @@ package plugins import ( sdk "github.com/cosmos/cosmos-sdk/types" - "pkg.berachain.dev/polaris/cosmos/x/evm/types" + "pkg.berachain.dev/polaris/eth/core" ) // Base is the base interface which all x/evm Polaris plugins must implement @@ -36,6 +36,6 @@ type Base interface { // InitGenesis or ExportGenesis methods must implement type HasGenesis interface { - InitGenesis(sdk.Context, *types.GenesisState) - ExportGenesis(sdk.Context, *types.GenesisState) + InitGenesis(sdk.Context, *core.Genesis) + ExportGenesis(sdk.Context, *core.Genesis) } diff --git a/cosmos/x/evm/plugins/block/plugin.go b/cosmos/x/evm/plugins/block/plugin.go index bbd4cfa95..b837348f7 100644 --- a/cosmos/x/evm/plugins/block/plugin.go +++ b/cosmos/x/evm/plugins/block/plugin.go @@ -42,6 +42,8 @@ type Plugin interface { SetQueryContextFn(fn func(height int64, prove bool) (sdk.Context, error)) } +// TODO read genesis block from EthGenesis. + type plugin struct { // ctx is the current block context, used for accessing current block info and kv stores. ctx sdk.Context diff --git a/cosmos/x/evm/plugins/configuration/genesis.go b/cosmos/x/evm/plugins/configuration/genesis.go index a027d5778..dea4b22ec 100644 --- a/cosmos/x/evm/plugins/configuration/genesis.go +++ b/cosmos/x/evm/plugins/configuration/genesis.go @@ -23,19 +23,19 @@ package configuration import ( sdk "github.com/cosmos/cosmos-sdk/types" - "pkg.berachain.dev/polaris/cosmos/x/evm/types" + "pkg.berachain.dev/polaris/eth/core" ) // InitGenesis performs genesis initialization for the evm module. It returns // no validator updates. -func (p *plugin) InitGenesis(ctx sdk.Context, genesisState *types.GenesisState) { +func (p *plugin) InitGenesis(ctx sdk.Context, ethGen *core.Genesis) { p.Prepare(ctx) - p.SetParams(&genesisState.Params) + p.SetChainConfig(ethGen.Config) } // ExportGenesis returns the exported genesis state as raw bytes for the evm // module. -func (p *plugin) ExportGenesis(ctx sdk.Context, genesisState *types.GenesisState) { +func (p *plugin) ExportGenesis(ctx sdk.Context, ethGen *core.Genesis) { p.Prepare(ctx) - genesisState.Params = *p.GetParams() + ethGen.Config = p.ChainConfig() } diff --git a/cosmos/x/evm/plugins/configuration/plugin.go b/cosmos/x/evm/plugins/configuration/plugin.go index 5fb73523e..a58c100be 100644 --- a/cosmos/x/evm/plugins/configuration/plugin.go +++ b/cosmos/x/evm/plugins/configuration/plugin.go @@ -29,7 +29,6 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins" - "pkg.berachain.dev/polaris/cosmos/x/evm/types" "pkg.berachain.dev/polaris/eth/common" "pkg.berachain.dev/polaris/eth/core" "pkg.berachain.dev/polaris/eth/params" @@ -40,16 +39,13 @@ type Plugin interface { plugins.Base plugins.HasGenesis core.ConfigurationPlugin - SetParams(params *types.Params) - GetParams() *types.Params - GetEvmDenom() string + SetChainConfig(*params.ChainConfig) } // plugin implements the core.ConfigurationPlugin interface. type plugin struct { storeKey storetypes.StoreKey paramsStore storetypes.KVStore - evmDenom string } // NewPlugin returns a new plugin instance. @@ -65,27 +61,6 @@ func (p *plugin) Prepare(ctx context.Context) { p.paramsStore = sCtx.KVStore(p.storeKey) } -func (p *plugin) GetEvmDenom() string { - if p.evmDenom == "" { - p.evmDenom = p.GetParams().EvmDenom - } - return p.evmDenom -} - -// ChainConfig implements the core.ConfigurationPlugin interface. -func (p *plugin) ChainConfig() *params.ChainConfig { - return p.GetParams().EthereumChainConfig() -} - -// ExtraEips implements the core.ConfigurationPlugin interface. -func (p *plugin) ExtraEips() []int { - eips := make([]int, 0) - for _, e := range p.GetParams().ExtraEIPs { - eips = append(eips, int(e)) - } - return eips -} - // FeeCollector implements the core.ConfigurationPlugin interface. func (p *plugin) FeeCollector() *common.Address { // TODO: parameterize fee collector name. diff --git a/cosmos/x/evm/plugins/configuration/plugin_test.go b/cosmos/x/evm/plugins/configuration/plugin_test.go index fd5ed27f7..7336f74a3 100644 --- a/cosmos/x/evm/plugins/configuration/plugin_test.go +++ b/cosmos/x/evm/plugins/configuration/plugin_test.go @@ -26,9 +26,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" - "pkg.berachain.dev/polaris/cosmos/x/evm/types" - "pkg.berachain.dev/polaris/eth/params" - enclib "pkg.berachain.dev/polaris/lib/encoding" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -68,33 +65,18 @@ var _ = Describe("Plugin", func() { }) Context("when the params store contains valid params", func() { - It("should return the chain config", func() { - storedParams := types.Params{ - EvmDenom: "eth", - ExtraEIPs: []int64{123}, - ChainConfig: string(enclib.MustMarshalJSON(params.DefaultChainConfig)), - } - bz, err := storedParams.Marshal() - Expect(err).ToNot(HaveOccurred()) - p.paramsStore.Set([]byte{types.ParamsKey}, bz) + // It("should return the chain config", func() { + // storedParams := types.Params{ + // EvmDenom: "eth", + // ExtraEIPs: []int64{123}, + // } + // bz, err := storedParams.Marshal() + // Expect(err).ToNot(HaveOccurred()) + // p.paramsStore.Set([]byte{types.ParamsKey}, bz) - config := p.ChainConfig() - Expect(config).To(Equal(params.DefaultChainConfig)) - }) - }) - - Context("when the params store contains invalid params", func() { - It("should panic", func() { - p.paramsStore.Set([]byte{types.ParamsKey}, []byte("invalid params")) - Expect(func() { p.ChainConfig() }).To(Panic()) - }) - }) - }) - - Describe("ExtraEips", func() { - It("should return an empty slice", func() { - eips := p.ExtraEips() - Expect(eips).To(BeEmpty()) + // config := p.ChainConfig() + // Expect(config).To(Equal(params.DefaultChainConfig)) + // }) }) }) }) diff --git a/cosmos/x/evm/plugins/configuration/store.go b/cosmos/x/evm/plugins/configuration/store.go index 526428fd3..e00334c4e 100644 --- a/cosmos/x/evm/plugins/configuration/store.go +++ b/cosmos/x/evm/plugins/configuration/store.go @@ -21,27 +21,30 @@ package configuration import ( + "encoding/json" + "pkg.berachain.dev/polaris/cosmos/x/evm/types" + "pkg.berachain.dev/polaris/eth/params" ) -// GetParams is used to get the params for the evm module. -func (p *plugin) GetParams() *types.Params { - bz := p.paramsStore.Get([]byte{types.ParamsKey}) +// GetChainConfig is used to get the genesis info of the Ethereum chain. +func (p *plugin) ChainConfig() *params.ChainConfig { + bz := p.paramsStore.Get([]byte{types.ChainConfigPrefix}) if bz == nil { - return &types.Params{} + return nil } - var params types.Params - if err := params.Unmarshal(bz); err != nil { + var chainConfig params.ChainConfig + if err := json.Unmarshal(bz, &chainConfig); err != nil { panic(err) } - return ¶ms + return &chainConfig } -// SetParams is used to set the params for the evm module. -func (p *plugin) SetParams(params *types.Params) { - bz, err := params.Marshal() +// GetEthGenesis is used to get the genesis info of the Ethereum chain. +func (p *plugin) SetChainConfig(chainConfig *params.ChainConfig) { + bz, err := json.Marshal(chainConfig) if err != nil { panic(err) } - p.paramsStore.Set([]byte{types.ParamsKey}, bz) + p.paramsStore.Set([]byte{types.ChainConfigPrefix}, bz) } diff --git a/cosmos/x/evm/plugins/configuration/store_test.go b/cosmos/x/evm/plugins/configuration/store_test.go index 958c476e7..38da1de25 100644 --- a/cosmos/x/evm/plugins/configuration/store_test.go +++ b/cosmos/x/evm/plugins/configuration/store_test.go @@ -20,83 +20,21 @@ package configuration -import ( - storetypes "cosmossdk.io/store/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - - testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" - "pkg.berachain.dev/polaris/cosmos/x/evm/types" - "pkg.berachain.dev/polaris/eth/params" - enclib "pkg.berachain.dev/polaris/lib/encoding" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -var _ = Describe("Plugin", func() { - var ( - p *plugin - ctx sdk.Context - ) - - BeforeEach(func() { - ctx = testutil.NewContext() - storeKey := storetypes.NewKVStoreKey("evm") - p = &plugin{ - storeKey: storeKey, - paramsStore: ctx.KVStore(storeKey), - } - }) - - Describe("GetParams", func() { - Context("when the params store is empty", func() { - It("should return the default params", func() { - params := p.GetParams() - Expect(params).To(Equal(&types.Params{})) - }) - }) - - Context("when the params store contains valid params", func() { - It("should return the stored params", func() { - storedParams := types.Params{ - EvmDenom: "eth", - ExtraEIPs: []int64{123}, - ChainConfig: string(enclib.MustMarshalJSON(params.DefaultChainConfig)), - } - bz, err := storedParams.Marshal() - Expect(err).ToNot(HaveOccurred()) - p.paramsStore.Set([]byte{types.ParamsKey}, bz) - - params := p.GetParams() - Expect(params).To(Equal(&storedParams)) - }) - }) - - Context("when the params store contains invalid params", func() { - It("should panic", func() { - p.paramsStore.Set([]byte{types.ParamsKey}, []byte("invalid params")) - Expect(func() { p.GetParams() }).To(Panic()) - }) - }) - }) - - Describe("SetParams", func() { - It("should store the params in the params store", func() { - params := types.Params{ - EvmDenom: "eth", - ExtraEIPs: []int64{123}, - ChainConfig: string(enclib.MustMarshalJSON(params.DefaultChainConfig)), - } - p.SetParams(¶ms) - - var storedParams types.Params - bz := p.paramsStore.Get([]byte{types.ParamsKey}) - Expect(bz).ToNot(BeNil()) - - err := storedParams.Unmarshal(bz) - Expect(err).ToNot(HaveOccurred()) - Expect(storedParams).To(Equal(params)) - }) - }) -}) +// . "github.com/onsi/ginkgo/v2" +// . "github.com/onsi/gomega" + +// var _ = Describe("Plugin", func() { +// var ( +// // p *plugin +// // ctx sdk.Context +// ) + +// BeforeEach(func() { +// // ctx = testutil.NewContext() +// // storeKey := storetypes.NewKVStoreKey("evm") +// // // p = &plugin{ +// // storeKey: storeKey, +// // paramsStore: ctx.KVStore(storeKey), +// // } +// }) +// }) diff --git a/cosmos/x/evm/plugins/state/genesis.go b/cosmos/x/evm/plugins/state/genesis.go index dcfa34f77..928fee0d2 100644 --- a/cosmos/x/evm/plugins/state/genesis.go +++ b/cosmos/x/evm/plugins/state/genesis.go @@ -21,70 +21,67 @@ package state import ( + "math/big" + sdk "github.com/cosmos/cosmos-sdk/types" - "pkg.berachain.dev/polaris/cosmos/x/evm/types" + "github.com/ethereum/go-ethereum/core" + "pkg.berachain.dev/polaris/eth/common" ) // InitGenesis takes in a pointer to a genesis state object and populates the KV store. -func (p *plugin) InitGenesis(ctx sdk.Context, data *types.GenesisState) { +func (p *plugin) InitGenesis(ctx sdk.Context, ethGen *core.Genesis) { p.Reset(ctx) - for addr, contract := range data.AddressToContract { - // Set the contract code. - address := common.HexToAddress(addr) - code := []byte(data.HashToCode[contract.CodeHash]) - p.SetCode(address, code) - - // Set the contract state. - for k, v := range contract.SlotToValue { - slot := common.HexToHash(k) - value := common.HexToHash(v) - p.SetState(address, slot, value) + // Iterate over the genesis accounts and set the balances. + for address, account := range ethGen.Alloc { + // TODO: technically wrong since its overriding / hacking the auth keeper and + // we are using the nonce from the account keeper as well. + p.CreateAccount(address) + p.SetBalance(address, account.Balance) + if account.Code != nil { + p.SetCode(address, account.Code) + } + if account.Storage != nil { + for k, v := range account.Storage { + p.SetState(address, k, v) + } } } - p.Finalize() } // Export genesis modifies a pointer to a genesis state object and populates it. -func (p *plugin) ExportGenesis(ctx sdk.Context, data *types.GenesisState) { +func (p *plugin) ExportGenesis(ctx sdk.Context, ethGen *core.Genesis) { p.Reset(ctx) + ethGen.Alloc = make(core.GenesisAlloc) - // Allocate memory for the address to contract map if it is nil. - if data.AddressToContract == nil { - data.AddressToContract = make(map[string]*types.Contract) - } - // Allocate memory for the hash to code map if it is nil. - if data.HashToCode == nil { - data.HashToCode = make(map[string]string) - } - - p.IterateCode(func(address common.Address, code []byte) bool { - // Get the contract code hash. - codeHash := p.GetCodeHash(address) - // If the contract is nil, allocate memory for it. - if data.AddressToContract[address.Hex()] == nil { - data.AddressToContract[address.Hex()] = &types.Contract{} + // Iterate Balances and set the genesis accounts. + p.IterateBalances(func(address common.Address, balance *big.Int) bool { + account, ok := ethGen.Alloc[address] + if !ok { + account = core.GenesisAccount{} + } + account.Code = p.GetCode(address) + if account.Code != nil { + account.Storage = make(map[common.Hash]common.Hash) } - data.AddressToContract[address.Hex()].CodeHash = codeHash.Hex() - // Add the code hash and code to the code hash to code map. - data.HashToCode[codeHash.Hex()] = string(code) - return false // keep iterating + account.Balance = p.GetBalance(address) + ethGen.Alloc[address] = account + return false }) - p.IterateState(func(addr common.Address, key, value common.Hash) bool { - // if the slot to value map is nil on the contract, allocate memory for it. - if data.AddressToContract[addr.Hex()].SlotToValue == nil { - data.AddressToContract[addr.Hex()].SlotToValue = make(map[string]string) + // Iterate Storage and set the genesis accounts. + p.IterateState(func(address common.Address, key common.Hash, value common.Hash) bool { + account, ok := ethGen.Alloc[address] + if !ok { + account = core.GenesisAccount{} } - - // Set the slots to value map. - data.AddressToContract[addr.Hex()].SlotToValue[key.Hex()] = value.Hex() - - return false // keep iterating + if account.Storage == nil { + account.Storage = make(map[common.Hash]common.Hash) + } + account.Storage[key] = value + return false }) - - p.Finalize() } diff --git a/cosmos/x/evm/plugins/state/genesis_test.go b/cosmos/x/evm/plugins/state/genesis_test.go index a5ed3989a..01d08c4e8 100644 --- a/cosmos/x/evm/plugins/state/genesis_test.go +++ b/cosmos/x/evm/plugins/state/genesis_test.go @@ -21,12 +21,14 @@ package state_test import ( + "math/big" + sdk "github.com/cosmos/cosmos-sdk/types" testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state" - "pkg.berachain.dev/polaris/cosmos/x/evm/types" "pkg.berachain.dev/polaris/eth/common" + "pkg.berachain.dev/polaris/eth/core" "pkg.berachain.dev/polaris/eth/crypto" . "github.com/onsi/ginkgo/v2" @@ -35,49 +37,33 @@ import ( var _ = Describe("Genesis", func() { var ( - ctx sdk.Context - sp state.Plugin - codeHash common.Hash - code []byte - slot common.Hash - value common.Hash + ctx sdk.Context + sp state.Plugin + code []byte ) BeforeEach(func() { var ak state.AccountKeeper - var bk state.BankKeeper - ctx, ak, bk, _ = testutil.SetupMinimalKeepers() - sp = state.NewPlugin(ak, bk, testutil.EvmKey, &mockConfigurationPlugin{}, nil) + ctx, ak, _, _ = testutil.SetupMinimalKeepers() + sp = state.NewPlugin(ak, testutil.EvmKey, nil) // Create account for alice. sp.Reset(ctx) - sp.CreateAccount(alice) - sp.Finalize() - code = []byte("code") - codeHash = crypto.Keccak256Hash(code) - slot = common.HexToHash("0x456") - value = common.HexToHash("0x789") }) It("should init and export genesis", func() { - genesis := types.DefaultGenesis() + genesis := new(core.Genesis) + genesis.Alloc = make(core.GenesisAlloc) - // New Contract. - contract := types.Contract{ - CodeHash: codeHash.Hex(), - SlotToValue: map[string]string{ - slot.Hex(): value.Hex(), + genesis.Alloc[alice] = core.GenesisAccount{ + Balance: big.NewInt(5e18), + Storage: map[common.Hash]common.Hash{ + common.BytesToHash([]byte("key")): common.BytesToHash([]byte("value")), }, + Code: code, } - - // Set the address to contract. - genesis.AddressToContract[alice.Hex()] = &contract - - // Set the code hash to code. - genesis.HashToCode[codeHash.Hex()] = string(code) - - // Init Genesis. + // Call Init Genesis sp.InitGenesis(ctx, genesis) // Check that the code is set. @@ -87,25 +73,14 @@ var _ = Describe("Genesis", func() { // Check that the code hash is set. sp.Reset(ctx) - Expect(sp.GetCodeHash(alice)).To(Equal(codeHash)) + Expect(sp.GetCodeHash(alice)).To(Equal(crypto.Keccak256Hash(code))) sp.Finalize() + Expect(sp.GetBalance(alice)).To(Equal(big.NewInt(5e18))) + Expect(sp.GetCode(alice), code) - // Check that the storage is set. - sp.Reset(ctx) - Expect(sp.GetState(alice, slot)).To(Equal(value)) - sp.Finalize() - - // Export Genesis. - exportedGenesis := types.GenesisState{} + // Very exported genesis is equal. + var exportedGenesis core.Genesis sp.ExportGenesis(ctx, &exportedGenesis) - - // Check that the code is exported. - Expect(exportedGenesis.AddressToContract).To(Equal(genesis.AddressToContract)) - // Check that the hash to code is exported. - Expect(exportedGenesis.HashToCode).To(Equal(genesis.HashToCode)) - // Check that the storage is exported. - Expect( - exportedGenesis.AddressToContract[alice.Hex()].SlotToValue). - To(Equal(genesis.AddressToContract[alice.Hex()].SlotToValue)) + Expect(exportedGenesis.Alloc).To(Equal(genesis.Alloc)) }) }) diff --git a/cosmos/x/evm/plugins/state/interfaces.go b/cosmos/x/evm/plugins/state/interfaces.go index 0a1e7ecd6..43d89b636 100644 --- a/cosmos/x/evm/plugins/state/interfaces.go +++ b/cosmos/x/evm/plugins/state/interfaces.go @@ -65,19 +65,3 @@ type AccountKeeper interface { RemoveAccount(ctx context.Context, account sdk.AccountI) IterateAccounts(ctx context.Context, cb func(account sdk.AccountI) bool) } - -// BankKeeper defines the expected bank keeper. -type BankKeeper interface { - GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin - SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, - recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, - recipientModule string, amt sdk.Coins) error - MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error - SendCoins(ctx context.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error -} - -type ConfigurationPlugin interface { - GetEvmDenom() string -} diff --git a/cosmos/x/evm/plugins/state/keys.go b/cosmos/x/evm/plugins/state/keys.go index 83ec07ebc..fe1889759 100644 --- a/cosmos/x/evm/plugins/state/keys.go +++ b/cosmos/x/evm/plugins/state/keys.go @@ -27,6 +27,13 @@ import ( // NOTE: we use copy to build keys for max performance: https://github.com/golang/go/issues/55905 +func BalanceKeyFor(address common.Address) []byte { + bz := make([]byte, 1+common.AddressLength) + copy(bz, []byte{types.BalanceKeyPrefix}) + copy(bz[1:], address[:]) + return bz +} + // StorageKeyFor returns a prefix to iterate over a given account storage (multiple slots). func StorageKeyFor(address common.Address) []byte { bz := make([]byte, 1+common.AddressLength) @@ -75,12 +82,12 @@ func CodeKeyFor(codeHash common.Hash) []byte { return bz } -// CodeHashFromKey returns the code hash from a code hash key. -func CodeHashFromKey(key []byte) common.Hash { - return common.BytesToHash(key[1:]) -} - // AddressFromCodeHashKey returns the address from a code hash key. func AddressFromCodeHashKey(key []byte) common.Address { return common.BytesToAddress(key[1:]) } + +// AddressFromBalanceKey returns the address from a balance key. +func AddressFromBalanceKey(key []byte) common.Address { + return common.BytesToAddress(key[1:]) +} diff --git a/cosmos/x/evm/plugins/state/keys_test.go b/cosmos/x/evm/plugins/state/keys_test.go index 6738cf977..d321cb348 100644 --- a/cosmos/x/evm/plugins/state/keys_test.go +++ b/cosmos/x/evm/plugins/state/keys_test.go @@ -98,13 +98,3 @@ var _ = Describe("CodeKeyFor", func() { Expect(key[1:]).To(Equal(address.Bytes())) }) }) - -var _ = Describe("CodeHashFromKey", func() { - It("returns a code hash", func() { - address := common.HexToHash("0x1234567890abcdef1234567890abcdef12345678") - key := CodeKeyFor(address) - - address2 := CodeHashFromKey(key) - Expect(address2).To(Equal(address)) - }) -}) diff --git a/cosmos/x/evm/plugins/state/plugin.go b/cosmos/x/evm/plugins/state/plugin.go index 513ebe304..e6793c894 100644 --- a/cosmos/x/evm/plugins/state/plugin.go +++ b/cosmos/x/evm/plugins/state/plugin.go @@ -29,7 +29,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "pkg.berachain.dev/polaris/cosmos/lib" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state/events" "pkg.berachain.dev/polaris/cosmos/x/evm/store/snapmulti" @@ -58,10 +57,10 @@ type Plugin interface { core.StatePlugin // SetQueryContextFn sets the query context func for the plugin. SetQueryContextFn(fn func(height int64, prove bool) (sdk.Context, error)) + // IterateBalances iterates over the balances of all accounts and calls the given callback function. + IterateBalances(fn func(common.Address, *big.Int) bool) // IterateState iterates over the state of all accounts and calls the given callback function. IterateState(fn func(addr common.Address, key common.Hash, value common.Hash) bool) - // IterateCode iterates over the code of all accounts and calls the given callback function. - IterateCode(fn func(addr common.Address, code []byte) bool) // SetGasConfig sets the gas config for the plugin. SetGasConfig(storetypes.GasConfig, storetypes.GasConfig) } @@ -105,15 +104,10 @@ type plugin struct { // keepers used for balance and account information. ak AccountKeeper - bk BankKeeper // getQueryContext allows for querying state a historical height. getQueryContext func(height int64, prove bool) (sdk.Context, error) - // we load the evm denom in the constructor, to prevent going to - // the params to get it mid interpolation. - cp ConfigurationPlugin - // savedErr stores any error that is returned from state modifications on the underlying // keepers. savedErr error @@ -122,16 +116,12 @@ type plugin struct { // NewPlugin returns a plugin with the given context and keepers. func NewPlugin( ak AccountKeeper, - bk BankKeeper, storeKey storetypes.StoreKey, - cp ConfigurationPlugin, plf events.PrecompileLogFactory, ) Plugin { return &plugin{ storeKey: storeKey, ak: ak, - bk: bk, - cp: cp, plf: plf, } } @@ -261,36 +251,31 @@ func (p *plugin) DeleteAccounts(accounts []common.Address) { // GetBalance implements `StatePlugin` interface. func (p *plugin) GetBalance(addr common.Address) *big.Int { - // Note: bank keeper will return 0 if account/state_object is not found - return p.bk.GetBalance(p.ctx, addr[:], p.cp.GetEvmDenom()).Amount.BigInt() + return new(big.Int).SetBytes(p.ctx.KVStore(p.storeKey).Get(BalanceKeyFor(addr))) } // SetBalance implements `StatePlugin` interface. func (p *plugin) SetBalance(addr common.Address, amount *big.Int) { - currBalance := p.GetBalance(addr) - delta := new(big.Int).Sub(currBalance, amount) - if delta.Sign() < 0 { - p.AddBalance(addr, new(big.Int).Neg(delta)) - } else if delta.Sign() > 0 { - p.SubBalance(addr, delta) - } + p.ctx.KVStore(p.storeKey).Set(BalanceKeyFor(addr), amount.Bytes()) } // AddBalance implements the `StatePlugin` interface by adding the given amount // from thew account associated with addr. If the account does not exist, it will be // created. func (p *plugin) AddBalance(addr common.Address, amount *big.Int) { - if err := lib.MintCoinsToAddress(p.ctx, p.bk, types.ModuleName, addr, p.cp.GetEvmDenom(), amount); err != nil { - p.savedErr = err + if amount.Sign() == 0 { + return } + p.ctx.KVStore(p.storeKey).Set(BalanceKeyFor(addr), new(big.Int).Add(p.GetBalance(addr), amount).Bytes()) } // SubBalance implements the `StatePlugin` interface by subtracting the given amount // from the account associated with addr. func (p *plugin) SubBalance(addr common.Address, amount *big.Int) { - if err := lib.BurnCoinsFromAddress(p.ctx, p.bk, types.ModuleName, addr, p.cp.GetEvmDenom(), amount); err != nil { - p.savedErr = err + if amount.Sign() == 0 { + return } + p.ctx.KVStore(p.storeKey).Set(BalanceKeyFor(addr), new(big.Int).Sub(p.GetBalance(addr), amount).Bytes()) } // ============================================================================= @@ -370,22 +355,6 @@ func (p *plugin) SetCode(addr common.Address, code []byte) { } } -// IterateCode iterates over all the addresses with code and calls the given method. -func (p *plugin) IterateCode(fn func(address common.Address, code []byte) bool) { - it := storetypes.KVStorePrefixIterator( - p.cms.GetKVStore(p.storeKey), - []byte{types.CodeHashKeyPrefix}, - ) - defer it.Close() - - for ; it.Valid(); it.Next() { - addr := AddressFromCodeHashKey(it.Key()) - if fn(addr, p.GetCode(addr)) { - break - } - } -} - // ============================================================================= // Storage // ============================================================================= @@ -488,6 +457,21 @@ func getStateFromStore( return common.Hash{} } +func (p *plugin) IterateBalances(fn func(common.Address, *big.Int) bool) { + it := storetypes.KVStorePrefixIterator( + p.cms.GetKVStore(p.storeKey), + []byte{types.BalanceKeyPrefix}, + ) + defer it.Close() + + for ; it.Valid(); it.Next() { + addr := AddressFromBalanceKey(it.Key()) + if fn(addr, p.GetBalance(addr)) { + break + } + } +} + // ============================================================================= // Historical State // ============================================================================= @@ -521,7 +505,7 @@ func (p *plugin) StateAtBlockNumber(number uint64) (core.StatePlugin, error) { } // Create a State Plugin with the requested chain height. - sp := NewPlugin(p.ak, p.bk, p.storeKey, p.cp, p.plf) + sp := NewPlugin(p.ak, p.storeKey, p.plf) sp.Reset(ctx) return sp, nil } @@ -532,7 +516,7 @@ func (p *plugin) StateAtBlockNumber(number uint64) (core.StatePlugin, error) { // Clone implements libtypes.Cloneable. func (p *plugin) Clone() ethstate.Plugin { - sp := NewPlugin(p.ak, p.bk, p.storeKey, p.cp, p.plf) + sp := NewPlugin(p.ak, p.storeKey, p.plf) cacheCtx, _ := p.ctx.CacheContext() sp.Reset(cacheCtx) return sp diff --git a/cosmos/x/evm/plugins/state/plugin_benchmark_test.go b/cosmos/x/evm/plugins/state/plugin_benchmark_test.go index 767c7f7eb..7004c0720 100644 --- a/cosmos/x/evm/plugins/state/plugin_benchmark_test.go +++ b/cosmos/x/evm/plugins/state/plugin_benchmark_test.go @@ -37,8 +37,8 @@ var ( ) func GetNewStatePlugin() core.StatePlugin { - ctx, ak, bk, _ := testutil.SetupMinimalKeepers() - sp := state.NewPlugin(ak, bk, testutil.EvmKey, &mockConfigurationPlugin{}, nil) + ctx, ak, _, _ := testutil.SetupMinimalKeepers() + sp := state.NewPlugin(ak, testutil.EvmKey, nil) sp.Reset(ctx) return sp } diff --git a/cosmos/x/evm/plugins/state/plugin_test.go b/cosmos/x/evm/plugins/state/plugin_test.go index 99a8ec91f..6cff43fe9 100644 --- a/cosmos/x/evm/plugins/state/plugin_test.go +++ b/cosmos/x/evm/plugins/state/plugin_test.go @@ -27,7 +27,6 @@ import ( testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state" - "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state/storage" "pkg.berachain.dev/polaris/eth/common" "pkg.berachain.dev/polaris/eth/core" coretypes "pkg.berachain.dev/polaris/eth/core/types" @@ -45,13 +44,12 @@ var ( var _ = Describe("State Plugin", func() { var ak state.AccountKeeper - var bk state.BankKeeper var ctx sdk.Context var sp core.StatePlugin BeforeEach(func() { - ctx, ak, bk, _ = testutil.SetupMinimalKeepers() - sp = state.NewPlugin(ak, bk, testutil.EvmKey, &mockConfigurationPlugin{}, &mockPLF{}) + ctx, ak, _, _ = testutil.SetupMinimalKeepers() + sp = state.NewPlugin(ak, testutil.EvmKey, &mockPLF{}) sp.Reset(ctx) }) @@ -59,7 +57,7 @@ var _ = Describe("State Plugin", func() { Expect(sp.RegistryKey()).To(Equal("statePlugin")) }) - Describe("TestReset", func() { + Describe("TestevmReset", func() { It("should reset", func() { sp.CreateAccount(alice) sp.AddBalance(alice, big.NewInt(50)) @@ -105,25 +103,6 @@ var _ = Describe("State Plugin", func() { sp.AddBalance(alice, big.NewInt(100)) Expect(sp.GetBalance(alice)).To(Equal(big.NewInt(100))) }) - It("should panic if using negative value", func() { - Expect(func() { - sp.AddBalance(alice, big.NewInt(-100)) - }).To(Panic()) - }) - }) - - Context("TestSubBalance", func() { - It("should not panic when setting balance to negative value", func() { - Expect(func() { - sp.SubBalance(alice, big.NewInt(100)) - }).ToNot(Panic()) - Expect(sp.Error()).To(HaveOccurred()) - }) - It("should not panic if using negative value", func() { - Expect(func() { - sp.SubBalance(alice, big.NewInt(-100)) - }).To(Panic()) - }) }) It("should handle complex balance updates", func() { @@ -141,12 +120,6 @@ var _ = Describe("State Plugin", func() { // Add some balance to alice sp.AddBalance(alice, big.NewInt(100)) Expect(sp.GetBalance(alice)).To(Equal(big.NewInt(150))) - - // Subtract some balance from alice - Expect(func() { - sp.SubBalance(alice, big.NewInt(200)) - }).ToNot(Panic()) - Expect(sp.Error()).To(HaveOccurred()) }) }) @@ -277,34 +250,41 @@ var _ = Describe("State Plugin", func() { sp.CreateAccount(bob) }) + type Slot struct { + Key common.Hash + Value common.Hash + } + + type Storage []Slot + It("should iterate through storage correctly", func() { Expect(sp.GetCode(alice)).To(BeNil()) - var aliceStorage storage.Storage + var aliceStorage Storage err := sp.ForEachStorage(alice, func(key, value common.Hash) bool { aliceStorage = append(aliceStorage, - storage.NewSlot(key, value)) + Slot{key, value}) return true }) Expect(err).ToNot(HaveOccurred()) Expect(aliceStorage).To(BeEmpty()) sp.SetState(bob, common.BytesToHash([]byte{1}), common.BytesToHash([]byte{2})) - var bobStorage storage.Storage + var bobStorage Storage err = sp.ForEachStorage(bob, func(key, value common.Hash) bool { - bobStorage = append(bobStorage, storage.NewSlot(key, value)) + bobStorage = append(bobStorage, Slot{key, value}) return true }) Expect(err).ToNot(HaveOccurred()) Expect(bobStorage).To(HaveLen(1)) Expect(bobStorage[0].Key). - To(Equal("0x0000000000000000000000000000000000000000000000000000000000000001")) + To(Equal(common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000001"))) Expect(bobStorage[0].Value). - To(Equal("0x0000000000000000000000000000000000000000000000000000000000000002")) + To(Equal(common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000002"))) sp.SetState(bob, common.BytesToHash([]byte{3}), common.BytesToHash([]byte{4})) - var bobStorage2 storage.Storage + var bobStorage2 Storage i := 0 err = sp.ForEachStorage(bob, func(key, value common.Hash) bool { @@ -312,7 +292,7 @@ var _ = Describe("State Plugin", func() { return false } - bobStorage2 = append(bobStorage2, storage.NewSlot(key, value)) + bobStorage2 = append(bobStorage2, Slot{key, value}) i++ return true }, @@ -485,12 +465,6 @@ var _ = Describe("State Plugin", func() { // MOCKS BELOW. -type mockConfigurationPlugin struct{} - -func (mcp *mockConfigurationPlugin) GetEvmDenom() string { - return "abera" -} - type mockPLF struct{} func (mplf *mockPLF) Build(event *sdk.Event) (*coretypes.Log, error) { diff --git a/cosmos/x/evm/plugins/state/storage/errors.go b/cosmos/x/evm/plugins/state/storage/errors.go deleted file mode 100644 index a126617bd..000000000 --- a/cosmos/x/evm/plugins/state/storage/errors.go +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package storage - -import "errors" - -var ErrInvalidState = errors.New("invalid state") diff --git a/cosmos/x/evm/plugins/state/storage/slot.pb.go b/cosmos/x/evm/plugins/state/storage/slot.pb.go deleted file mode 100644 index 7bb7a26b8..000000000 --- a/cosmos/x/evm/plugins/state/storage/slot.pb.go +++ /dev/null @@ -1,370 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: polaris/evm/storage/v1/slot.proto - -package storage - -import ( - fmt "fmt" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// `Slot` represents a single key/value pair of evm state data. -type Slot struct { - // `key` is the stored key. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // `value` is the stored value for the given key. - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *Slot) Reset() { *m = Slot{} } -func (m *Slot) String() string { return proto.CompactTextString(m) } -func (*Slot) ProtoMessage() {} -func (*Slot) Descriptor() ([]byte, []int) { - return fileDescriptor_4cade16f586fae0d, []int{0} -} -func (m *Slot) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Slot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Slot.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Slot) XXX_Merge(src proto.Message) { - xxx_messageInfo_Slot.Merge(m, src) -} -func (m *Slot) XXX_Size() int { - return m.Size() -} -func (m *Slot) XXX_DiscardUnknown() { - xxx_messageInfo_Slot.DiscardUnknown(m) -} - -var xxx_messageInfo_Slot proto.InternalMessageInfo - -func (m *Slot) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - -func (m *Slot) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -func init() { - proto.RegisterType((*Slot)(nil), "polaris.evm.storage.v1.Slot") -} - -func init() { proto.RegisterFile("polaris/evm/storage/v1/slot.proto", fileDescriptor_4cade16f586fae0d) } - -var fileDescriptor_4cade16f586fae0d = []byte{ - // 192 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2c, 0xc8, 0xcf, 0x49, - 0x2c, 0xca, 0x2c, 0xd6, 0x4f, 0x2d, 0xcb, 0xd5, 0x2f, 0x2e, 0xc9, 0x2f, 0x4a, 0x4c, 0x4f, 0xd5, - 0x2f, 0x33, 0xd4, 0x2f, 0xce, 0xc9, 0x2f, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x83, - 0x2a, 0xd1, 0x4b, 0x2d, 0xcb, 0xd5, 0x83, 0x2a, 0xd1, 0x2b, 0x33, 0x54, 0xd2, 0xe3, 0x62, 0x09, - 0xce, 0xc9, 0x2f, 0x11, 0x12, 0xe0, 0x62, 0xce, 0x4e, 0xad, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, - 0x0c, 0x02, 0x31, 0x85, 0x44, 0xb8, 0x58, 0xcb, 0x12, 0x73, 0x4a, 0x53, 0x25, 0x98, 0xc0, 0x62, - 0x10, 0x8e, 0x53, 0xd8, 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, 0xd9, 0x14, - 0x64, 0xa7, 0xeb, 0x25, 0xa5, 0x16, 0x25, 0x26, 0x67, 0x24, 0x66, 0xe6, 0xe9, 0xa5, 0xa4, 0x96, - 0xe9, 0xc3, 0x9c, 0x95, 0x9c, 0x5f, 0x9c, 0x9b, 0x5f, 0xac, 0x5f, 0x01, 0x76, 0x5f, 0x41, 0x4e, - 0x69, 0x7a, 0x66, 0x5e, 0xb1, 0x7e, 0x71, 0x49, 0x62, 0x49, 0x2a, 0xcc, 0xb5, 0x49, 0x6c, 0x60, - 0x67, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xfd, 0x84, 0x3c, 0xfd, 0xcb, 0x00, 0x00, 0x00, -} - -func (m *Slot) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Slot) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Slot) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintSlot(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintSlot(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintSlot(dAtA []byte, offset int, v uint64) int { - offset -= sovSlot(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Slot) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovSlot(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovSlot(uint64(l)) - } - return n -} - -func sovSlot(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozSlot(x uint64) (n int) { - return sovSlot(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Slot) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSlot - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Slot: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Slot: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSlot - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSlot - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSlot - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSlot - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSlot - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSlot - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSlot(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSlot - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipSlot(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSlot - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSlot - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSlot - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthSlot - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupSlot - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthSlot - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthSlot = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowSlot = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupSlot = fmt.Errorf("proto: unexpected end of group") -) diff --git a/cosmos/x/evm/plugins/state/storage/slot_test.go b/cosmos/x/evm/plugins/state/storage/slot_test.go deleted file mode 100644 index 1b1fb66c5..000000000 --- a/cosmos/x/evm/plugins/state/storage/slot_test.go +++ /dev/null @@ -1,89 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package storage_test - -import ( - "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state/storage" - "pkg.berachain.dev/polaris/eth/common" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -var _ = Describe("x/evm/plugins/state/storage", func() { - var slot *storage.Slot - key := common.Hash{222}.Bytes() - value := common.Hash{111}.Bytes() - - BeforeEach(func() { - slot = storage.NewSlot(common.BytesToHash(key), common.BytesToHash(value)) - }) - - It("should return the correct key", func() { - Expect(slot.Key).To(Equal(common.BytesToHash(key).Hex())) - }) - - It("should return the correct value", func() { - Expect(slot.Value).To(Equal(common.BytesToHash(value).Hex())) - }) - - It("should have valid slot", func() { - Expect(slot.ValidateBasic()).To(Succeed()) - }) - - When("slot key is empty", func() { - BeforeEach(func() { - slot.Key = "" - }) - - It("should return an error", func() { - Expect(slot.ValidateBasic()).NotTo(Succeed()) - }) - }) - - When("slot key has leading or trailing spaces", func() { - When("slot key is not empty", func() { - BeforeEach(func() { - slot.Key = " bingbong " - }) - - It("should not return an error", func() { - Expect(slot.ValidateBasic()).To(Succeed()) - }) - }) - - When("slot key is empty", func() { - BeforeEach(func() { - slot.Key = " " - }) - - It("should return an error", func() { - Expect(slot.ValidateBasic()).NotTo(Succeed()) - }) - }) - }) - - It("is cloneable", func() { - clone := slot.Clone() - Expect(clone).To(Equal(slot)) - Expect(&clone).NotTo(BeIdenticalTo(&slot)) - }) -}) diff --git a/cosmos/x/evm/plugins/state/storage/storage.go b/cosmos/x/evm/plugins/state/storage/storage.go deleted file mode 100644 index cbd591941..000000000 --- a/cosmos/x/evm/plugins/state/storage/storage.go +++ /dev/null @@ -1,73 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package storage - -import ( - "fmt" - - "pkg.berachain.dev/polaris/lib/errors" - libtypes "pkg.berachain.dev/polaris/lib/types" -) - -// Compile-time type assertions. -var _ libtypes.Cloneable[Storage] = Storage{} -var _ fmt.Stringer = Storage{} - -// Storage represents the account Storage map as a slice of single key-value -// Slot pairs. This helps to ensure that the Storage map can be iterated over -// deterministically. -type Storage []*Slot - -// ValidateBasic performs basic validation of the Storage data structure. -// It checks for duplicate keys and calls `ValidateBasic` on each `State`. -func (s Storage) ValidateBasic() error { - seenSlots := make(map[string]struct{}) - for i, slot := range s { - if _, found := seenSlots[slot.Key]; found { - return errors.Wrapf(ErrInvalidState, "duplicate state key %d: %s", i, slot.Key) - } - - if err := slot.ValidateBasic(); err != nil { - return err - } - - seenSlots[slot.Key] = struct{}{} - } - return nil -} - -// String implements `fmt.Stringer`. -func (s Storage) String() string { - var str string - for _, slot := range s { - str += fmt.Sprintf("%s\n", slot.String()) - } - - return str -} - -// Clone implements `types.Cloneable`. -func (s Storage) Clone() Storage { - cpy := make(Storage, len(s)) - copy(cpy, s) - - return cpy -} diff --git a/cosmos/x/evm/plugins/state/storage/storage_test.go b/cosmos/x/evm/plugins/state/storage/storage_test.go deleted file mode 100644 index 43f9c937b..000000000 --- a/cosmos/x/evm/plugins/state/storage/storage_test.go +++ /dev/null @@ -1,94 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package storage_test - -import ( - "testing" - - "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state/storage" - "pkg.berachain.dev/polaris/eth/common" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -func TestStorage(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "cosmos/x/evm/plugins/state/storage") -} - -var _ = Describe("StorageTest", func() { - When("storage is empty", func() { - It("should not return an error", func() { - slots := storage.Storage{} - Expect(slots.ValidateBasic()).To(Succeed()) - }) - }) - When("storage is not empty", func() { - var slots storage.Storage - - BeforeEach(func() { - slots = storage.Storage{ - storage.NewSlot(common.BytesToHash([]byte{1, 2, 3}), common.BytesToHash([]byte{1, 2, 3})), - } - }) - - It("should not return an error", func() { - Expect(slots.ValidateBasic()).To(Succeed()) - }) - - When("a storage key is empty", func() { - BeforeEach(func() { - slots[0].Key = "" - }) - - It("should return an error", func() { - Expect(slots.ValidateBasic()).NotTo(Succeed()) - }) - }) - - It("should be Cloneable", func() { - clone := slots.Clone() - Expect(clone).To(Equal(slots)) - Expect(clone).NotTo(BeIdenticalTo(slots)) - }) - - When("a storage key is duplicated", func() { - BeforeEach(func() { - slots = append(slots, storage.NewSlot( - common.BytesToHash([]byte{1, 2, 3}), - common.BytesToHash([]byte{1, 2, 3}), - )) - }) - - It("should return an error", func() { - Expect(slots.ValidateBasic()).NotTo(Succeed()) - }) - }) - - It("should be printable", func() { - Expect(slots.String()).To(ContainSubstring("key:" + - "\"0x0000000000000000000000000000000000000000000000000000000000010203\" value:" + - "\"0x0000000000000000000000000000000000000000000000000000000000010203\"", - )) - }) - }) -}) diff --git a/cosmos/x/evm/plugins/txpool/mempool/mempool_test.go b/cosmos/x/evm/plugins/txpool/mempool/mempool_test.go index 0da2da433..509f30144 100644 --- a/cosmos/x/evm/plugins/txpool/mempool/mempool_test.go +++ b/cosmos/x/evm/plugins/txpool/mempool/mempool_test.go @@ -64,8 +64,8 @@ var _ = Describe("EthTxPool", func() { ) BeforeEach(func() { - sCtx, ak, bk, _ := testutil.SetupMinimalKeepers() - sp = state.NewPlugin(ak, bk, testutil.EvmKey, &mockConfigurationPlugin{}, &mockPLF{}) + sCtx, ak, _, _ := testutil.SetupMinimalKeepers() + sp = state.NewPlugin(ak, testutil.EvmKey, &mockPLF{}) ctx = sCtx sp.Reset(ctx) sp.SetNonce(addr1, 1) @@ -395,12 +395,6 @@ var _ = Describe("EthTxPool", func() { // MOCKS BELOW. -type mockConfigurationPlugin struct{} - -func (mcp *mockConfigurationPlugin) GetEvmDenom() string { - return "abera" -} - type mockPLF struct{} func (mplf *mockPLF) Build(event *sdk.Event) (*coretypes.Log, error) { diff --git a/cosmos/x/evm/plugins/txpool/plugin.go b/cosmos/x/evm/plugins/txpool/plugin.go index e7c3d941e..bd4ed27c2 100644 --- a/cosmos/x/evm/plugins/txpool/plugin.go +++ b/cosmos/x/evm/plugins/txpool/plugin.go @@ -52,7 +52,6 @@ type plugin struct { *mempool.EthTxPool clientContext client.Context - cp ConfigurationPlugin // txFeed and scope is used to send new batch transactions to new txs subscribers when the // batch is added to the mempool. @@ -61,10 +60,9 @@ type plugin struct { } // NewPlugin returns a new transaction pool plugin. -func NewPlugin(cp ConfigurationPlugin, ethTxMempool *mempool.EthTxPool) Plugin { +func NewPlugin(ethTxMempool *mempool.EthTxPool) Plugin { return &plugin{ EthTxPool: ethTxMempool, - cp: cp, } } @@ -83,7 +81,7 @@ func (p *plugin) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscrip // broadcasted to the network. func (p *plugin) SendTx(signedEthTx *coretypes.Transaction) error { // Serialize the transaction to Bytes - txBytes, err := SerializeToBytes(p.cp.GetEvmDenom(), p.clientContext, signedEthTx) + txBytes, err := SerializeToBytes(p.clientContext, signedEthTx) if err != nil { return errorslib.Wrap(err, "failed to serialize transaction") } @@ -113,7 +111,7 @@ func (p *plugin) SendTx(signedEthTx *coretypes.Transaction) error { // transaction from the rpc backend and wraps it in a Cosmos transaction. The Cosmos transaction is // injected into the local mempool, but is NOT gossiped to peers. func (p *plugin) SendPrivTx(signedTx *coretypes.Transaction) error { - cosmosTx, err := SerializeToSdkTx(p.cp.GetEvmDenom(), p.clientContext, signedTx) + cosmosTx, err := SerializeToSdkTx(p.clientContext, signedTx) if err != nil { return err } diff --git a/cosmos/x/evm/plugins/txpool/serializer.go b/cosmos/x/evm/plugins/txpool/serializer.go index 7f2a5a56e..1577792a2 100644 --- a/cosmos/x/evm/plugins/txpool/serializer.go +++ b/cosmos/x/evm/plugins/txpool/serializer.go @@ -21,37 +21,24 @@ package txpool import ( - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" "pkg.berachain.dev/polaris/cosmos/crypto/keys/ethsecp256k1" evmante "pkg.berachain.dev/polaris/cosmos/x/evm/ante" "pkg.berachain.dev/polaris/cosmos/x/evm/types" coretypes "pkg.berachain.dev/polaris/eth/core/types" - errorslib "pkg.berachain.dev/polaris/lib/errors" ) // SerializeToSdkTx converts an ethereum transaction to a Cosmos native transaction. func SerializeToSdkTx( - evmDenom string, clientCtx client.Context, signedTx *coretypes.Transaction, + clientCtx client.Context, signedTx *coretypes.Transaction, ) (sdk.Tx, error) { // TODO: do we really need to use extensions for anything? Since we // are using the standard ante handler stuff I don't think we actually need to. tx := clientCtx.TxConfig.NewTxBuilder() - // Second, we attach the required fees to the Cosmos Tx. This is simply done, - // by calling Cost() on the types.Transaction and setting the fee amount to that - feeAmt := sdkmath.NewIntFromBigInt(signedTx.Cost()) - if feeAmt.Sign() < 0 { - return nil, errorslib.Wrapf(sdkerrors.ErrInsufficientFee, "fee amount cannot be negative") - } - // Set the fee amount to the Cosmos transaction. - tx.SetFeeAmount(sdk.Coins{sdk.NewCoin(evmDenom, feeAmt)}) - // We can also retrieve the gaslimit for the transaction from the ethereum transaction. tx.SetGasLimit(signedTx.Gas()) @@ -70,8 +57,7 @@ func SerializeToSdkTx( // Create the WrappedEthereumTransaction message. wrappedEthTx := types.NewFromTransaction(signedTx) - // Hack until https://github.com/cosmos/cosmos-sdk/issues/16112 is merged. - wrappedEthTx.HackyFixCauseCosmos = "" + sig, err := wrappedEthTx.GetSignature() if err != nil { return nil, err @@ -108,10 +94,10 @@ func SerializeToSdkTx( // SerializeToBytes converts an Ethereum transaction to Cosmos formatted txBytes which allows for // it to broadcast it to CometBFT. func SerializeToBytes( - evmDenom string, clientCtx client.Context, signedTx *coretypes.Transaction, + clientCtx client.Context, signedTx *coretypes.Transaction, ) ([]byte, error) { // First, we convert the Ethereum transaction to a Cosmos transaction. - cosmosTx, err := SerializeToSdkTx(evmDenom, clientCtx, signedTx) + cosmosTx, err := SerializeToSdkTx(clientCtx, signedTx) if err != nil { return nil, err } diff --git a/cosmos/x/evm/types/codec.go b/cosmos/x/evm/types/codec.go index 5bff0ed4f..36f11ad5d 100644 --- a/cosmos/x/evm/types/codec.go +++ b/cosmos/x/evm/types/codec.go @@ -31,7 +31,6 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { registry.RegisterImplementations( (*sdk.Msg)(nil), &WrappedEthereumTransaction{}, - &UpdateParamsRequest{}, ) msgservice.RegisterMsgServiceDesc(registry, &_MsgService_serviceDesc) diff --git a/cosmos/x/evm/types/errors.go b/cosmos/x/evm/types/errors.go deleted file mode 100644 index 5ac598968..000000000 --- a/cosmos/x/evm/types/errors.go +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -//nolint:gomnd // register with cosmos errors. -package types - -import sdkerrors "cosmossdk.io/errors" - -var ( - ErrNoEvmDenom = sdkerrors.Register(ModuleName, 1, "evm denom not set") - ErrNoExtraEIPs = sdkerrors.Register(ModuleName, 2, "extra eips not set") -) diff --git a/cosmos/x/evm/types/genesis.go b/cosmos/x/evm/types/genesis.go deleted file mode 100644 index a5cfdacb7..000000000 --- a/cosmos/x/evm/types/genesis.go +++ /dev/null @@ -1,69 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package types - -import ( - "pkg.berachain.dev/polaris/eth/common" -) - -// DefaultGenesis is the default genesis state. -func DefaultGenesis() *GenesisState { - atc := make(map[string]*Contract) - htc := make(map[string]string) - - return &GenesisState{ - Params: *DefaultParams(), - AddressToContract: atc, - HashToCode: htc, - } -} - -// ValidateGenesis is used to validate the genesis state. -func ValidateGenesis(data GenesisState) error { - return data.Params.ValidateBasic() -} - -// NewGenesisState creates a new `GenesisState` object. -func NewGenesisState(params Params, atc map[string]*Contract, htc map[string]string) *GenesisState { - return &GenesisState{ - Params: params, - AddressToContract: atc, - HashToCode: htc, - } -} - -// NewContract creates a new `Contract` object. -func NewContract(codeHash common.Hash, slotToValue map[string]string) *Contract { - return &Contract{ - CodeHash: codeHash.Hex(), - SlotToValue: slotToValue, - } -} - -// WriteToSlot takes in a slot, value and pointer to a contract and writes the value to the slot. -func WriteToSlot(slot common.Hash, value common.Hash, contract *Contract) { - contract.SlotToValue[slot.Hex()] = value.Hex() -} - -// WriteCodeToHash takes in a code hash, code and map of code hashes to code and writes the code to the code hash. -func WriteCodeToHash(codeHash common.Hash, code []byte, htc map[string]string) { - htc[codeHash.Hex()] = string(code) -} diff --git a/cosmos/x/evm/types/genesis.pb.go b/cosmos/x/evm/types/genesis.pb.go deleted file mode 100644 index da0bc9c6b..000000000 --- a/cosmos/x/evm/types/genesis.pb.go +++ /dev/null @@ -1,1016 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: polaris/evm/v1alpha1/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisState defines the evm module's genesis state. -type GenesisState struct { - // params defines all the parameters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - // `address_to_contract` is a map of address to contract. - AddressToContract map[string]*Contract `protobuf:"bytes,2,rep,name=address_to_contract,json=addressToContract,proto3" json:"address_to_contract,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // `hash_to_code` is a map of code hash to code. - HashToCode map[string]string `protobuf:"bytes,3,rep,name=hash_to_code,json=hashToCode,proto3" json:"hash_to_code,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_8f2dd36de00e161b, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func (m *GenesisState) GetAddressToContract() map[string]*Contract { - if m != nil { - return m.AddressToContract - } - return nil -} - -func (m *GenesisState) GetHashToCode() map[string]string { - if m != nil { - return m.HashToCode - } - return nil -} - -// `Contract` defines the contract state. -type Contract struct { - // `code_hash` is the hash of the contract code. - CodeHash string `protobuf:"bytes,1,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` - // `slot_to_value` is a map of slot to value. - SlotToValue map[string]string `protobuf:"bytes,2,rep,name=slot_to_value,json=slotToValue,proto3" json:"slot_to_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (m *Contract) Reset() { *m = Contract{} } -func (m *Contract) String() string { return proto.CompactTextString(m) } -func (*Contract) ProtoMessage() {} -func (*Contract) Descriptor() ([]byte, []int) { - return fileDescriptor_8f2dd36de00e161b, []int{1} -} -func (m *Contract) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Contract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Contract.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Contract) XXX_Merge(src proto.Message) { - xxx_messageInfo_Contract.Merge(m, src) -} -func (m *Contract) XXX_Size() int { - return m.Size() -} -func (m *Contract) XXX_DiscardUnknown() { - xxx_messageInfo_Contract.DiscardUnknown(m) -} - -var xxx_messageInfo_Contract proto.InternalMessageInfo - -func (m *Contract) GetCodeHash() string { - if m != nil { - return m.CodeHash - } - return "" -} - -func (m *Contract) GetSlotToValue() map[string]string { - if m != nil { - return m.SlotToValue - } - return nil -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "polaris.evm.v1alpha1.GenesisState") - proto.RegisterMapType((map[string]*Contract)(nil), "polaris.evm.v1alpha1.GenesisState.AddressToContractEntry") - proto.RegisterMapType((map[string]string)(nil), "polaris.evm.v1alpha1.GenesisState.HashToCodeEntry") - proto.RegisterType((*Contract)(nil), "polaris.evm.v1alpha1.Contract") - proto.RegisterMapType((map[string]string)(nil), "polaris.evm.v1alpha1.Contract.SlotToValueEntry") -} - -func init() { - proto.RegisterFile("polaris/evm/v1alpha1/genesis.proto", fileDescriptor_8f2dd36de00e161b) -} - -var fileDescriptor_8f2dd36de00e161b = []byte{ - // 418 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x4f, 0x6a, 0xdb, 0x40, - 0x18, 0xc5, 0x25, 0xab, 0x35, 0xf6, 0xd8, 0xa5, 0xae, 0x6a, 0x8a, 0x50, 0x8b, 0xea, 0x7a, 0xe5, - 0x45, 0x19, 0x61, 0xb7, 0x8b, 0xd6, 0x90, 0x40, 0x1c, 0xf2, 0x67, 0x19, 0x64, 0x93, 0x45, 0x36, - 0x66, 0x2c, 0x0d, 0x92, 0xb0, 0xa4, 0x11, 0x9a, 0x89, 0x88, 0x6f, 0x91, 0xa3, 0xe4, 0x00, 0x39, - 0x80, 0x97, 0x5e, 0x66, 0x15, 0x82, 0x7d, 0x91, 0x30, 0x1a, 0xc9, 0x31, 0x46, 0x84, 0x64, 0x37, - 0x7c, 0xbc, 0xf7, 0x7b, 0xdf, 0x3c, 0x3e, 0xd0, 0x8d, 0x49, 0x80, 0x12, 0x9f, 0x9a, 0x38, 0x0d, - 0xcd, 0xb4, 0x8f, 0x82, 0xd8, 0x43, 0x7d, 0xd3, 0xc5, 0x11, 0xa6, 0x3e, 0x85, 0x71, 0x42, 0x18, - 0x51, 0xdb, 0xb9, 0x06, 0xe2, 0x34, 0x84, 0x85, 0x46, 0x6f, 0xbb, 0xc4, 0x25, 0x99, 0xc0, 0xe4, - 0x2f, 0xa1, 0xd5, 0x7f, 0x95, 0xf2, 0x62, 0x94, 0xa0, 0x30, 0xc7, 0x75, 0xef, 0x14, 0xd0, 0x3c, - 0x13, 0x01, 0x63, 0x86, 0x18, 0x56, 0x87, 0xa0, 0x2a, 0x04, 0x9a, 0xdc, 0x91, 0x7b, 0x8d, 0xc1, - 0x0f, 0x58, 0x16, 0x08, 0x2f, 0x32, 0xcd, 0xe8, 0xc3, 0xf2, 0xf1, 0xa7, 0x64, 0xe5, 0x0e, 0xd5, - 0x07, 0x5f, 0x91, 0xe3, 0x24, 0x98, 0xd2, 0x29, 0x23, 0x53, 0x9b, 0x44, 0x2c, 0x41, 0x36, 0xd3, - 0x2a, 0x1d, 0xa5, 0xd7, 0x18, 0xfc, 0x2f, 0x07, 0xed, 0x86, 0xc3, 0x23, 0xe1, 0x9e, 0x90, 0xe3, - 0xdc, 0x7b, 0x12, 0xb1, 0x64, 0x61, 0x7d, 0x41, 0xfb, 0x73, 0x75, 0x02, 0x9a, 0x1e, 0xa2, 0x9e, - 0xc8, 0x71, 0xb0, 0xa6, 0x64, 0x19, 0x83, 0x37, 0x64, 0x9c, 0x23, 0xea, 0x71, 0x90, 0x83, 0x05, - 0x1c, 0x78, 0xdb, 0x81, 0xee, 0x80, 0x6f, 0xe5, 0x2b, 0xa8, 0x2d, 0xa0, 0xcc, 0xf1, 0x22, 0xeb, - 0xa4, 0x6e, 0xf1, 0xa7, 0xfa, 0x17, 0x7c, 0x4c, 0x51, 0x70, 0x8d, 0xb5, 0x4a, 0xd6, 0x93, 0x51, - 0x1e, 0x5d, 0x50, 0x2c, 0x21, 0x1e, 0x56, 0xfe, 0xc9, 0xfa, 0x01, 0xf8, 0xbc, 0xb7, 0x44, 0x09, - 0xbe, 0xbd, 0x8b, 0xaf, 0xef, 0xd8, 0xbb, 0xf7, 0x32, 0xa8, 0x6d, 0x7b, 0xf8, 0x0e, 0xea, 0xfc, - 0xff, 0x53, 0xfe, 0x89, 0xdc, 0x5e, 0xe3, 0x03, 0x1e, 0xa0, 0x8e, 0xc1, 0x27, 0x1a, 0x10, 0xc6, - 0x4b, 0x2a, 0x58, 0xbc, 0x25, 0xf3, 0xf5, 0x55, 0xe1, 0x38, 0x20, 0x6c, 0x42, 0x2e, 0xb9, 0x43, - 0x54, 0xd4, 0xa0, 0x2f, 0x13, 0xfd, 0x10, 0xb4, 0xf6, 0x05, 0xef, 0x59, 0x7f, 0x74, 0xba, 0x5c, - 0x1b, 0xf2, 0x6a, 0x6d, 0xc8, 0x4f, 0x6b, 0x43, 0xbe, 0xdd, 0x18, 0xd2, 0x6a, 0x63, 0x48, 0x0f, - 0x1b, 0x43, 0xba, 0xfa, 0x1d, 0xcf, 0x5d, 0x38, 0xc3, 0x09, 0xb2, 0x3d, 0xe4, 0x47, 0xd0, 0xc1, - 0xa9, 0x59, 0x1c, 0xb0, 0x4d, 0x68, 0x48, 0xa8, 0x79, 0x93, 0x5d, 0x32, 0x5b, 0xc4, 0x98, 0xce, - 0xaa, 0xd9, 0x01, 0xff, 0x79, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x06, 0x61, 0x31, 0x42, 0x35, 0x03, - 0x00, 0x00, -} - -func (m *GenesisState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.HashToCode) > 0 { - for k := range m.HashToCode { - v := m.HashToCode[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintGenesis(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintGenesis(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenesis(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x1a - } - } - if len(m.AddressToContract) > 0 { - for k := range m.AddressToContract { - v := m.AddressToContract[k] - baseI := i - if v != nil { - { - size, err := v.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintGenesis(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenesis(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Contract) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Contract) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Contract) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.SlotToValue) > 0 { - for k := range m.SlotToValue { - v := m.SlotToValue[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintGenesis(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintGenesis(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenesis(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x12 - } - } - if len(m.CodeHash) > 0 { - i -= len(m.CodeHash) - copy(dAtA[i:], m.CodeHash) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.CodeHash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - if len(m.AddressToContract) > 0 { - for k, v := range m.AddressToContract { - _ = k - _ = v - l = 0 - if v != nil { - l = v.Size() - l += 1 + sovGenesis(uint64(l)) - } - mapEntrySize := 1 + len(k) + sovGenesis(uint64(len(k))) + l - n += mapEntrySize + 1 + sovGenesis(uint64(mapEntrySize)) - } - } - if len(m.HashToCode) > 0 { - for k, v := range m.HashToCode { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovGenesis(uint64(len(k))) + 1 + len(v) + sovGenesis(uint64(len(v))) - n += mapEntrySize + 1 + sovGenesis(uint64(mapEntrySize)) - } - } - return n -} - -func (m *Contract) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.CodeHash) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - if len(m.SlotToValue) > 0 { - for k, v := range m.SlotToValue { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovGenesis(uint64(len(k))) + 1 + len(v) + sovGenesis(uint64(len(v))) - n += mapEntrySize + 1 + sovGenesis(uint64(mapEntrySize)) - } - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AddressToContract", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AddressToContract == nil { - m.AddressToContract = make(map[string]*Contract) - } - var mapkey string - var mapvalue *Contract - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenesis - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenesis - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthGenesis - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthGenesis - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &Contract{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.AddressToContract[mapkey] = mapvalue - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HashToCode", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.HashToCode == nil { - m.HashToCode = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenesis - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenesis - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthGenesis - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthGenesis - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.HashToCode[mapkey] = mapvalue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Contract) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Contract: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Contract: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CodeHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SlotToValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.SlotToValue == nil { - m.SlotToValue = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenesis - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenesis - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthGenesis - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthGenesis - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.SlotToValue[mapkey] = mapvalue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/cosmos/x/evm/types/genesis_test.go b/cosmos/x/evm/types/genesis_test.go deleted file mode 100644 index 83c3bd28d..000000000 --- a/cosmos/x/evm/types/genesis_test.go +++ /dev/null @@ -1,81 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package types - -import ( - "pkg.berachain.dev/polaris/eth/common" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -var _ = Describe("Genesis", func() { - It("fail if genesis is invalid", func() { - params := DefaultParams() - params.EvmDenom = "" - state := NewGenesisState(*params, nil, nil) - err := ValidateGenesis(*state) - Expect(err).To(HaveOccurred()) - }) - - It("should return default genesis", func() { - state := DefaultGenesis() - Expect(state).ToNot(BeNil()) - }) - - It("should return new genesis state", func() { - atc := make(map[string]*Contract) - htc := make(map[string]string) - params := DefaultParams() - state := NewGenesisState(*params, atc, htc) - Expect(state).ToNot(BeNil()) - Expect(state.Params).To(Equal(*params)) - Expect(state.AddressToContract).To(Equal(atc)) - Expect(state.HashToCode).To(Equal(htc)) - }) - - It("should return a new contract code", func() { - codeHash := common.HexToHash("0x123") - slotToValue := make(map[string]string) - contract := NewContract(codeHash, slotToValue) - Expect(contract).ToNot(BeNil()) - Expect(contract.CodeHash).To(Equal(codeHash.Hex())) - }) - - It("should write to slot", func() { - slot := common.HexToHash("0x123") - value := common.HexToHash("0x123") - contract := NewContract(common.HexToHash("0x123"), make(map[string]string)) - WriteToSlot(slot, value, contract) - Expect(contract).ToNot(BeNil()) - Expect(contract.SlotToValue[slot.Hex()]).To(Equal(value.Hex())) - }) - - It("should return a new contract code", func() { - state := DefaultGenesis() - codeHash := common.HexToHash("0x123") - code := []byte("0x123") - WriteCodeToHash(codeHash, code, state.HashToCode) - code2 := state.HashToCode[codeHash.Hex()] - Expect(code2).To(Equal(string(code))) - - }) -}) diff --git a/cosmos/x/evm/types/keys.go b/cosmos/x/evm/types/keys.go index 8a767b2b9..c6c9505cf 100644 --- a/cosmos/x/evm/types/keys.go +++ b/cosmos/x/evm/types/keys.go @@ -22,6 +22,7 @@ package types const ( CodeKeyPrefix byte = iota + BalanceKeyPrefix StorageKeyPrefix CodeHashKeyPrefix BlockHashKeyToNumPrefix @@ -30,4 +31,6 @@ const ( VersionKey HeaderKey ParamsKey + ChainConfigPrefix + GenesisBlockPrefix ) diff --git a/cosmos/x/evm/types/params.go b/cosmos/x/evm/types/params.go deleted file mode 100644 index fa78b4e20..000000000 --- a/cosmos/x/evm/types/params.go +++ /dev/null @@ -1,67 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package types - -import ( - "encoding/json" - - "pkg.berachain.dev/polaris/eth/params" - enclib "pkg.berachain.dev/polaris/lib/encoding" -) - -const ( - // DefaultEvmDenom is the default EVM denom. - DefaultEvmDenom = "abera" -) - -var ( - // DefaultExtraEIPs is the default extra EIPs. - DefaultExtraEIPs = []int64{} -) - -// DefaultParams contains the default values for all parameters. -func DefaultParams() *Params { - return &Params{ - EvmDenom: DefaultEvmDenom, - ExtraEIPs: DefaultExtraEIPs, - ChainConfig: string(enclib.MustMarshalJSON(params.DefaultChainConfig)), - } -} - -// EthereumChainConfig returns the chain config as a struct. -func (p Params) EthereumChainConfig() *params.ChainConfig { - if p.ChainConfig == "" { - return nil - } - return enclib.MustUnmarshalJSON[params.ChainConfig]([]byte(p.ChainConfig)) -} - -// ValidateBasic is used to validate the parameters. -func (p *Params) ValidateBasic() error { - if p.EvmDenom == "" { - return ErrNoEvmDenom - } - if p.ExtraEIPs == nil { - return ErrNoExtraEIPs - } - _, err := json.Marshal(p.ChainConfig) - return err -} diff --git a/cosmos/x/evm/types/params.pb.go b/cosmos/x/evm/types/params.pb.go deleted file mode 100644 index 3b7e5a757..000000000 --- a/cosmos/x/evm/types/params.pb.go +++ /dev/null @@ -1,490 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: polaris/evm/v1alpha1/params.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// `Params` defines the parameters for the x/evm module. -type Params struct { - // `evm_denom` represents the token denomination used as the native token - // within the EVM. - EvmDenom string `protobuf:"bytes,1,opt,name=evm_denom,json=evmDenom,proto3" json:"evm_denom,omitempty" yaml:"evm_denom"` - // `extra_eips` defines a list of additional EIPs for the vm.Config - ExtraEIPs []int64 `protobuf:"varint,2,rep,packed,name=extra_eips,json=extraEips,proto3" json:"extra_eips,omitempty" yaml:"extra_eips"` - // `chain_config` represents the ethereum chain config for the polaris - // EVM - ChainConfig string `protobuf:"bytes,3,opt,name=chain_config,json=chainConfig,proto3" json:"chain_config,omitempty" yaml:"chain_config"` -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_9f6c2eac5100e18c, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetEvmDenom() string { - if m != nil { - return m.EvmDenom - } - return "" -} - -func (m *Params) GetExtraEIPs() []int64 { - if m != nil { - return m.ExtraEIPs - } - return nil -} - -func (m *Params) GetChainConfig() string { - if m != nil { - return m.ChainConfig - } - return "" -} - -func init() { - proto.RegisterType((*Params)(nil), "polaris.evm.v1alpha1.Params") -} - -func init() { proto.RegisterFile("polaris/evm/v1alpha1/params.proto", fileDescriptor_9f6c2eac5100e18c) } - -var fileDescriptor_9f6c2eac5100e18c = []byte{ - // 288 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2c, 0xc8, 0xcf, 0x49, - 0x2c, 0xca, 0x2c, 0xd6, 0x4f, 0x2d, 0xcb, 0xd5, 0x2f, 0x33, 0x4c, 0xcc, 0x29, 0xc8, 0x48, 0x34, - 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81, - 0x2a, 0xd1, 0x4b, 0x2d, 0xcb, 0xd5, 0x83, 0x29, 0x91, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, - 0xd0, 0x07, 0xb1, 0x20, 0x6a, 0x95, 0x76, 0x31, 0x72, 0xb1, 0x05, 0x80, 0x35, 0x0b, 0x19, 0x72, - 0x71, 0xa6, 0x96, 0xe5, 0xc6, 0xa7, 0xa4, 0xe6, 0xe5, 0xe7, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, - 0x3a, 0x89, 0x7c, 0xba, 0x27, 0x2f, 0x50, 0x99, 0x98, 0x9b, 0x63, 0xa5, 0x04, 0x97, 0x52, 0x0a, - 0xe2, 0x48, 0x2d, 0xcb, 0x75, 0x01, 0x31, 0x85, 0x1c, 0xb9, 0xb8, 0x52, 0x2b, 0x4a, 0x8a, 0x12, - 0xe3, 0x53, 0x33, 0x0b, 0x8a, 0x25, 0x98, 0x14, 0x98, 0x35, 0x98, 0x9d, 0x94, 0x1e, 0xdd, 0x93, - 0xe7, 0x74, 0x05, 0x89, 0xba, 0x7a, 0x06, 0x14, 0x7f, 0xba, 0x27, 0x2f, 0x08, 0x35, 0x00, 0xae, - 0x50, 0x29, 0x88, 0x13, 0xcc, 0x71, 0xcd, 0x2c, 0x28, 0x16, 0xb2, 0xe2, 0xe2, 0x49, 0xce, 0x48, - 0xcc, 0xcc, 0x8b, 0x4f, 0xce, 0xcf, 0x4b, 0xcb, 0x4c, 0x97, 0x60, 0x06, 0x5b, 0x2c, 0xfe, 0xe9, - 0x9e, 0xbc, 0x30, 0x44, 0x1f, 0xb2, 0xac, 0x52, 0x10, 0x37, 0x98, 0xeb, 0x0c, 0xe6, 0x39, 0xb9, - 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, - 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x4e, 0x41, 0x76, 0xba, 0x5e, - 0x52, 0x6a, 0x51, 0x22, 0x58, 0xb9, 0x5e, 0x4a, 0x6a, 0x99, 0x3e, 0x2c, 0xdc, 0x92, 0xf3, 0x8b, - 0x73, 0xf3, 0x8b, 0xf5, 0x2b, 0xc0, 0x01, 0x58, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, - 0x0b, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x40, 0xd7, 0xc0, 0xb1, 0x5c, 0x01, 0x00, 0x00, -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ChainConfig) > 0 { - i -= len(m.ChainConfig) - copy(dAtA[i:], m.ChainConfig) - i = encodeVarintParams(dAtA, i, uint64(len(m.ChainConfig))) - i-- - dAtA[i] = 0x1a - } - if len(m.ExtraEIPs) > 0 { - dAtA2 := make([]byte, len(m.ExtraEIPs)*10) - var j1 int - for _, num1 := range m.ExtraEIPs { - num := uint64(num1) - for num >= 1<<7 { - dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j1++ - } - dAtA2[j1] = uint8(num) - j1++ - } - i -= j1 - copy(dAtA[i:], dAtA2[:j1]) - i = encodeVarintParams(dAtA, i, uint64(j1)) - i-- - dAtA[i] = 0x12 - } - if len(m.EvmDenom) > 0 { - i -= len(m.EvmDenom) - copy(dAtA[i:], m.EvmDenom) - i = encodeVarintParams(dAtA, i, uint64(len(m.EvmDenom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintParams(dAtA []byte, offset int, v uint64) int { - offset -= sovParams(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.EvmDenom) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - if len(m.ExtraEIPs) > 0 { - l = 0 - for _, e := range m.ExtraEIPs { - l += sovParams(uint64(e)) - } - n += 1 + sovParams(uint64(l)) + l - } - l = len(m.ChainConfig) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - return n -} - -func sovParams(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozParams(x uint64) (n int) { - return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EvmDenom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.EvmDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType == 0 { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ExtraEIPs = append(m.ExtraEIPs, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.ExtraEIPs) == 0 { - m.ExtraEIPs = make([]int64, 0, elementCount) - } - for iNdEx < postIndex { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ExtraEIPs = append(m.ExtraEIPs, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field ExtraEIPs", wireType) - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainConfig", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainConfig = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipParams(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthParams - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupParams - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthParams - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") -) diff --git a/cosmos/x/evm/types/params_test.go b/cosmos/x/evm/types/params_test.go deleted file mode 100644 index 4b96ac222..000000000 --- a/cosmos/x/evm/types/params_test.go +++ /dev/null @@ -1,36 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package types - -import ( - "math/big" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -var _ = Describe("Test Params", func() { - It("should marshal chain config correctly", func() { - params := DefaultParams() - ethConfig := params.EthereumChainConfig() - Expect(ethConfig.ChainID).To(Equal(big.NewInt(2061))) - }) -}) diff --git a/cosmos/x/evm/types/query.pb.go b/cosmos/x/evm/types/query.pb.go deleted file mode 100644 index 826bdc53a..000000000 --- a/cosmos/x/evm/types/query.pb.go +++ /dev/null @@ -1,536 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: polaris/evm/v1alpha1/query.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// `ParamsRequest` is the request type for the Query/Params RPC method. -type ParamsRequest struct { -} - -func (m *ParamsRequest) Reset() { *m = ParamsRequest{} } -func (m *ParamsRequest) String() string { return proto.CompactTextString(m) } -func (*ParamsRequest) ProtoMessage() {} -func (*ParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_eabbdb83b909a591, []int{0} -} -func (m *ParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ParamsRequest.Merge(m, src) -} -func (m *ParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *ParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ParamsRequest proto.InternalMessageInfo - -// `ParamsResponse` is the response type for the Query/Params RPC method. -type ParamsResponse struct { - // params defines the parameters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *ParamsResponse) Reset() { *m = ParamsResponse{} } -func (m *ParamsResponse) String() string { return proto.CompactTextString(m) } -func (*ParamsResponse) ProtoMessage() {} -func (*ParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_eabbdb83b909a591, []int{1} -} -func (m *ParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ParamsResponse.Merge(m, src) -} -func (m *ParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *ParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ParamsResponse proto.InternalMessageInfo - -func (m *ParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func init() { - proto.RegisterType((*ParamsRequest)(nil), "polaris.evm.v1alpha1.ParamsRequest") - proto.RegisterType((*ParamsResponse)(nil), "polaris.evm.v1alpha1.ParamsResponse") -} - -func init() { proto.RegisterFile("polaris/evm/v1alpha1/query.proto", fileDescriptor_eabbdb83b909a591) } - -var fileDescriptor_eabbdb83b909a591 = []byte{ - // 291 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x28, 0xc8, 0xcf, 0x49, - 0x2c, 0xca, 0x2c, 0xd6, 0x4f, 0x2d, 0xcb, 0xd5, 0x2f, 0x33, 0x4c, 0xcc, 0x29, 0xc8, 0x48, 0x34, - 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81, 0xaa, - 0xd0, 0x4b, 0x2d, 0xcb, 0xd5, 0x83, 0xa9, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd0, - 0x07, 0xb1, 0x20, 0x6a, 0xa5, 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, - 0xf5, 0x13, 0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0xa1, 0xb2, 0x8a, 0x58, - 0xed, 0x2a, 0x48, 0x2c, 0x4a, 0xcc, 0x85, 0x2a, 0x51, 0xe2, 0xe7, 0xe2, 0x0d, 0x00, 0xf3, 0x83, - 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x94, 0x7c, 0xb8, 0xf8, 0x60, 0x02, 0xc5, 0x05, 0xf9, 0x79, - 0xc5, 0xa9, 0x42, 0x56, 0x5c, 0x6c, 0x10, 0x2d, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x32, - 0x7a, 0xd8, 0x1c, 0xa8, 0x07, 0xd1, 0xe5, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x54, 0x87, - 0x51, 0x27, 0x23, 0x17, 0x4f, 0x20, 0xc8, 0x6f, 0xc1, 0xa9, 0x45, 0x65, 0x99, 0xc9, 0xa9, 0x42, - 0x95, 0x5c, 0x6c, 0x10, 0x85, 0x42, 0xca, 0xf8, 0x8c, 0x81, 0xba, 0x46, 0x4a, 0x05, 0xbf, 0x22, - 0x88, 0x0b, 0x95, 0x54, 0x9a, 0x2e, 0x3f, 0x99, 0xcc, 0x24, 0x27, 0x24, 0xa3, 0x8f, 0xc7, 0xc3, - 0x4e, 0x6e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, - 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x53, 0x90, 0x9d, - 0xae, 0x97, 0x94, 0x5a, 0x94, 0x98, 0x9c, 0x91, 0x98, 0x99, 0xa7, 0x97, 0x92, 0x5a, 0x06, 0x37, - 0x28, 0x39, 0xbf, 0x38, 0x37, 0xbf, 0x58, 0xbf, 0x02, 0x6c, 0x62, 0x49, 0x65, 0x41, 0x6a, 0x71, - 0x12, 0x1b, 0x38, 0xe4, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x13, 0xfd, 0xe8, 0x4a, 0xca, - 0x01, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryServiceClient is the client API for QueryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryServiceClient interface { - // Params returns the total set of evm parameters. - Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) -} - -type queryServiceClient struct { - cc grpc1.ClientConn -} - -func NewQueryServiceClient(cc grpc1.ClientConn) QueryServiceClient { - return &queryServiceClient{cc} -} - -func (c *queryServiceClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { - out := new(ParamsResponse) - err := c.cc.Invoke(ctx, "/polaris.evm.v1alpha1.QueryService/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServiceServer is the server API for QueryService service. -type QueryServiceServer interface { - // Params returns the total set of evm parameters. - Params(context.Context, *ParamsRequest) (*ParamsResponse, error) -} - -// UnimplementedQueryServiceServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServiceServer struct { -} - -func (*UnimplementedQueryServiceServer) Params(ctx context.Context, req *ParamsRequest) (*ParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} - -func RegisterQueryServiceServer(s grpc1.Server, srv QueryServiceServer) { - s.RegisterService(&_QueryService_serviceDesc, srv) -} - -func _QueryService_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServiceServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/polaris.evm.v1alpha1.QueryService/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServiceServer).Params(ctx, req.(*ParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _QueryService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "polaris.evm.v1alpha1.QueryService", - HandlerType: (*QueryServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _QueryService_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "polaris/evm/v1alpha1/query.proto", -} - -func (m *ParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *ParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *ParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/cosmos/x/evm/types/query.pb.gw.go b/cosmos/x/evm/types/query.pb.gw.go deleted file mode 100644 index 0d6190a82..000000000 --- a/cosmos/x/evm/types/query.pb.gw.go +++ /dev/null @@ -1,153 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: polaris/evm/v1alpha1/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - -func request_QueryService_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_QueryService_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryServiceHandlerServer registers the http handlers for service QueryService to "mux". -// UnaryRPC :call QueryServiceServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryServiceHandlerFromEndpoint instead. -func RegisterQueryServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServiceServer) error { - - mux.Handle("GET", pattern_QueryService_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_QueryService_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryService_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryServiceHandlerFromEndpoint is same as RegisterQueryServiceHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryServiceHandler(ctx, mux, conn) -} - -// RegisterQueryServiceHandler registers the http handlers for service QueryService to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryServiceHandlerClient(ctx, mux, NewQueryServiceClient(conn)) -} - -// RegisterQueryServiceHandlerClient registers the http handlers for service QueryService -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryServiceClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryServiceClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryServiceClient" to call the correct interceptors. -func RegisterQueryServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryServiceClient) error { - - mux.Handle("GET", pattern_QueryService_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_QueryService_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryService_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_QueryService_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"polaris", "evm", "v1alpha1", "params"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_QueryService_Params_0 = runtime.ForwardResponseMessage -) diff --git a/cosmos/x/evm/types/tx.pb.go b/cosmos/x/evm/types/tx.pb.go index 4ed723a1f..49a80e693 100644 --- a/cosmos/x/evm/types/tx.pb.go +++ b/cosmos/x/evm/types/tx.pb.go @@ -6,9 +6,7 @@ package types import ( context "context" fmt "fmt" - _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" - _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" @@ -71,6 +69,20 @@ func (m *WrappedEthereumTransaction) XXX_DiscardUnknown() { var xxx_messageInfo_WrappedEthereumTransaction proto.InternalMessageInfo +func (m *WrappedEthereumTransaction) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +func (m *WrappedEthereumTransaction) GetHackyFixCauseCosmos() string { + if m != nil { + return m.HackyFixCauseCosmos + } + return "" +} + // WrappedEthereumTransactionResult defines the Msg/EthereumTx response type. type WrappedEthereumTransactionResult struct { // `gas_used` represents the gas used by the virtual machine execution. @@ -114,149 +126,59 @@ func (m *WrappedEthereumTransactionResult) XXX_DiscardUnknown() { var xxx_messageInfo_WrappedEthereumTransactionResult proto.InternalMessageInfo -// `UpdateParamsRequest` is the Msg/UpdateParams request type. -// -// Since: cosmos-sdk 0.47 -type UpdateParamsRequest struct { - // authority is the address that controls the module (defaults to x/gov unless overwritten). - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the x/evm parameters to update. - // - // NOTE: All parameters must be supplied. - Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` -} - -func (m *UpdateParamsRequest) Reset() { *m = UpdateParamsRequest{} } -func (m *UpdateParamsRequest) String() string { return proto.CompactTextString(m) } -func (*UpdateParamsRequest) ProtoMessage() {} -func (*UpdateParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d8b33d2a2c64400f, []int{2} -} -func (m *UpdateParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UpdateParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UpdateParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (m *WrappedEthereumTransactionResult) GetGasUsed() uint64 { + if m != nil { + return m.GasUsed } + return 0 } -func (m *UpdateParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpdateParamsRequest.Merge(m, src) -} -func (m *UpdateParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *UpdateParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_UpdateParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_UpdateParamsRequest proto.InternalMessageInfo -func (m *UpdateParamsRequest) GetAuthority() string { +func (m *WrappedEthereumTransactionResult) GetVmError() string { if m != nil { - return m.Authority + return m.VmError } return "" } -func (m *UpdateParamsRequest) GetParams() Params { +func (m *WrappedEthereumTransactionResult) GetReturnData() []byte { if m != nil { - return m.Params + return m.ReturnData } - return Params{} -} - -// `UpdateParamsResponse` defines the response structure for executing a -// UpdateParamsResponse message. -// -// Since: cosmos-sdk 0.47 -type UpdateParamsResponse struct { -} - -func (m *UpdateParamsResponse) Reset() { *m = UpdateParamsResponse{} } -func (m *UpdateParamsResponse) String() string { return proto.CompactTextString(m) } -func (*UpdateParamsResponse) ProtoMessage() {} -func (*UpdateParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d8b33d2a2c64400f, []int{3} -} -func (m *UpdateParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UpdateParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *UpdateParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpdateParamsResponse.Merge(m, src) -} -func (m *UpdateParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *UpdateParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_UpdateParamsResponse.DiscardUnknown(m) + return nil } -var xxx_messageInfo_UpdateParamsResponse proto.InternalMessageInfo - func init() { proto.RegisterType((*WrappedEthereumTransaction)(nil), "polaris.evm.v1alpha1.WrappedEthereumTransaction") proto.RegisterType((*WrappedEthereumTransactionResult)(nil), "polaris.evm.v1alpha1.WrappedEthereumTransactionResult") - proto.RegisterType((*UpdateParamsRequest)(nil), "polaris.evm.v1alpha1.UpdateParamsRequest") - proto.RegisterType((*UpdateParamsResponse)(nil), "polaris.evm.v1alpha1.UpdateParamsResponse") } func init() { proto.RegisterFile("polaris/evm/v1alpha1/tx.proto", fileDescriptor_d8b33d2a2c64400f) } var fileDescriptor_d8b33d2a2c64400f = []byte{ - // 517 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x3f, 0x6f, 0xd3, 0x40, - 0x14, 0x8f, 0x21, 0xb4, 0xf4, 0x5a, 0x75, 0xb8, 0x46, 0x25, 0xb5, 0xc0, 0x09, 0x99, 0x4a, 0x04, - 0x36, 0x69, 0xa5, 0x0e, 0xd9, 0x48, 0x49, 0x37, 0x24, 0xe4, 0x52, 0x21, 0xb1, 0x58, 0xaf, 0xf6, - 0xc3, 0xb6, 0x1a, 0xfb, 0x8e, 0xbb, 0xb3, 0x95, 0xb0, 0x80, 0x18, 0x10, 0x23, 0x2b, 0x1b, 0x1f, - 0xa1, 0x03, 0x1f, 0xa2, 0x63, 0xc5, 0xc4, 0x84, 0x50, 0x32, 0xf4, 0x1b, 0x30, 0x23, 0x9f, 0x5d, - 0xb5, 0x48, 0x89, 0x04, 0xd3, 0xdd, 0x7b, 0xbf, 0xf7, 0xe7, 0xf7, 0x7e, 0x4f, 0x8f, 0xdc, 0xe3, - 0x6c, 0x04, 0x22, 0x96, 0x0e, 0xe6, 0x89, 0x93, 0xf7, 0x60, 0xc4, 0x23, 0xe8, 0x39, 0x6a, 0x6c, - 0x73, 0xc1, 0x14, 0xa3, 0x8d, 0x0a, 0xb6, 0x31, 0x4f, 0xec, 0x4b, 0xd8, 0xbc, 0xe3, 0x33, 0x99, - 0x30, 0xe9, 0x24, 0x32, 0x74, 0xf2, 0x5e, 0xf1, 0x94, 0xe1, 0xe6, 0x56, 0x09, 0x78, 0xda, 0x72, - 0x4a, 0xa3, 0x82, 0x1a, 0x21, 0x0b, 0x59, 0xe9, 0x2f, 0x7e, 0x95, 0xf7, 0xfe, 0xdc, 0xf6, 0x1c, - 0x04, 0x24, 0x55, 0x62, 0xe7, 0xa3, 0x41, 0xcc, 0x97, 0x02, 0x38, 0xc7, 0x60, 0xa8, 0x22, 0x14, - 0x98, 0x25, 0x2f, 0x04, 0xa4, 0x12, 0x7c, 0x15, 0xb3, 0x94, 0x52, 0x52, 0x0f, 0x40, 0x41, 0xd3, - 0x68, 0x1b, 0xdb, 0x6b, 0xae, 0xfe, 0xd3, 0x5d, 0xb2, 0x19, 0x81, 0x7f, 0x32, 0xf1, 0x5e, 0xc7, - 0x63, 0xcf, 0x87, 0x4c, 0xa2, 0x57, 0x72, 0x69, 0xde, 0x68, 0x1b, 0xdb, 0x2b, 0xee, 0x86, 0x46, - 0x0f, 0xe2, 0xf1, 0x7e, 0x81, 0xed, 0x6b, 0xa8, 0xdf, 0xfa, 0xf4, 0xb5, 0x55, 0xfb, 0x70, 0x71, - 0xda, 0x5d, 0x90, 0xdb, 0x79, 0x47, 0xda, 0x8b, 0x79, 0xb8, 0x28, 0xb3, 0x91, 0xa2, 0x5b, 0xe4, - 0x76, 0x08, 0xd2, 0xcb, 0x24, 0x06, 0x9a, 0x51, 0xdd, 0x5d, 0x0e, 0x41, 0x1e, 0x49, 0x0c, 0x0a, - 0x28, 0x4f, 0x3c, 0x14, 0x82, 0x89, 0x8a, 0xc6, 0x72, 0x9e, 0x0c, 0x0b, 0x93, 0xb6, 0xc8, 0xaa, - 0x40, 0x95, 0x89, 0xd4, 0xd3, 0xa3, 0xdc, 0xd4, 0xa3, 0x90, 0xd2, 0xf5, 0x14, 0x14, 0xf4, 0xeb, - 0x05, 0xb7, 0xce, 0x17, 0x83, 0x6c, 0x1c, 0xf1, 0x00, 0x14, 0x3e, 0xd7, 0x02, 0xb9, 0xf8, 0x26, - 0x43, 0xa9, 0xe8, 0x1e, 0x59, 0x81, 0x4c, 0x45, 0x4c, 0xc4, 0x6a, 0xa2, 0xbb, 0xae, 0x0c, 0x9a, - 0xdf, 0xbf, 0x3d, 0x6a, 0x54, 0xfa, 0x3f, 0x09, 0x02, 0x81, 0x52, 0x1e, 0x2a, 0x11, 0xa7, 0xa1, - 0x7b, 0x15, 0x4a, 0xfb, 0x64, 0xa9, 0x54, 0x5a, 0xf3, 0x59, 0xdd, 0xb9, 0x6b, 0xcf, 0xdb, 0xb6, - 0x5d, 0x36, 0x1b, 0xd4, 0xcf, 0x7e, 0xb6, 0x6a, 0x6e, 0x95, 0xd1, 0x5f, 0x2f, 0x94, 0xba, 0xaa, - 0xd5, 0xd9, 0x24, 0x8d, 0xbf, 0xa9, 0x49, 0xce, 0x52, 0x89, 0x3b, 0xbf, 0x0d, 0x42, 0x9e, 0xc9, - 0xf0, 0x10, 0x45, 0x1e, 0xfb, 0x48, 0xdf, 0x92, 0xf5, 0xa1, 0x8a, 0xae, 0xef, 0xef, 0xf1, 0xfc, - 0xa6, 0x8b, 0x95, 0x36, 0xf7, 0xfe, 0x37, 0xa3, 0xda, 0x0d, 0x92, 0xb5, 0xeb, 0x14, 0xe9, 0x83, - 0xf9, 0x75, 0xe6, 0x28, 0x6c, 0x76, 0xff, 0x25, 0xb4, 0x9c, 0xd8, 0xbc, 0xf5, 0xfe, 0xe2, 0xb4, - 0x6b, 0x0c, 0x0e, 0xce, 0xa6, 0x96, 0x71, 0x3e, 0xb5, 0x8c, 0x5f, 0x53, 0xcb, 0xf8, 0x3c, 0xb3, - 0x6a, 0xe7, 0x33, 0xab, 0xf6, 0x63, 0x66, 0xd5, 0x5e, 0x3d, 0xe4, 0x27, 0xa1, 0x7d, 0x8c, 0x02, - 0xfc, 0x08, 0xe2, 0xd4, 0x0e, 0x30, 0x77, 0x2e, 0xaf, 0xa0, 0xba, 0xab, 0xb1, 0x3e, 0x07, 0x35, - 0xe1, 0x28, 0x8f, 0x97, 0xf4, 0x15, 0xec, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xe8, 0xbf, 0xf9, - 0xd3, 0xa9, 0x03, 0x00, 0x00, + // 368 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xbd, 0x4e, 0xe3, 0x40, + 0x14, 0x85, 0x33, 0xbb, 0xd9, 0xcd, 0xee, 0xec, 0x6a, 0x0b, 0xef, 0x6a, 0x09, 0x46, 0x98, 0x28, + 0x55, 0x14, 0x21, 0x9b, 0x10, 0x89, 0x82, 0x92, 0x90, 0x74, 0x34, 0x06, 0x84, 0x44, 0x63, 0xdd, + 0xd8, 0x17, 0xdb, 0x4a, 0xfc, 0xa3, 0x99, 0xf1, 0xc8, 0xa1, 0x42, 0x79, 0x01, 0x78, 0x94, 0x3c, + 0x06, 0x65, 0x4a, 0x4a, 0x94, 0x14, 0x79, 0x0d, 0xe4, 0x71, 0x22, 0x51, 0x90, 0x82, 0x6a, 0x7e, + 0xbe, 0xb9, 0xa3, 0x73, 0xee, 0x3d, 0x74, 0x3f, 0x4d, 0xc6, 0xc0, 0x42, 0x6e, 0xa1, 0x8c, 0x2c, + 0xd9, 0x81, 0x71, 0x1a, 0x40, 0xc7, 0x12, 0xb9, 0x99, 0xb2, 0x44, 0x24, 0xda, 0xbf, 0x35, 0x36, + 0x51, 0x46, 0xe6, 0x06, 0xeb, 0x3b, 0x6e, 0xc2, 0xa3, 0x84, 0x5b, 0x11, 0xf7, 0x2d, 0xd9, 0x29, + 0x96, 0xf2, 0x79, 0x73, 0x4a, 0xa8, 0x7e, 0xc3, 0x20, 0x4d, 0xd1, 0xeb, 0x8b, 0x00, 0x19, 0x66, + 0xd1, 0x15, 0x83, 0x98, 0x83, 0x2b, 0xc2, 0x24, 0xd6, 0x34, 0x5a, 0xf5, 0x40, 0x40, 0x9d, 0x34, + 0x48, 0xeb, 0xb7, 0xad, 0xf6, 0x5a, 0x97, 0xfe, 0x0f, 0xc0, 0x1d, 0x4d, 0x9c, 0xbb, 0x30, 0x77, + 0x5c, 0xc8, 0x38, 0x3a, 0xe5, 0xef, 0xf5, 0x2f, 0x0d, 0xd2, 0xfa, 0x69, 0xff, 0x55, 0x74, 0x10, + 0xe6, 0xbd, 0x82, 0xf5, 0x14, 0x3a, 0xdd, 0x9b, 0xae, 0x66, 0xed, 0x2d, 0x75, 0xcd, 0x09, 0x6d, + 0x6c, 0xd7, 0x60, 0x23, 0xcf, 0xc6, 0x42, 0xdb, 0xa5, 0x3f, 0x7c, 0xe0, 0x4e, 0xc6, 0xd1, 0x53, + 0x6a, 0xaa, 0x76, 0xcd, 0x07, 0x7e, 0xcd, 0xd1, 0x2b, 0x90, 0x8c, 0x1c, 0x64, 0x2c, 0x61, 0x6b, + 0x09, 0x35, 0x19, 0xf5, 0x8b, 0xa3, 0x76, 0x40, 0x7f, 0x31, 0x14, 0x19, 0x8b, 0x1d, 0x65, 0xe3, + 0xab, 0xb2, 0x41, 0xcb, 0xab, 0x73, 0x10, 0x70, 0xfc, 0x48, 0x28, 0xbd, 0xe0, 0xfe, 0x25, 0x32, + 0x19, 0xba, 0xa8, 0xdd, 0xd3, 0x3f, 0x7d, 0x11, 0xbc, 0xef, 0xc0, 0x91, 0xf9, 0x51, 0x43, 0xcd, + 0xed, 0x7a, 0xf5, 0x93, 0xcf, 0x56, 0x94, 0x0e, 0xf5, 0x6f, 0x0f, 0xab, 0x59, 0x9b, 0x9c, 0x0d, + 0x9e, 0x17, 0x06, 0x99, 0x2f, 0x0c, 0xf2, 0xba, 0x30, 0xc8, 0xd3, 0xd2, 0xa8, 0xcc, 0x97, 0x46, + 0xe5, 0x65, 0x69, 0x54, 0x6e, 0x0f, 0xd3, 0x91, 0x6f, 0x0e, 0x91, 0x81, 0x1b, 0x40, 0x18, 0x9b, + 0x1e, 0x4a, 0x6b, 0x93, 0x85, 0xf5, 0x78, 0x73, 0x15, 0x0a, 0x31, 0x49, 0x91, 0x0f, 0xbf, 0xab, + 0x01, 0x77, 0xdf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x6b, 0x4d, 0x7b, 0x17, 0x30, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -273,11 +195,6 @@ const _ = grpc.SupportPackageIsVersion4 type MsgServiceClient interface { // EthTransaction defines a method submitting Ethereum transactions. EthTransaction(ctx context.Context, in *WrappedEthereumTransaction, opts ...grpc.CallOption) (*WrappedEthereumTransactionResult, error) - // `UpdateParams` defines a governance operation for updating the x/evm module - // parameters. The authority is defaults to the x/gov module account. - // - // Since: cosmos-sdk 0.47 - UpdateParams(ctx context.Context, in *UpdateParamsRequest, opts ...grpc.CallOption) (*UpdateParamsResponse, error) } type msgServiceClient struct { @@ -297,24 +214,10 @@ func (c *msgServiceClient) EthTransaction(ctx context.Context, in *WrappedEthere return out, nil } -func (c *msgServiceClient) UpdateParams(ctx context.Context, in *UpdateParamsRequest, opts ...grpc.CallOption) (*UpdateParamsResponse, error) { - out := new(UpdateParamsResponse) - err := c.cc.Invoke(ctx, "/polaris.evm.v1alpha1.MsgService/UpdateParams", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // MsgServiceServer is the server API for MsgService service. type MsgServiceServer interface { // EthTransaction defines a method submitting Ethereum transactions. EthTransaction(context.Context, *WrappedEthereumTransaction) (*WrappedEthereumTransactionResult, error) - // `UpdateParams` defines a governance operation for updating the x/evm module - // parameters. The authority is defaults to the x/gov module account. - // - // Since: cosmos-sdk 0.47 - UpdateParams(context.Context, *UpdateParamsRequest) (*UpdateParamsResponse, error) } // UnimplementedMsgServiceServer can be embedded to have forward compatible implementations. @@ -324,9 +227,6 @@ type UnimplementedMsgServiceServer struct { func (*UnimplementedMsgServiceServer) EthTransaction(ctx context.Context, req *WrappedEthereumTransaction) (*WrappedEthereumTransactionResult, error) { return nil, status.Errorf(codes.Unimplemented, "method EthTransaction not implemented") } -func (*UnimplementedMsgServiceServer) UpdateParams(ctx context.Context, req *UpdateParamsRequest) (*UpdateParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") -} func RegisterMsgServiceServer(s grpc1.Server, srv MsgServiceServer) { s.RegisterService(&_MsgService_serviceDesc, srv) @@ -350,24 +250,6 @@ func _MsgService_EthTransaction_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } -func _MsgService_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServiceServer).UpdateParams(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/polaris.evm.v1alpha1.MsgService/UpdateParams", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServiceServer).UpdateParams(ctx, req.(*UpdateParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - var _MsgService_serviceDesc = grpc.ServiceDesc{ ServiceName: "polaris.evm.v1alpha1.MsgService", HandlerType: (*MsgServiceServer)(nil), @@ -376,10 +258,6 @@ var _MsgService_serviceDesc = grpc.ServiceDesc{ MethodName: "EthTransaction", Handler: _MsgService_EthTransaction_Handler, }, - { - MethodName: "UpdateParams", - Handler: _MsgService_UpdateParams_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "polaris/evm/v1alpha1/tx.proto", @@ -464,69 +342,6 @@ func (m *WrappedEthereumTransactionResult) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } -func (m *UpdateParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *UpdateParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UpdateParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *UpdateParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *UpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -575,30 +390,6 @@ func (m *WrappedEthereumTransactionResult) Size() (n int) { return n } -func (m *UpdateParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *UpdateParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -856,171 +647,6 @@ func (m *WrappedEthereumTransactionResult) Unmarshal(dAtA []byte) error { } return nil } -func (m *UpdateParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: UpdateParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UpdateParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UpdateParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: UpdateParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/cosmos/x/evm/types/update_params.go b/cosmos/x/evm/types/update_params.go deleted file mode 100644 index 729f316b2..000000000 --- a/cosmos/x/evm/types/update_params.go +++ /dev/null @@ -1,46 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - errorslib "pkg.berachain.dev/polaris/lib/errors" -) - -// Compile-time interface assertions. -var _ sdk.Msg = (*UpdateParamsRequest)(nil) - -// GetSigners returns the expected signers for the request. -func (m UpdateParamsRequest) GetSigners() []sdk.AccAddress { - //#nosec G703: // purposely leave error unhandled. - addr, _ := sdk.AccAddressFromBech32(m.Authority) - return []sdk.AccAddress{addr} -} - -// ValidateBasic validates the request. -func (m *UpdateParamsRequest) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { - return errorslib.Wrap(err, "invalid authority address") - } - - return m.Params.ValidateBasic() -} diff --git a/docs/web/pages/docs/for-frontend-devs/chain-config.mdx b/docs/web/pages/docs/for-frontend-devs/chain-config.mdx index c8e75f984..8465a9c22 100644 --- a/docs/web/pages/docs/for-frontend-devs/chain-config.mdx +++ b/docs/web/pages/docs/for-frontend-devs/chain-config.mdx @@ -1,10 +1,12 @@ # Chain Configurations -This section covers the default chain configuration for all Polaris Ethereum +This section covers the default chain configuration for all Polaris Ethereum environments. + ## Local Node Configurations ### JSON RPC Configuration + - Network Name: `Polaris Ethereum` - RPC URL: `http://localhost:8545` - Chain ID: `2061` @@ -12,43 +14,47 @@ environments. - Block Explorer URL (optional): `` ### Cosmos Chain Configuration / Keplr Chain Info + - RPC: `http://localhost:9090` - REST: `http://localhost:1317` - ChainID: `polaris-2061` - ChainName: `Polaris Ethereum` - BIP44: `60` - Bech32Config: - - bech32PrefixAccAddr: `polaris` - - bech32PrefixAccPub: `polarispub` - - bech32PrefixValAddr: `polarisvaloper` - - bech32PrefixValPub: `polarisvaloperpub` - - bech32PrefixConsAddr: `polarisvalcons` - - bech32PrefixConsPub: `polarisvalconspub` + - bech32PrefixAccAddr: `polaris` + - bech32PrefixAccPub: `polarispub` + - bech32PrefixValAddr: `polarisvaloper` + - bech32PrefixValPub: `polarisvaloperpub` + - bech32PrefixConsAddr: `polarisvalcons` + - bech32PrefixConsPub: `polarisvalconspub` - Currencies: - - coinDenom: `BERA` - - coinMinimalDenom: `abera` - - coinDecimals: `18` - - isStakeCurrency: `true` - - isFeeCurrency: `true` + - coinDenom: `BERA` + - coinMinimalDenom: `abera` + - coinDecimals: `18` + - isStakeCurrency: `true` + - isFeeCurrency: `true` - StakeCurrency: - - coinDenom: `BERA` - - coinMinimalDenom: `abera` - - coinDecimals: `18` - - isStakeCurrency: `true` - - isFeeCurrency: `true` + - coinDenom: `BERA` + - coinMinimalDenom: `abera` + - coinDecimals: `18` + - isStakeCurrency: `true` + - isFeeCurrency: `true` - GasPriceStep: - - low: `0` - - average: `0` - - high: `0.025` + - low: `0` + - average: `0` + - high: `0.025` - Features: - - `ibc-transfer` - - `ibc-go` - - `eth-address-gen` - - `eth-key-sign` + - `ibc-transfer` + - `ibc-go` + - `eth-address-gen` + - `eth-key-sign` + ## Testnet Configuration ### JSON RPC Configuration + 🚧 Coming Soon 🚧 ### Cosmos Chain Configuration / Keplr Chain Info + 🚧 Coming Soon 🚧 diff --git a/docs/web/pages/docs/for-frontend-devs/staking-example.mdx b/docs/web/pages/docs/for-frontend-devs/staking-example.mdx index 3ed483b1b..d359f7ada 100644 --- a/docs/web/pages/docs/for-frontend-devs/staking-example.mdx +++ b/docs/web/pages/docs/for-frontend-devs/staking-example.mdx @@ -1,11 +1,13 @@ -import { Callout, FileTree } from 'nextra-theme-docs' +import { Callout, FileTree } from "nextra-theme-docs"; # Building a Staking dApp -We will create a straightforward staking decentralized application (dApp) -in this section, which will be linked to a [Local Node](../running-a-node/running-locally). This dApp will -use the [staking precompile](../precompile-overview) feature to obtain information about validators -and delegators from the EVM, as well as to create delegate transactions + +We will create a straightforward staking decentralized application (dApp) +in this section, which will be linked to a [Local Node](../running-a-node/running-locally). This dApp will +use the [staking precompile](../precompile-overview) feature to obtain information about validators +and delegators from the EVM, as well as to create delegate transactions on the EVM natively. +
### Requirements @@ -19,6 +21,7 @@ on the EVM natively. - Basic knowledge of [Rainbow Kit](https://www.rainbowkit.com/) - [Metamask configured](../using-metamask) - A running [Local Node](../running-a-node/running-locally) + ### Setup Wagmi Project Run the following command to create a folder @@ -28,14 +31,15 @@ Run the following command: `yarn create wagmi` -After running the above command, input the following values: +After running the above command, input the following values: + ```sh ✔ What is your project named? … staking-precompile-example ✔ What framework would you like to use? › Next.js ✔ What template would you like to use? › RainbowKit ``` -This command will create a folder named `staking-precompile-example`. Inside this folder +This command will create a folder named `staking-precompile-example`. Inside this folder there will be a Next.js project with RainbowKit and Wagmi installed and configured. the folder called `staking-precompile-example` will look like this: @@ -43,16 +47,16 @@ the folder called `staking-precompile-example` will look like this: - - - - - - - - - - + + + + + + + + + + @@ -83,24 +87,24 @@ Under the `src` folder, create a new file called `theme.ts`. This will hold our Populate `theme.ts` with the following code: ```tsx -import { extendTheme } from '@chakra-ui/react' +import { extendTheme } from "@chakra-ui/react"; // Configure Chakra theme const theme = extendTheme({ - fonts: { - heading: `'Open Sans', sans-serif`, - body: `'Raleway', sans-serif`, - }, - styles: { - global: { - "html, body": { - height: "100vh", - width: "100vw", - backgroundColor: "#000000", - color: "#ffffff", - }, - }, + fonts: { + heading: `'Open Sans', sans-serif`, + body: `'Raleway', sans-serif`, + }, + styles: { + global: { + "html, body": { + height: "100vh", + width: "100vw", + backgroundColor: "#000000", + color: "#ffffff", + }, }, + }, }); export default theme; @@ -111,17 +115,17 @@ After adding the `theme.ts` file your file structure should look like this: - - - - - - - - - - - + + + + + + + + + + + @@ -140,20 +144,20 @@ After adding the `theme.ts` file your file structure should look like this: Now we need to add `ChakraProvider` to the `_app.tsx` file. Navigate to `src/pages/_app.tsx` file and add the following code: ```tsx -import '@rainbow-me/rainbowkit/styles.css' -import { RainbowKitProvider } from '@rainbow-me/rainbowkit' -import type { AppProps } from 'next/app' -import NextHead from 'next/head' -import * as React from 'react' -import { WagmiConfig } from 'wagmi' -import { chains, client } from '../wagmi' -import { ChakraProvider } from '@chakra-ui/react' -import theme from '../theme'; +import "@rainbow-me/rainbowkit/styles.css"; +import { RainbowKitProvider } from "@rainbow-me/rainbowkit"; +import type { AppProps } from "next/app"; +import NextHead from "next/head"; +import * as React from "react"; +import { WagmiConfig } from "wagmi"; +import { chains, client } from "../wagmi"; +import { ChakraProvider } from "@chakra-ui/react"; +import theme from "../theme"; function App({ Component, pageProps }: AppProps) { - const [mounted, setMounted] = React.useState(false) - React.useEffect(() => setMounted(true), []) - + const [mounted, setMounted] = React.useState(false); + React.useEffect(() => setMounted(true), []); + return ( @@ -165,17 +169,17 @@ function App({ Component, pageProps }: AppProps) { - ) + ); } -export default App +export default App; ``` We now have a basic themed Chakra UI setup. ### Configuring `wagmi.ts` -In order to point this dapp towards a Polaris Ethereum local node, +In order to point this dapp towards a Polaris Ethereum local node, we need to modify `wagmi.ts`. Make `wagmi.ts` look like this: @@ -235,12 +239,12 @@ export const client = createClient({ export { chains } ``` - ### Adding Utility Functions We will need to add some utility functions to our dApp. These functions will help us interact with the Polaris Ethereum precompile. ### Creating a `utils` Folder + Under the `src` folder, create a new folder called `utils`. This will hold our utility functions. ### Creating a `utils/formatFromBaseUnit.ts` File @@ -251,12 +255,13 @@ This will be responsible for parsing information as it is returned to us from th Populate `formatFromBaseUnit.ts` with the following code: ```tsx -import BigNumber from 'bignumber.js'; +import BigNumber from "bignumber.js"; export const BIG_TEN = new BigNumber(10); // Formats numbers from base unit to normal unit -const formatFromBaseUnit = (amount: any, decimals: any) => new BigNumber(amount).div(BIG_TEN.pow(decimals)).toString(); +const formatFromBaseUnit = (amount: any, decimals: any) => + new BigNumber(amount).div(BIG_TEN.pow(decimals)).toString(); export default formatFromBaseUnit; ``` @@ -269,18 +274,19 @@ This will be responsible for formatting information as it is sent to the chain. Populate `formatToBaseUnit.ts` with the following code: ```tsx -import { ethers } from 'ethers'; +import { ethers } from "ethers"; // Format normal units to base units for use on the EVM const formatToBaseUnit = (amount: string, decimals: any) => { - if (!amount) return ethers.BigNumber.from(0); - try { - return ethers.BigNumber.from(ethers.utils.parseUnits(amount?.toString(), decimals)); - } - catch (e) { - return ethers.BigNumber.from(0); - } -} + if (!amount) return ethers.BigNumber.from(0); + try { + return ethers.BigNumber.from( + ethers.utils.parseUnits(amount?.toString(), decimals) + ); + } catch (e) { + return ethers.BigNumber.from(0); + } +}; export default formatToBaseUnit; ``` @@ -297,8 +303,8 @@ Populate `getEvmEllipsis.ts` with the following code: export const getHexEllipsis = (hexAddress: string) => { const accountEllipsis = hexAddress ? `${hexAddress.substring(0, 4)}...${hexAddress.substring( - hexAddress.length - 4 - )}` + hexAddress.length - 4 + )}` : null; return accountEllipsis; }; @@ -310,21 +316,21 @@ export const getHexEllipsis = (hexAddress: string) => { - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -338,10 +344,9 @@ export const getHexEllipsis = (hexAddress: string) => { - ### Adding ABIs -We will need to add a way to handle ABIs in the application. ABI handling is a common issue across +We will need to add a way to handle ABIs in the application. ABI handling is a common issue across dApps. This is the way I prefer to do it. ### Creating an `abi` Folder & Adding Staking Precompile ABI @@ -351,545 +356,546 @@ Under the `src` folder, create a new folder called `abis`. This will hold our AB Under the `abis` folder, create a new file called `IStakingModule.abi.js`. This will hold the ABI for the Staking Precompile. - You can generate the Staking Precompile ABI [here](../precompile-overview#stateful-precompile-abi-generation) + You can generate the Staking Precompile ABI + [here](../precompile-overview#stateful-precompile-abi-generation) Populate `IStakingModule.abi.js` with the following code: ```tsx const STAKING_ABI = [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "validator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "int64", - "name": "creationHeight", - "type": "int64" - } - ], - "name": "CancelUnbondingDelegation", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "validator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "CreateValidator", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "validator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Delegate", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sourceValidator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "destinationValidator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Redelegate", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "validator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Unbond", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "srcValidator", - "type": "string" - }, - { - "internalType": "string", - "name": "dstValidator", - "type": "string" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "beginRedelegate", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "srcValidator", - "type": "address" - }, - { - "internalType": "address", - "name": "dstValidator", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "beginRedelegate", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validatorAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "int64", - "name": "creationHeight", - "type": "int64" - } - ], - "name": "cancelUnbondingDelegation", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "validatorAddress", - "type": "string" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "int64", - "name": "creationHeight", - "type": "int64" - } - ], - "name": "cancelUnbondingDelegation", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validatorAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "delegate", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "validatorAddress", - "type": "string" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "delegate", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "getActiveValidators", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "delegatorAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "validatorAddress", - "type": "address" - } - ], - "name": "getDelegation", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "delegatorAddress", - "type": "string" - }, - { - "internalType": "string", - "name": "validatorAddress", - "type": "string" - } - ], - "name": "getDelegation", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "srcValidator", - "type": "address" - }, - { - "internalType": "address", - "name": "dstValidator", - "type": "address" - } - ], - "name": "getRedelegations", - "outputs": [ - { - "components": [ - { - "internalType": "int64", - "name": "creationHeight", - "type": "int64" - }, - { - "internalType": "string", - "name": "completionTime", - "type": "string" - }, - { - "internalType": "uint256", - "name": "initialBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sharesDst", - "type": "uint256" - }, - { - "internalType": "uint64", - "name": "unbondingId", - "type": "uint64" - } - ], - "internalType": "struct IStakingModule.RedelegationEntry[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "srcValidator", - "type": "string" - }, - { - "internalType": "string", - "name": "dstValidator", - "type": "string" - } - ], - "name": "getRedelegations", - "outputs": [ - { - "components": [ - { - "internalType": "int64", - "name": "creationHeight", - "type": "int64" - }, - { - "internalType": "string", - "name": "completionTime", - "type": "string" - }, - { - "internalType": "uint256", - "name": "initialBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sharesDst", - "type": "uint256" - }, - { - "internalType": "uint64", - "name": "unbondingId", - "type": "uint64" - } - ], - "internalType": "struct IStakingModule.RedelegationEntry[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "validatorAddress", - "type": "string" - } - ], - "name": "getUnbondingDelegation", - "outputs": [ - { - "components": [ - { - "internalType": "int64", - "name": "creationHeight", - "type": "int64" - }, - { - "internalType": "string", - "name": "completionTime", - "type": "string" - }, - { - "internalType": "uint256", - "name": "initialBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint64", - "name": "unbondingId", - "type": "uint64" - } - ], - "internalType": "struct IStakingModule.UnbondingDelegationEntry[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validatorAddress", - "type": "address" - } - ], - "name": "getUnbondingDelegation", - "outputs": [ - { - "components": [ - { - "internalType": "int64", - "name": "creationHeight", - "type": "int64" - }, - { - "internalType": "string", - "name": "completionTime", - "type": "string" - }, - { - "internalType": "uint256", - "name": "initialBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint64", - "name": "unbondingId", - "type": "uint64" - } - ], - "internalType": "struct IStakingModule.UnbondingDelegationEntry[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validatorAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "undelegate", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "validatorAddress", - "type": "string" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "undelegate", - "outputs": [], - "stateMutability": "payable", - "type": "function" - } - ] + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "validator", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "delegator", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + indexed: false, + internalType: "int64", + name: "creationHeight", + type: "int64", + }, + ], + name: "CancelUnbondingDelegation", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "validator", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "CreateValidator", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "validator", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "Delegate", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sourceValidator", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "destinationValidator", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "Redelegate", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "validator", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "Unbond", + type: "event", + }, + { + inputs: [ + { + internalType: "string", + name: "srcValidator", + type: "string", + }, + { + internalType: "string", + name: "dstValidator", + type: "string", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "beginRedelegate", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "srcValidator", + type: "address", + }, + { + internalType: "address", + name: "dstValidator", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "beginRedelegate", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "validatorAddress", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + internalType: "int64", + name: "creationHeight", + type: "int64", + }, + ], + name: "cancelUnbondingDelegation", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "validatorAddress", + type: "string", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + internalType: "int64", + name: "creationHeight", + type: "int64", + }, + ], + name: "cancelUnbondingDelegation", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "validatorAddress", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "delegate", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "validatorAddress", + type: "string", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "delegate", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "getActiveValidators", + outputs: [ + { + internalType: "address[]", + name: "", + type: "address[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "delegatorAddress", + type: "address", + }, + { + internalType: "address", + name: "validatorAddress", + type: "address", + }, + ], + name: "getDelegation", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "delegatorAddress", + type: "string", + }, + { + internalType: "string", + name: "validatorAddress", + type: "string", + }, + ], + name: "getDelegation", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "srcValidator", + type: "address", + }, + { + internalType: "address", + name: "dstValidator", + type: "address", + }, + ], + name: "getRedelegations", + outputs: [ + { + components: [ + { + internalType: "int64", + name: "creationHeight", + type: "int64", + }, + { + internalType: "string", + name: "completionTime", + type: "string", + }, + { + internalType: "uint256", + name: "initialBalance", + type: "uint256", + }, + { + internalType: "uint256", + name: "sharesDst", + type: "uint256", + }, + { + internalType: "uint64", + name: "unbondingId", + type: "uint64", + }, + ], + internalType: "struct IStakingModule.RedelegationEntry[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "srcValidator", + type: "string", + }, + { + internalType: "string", + name: "dstValidator", + type: "string", + }, + ], + name: "getRedelegations", + outputs: [ + { + components: [ + { + internalType: "int64", + name: "creationHeight", + type: "int64", + }, + { + internalType: "string", + name: "completionTime", + type: "string", + }, + { + internalType: "uint256", + name: "initialBalance", + type: "uint256", + }, + { + internalType: "uint256", + name: "sharesDst", + type: "uint256", + }, + { + internalType: "uint64", + name: "unbondingId", + type: "uint64", + }, + ], + internalType: "struct IStakingModule.RedelegationEntry[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "validatorAddress", + type: "string", + }, + ], + name: "getUnbondingDelegation", + outputs: [ + { + components: [ + { + internalType: "int64", + name: "creationHeight", + type: "int64", + }, + { + internalType: "string", + name: "completionTime", + type: "string", + }, + { + internalType: "uint256", + name: "initialBalance", + type: "uint256", + }, + { + internalType: "uint256", + name: "balance", + type: "uint256", + }, + { + internalType: "uint64", + name: "unbondingId", + type: "uint64", + }, + ], + internalType: "struct IStakingModule.UnbondingDelegationEntry[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "validatorAddress", + type: "address", + }, + ], + name: "getUnbondingDelegation", + outputs: [ + { + components: [ + { + internalType: "int64", + name: "creationHeight", + type: "int64", + }, + { + internalType: "string", + name: "completionTime", + type: "string", + }, + { + internalType: "uint256", + name: "initialBalance", + type: "uint256", + }, + { + internalType: "uint256", + name: "balance", + type: "uint256", + }, + { + internalType: "uint64", + name: "unbondingId", + type: "uint64", + }, + ], + internalType: "struct IStakingModule.UnbondingDelegationEntry[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "validatorAddress", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "undelegate", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "validatorAddress", + type: "string", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "undelegate", + outputs: [], + stateMutability: "payable", + type: "function", + }, +]; export default STAKING_ABI; ``` @@ -900,24 +906,24 @@ after creating `src/abi/IStakingModule.abi.js` your file tree should look like t - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -931,7 +937,6 @@ after creating `src/abi/IStakingModule.abi.js` your file tree should look like t - ### Styling & Populating The Homepage Now that we have a base skeleton for our dApp, we can start adding some styling and content. @@ -942,32 +947,48 @@ In our `src/pages/index.tsx` file, we still have the default template content. Lets replace this with the following: ```tsx -import { ConnectButton } from '@rainbow-me/rainbowkit' -import { Flex, Box, Text, Link } from '@chakra-ui/react' -import React from 'react' -import Staking from '../components/Staking' +import { ConnectButton } from "@rainbow-me/rainbowkit"; +import { Flex, Box, Text, Link } from "@chakra-ui/react"; +import React from "react"; +import Staking from "../components/Staking"; function Page() { return ( - + + position={"absolute"} + top={"0"} + right={"0"} + marginTop={"16px"} + marginRight={"16px"} + > {/* Rainbow Kit Connect Button floating top right of the screen */} - Polaris Ethereum Staking Precompile Example - Ensure you have a Local Polaris Ethereum Node running. + Polaris Ethereum Staking Precompile Example + + Ensure you have a Local{" "} + + Polaris Ethereum Node running. + + - To learn more about Polaris Ethereum please reference our docs + + To learn more about Polaris Ethereum please reference our{" "} + + docs + + - ) + ); } -export default Page +export default Page; ``` Note how we are missing a `components/Staking` component. We will add this in the next step. @@ -983,7 +1004,6 @@ Under the `src/components` folder, delete the following files: - `Account.tsx` - `index.ts` - Under the `src/components` folder, create a new file called `Staking.tsx`. This will be our main component for staking. Your folder structure should look like this: @@ -992,20 +1012,20 @@ Your folder structure should look like this: - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -1021,7 +1041,7 @@ Your folder structure should look like this: ### Adding the Functionality to the Staking Component -Now we can finally add functionality to `Staking.tsx`. The following +Now we can finally add functionality to `Staking.tsx`. The following is a component that will do the following: - Query the Staking precompile for a list of active validators and select the first Open @@ -1033,131 +1053,139 @@ For more information, please refer to the comments in the code below. Below is the code for the `Staking.tsx` component: ```tsx -import React from 'react'; -import { useMemo, useState, } from 'react' -import { - Flex, - Box, - Text, - Input, - Button -} from '@chakra-ui/react' +import React from "react"; +import { useMemo, useState } from "react"; +import { Flex, Box, Text, Input, Button } from "@chakra-ui/react"; import { - useContractWrite, - usePrepareContractWrite, - useContractRead, - useAccount, - Address -} from 'wagmi' -import STAKING_ABI from '../abi/IStakingModule.abi'; -import formatToBaseUnit from '../utils/formatToBaseUnit'; -import { getHexEllipsis } from '../utils/getEvmEllipsis'; -import formatFromBaseUnit from '../utils/formatFromBaseUnit'; -import BigNumber from 'bignumber.js'; + useContractWrite, + usePrepareContractWrite, + useContractRead, + useAccount, + Address, +} from "wagmi"; +import STAKING_ABI from "../abi/IStakingModule.abi"; +import formatToBaseUnit from "../utils/formatToBaseUnit"; +import { getHexEllipsis } from "../utils/getEvmEllipsis"; +import formatFromBaseUnit from "../utils/formatFromBaseUnit"; +import BigNumber from "bignumber.js"; // Default Address of the Staking Precompile Contract on Polaris. // More information here: TODO: Add link to docs -const STAKING_PRECOMPILE_ADDRESS = '0xd9A998CaC66092748FfEc7cFBD155Aae1737C2fF' +const STAKING_PRECOMPILE_ADDRESS = "0xd9A998CaC66092748FfEc7cFBD155Aae1737C2fF"; const Staking = () => { + // State that holds the selected cosmos Hex Validator Address + const [validator_address, setValidatorAddress] = useState< + Address | undefined + >(undefined); + + // State that holds the amount of tBera the connected account has delegated to the selected validator + const [delegated_amount, setDelegatedAmount] = useState( + undefined + ); + + // State that tracks values of the input field + const [input_amount, setInputAmount] = useState(""); + + // Returns the address of the connected wallet. + const { address } = useAccount(); + + // Query the Staking Precompile for the active validators, returns an array of addresses. + const { data: rawValidators } = useContractRead({ + address: STAKING_PRECOMPILE_ADDRESS, + abi: STAKING_ABI, + functionName: "getActiveValidators", + }); + + // UseMemo will trigger this function when the value of rawValidators changes. It will set the state variable + // validator_address to the first raw validator address in the array. This is a lazy way to "select" a validator. + useMemo(() => { + if (rawValidators) { + const validator: Address = (rawValidators as any)[0] as Address; + setValidatorAddress(validator); + } + }, [rawValidators]); + + // Query the Staking Precompile for the amount of tBera delegated to the selected validator from the + // connected wallet address. Returns a string or undefined. + const { data: rawDelegation } = useContractRead({ + address: STAKING_PRECOMPILE_ADDRESS, + abi: STAKING_ABI, + functionName: "getDelegation(address,address)", + args: [address, validator_address], + watch: true, + }); + + // UseMemo will trigger this function when the value of rawDelegation changes. It will set the state variable + // delegated_amount to the amount of tBera delegated to the selected validator. + useMemo(() => { + if (rawDelegation) { + const castedDelegation = rawDelegation as BigNumber; + const parsedDelegation = formatFromBaseUnit( + castedDelegation.toString(), + 18 + ).toString(); + setDelegatedAmount(parsedDelegation); + } + }, [rawDelegation]); + + // Prepares a payload for writing a delegate transaction to the Staking Precompile contract. + // passed in arguments: + // validator_address: Address of the validator to delegate to + // formatToBaseUnit(input_amount, 18) a formatted value of the amount to delegate to the selected validator + // this payload will be used later to call the Staking Precompile contract's delegate function when the button is clicked. + const { config } = usePrepareContractWrite({ + address: STAKING_PRECOMPILE_ADDRESS, + abi: STAKING_ABI, + functionName: "delegate", + args: [validator_address as Address, formatToBaseUnit(input_amount, 18)], + }); + + // When the button is clicked, it will call the Staking Precompile contract's delegate function. + // on Error, will log the error to the console. + const { write } = useContractWrite({ + ...config, + onError(error) { + console.log("Error", error); + }, + }); - // State that holds the selected cosmos Hex Validator Address - const [validator_address, setValidatorAddress] = useState
(undefined) - - // State that holds the amount of tBera the connected account has delegated to the selected validator - const [delegated_amount, setDelegatedAmount] = useState(undefined) - - // State that tracks values of the input field - const [input_amount, setInputAmount] = useState('') - - // Returns the address of the connected wallet. - const { address } = useAccount() - - // Query the Staking Precompile for the active validators, returns an array of addresses. - const { data: rawValidators } = useContractRead({ - address: STAKING_PRECOMPILE_ADDRESS, - abi: STAKING_ABI, - functionName: 'getActiveValidators', - }) - - // UseMemo will trigger this function when the value of rawValidators changes. It will set the state variable - // validator_address to the first raw validator address in the array. This is a lazy way to "select" a validator. - useMemo(() => { - if (rawValidators) { - const validator: Address = ((rawValidators as any)[0] as Address) - setValidatorAddress(validator) - } - }, [rawValidators]) - - // Query the Staking Precompile for the amount of tBera delegated to the selected validator from the - // connected wallet address. Returns a string or undefined. - const { data: rawDelegation } = useContractRead({ - address: STAKING_PRECOMPILE_ADDRESS, - abi: STAKING_ABI, - functionName: 'getDelegation(address,address)', - args: [address, validator_address], - watch: true, - }) - - // UseMemo will trigger this function when the value of rawDelegation changes. It will set the state variable - // delegated_amount to the amount of tBera delegated to the selected validator. - useMemo(() => { - if (rawDelegation) { - const castedDelegation = rawDelegation as BigNumber - const parsedDelegation = formatFromBaseUnit(castedDelegation.toString(), 18).toString() - setDelegatedAmount(parsedDelegation) - } - }, [rawDelegation]) - - // Prepares a payload for writing a delegate transaction to the Staking Precompile contract. - // passed in arguments: - // validator_address: Address of the validator to delegate to - // formatToBaseUnit(input_amount, 18) a formatted value of the amount to delegate to the selected validator - // this payload will be used later to call the Staking Precompile contract's delegate function when the button is clicked. - const { config } = usePrepareContractWrite({ - address: STAKING_PRECOMPILE_ADDRESS, - abi: STAKING_ABI, - functionName: 'delegate', - args: [validator_address as Address, formatToBaseUnit(input_amount, 18)], - }) - - // When the button is clicked, it will call the Staking Precompile contract's delegate function. - // on Error, will log the error to the console. - const { write } = useContractWrite({ - ...config, - onError(error) { - console.log('Error', error) - }, - }) - - return ( - - - Validator Address: - {validator_address ? getHexEllipsis(validator_address) : ''} - - - Delegated Amount: - {delegated_amount ? delegated_amount : '0'} tBera - - - { setInputAmount(e.target.value) }} /> - - - - ) -} -export default Staking + return ( + + + Validator Address: + + {validator_address ? getHexEllipsis(validator_address) : ""} + + + + Delegated Amount: + {delegated_amount ? delegated_amount : "0"} tBera + + + { + setInputAmount(e.target.value); + }} + /> + + + + ); +}; +export default Staking; ``` ### Run the Application @@ -1176,8 +1204,9 @@ This will open a browser window at `http://localhost:3000/` and you should see t Congratulations! You have now created a staking application using the EVM! You can now delegate your tBera to a validator and earn rewards! Prior to Polaris Ethereum's precompiled contracts, the UX of this task would be more complicated and foreign as it involves -many moving parts and having to use Cosmos through Metamask. Now, with the Staking precompile, we can enjoy interacting with +many moving parts and having to use Cosmos through Metamask. Now, with the Staking precompile, we can enjoy interacting with Cosmos through an EVM native experience! You can view this example and others like it on our examples repository on Github [here](https://github.com/berachain/polaris-examples) +
diff --git a/docs/web/pages/docs/using-metamask.mdx b/docs/web/pages/docs/using-metamask.mdx index d451a4394..8cb6ad119 100644 --- a/docs/web/pages/docs/using-metamask.mdx +++ b/docs/web/pages/docs/using-metamask.mdx @@ -1,25 +1,28 @@ -import { Callout } from 'nextra-theme-docs' +import { Callout } from "nextra-theme-docs"; # Using Metamask With Polaris Ethereum -In this section, we will guide you through the process of -downloading Metamask and connecting it to a local Polaris Ethereum node. -Before proceeding, please ensure that you have a local node up and running. +In this section, we will guide you through the process of +downloading Metamask and connecting it to a local Polaris Ethereum node. +Before proceeding, please ensure that you have a local node up and running. If you need help with this, you can refer to the [Local Machine](./running-a-node/running-locally) section for instructions. -To begin, you will need to download and install the Metamask browser extension. -Once installed, you can then connect your Injected Metamask to your local Polaris Ethereum +To begin, you will need to download and install the Metamask browser extension. +Once installed, you can then connect your Injected Metamask to your local Polaris Ethereum node by following the steps provided in this section. - - Take note of your private key and keep it somewhere safe. click [here](https://learn.metamask.io/lessons/what-is-a-self-custody-wallet) to learn about self custody. + Take note of your private key and keep it somewhere safe. click + [here](https://learn.metamask.io/lessons/what-is-a-self-custody-wallet) to + learn about self custody. ## Downloading And Installing Metamask + You can download and install the Metamask browser extension [here](https://metamask.io/download/). ## Adding Polaris Ethereum Local Network + Click to MetaMask icon on the browser and select the network drop-down menu. Here we should connect to C-Chain. Click to "Custom RPC". ![](/metamask-add-network.png) @@ -42,4 +45,4 @@ Coming Soon. ## Using the Faucet -Coming Soon. \ No newline at end of file +Coming Soon. diff --git a/eth/common/hexutil/imported.go b/eth/common/hexutil/imported.go index 5204ea6ef..29b742112 100644 --- a/eth/common/hexutil/imported.go +++ b/eth/common/hexutil/imported.go @@ -28,3 +28,5 @@ type ( Bytes = hexutil.Bytes Uint = hexutil.Uint ) + +var MustDecode = hexutil.MustDecode diff --git a/eth/core/chain_resources.go b/eth/core/chain_resources.go index 6aca09d28..6b413d1d8 100644 --- a/eth/core/chain_resources.go +++ b/eth/core/chain_resources.go @@ -82,7 +82,7 @@ func (bc *blockchain) GetVMConfig() *vm.Config { // CalculateBaseFee calculates the base fee for the next block based on the finalized block or the // plugin's base fee. func (bc *blockchain) CalculateNextBaseFee() *big.Int { - if pluginBaseFee := bc.bp.BaseFee(); pluginBaseFee.Cmp(big.NewInt(0)) >= 0 /* non-negative */ { + if pluginBaseFee := bc.bp.BaseFee(); pluginBaseFee.Cmp(new(big.Int)) >= 0 /* non-negative */ { return pluginBaseFee } diff --git a/eth/core/chain_writer.go b/eth/core/chain_writer.go index eb6819a32..c5c3caf4b 100644 --- a/eth/core/chain_writer.go +++ b/eth/core/chain_writer.go @@ -78,11 +78,12 @@ func (bc *blockchain) Prepare(ctx context.Context, number uint64) { header := &types.Header{ // Used in Polaris. ParentHash: parentHash, + Coinbase: coinbase, Number: new(big.Int).SetUint64(number), GasLimit: bc.gp.BlockGasLimit(), Time: timestamp, - Coinbase: coinbase, BaseFee: bc.CalculateNextBaseFee(), + // Not used in Polaris at the moment, but we set them to prevent nil ptr panic. Difficulty: new(big.Int), UncleHash: types.EmptyUncleHash, diff --git a/cosmos/x/evm/plugins/state/storage/slot.go b/eth/core/genesis.go similarity index 51% rename from cosmos/x/evm/plugins/state/storage/slot.go rename to eth/core/genesis.go index db0624a1e..d2792ec5e 100644 --- a/cosmos/x/evm/plugins/state/storage/slot.go +++ b/eth/core/genesis.go @@ -18,44 +18,43 @@ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND // TITLE. -package storage +package core import ( - "fmt" - "strings" + "math/big" + + "github.com/ethereum/go-ethereum/core" "pkg.berachain.dev/polaris/eth/common" - "pkg.berachain.dev/polaris/lib/errors" - libtypes "pkg.berachain.dev/polaris/lib/types" + "pkg.berachain.dev/polaris/eth/common/hexutil" + "pkg.berachain.dev/polaris/eth/params" ) -// Compile-time interface assertions. -var ( - _ libtypes.Cloneable[*Slot] = (*Slot)(nil) - _ fmt.Stringer = (*Slot)(nil) +type ( + Genesis = core.Genesis + GenesisAlloc = core.GenesisAlloc + GenesisAccount = core.GenesisAccount ) -// NewSlot creates a new State instance. -func NewSlot(key, value common.Hash) *Slot { - return &Slot{ - Key: key.Hex(), - Value: value.Hex(), - } -} - -// ValidateBasic checks to make sure the key is not empty. -func (s *Slot) ValidateBasic() error { - if strings.TrimSpace(s.Key) == "" { - return errors.Wrapf(ErrInvalidState, "key cannot be empty %s", s.Key) - } - - return nil -} - -// Clone implements `types.Cloneable`. -func (s *Slot) Clone() *Slot { - return &Slot{ - Key: s.Key, - Value: s.Value, - } +// DefaultGenesis is the default genesis block used by Polaris. +var DefaultGenesis = &core.Genesis{ + // Genesis Config + Config: params.DefaultChainConfig, + + // Genesis Block + Nonce: 0, + Timestamp: 0, + ExtraData: hexutil.MustDecode("0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa"), + GasLimit: 30_000_000, //nolint:gomnd // its okay. + Difficulty: big.NewInt(0), + Mixhash: common.Hash{}, + Coinbase: common.Address{}, + + // Genesis Accounts + Alloc: core.GenesisAlloc{ + // 0xfffdbb37105441e14b0ee6330d855d8504ff39e705c3afa8f859ac9865f99306 + common.HexToAddress("0x20f33CE90A13a4b5E7697E3544c3083B8F8A51D4"): { + Balance: big.NewInt(5e18), //nolint:gomnd // its okay. + }, + }, } diff --git a/eth/core/host.go b/eth/core/host.go index 910623af0..ec1f7eac5 100644 --- a/eth/core/host.go +++ b/eth/core/host.go @@ -83,8 +83,6 @@ type ( libtypes.Preparable // ChainConfig returns the current chain configuration of the Polaris EVM. ChainConfig() *params.ChainConfig - // ExtraEips returns the extra EIPs that the Polaris EVM supports. - ExtraEips() []int // `The fee collector is utilized on chains that have a fee collector account. This was added // specifically to support Cosmos-SDK chains, where we want the coinbase in the block header // to be the operator address of the proposer, but we want the coinbase in the BlockContext diff --git a/eth/core/mock/config_plugin.go b/eth/core/mock/config_plugin.go index 82ad12e2d..f7e3f0bc4 100644 --- a/eth/core/mock/config_plugin.go +++ b/eth/core/mock/config_plugin.go @@ -37,9 +37,6 @@ func NewConfigurationPluginMock() *ConfigurationPluginMock { ChainConfigFunc: func() *params.ChainConfig { return params.DefaultChainConfig }, - ExtraEipsFunc: func() []int { - return []int{} - }, FeeCollectorFunc: func() *common.Address { return &common.Address{} }, diff --git a/eth/core/mock/config_plugin.mock.go b/eth/core/mock/config_plugin.mock.go index 31c4a1782..e6024f27c 100644 --- a/eth/core/mock/config_plugin.mock.go +++ b/eth/core/mock/config_plugin.mock.go @@ -24,9 +24,6 @@ var _ core.ConfigurationPlugin = &ConfigurationPluginMock{} // ChainConfigFunc: func() *params.ChainConfig { // panic("mock out the ChainConfig method") // }, -// ExtraEipsFunc: func() []int { -// panic("mock out the ExtraEips method") -// }, // FeeCollectorFunc: func() *common.Address { // panic("mock out the FeeCollector method") // }, @@ -43,9 +40,6 @@ type ConfigurationPluginMock struct { // ChainConfigFunc mocks the ChainConfig method. ChainConfigFunc func() *params.ChainConfig - // ExtraEipsFunc mocks the ExtraEips method. - ExtraEipsFunc func() []int - // FeeCollectorFunc mocks the FeeCollector method. FeeCollectorFunc func() *common.Address @@ -57,9 +51,6 @@ type ConfigurationPluginMock struct { // ChainConfig holds details about calls to the ChainConfig method. ChainConfig []struct { } - // ExtraEips holds details about calls to the ExtraEips method. - ExtraEips []struct { - } // FeeCollector holds details about calls to the FeeCollector method. FeeCollector []struct { } @@ -70,7 +61,6 @@ type ConfigurationPluginMock struct { } } lockChainConfig sync.RWMutex - lockExtraEips sync.RWMutex lockFeeCollector sync.RWMutex lockPrepare sync.RWMutex } @@ -102,33 +92,6 @@ func (mock *ConfigurationPluginMock) ChainConfigCalls() []struct { return calls } -// ExtraEips calls ExtraEipsFunc. -func (mock *ConfigurationPluginMock) ExtraEips() []int { - if mock.ExtraEipsFunc == nil { - panic("ConfigurationPluginMock.ExtraEipsFunc: method is nil but ConfigurationPlugin.ExtraEips was just called") - } - callInfo := struct { - }{} - mock.lockExtraEips.Lock() - mock.calls.ExtraEips = append(mock.calls.ExtraEips, callInfo) - mock.lockExtraEips.Unlock() - return mock.ExtraEipsFunc() -} - -// ExtraEipsCalls gets all the calls that were made to ExtraEips. -// Check the length with: -// -// len(mockedConfigurationPlugin.ExtraEipsCalls()) -func (mock *ConfigurationPluginMock) ExtraEipsCalls() []struct { -} { - var calls []struct { - } - mock.lockExtraEips.RLock() - calls = mock.calls.ExtraEips - mock.lockExtraEips.RUnlock() - return calls -} - // FeeCollector calls FeeCollectorFunc. func (mock *ConfigurationPluginMock) FeeCollector() *common.Address { if mock.FeeCollectorFunc == nil { diff --git a/eth/core/processor.go b/eth/core/processor.go index 02ce0f7dd..2fe685d35 100644 --- a/eth/core/processor.go +++ b/eth/core/processor.go @@ -133,7 +133,6 @@ func (sp *StateProcessor) Prepare(evm *vm.GethEVM, header *types.Header) { // *technically* the precompiles change based on the chain config rules, to be fully correct, // we should check every block. sp.BuildAndRegisterPrecompiles(precompile.GetDefaultPrecompiles(&rules)) - sp.vmConfig.ExtraEips = sp.cp.ExtraEips() sp.evm = evm } diff --git a/eth/core/processor_test.go b/eth/core/processor_test.go index 5ae3a9019..de5901d4d 100644 --- a/eth/core/processor_test.go +++ b/eth/core/processor_test.go @@ -162,7 +162,7 @@ var _ = Describe("StateProcessor", func() { } sdb.FinaliseFunc = func(bool) {} legacyTxData.To = nil - legacyTxData.Value = big.NewInt(0) + legacyTxData.Value = new(big.Int) signedTx := types.MustSignNewTx(key, signer, legacyTxData) Expect(gp.SetTxGasLimit(1000002)).ToNot(HaveOccurred()) result, err := sp.ProcessTransaction(context.Background(), signedTx) diff --git a/eth/core/state/mock/state.go b/eth/core/state/mock/state.go index 33bf14479..19dbc0a2f 100644 --- a/eth/core/state/mock/state.go +++ b/eth/core/state/mock/state.go @@ -57,7 +57,7 @@ func NewEmptyStatePlugin() *PluginMock { }, CreateAccountFunc: func(address common.Address) { Accounts[address] = &Account{ - Balance: big.NewInt(0), + Balance: new(big.Int), CodeHash: crypto.Keccak256Hash(nil), } }, diff --git a/eth/polar/backend.go b/eth/polar/backend.go index c4fbbecdc..6a5aee0b8 100644 --- a/eth/polar/backend.go +++ b/eth/polar/backend.go @@ -80,6 +80,10 @@ func NewBackend( cfg: cfg, logger: log.Root(), } + + if cfg.GPO.Default == nil { + panic("cfg.GPO.Default is nil") + } b.gpo = gasprice.NewOracle(b, *cfg.GPO) return b } diff --git a/go.work.sum b/go.work.sum index cad43bb92..ff8d78f1b 100644 --- a/go.work.sum +++ b/go.work.sum @@ -281,6 +281,7 @@ github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFD github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6VqkYlkM= +github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/gotestyourself/gotestyourself v2.2.0+incompatible h1:AQwinXlbQR2HvPjQZOmDhRqsv5mZf+Jb1RnSLxcqZcI=