From 86bef000f2f0874a2a01543ca280bf70f5c5fc71 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 10 Jun 2024 19:22:38 +0000 Subject: [PATCH 01/27] feat(dogfood): re-scaffold genesis In preparation for the `ExportGenesis` implementation, re-scaffold the genesis state of the dogfood module. --- proto/exocore/dogfood/v1/genesis.proto | 106 ++- x/dogfood/types/genesis.pb.go | 1055 +++++++++++++++++++++++- 2 files changed, 1117 insertions(+), 44 deletions(-) diff --git a/proto/exocore/dogfood/v1/genesis.proto b/proto/exocore/dogfood/v1/genesis.proto index c81b3070c..f87b04b83 100644 --- a/proto/exocore/dogfood/v1/genesis.proto +++ b/proto/exocore/dogfood/v1/genesis.proto @@ -3,27 +3,115 @@ syntax = "proto3"; package exocore.dogfood.v1; import "gogoproto/gogo.proto"; +import "amino/amino.proto"; +import "tendermint/abci/types.proto"; import "exocore/dogfood/v1/params.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/dogfood/types"; -// GenesisState defines the dogfood module's genesis state. +// GenesisState defines the dogfood module's genesis state. Note that, as always, +// `genesis` is a misnomer. Ideally, this state can be exported at any point in +// time (or height), and reimported elsewhere where it will be the new genesis +// potentially at a non-zero height. In other words, it is the entire, current, +// state of the module. message GenesisState { // params refers to the parameters of the module. Params params = 1 [(gogoproto.nullable) = false]; - // initial_val_set is the initial validator set. - repeated GenesisValidator initial_val_set = 2 + // val_set is the initial validator set. it onyl represents the active + // validators. + repeated GenesisValidator val_set = 2 [ (gogoproto.nullable) = false ]; + + // epochs_opt_out_expiries is a list of (future) epochs at the end of which the + // corresponding operators' opt-out will expire. we store this, as well as its reverse + // lookup. + repeated EpochToOperatorAddrs epochs_opt_out_expiries = 3 + [ (gogoproto.nullable) = false ]; + + // epochs_consensus_addrs is a list of epochs at the end of which the corresponding + // consensus addresses should be pruned from the operator module. + repeated EpochToConsensusAddrs epochs_consensus_addrs = 4 + [ (gogoproto.nullable) = false ]; + + // undelegation_maturities is a list of epochs at the end of which the corresponding + // undelegations will mature. we store its reverse lookup as well. + repeated EpochToUndelegationRecordKeys undelegation_maturities = 5 + [ (gogoproto.nullable) = false ]; + + // data against HistoricalInfoBytePrefix is not made available in the module + // state for import / export. this is in line with Cosmos SDK. + + // the data indexed by the pending keys is created within the epochs hooks + // which happen in the BeginBlocker. it is applied during the EndBlocker and + // then immediately cleared. + // remember that data can be exported from a node that is stopped. + // a node can be stopped only if it has committed a block. if a full + // block is committed, data that is saved to state during BeginBlock + // and cleared at EndBlock will not be available. hence, we don't need + // to make data for any of the `pending` keys available here. + + // last_total_power tracks the total voting power as of the last validator set + // update. such an update is most likely to be at the end of the last epoch (or the + // beginning of this one, to be more precise) and less likely to be at other blocks, + // since the validator set can otherwise only change as a result of slashing events. + bytes last_total_power = 6 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // validator_updates is a list of validator updates applied at the end of the previous + // block. it is then cleared at the end of the next block, and hence, is available + // for other modules to access during that block. it must, therefore, be exported. + repeated .tendermint.abci.ValidatorUpdate validator_updates = 7 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"validator_updates\"" + ]; } // GenesisValidator defines a genesis validator. It is a helper struct -// used for serializing the genesis state. +// used for serializing the genesis state. The only reason it is a different +// structure is to support importing hex public keys from Solidity. +// TODO: consider this set up when resolving issue 73 about storage +// optimization between dogfood and operator modules. +// https://github.com/ExocoreNetwork/exocore/issues/73 message GenesisValidator { - // public_key is the consensus public key of the validator. It should - // be exactly 32 bytes, but this is not enforced in protobuf. - string public_key = 1; - // power is the voting power of the validator. - int64 power = 2; + // public_key is the consensus public key of the validator. It should + // be exactly 32 bytes, but this is not enforced in protobuf. + string public_key = 1; + // power is the voting power of the validator. + int64 power = 2; +} + +// EpochToOperatorAddress is used to store a mapping from epoch to a list of +// operator account addresses. +message EpochToOperatorAddrs { + // epoch is the epoch in question. + int64 epoch = 1; + // operator_acc_addrs is the list of account addresses to expire at this epoch. + // It is of type string for human readability of the genesis file. + repeated string operator_acc_addrs = 2; } + +// EpochToConsensusAddrs is used to store a mapping from the epoch to a list of +// consensus addresses. +message EpochToConsensusAddrs { + // epoch is the epoch in question. + int64 epoch = 1; + // cons_addrs is the list of consensus addresses to prune at this epoch. + // It is of type string for human readability of the genesis file. + repeated string cons_addrs = 2; +} + +// EpochToUndelegationRecordKeys is used to store a mapping from an epoch to a list of +// undelegations which mature at that epoch. +message EpochToUndelegationRecordKeys { + // epoch is the epoch in question. + int64 epoch = 1; + // undelegation_record_keys is the list of undelegations (defined by the record key) + // to expire at this epoch. + // It is of type string for human readability of the genesis file. + repeated string undelegation_record_keys = 2; +} \ No newline at end of file diff --git a/x/dogfood/types/genesis.pb.go b/x/dogfood/types/genesis.pb.go index e900011d4..03286eded 100644 --- a/x/dogfood/types/genesis.pb.go +++ b/x/dogfood/types/genesis.pb.go @@ -5,6 +5,9 @@ package types import ( fmt "fmt" + types "github.com/cometbft/cometbft/abci/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -23,12 +26,36 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// GenesisState defines the dogfood module's genesis state. +// GenesisState defines the dogfood module's genesis state. Note that, as always, +// `genesis` is a misnomer. Ideally, this state can be exported at any point in +// time (or height), and reimported elsewhere where it will be the new genesis +// potentially at a non-zero height. In other words, it is the entire, current, +// state of the module. type GenesisState struct { // params refers to the parameters of the module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - // initial_val_set is the initial validator set. - InitialValSet []GenesisValidator `protobuf:"bytes,2,rep,name=initial_val_set,json=initialValSet,proto3" json:"initial_val_set"` + // val_set is the initial validator set. it onyl represents the active + // validators. + ValSet []GenesisValidator `protobuf:"bytes,2,rep,name=val_set,json=valSet,proto3" json:"val_set"` + // epochs_opt_out_expiries is a list of (future) epochs at the end of which the + // corresponding operators' opt-out will expire. we store this, as well as its reverse + // lookup. + EpochsOptOutExpiries []EpochToOperatorAddrs `protobuf:"bytes,3,rep,name=epochs_opt_out_expiries,json=epochsOptOutExpiries,proto3" json:"epochs_opt_out_expiries"` + // epochs_consensus_addrs is a list of epochs at the end of which the corresponding + // consensus addresses should be pruned from the operator module. + EpochsConsensusAddrs []EpochToConsensusAddrs `protobuf:"bytes,4,rep,name=epochs_consensus_addrs,json=epochsConsensusAddrs,proto3" json:"epochs_consensus_addrs"` + // undelegation_maturities is a list of epochs at the end of which the corresponding + // undelegations will mature. we store its reverse lookup as well. + UndelegationMaturities []EpochToUndelegationRecordKeys `protobuf:"bytes,5,rep,name=undelegation_maturities,json=undelegationMaturities,proto3" json:"undelegation_maturities"` + // last_total_power tracks the total voting power as of the last validator set + // update. such an update is most likely to be at the end of the last epoch (or the + // beginning of this one, to be more precise) and less likely to be at other blocks, + // since the validator set can otherwise only change as a result of slashing events. + LastTotalPower github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=last_total_power,json=lastTotalPower,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"last_total_power"` + // validator_updates is a list of validator updates applied at the end of the previous + // block. it is then cleared at the end of the next block, and hence, is available + // for other modules to access during that block. it must, therefore, be exported. + ValidatorUpdates []types.ValidatorUpdate `protobuf:"bytes,7,rep,name=validator_updates,json=validatorUpdates,proto3" json:"validator_updates" yaml:"validator_updates"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -71,15 +98,47 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetInitialValSet() []GenesisValidator { +func (m *GenesisState) GetValSet() []GenesisValidator { if m != nil { - return m.InitialValSet + return m.ValSet + } + return nil +} + +func (m *GenesisState) GetEpochsOptOutExpiries() []EpochToOperatorAddrs { + if m != nil { + return m.EpochsOptOutExpiries + } + return nil +} + +func (m *GenesisState) GetEpochsConsensusAddrs() []EpochToConsensusAddrs { + if m != nil { + return m.EpochsConsensusAddrs + } + return nil +} + +func (m *GenesisState) GetUndelegationMaturities() []EpochToUndelegationRecordKeys { + if m != nil { + return m.UndelegationMaturities + } + return nil +} + +func (m *GenesisState) GetValidatorUpdates() []types.ValidatorUpdate { + if m != nil { + return m.ValidatorUpdates } return nil } // GenesisValidator defines a genesis validator. It is a helper struct -// used for serializing the genesis state. +// used for serializing the genesis state. The only reason it is a different +// structure is to support importing hex public keys from Solidity. +// TODO: consider this set up when resolving issue 73 about storage +// optimization between dogfood and operator modules. +// https://github.com/ExocoreNetwork/exocore/issues/73 type GenesisValidator struct { // public_key is the consensus public key of the validator. It should // be exactly 32 bytes, but this is not enforced in protobuf. @@ -135,34 +194,231 @@ func (m *GenesisValidator) GetPower() int64 { return 0 } +// EpochToOperatorAddress is used to store a mapping from epoch to a list of +// operator account addresses. +type EpochToOperatorAddrs struct { + // epoch is the epoch in question. + Epoch int64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` + // operator_acc_addrs is the list of account addresses to expire at this epoch. + // It is of type string for human readability of the genesis file. + OperatorAccAddrs []string `protobuf:"bytes,2,rep,name=operator_acc_addrs,json=operatorAccAddrs,proto3" json:"operator_acc_addrs,omitempty"` +} + +func (m *EpochToOperatorAddrs) Reset() { *m = EpochToOperatorAddrs{} } +func (m *EpochToOperatorAddrs) String() string { return proto.CompactTextString(m) } +func (*EpochToOperatorAddrs) ProtoMessage() {} +func (*EpochToOperatorAddrs) Descriptor() ([]byte, []int) { + return fileDescriptor_1a9d908a27866b1b, []int{2} +} +func (m *EpochToOperatorAddrs) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EpochToOperatorAddrs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EpochToOperatorAddrs.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 *EpochToOperatorAddrs) XXX_Merge(src proto.Message) { + xxx_messageInfo_EpochToOperatorAddrs.Merge(m, src) +} +func (m *EpochToOperatorAddrs) XXX_Size() int { + return m.Size() +} +func (m *EpochToOperatorAddrs) XXX_DiscardUnknown() { + xxx_messageInfo_EpochToOperatorAddrs.DiscardUnknown(m) +} + +var xxx_messageInfo_EpochToOperatorAddrs proto.InternalMessageInfo + +func (m *EpochToOperatorAddrs) GetEpoch() int64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *EpochToOperatorAddrs) GetOperatorAccAddrs() []string { + if m != nil { + return m.OperatorAccAddrs + } + return nil +} + +// EpochToConsensusAddrs is used to store a mapping from the epoch to a list of +// consensus addresses. +type EpochToConsensusAddrs struct { + // epoch is the epoch in question. + Epoch int64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` + // cons_addrs is the list of consensus addresses to prune at this epoch. + // It is of type string for human readability of the genesis file. + ConsAddrs []string `protobuf:"bytes,2,rep,name=cons_addrs,json=consAddrs,proto3" json:"cons_addrs,omitempty"` +} + +func (m *EpochToConsensusAddrs) Reset() { *m = EpochToConsensusAddrs{} } +func (m *EpochToConsensusAddrs) String() string { return proto.CompactTextString(m) } +func (*EpochToConsensusAddrs) ProtoMessage() {} +func (*EpochToConsensusAddrs) Descriptor() ([]byte, []int) { + return fileDescriptor_1a9d908a27866b1b, []int{3} +} +func (m *EpochToConsensusAddrs) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EpochToConsensusAddrs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EpochToConsensusAddrs.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 *EpochToConsensusAddrs) XXX_Merge(src proto.Message) { + xxx_messageInfo_EpochToConsensusAddrs.Merge(m, src) +} +func (m *EpochToConsensusAddrs) XXX_Size() int { + return m.Size() +} +func (m *EpochToConsensusAddrs) XXX_DiscardUnknown() { + xxx_messageInfo_EpochToConsensusAddrs.DiscardUnknown(m) +} + +var xxx_messageInfo_EpochToConsensusAddrs proto.InternalMessageInfo + +func (m *EpochToConsensusAddrs) GetEpoch() int64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *EpochToConsensusAddrs) GetConsAddrs() []string { + if m != nil { + return m.ConsAddrs + } + return nil +} + +// EpochToUndelegationRecordKeys is used to store a mapping from an epoch to a list of +// undelegations which mature at that epoch. +type EpochToUndelegationRecordKeys struct { + // epoch is the epoch in question. + Epoch int64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` + // undelegation_record_keys is the list of undelegations (defined by the record key) + // to expire at this epoch. + // It is of type string for human readability of the genesis file. + UndelegationRecordKeys []string `protobuf:"bytes,2,rep,name=undelegation_record_keys,json=undelegationRecordKeys,proto3" json:"undelegation_record_keys,omitempty"` +} + +func (m *EpochToUndelegationRecordKeys) Reset() { *m = EpochToUndelegationRecordKeys{} } +func (m *EpochToUndelegationRecordKeys) String() string { return proto.CompactTextString(m) } +func (*EpochToUndelegationRecordKeys) ProtoMessage() {} +func (*EpochToUndelegationRecordKeys) Descriptor() ([]byte, []int) { + return fileDescriptor_1a9d908a27866b1b, []int{4} +} +func (m *EpochToUndelegationRecordKeys) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EpochToUndelegationRecordKeys) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EpochToUndelegationRecordKeys.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 *EpochToUndelegationRecordKeys) XXX_Merge(src proto.Message) { + xxx_messageInfo_EpochToUndelegationRecordKeys.Merge(m, src) +} +func (m *EpochToUndelegationRecordKeys) XXX_Size() int { + return m.Size() +} +func (m *EpochToUndelegationRecordKeys) XXX_DiscardUnknown() { + xxx_messageInfo_EpochToUndelegationRecordKeys.DiscardUnknown(m) +} + +var xxx_messageInfo_EpochToUndelegationRecordKeys proto.InternalMessageInfo + +func (m *EpochToUndelegationRecordKeys) GetEpoch() int64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *EpochToUndelegationRecordKeys) GetUndelegationRecordKeys() []string { + if m != nil { + return m.UndelegationRecordKeys + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "exocore.dogfood.v1.GenesisState") proto.RegisterType((*GenesisValidator)(nil), "exocore.dogfood.v1.GenesisValidator") + proto.RegisterType((*EpochToOperatorAddrs)(nil), "exocore.dogfood.v1.EpochToOperatorAddrs") + proto.RegisterType((*EpochToConsensusAddrs)(nil), "exocore.dogfood.v1.EpochToConsensusAddrs") + proto.RegisterType((*EpochToUndelegationRecordKeys)(nil), "exocore.dogfood.v1.EpochToUndelegationRecordKeys") } func init() { proto.RegisterFile("exocore/dogfood/v1/genesis.proto", fileDescriptor_1a9d908a27866b1b) } var fileDescriptor_1a9d908a27866b1b = []byte{ - // 302 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xbd, 0x6a, 0x32, 0x41, - 0x18, 0x85, 0x77, 0xf4, 0xfb, 0x04, 0xc7, 0x84, 0x84, 0xc1, 0x42, 0x84, 0x8c, 0x8b, 0xa4, 0xb0, - 0x9a, 0x41, 0xd3, 0xa4, 0x16, 0x82, 0x85, 0x10, 0xc2, 0x0a, 0x16, 0x69, 0x64, 0xd4, 0x37, 0x9b, - 0xc1, 0xd5, 0x77, 0x99, 0x1d, 0xff, 0xee, 0x22, 0x17, 0x90, 0x0b, 0xb2, 0xb4, 0x4c, 0x15, 0x82, - 0xde, 0x48, 0x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x91, 0x07, 0xfb, 0x23, 0x0f, 0xde, 0x8e, 0x3c, - 0x78, 0x6c, 0xc7, 0xda, 0x3e, 0x2f, 0xc7, 0x62, 0x82, 0x73, 0x79, 0xe7, 0x7a, 0xde, 0x83, 0x5d, - 0xa3, 0x99, 0xc9, 0xef, 0xf1, 0x36, 0x3f, 0xf3, 0xd9, 0x6d, 0x0a, 0xd9, 0xb8, 0x94, 0x6f, 0x77, - 0xf3, 0x19, 0x00, 0x00, 0xff, 0xff, 0x94, 0xc2, 0x5a, 0x03, 0xaa, 0x01, 0x00, 0x00, + // 643 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0xcf, 0x4e, 0xdb, 0x4a, + 0x18, 0xc5, 0x63, 0xc2, 0x1f, 0x65, 0x40, 0x57, 0xc1, 0xca, 0x05, 0x2b, 0x57, 0x24, 0x56, 0x74, + 0x75, 0x95, 0x5b, 0xb5, 0xb6, 0x02, 0x1b, 0xd4, 0x1d, 0x20, 0x84, 0x2a, 0xda, 0x82, 0x0c, 0x74, + 0x81, 0x54, 0x59, 0x13, 0xfb, 0x6b, 0xb0, 0xb0, 0xfd, 0x59, 0x33, 0xe3, 0x40, 0xde, 0xa2, 0x2f, + 0xd0, 0x7d, 0x97, 0x7d, 0x0c, 0x96, 0x2c, 0xab, 0x2e, 0x50, 0x05, 0x8b, 0xee, 0xfb, 0x04, 0xd5, + 0x8c, 0xc7, 0x34, 0x29, 0x81, 0x4d, 0x92, 0x99, 0x39, 0xe7, 0x77, 0x66, 0x32, 0x47, 0x43, 0x6c, + 0xb8, 0xc4, 0x00, 0x19, 0xb8, 0x21, 0x0e, 0x3e, 0x20, 0x86, 0xee, 0xb0, 0xe7, 0x0e, 0x20, 0x05, + 0x1e, 0x71, 0x27, 0x63, 0x28, 0xd0, 0x34, 0xb5, 0xc2, 0xd1, 0x0a, 0x67, 0xd8, 0x6b, 0x36, 0x06, + 0x38, 0x40, 0xb5, 0xec, 0xca, 0x5f, 0x85, 0xb2, 0xb9, 0x4c, 0x93, 0x28, 0x45, 0x57, 0x7d, 0xea, + 0xa9, 0x7f, 0x04, 0xa4, 0x21, 0xb0, 0x24, 0x4a, 0x85, 0x4b, 0xfb, 0x41, 0xe4, 0x8a, 0x51, 0x06, + 0x9a, 0xdc, 0x6c, 0x4f, 0xc9, 0xce, 0x28, 0xa3, 0x89, 0x16, 0x74, 0x3e, 0xcd, 0x91, 0xa5, 0xbd, + 0x62, 0x33, 0x47, 0x82, 0x0a, 0x30, 0x37, 0xc9, 0x7c, 0x21, 0xb0, 0x0c, 0xdb, 0xe8, 0x2e, 0xae, + 0x37, 0x9d, 0x87, 0x9b, 0x73, 0x0e, 0x95, 0x62, 0x7b, 0xf6, 0xea, 0xa6, 0x5d, 0xf1, 0xb4, 0xde, + 0xdc, 0x21, 0x0b, 0x43, 0x1a, 0xfb, 0x1c, 0x84, 0x35, 0x63, 0x57, 0xbb, 0x8b, 0xeb, 0xff, 0x4e, + 0xb3, 0xea, 0xb0, 0x77, 0x34, 0x8e, 0x42, 0x2a, 0x90, 0x95, 0x90, 0x21, 0x8d, 0x8f, 0x40, 0x98, + 0x40, 0x56, 0x21, 0xc3, 0xe0, 0x8c, 0xfb, 0x98, 0x09, 0x1f, 0x73, 0xe1, 0xc3, 0x65, 0x16, 0xb1, + 0x08, 0xb8, 0x55, 0x55, 0xd0, 0xee, 0x34, 0xe8, 0xae, 0xb4, 0x1c, 0xe3, 0x41, 0x06, 0x4c, 0x32, + 0xb7, 0xc2, 0x90, 0x95, 0xbb, 0x6b, 0x14, 0xb8, 0x83, 0x4c, 0x1c, 0xe4, 0x62, 0x57, 0xb3, 0x4c, + 0x20, 0x2b, 0x3a, 0x26, 0xc0, 0x94, 0x43, 0xca, 0x73, 0xee, 0x53, 0xe9, 0xb2, 0x66, 0x55, 0xca, + 0xff, 0x4f, 0xa4, 0xec, 0x94, 0x8e, 0x29, 0x31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xe7, + 0x9e, 0xb1, 0x8d, 0x6e, 0xd5, 0x2b, 0x06, 0x9d, 0x53, 0xd2, 0x98, 0xd6, 0x12, 0xa9, 0x56, 0x57, + 0xa7, 0x38, 0x55, 0xaf, 0x18, 0x98, 0xcf, 0x89, 0x89, 0x5a, 0xe6, 0xd3, 0x20, 0xd0, 0xdd, 0x90, + 0xb5, 0xae, 0x79, 0xf5, 0x72, 0x65, 0x2b, 0x08, 0x14, 0xa3, 0xf3, 0x9a, 0xfc, 0x3d, 0xb5, 0x1b, + 0x8f, 0xc0, 0xd7, 0x08, 0x91, 0xad, 0x9b, 0x80, 0xd6, 0xe4, 0x4c, 0x41, 0x43, 0xb2, 0xf6, 0x64, + 0x03, 0x1e, 0xa1, 0x6e, 0x12, 0x6b, 0xa2, 0x6b, 0x4c, 0x19, 0xe4, 0x5f, 0x54, 0x66, 0x4c, 0x74, + 0x66, 0xac, 0x51, 0xfb, 0x57, 0xb7, 0x2d, 0xe3, 0xfa, 0xb6, 0x65, 0x7c, 0xbf, 0x6d, 0x19, 0x1f, + 0xef, 0x5a, 0x95, 0xeb, 0xbb, 0x56, 0xe5, 0xeb, 0x5d, 0xab, 0x72, 0xda, 0x1b, 0xeb, 0xca, 0x6e, + 0x51, 0xd4, 0xb7, 0x20, 0x2e, 0x90, 0x9d, 0xbb, 0xe5, 0xc3, 0x72, 0x79, 0xff, 0xb4, 0xa8, 0xea, + 0xf4, 0xe7, 0xd5, 0xbb, 0xb2, 0xf1, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x85, 0xe8, 0x0e, 0xe5, 0xf6, + 0x04, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -185,10 +441,76 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.InitialValSet) > 0 { - for iNdEx := len(m.InitialValSet) - 1; iNdEx >= 0; iNdEx-- { + if len(m.ValidatorUpdates) > 0 { + for iNdEx := len(m.ValidatorUpdates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ValidatorUpdates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + { + size := m.LastTotalPower.Size() + i -= size + if _, err := m.LastTotalPower.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + if len(m.UndelegationMaturities) > 0 { + for iNdEx := len(m.UndelegationMaturities) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.UndelegationMaturities[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.EpochsConsensusAddrs) > 0 { + for iNdEx := len(m.EpochsConsensusAddrs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.EpochsConsensusAddrs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.EpochsOptOutExpiries) > 0 { + for iNdEx := len(m.EpochsOptOutExpiries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.EpochsOptOutExpiries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.ValSet) > 0 { + for iNdEx := len(m.ValSet) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.InitialValSet[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ValSet[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -247,6 +569,117 @@ func (m *GenesisValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EpochToOperatorAddrs) 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 *EpochToOperatorAddrs) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EpochToOperatorAddrs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OperatorAccAddrs) > 0 { + for iNdEx := len(m.OperatorAccAddrs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.OperatorAccAddrs[iNdEx]) + copy(dAtA[i:], m.OperatorAccAddrs[iNdEx]) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.OperatorAccAddrs[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if m.Epoch != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EpochToConsensusAddrs) 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 *EpochToConsensusAddrs) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EpochToConsensusAddrs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ConsAddrs) > 0 { + for iNdEx := len(m.ConsAddrs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ConsAddrs[iNdEx]) + copy(dAtA[i:], m.ConsAddrs[iNdEx]) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.ConsAddrs[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if m.Epoch != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EpochToUndelegationRecordKeys) 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 *EpochToUndelegationRecordKeys) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EpochToUndelegationRecordKeys) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.UndelegationRecordKeys) > 0 { + for iNdEx := len(m.UndelegationRecordKeys) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.UndelegationRecordKeys[iNdEx]) + copy(dAtA[i:], m.UndelegationRecordKeys[iNdEx]) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.UndelegationRecordKeys[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if m.Epoch != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { offset -= sovGenesis(v) base := offset @@ -266,8 +699,34 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) - if len(m.InitialValSet) > 0 { - for _, e := range m.InitialValSet { + if len(m.ValSet) > 0 { + for _, e := range m.ValSet { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.EpochsOptOutExpiries) > 0 { + for _, e := range m.EpochsOptOutExpiries { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.EpochsConsensusAddrs) > 0 { + for _, e := range m.EpochsConsensusAddrs { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.UndelegationMaturities) > 0 { + for _, e := range m.UndelegationMaturities { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + l = m.LastTotalPower.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.ValidatorUpdates) > 0 { + for _, e := range m.ValidatorUpdates { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -291,7 +750,61 @@ func (m *GenesisValidator) Size() (n int) { return n } -func sovGenesis(x uint64) (n int) { +func (m *EpochToOperatorAddrs) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovGenesis(uint64(m.Epoch)) + } + if len(m.OperatorAccAddrs) > 0 { + for _, s := range m.OperatorAccAddrs { + l = len(s) + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func (m *EpochToConsensusAddrs) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovGenesis(uint64(m.Epoch)) + } + if len(m.ConsAddrs) > 0 { + for _, s := range m.ConsAddrs { + l = len(s) + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func (m *EpochToUndelegationRecordKeys) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovGenesis(uint64(m.Epoch)) + } + if len(m.UndelegationRecordKeys) > 0 { + for _, s := range m.UndelegationRecordKeys { + l = len(s) + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozGenesis(x uint64) (n int) { @@ -361,7 +874,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitialValSet", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValSet", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -388,8 +901,177 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.InitialValSet = append(m.InitialValSet, GenesisValidator{}) - if err := m.InitialValSet[len(m.InitialValSet)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ValSet = append(m.ValSet, GenesisValidator{}) + if err := m.ValSet[len(m.ValSet)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochsOptOutExpiries", 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 + } + m.EpochsOptOutExpiries = append(m.EpochsOptOutExpiries, EpochToOperatorAddrs{}) + if err := m.EpochsOptOutExpiries[len(m.EpochsOptOutExpiries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochsConsensusAddrs", 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 + } + m.EpochsConsensusAddrs = append(m.EpochsConsensusAddrs, EpochToConsensusAddrs{}) + if err := m.EpochsConsensusAddrs[len(m.EpochsConsensusAddrs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UndelegationMaturities", 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 + } + m.UndelegationMaturities = append(m.UndelegationMaturities, EpochToUndelegationRecordKeys{}) + if err := m.UndelegationMaturities[len(m.UndelegationMaturities)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastTotalPower", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LastTotalPower.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorUpdates", 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 + } + m.ValidatorUpdates = append(m.ValidatorUpdates, types.ValidatorUpdate{}) + if err := m.ValidatorUpdates[len(m.ValidatorUpdates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -515,6 +1197,309 @@ func (m *GenesisValidator) Unmarshal(dAtA []byte) error { } return nil } +func (m *EpochToOperatorAddrs) 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: EpochToOperatorAddrs: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EpochToOperatorAddrs: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAccAddrs", 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.OperatorAccAddrs = append(m.OperatorAccAddrs, string(dAtA[iNdEx:postIndex])) + 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 *EpochToConsensusAddrs) 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: EpochToConsensusAddrs: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EpochToConsensusAddrs: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsAddrs", 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.ConsAddrs = append(m.ConsAddrs, string(dAtA[iNdEx:postIndex])) + 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 *EpochToUndelegationRecordKeys) 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: EpochToUndelegationRecordKeys: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EpochToUndelegationRecordKeys: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UndelegationRecordKeys", 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.UndelegationRecordKeys = append(m.UndelegationRecordKeys, string(dAtA[iNdEx:postIndex])) + 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 From e8d36f0e8eff7f3bf9f7aa8bbde28b170703d841 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 10 Jun 2024 19:24:04 +0000 Subject: [PATCH 02/27] fix(dogfood): remove deprecated keys --- x/dogfood/types/keys.go | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/x/dogfood/types/keys.go b/x/dogfood/types/keys.go index 4e6b4c871..c1acb9bff 100644 --- a/x/dogfood/types/keys.go +++ b/x/dogfood/types/keys.go @@ -18,8 +18,10 @@ const ( // ExocoreValidatorBytePrefix is the prefix for the validator store. ExocoreValidatorBytePrefix byte = iota + 1 - // QueuedOperationsByte is the byte used to store the queue of operations. - QueuedOperationsByte + // queuedOperationsByte is the byte used to store the queue of operations. + // It is no longer used, but it is retained for backward compatibility, + // which is also why it is lower case (not exported). + queuedOperationsByte // OptOutsToFinishBytePrefix is the byte used to store the list of operator addresses whose // opt outs are maturing at the provided epoch. @@ -37,9 +39,10 @@ const ( // that will mature at the provided epoch. UnbondingReleaseMaturityBytePrefix - // PendingOperationsByte is the byte used to store the list of operations to be applied at - // the end of the current block. - PendingOperationsByte + // pendingOperationsByte is the byte used to store the list of operations to be applied at + // the end of the current block. It is no longer used, and is retained for backward + // compatibility. + pendingOperationsByte // PendingOptOutsByte is the byte used to store the list of operator addresses whose opt // outs will be made effective at the end of the current block. @@ -74,11 +77,6 @@ func ExocoreValidatorKey(address sdk.AccAddress) []byte { return append([]byte{ExocoreValidatorBytePrefix}, address.Bytes()...) } -// QueuedOperationsKey returns the key for the queued operations store. -func QueuedOperationsKey() []byte { - return []byte{QueuedOperationsByte} -} - // OptOutsToFinishKey returns the key for the operator opt out maturity store (epoch -> list of // addresses). func OptOutsToFinishKey(epoch int64) ([]byte, bool) { @@ -124,11 +122,6 @@ func UnbondingReleaseMaturityKey(epoch int64) ([]byte, bool) { ), true } -// PendingOperationsKey returns the key for the pending operations store. -func PendingOperationsKey() []byte { - return []byte{PendingOperationsByte} -} - // PendingOptOutsKey returns the key for the pending opt-outs store. func PendingOptOutsKey() []byte { return []byte{PendingOptOutsByte} From 50452cfb5715d9369a62badecb5eb4545103fda8 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 10 Jun 2024 21:27:38 +0000 Subject: [PATCH 03/27] refactor: use new dogfood genesis --- app/ethtest_helper.go | 3 + app/test_helpers.go | 3 + cmd/exocored/testnet.go | 8 + testutil/utils.go | 5 + x/delegation/types/keys.go | 10 +- x/dogfood/keeper/genesis.go | 4 +- x/dogfood/types/genesis.go | 228 +++++++++++++- x/dogfood/types/genesis_test.go | 531 +++++++++++++++++++++++++++++++- 8 files changed, 764 insertions(+), 28 deletions(-) diff --git a/app/ethtest_helper.go b/app/ethtest_helper.go index e4fcdcfaa..7b5ebea07 100644 --- a/app/ethtest_helper.go +++ b/app/ethtest_helper.go @@ -4,6 +4,7 @@ import ( "encoding/json" "time" + "cosmossdk.io/math" "cosmossdk.io/simapp" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" @@ -252,6 +253,8 @@ func genesisStateWithValSet(codec codec.Codec, genesisState simapp.GenesisState, Power: 1, }, }, + []dogfoodtypes.EpochToOperatorAddrs{}, []dogfoodtypes.EpochToConsensusAddrs{}, + []dogfoodtypes.EpochToUndelegationRecordKeys{}, math.NewInt(1), []abci.ValidatorUpdate{}, ) genesisState[dogfoodtypes.ModuleName] = codec.MustMarshalJSON(dogfoodGenesis) diff --git a/app/test_helpers.go b/app/test_helpers.go index a2c7191d0..d5a5f84bb 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -10,6 +10,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" + "cosmossdk.io/math" "cosmossdk.io/simapp" dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" @@ -274,6 +275,8 @@ func GenesisStateWithValSet(app *ExocoreApp, genesisState simapp.GenesisState, Power: 1, }, }, + []dogfoodtypes.EpochToOperatorAddrs{}, []dogfoodtypes.EpochToConsensusAddrs{}, + []dogfoodtypes.EpochToUndelegationRecordKeys{}, math.NewInt(1), []abci.ValidatorUpdate{}, ) genesisState[dogfoodtypes.ModuleName] = app.AppCodec().MustMarshalJSON(dogfoodGenesis) diff --git a/cmd/exocored/testnet.go b/cmd/exocored/testnet.go index 43e8333b6..a61d0b637 100644 --- a/cmd/exocored/testnet.go +++ b/cmd/exocored/testnet.go @@ -12,6 +12,8 @@ import ( "sort" "strings" + "cosmossdk.io/math" + abci "github.com/cometbft/cometbft/abci/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -459,6 +461,7 @@ func getTestExocoreGenesis( Power: power, }) } + totalPower := math.NewInt(power * int64(len(operatorAddrs))) return assetstypes.NewGenesis( assetstypes.DefaultParams(), clientChains, []assetstypes.StakingAssetInfo{ @@ -482,6 +485,11 @@ func getTestExocoreGenesis( []string{assetID}, ), validators, + []dogfoodtypes.EpochToOperatorAddrs{}, + []dogfoodtypes.EpochToConsensusAddrs{}, + []dogfoodtypes.EpochToUndelegationRecordKeys{}, + totalPower, + []abci.ValidatorUpdate{}, ) } diff --git a/testutil/utils.go b/testutil/utils.go index 82a4d53bd..047682a82 100644 --- a/testutil/utils.go +++ b/testutil/utils.go @@ -240,6 +240,11 @@ func (suite *BaseTestSuite) SetupWithGenesisValSet(genAccs []authtypes.GenesisAc Power: 1, }, }, + []dogfoodtypes.EpochToOperatorAddrs{}, + []dogfoodtypes.EpochToConsensusAddrs{}, + []dogfoodtypes.EpochToUndelegationRecordKeys{}, + math.NewInt(2), + []abci.ValidatorUpdate{}, ) genesisState[dogfoodtypes.ModuleName] = app.AppCodec().MustMarshalJSON(dogfoodGenesis) diff --git a/x/delegation/types/keys.go b/x/delegation/types/keys.go index 3f5bdfc83..83bf0f984 100644 --- a/x/delegation/types/keys.go +++ b/x/delegation/types/keys.go @@ -4,6 +4,7 @@ import ( "strings" assetstypes "github.com/ExocoreNetwork/exocore/x/assets/types" + sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -90,6 +91,10 @@ func ParseUndelegationRecordKey(key []byte) (field *UndelegationKeyFields, err e if err != nil { return nil, err } + operatorAccAddr, err := sdk.AccAddressFromBech32(stringList[0]) + if err != nil { + return nil, err + } height, err := hexutil.DecodeUint64(stringList[1]) if err != nil { return nil, err @@ -99,10 +104,11 @@ func ParseUndelegationRecordKey(key []byte) (field *UndelegationKeyFields, err e return nil, err } return &UndelegationKeyFields{ - OperatorAddr: stringList[0], + OperatorAddr: operatorAccAddr.String(), BlockHeight: height, LzNonce: lzNonce, - TxHash: stringList[3], + // TODO: validate the TxHash? + TxHash: stringList[3], }, nil } diff --git a/x/dogfood/keeper/genesis.go b/x/dogfood/keeper/genesis.go index d00906cce..69a3ade15 100644 --- a/x/dogfood/keeper/genesis.go +++ b/x/dogfood/keeper/genesis.go @@ -36,8 +36,8 @@ func (k Keeper) InitGenesis( // to be considered, or may not be in the top N operators. so checking that count here // is meaningless as well. totalPower := sdk.NewInt(0) - out := make([]abci.ValidatorUpdate, len(genState.InitialValSet)) - for _, val := range genState.InitialValSet { + out := make([]abci.ValidatorUpdate, len(genState.ValSet)) + for _, val := range genState.ValSet { // #nosec G703 // already validated consKey, _ := operatortypes.HexStringToPubKey(val.PublicKey) // #nosec G703 // this only fails if the key is of a type not already defined. diff --git a/x/dogfood/types/genesis.go b/x/dogfood/types/genesis.go index 792e300f2..cf18e913d 100644 --- a/x/dogfood/types/genesis.go +++ b/x/dogfood/types/genesis.go @@ -2,22 +2,48 @@ package types import ( errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + delegationtypes "github.com/ExocoreNetwork/exocore/x/delegation/types" operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" + abci "github.com/cometbft/cometbft/abci/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common/hexutil" ) // NewGenesis creates a new genesis state with the provided parameters and -// validators. -func NewGenesis(params Params, vals []GenesisValidator) *GenesisState { +// data. +func NewGenesis( + params Params, + vals []GenesisValidator, + expiries []EpochToOperatorAddrs, + consAddrs []EpochToConsensusAddrs, + recordKeys []EpochToUndelegationRecordKeys, + power math.Int, + valUpdates []abci.ValidatorUpdate, +) *GenesisState { return &GenesisState{ - Params: params, - InitialValSet: vals, + Params: params, + ValSet: vals, + EpochsOptOutExpiries: expiries, + EpochsConsensusAddrs: consAddrs, + UndelegationMaturities: recordKeys, + LastTotalPower: power, + ValidatorUpdates: valUpdates, } } // DefaultGenesis returns the default genesis state. func DefaultGenesis() *GenesisState { - // no initial validators intentionally, so that the caller must set them. - return NewGenesis(DefaultParams(), []GenesisValidator{}) + return NewGenesis( + DefaultParams(), + []GenesisValidator{}, + []EpochToOperatorAddrs{}, + []EpochToConsensusAddrs{}, + []EpochToUndelegationRecordKeys{}, + math.ZeroInt(), + []abci.ValidatorUpdate{}, + ) } // Validate performs basic genesis state validation returning an error upon any @@ -25,16 +51,17 @@ func DefaultGenesis() *GenesisState { func (gs GenesisState) Validate() error { // #nosec G701 // ok on 64-bit systems. maxValidators := int(gs.Params.MaxValidators) - if len(gs.InitialValSet) > maxValidators { + if len(gs.ValSet) > maxValidators { return errorsmod.Wrapf( ErrInvalidGenesisData, "too many validators %d", - len(gs.InitialValSet), + len(gs.ValSet), ) } // do not complain about 0 validators, let Tendermint do that. - vals := make(map[string]struct{}, len(gs.InitialValSet)) - for _, val := range gs.InitialValSet { + vals := make(map[string]struct{}, len(gs.ValSet)) + totalPower := int64(0) + for _, val := range gs.ValSet { // check for duplicates if _, ok := vals[val.PublicKey]; ok { return errorsmod.Wrapf( @@ -63,6 +90,187 @@ func (gs GenesisState) Validate() error { power, ) } + totalPower += power + } + + // we don't know the current epoch, since this is stateless validation. + // to check epoochs aren't duplicated. + epochs := make(map[int64]struct{}, len(gs.EpochsOptOutExpiries)) + // to check that there is no duplicate address - not by per epoch but overall. + addrsMap := make(map[string]struct{}) + for _, obj := range gs.EpochsOptOutExpiries { + epoch := obj.Epoch + if _, ok := epochs[epoch]; ok { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "duplicate epoch %d", epoch, + ) + } + // the first epoch in the epochs module is 1. this epoch is first + // incremented, and then AfterEpochEnd is called with a value of 2. + // therefore, the first epoch in the dogfood module is 2. all expiries + // must happen at the end of this epoch or any epoch thereafter. + if epoch <= 1 { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "epoch %d should be > 1", epoch, + ) + } + epochs[epoch] = struct{}{} + addrs := obj.OperatorAccAddrs + if len(addrs) == 0 { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "empty operator addresses for epoch %d", epoch, + ) + } + for _, addr := range addrs { + if _, err := sdk.AccAddressFromBech32(addr); err != nil { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "invalid operator address %s: %s", + addr, err, + ) + } + if _, ok := addrsMap[addr]; ok { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "duplicate operator address %s", addr, + ) + } + addrsMap[addr] = struct{}{} + } + } + + epochs = make(map[int64]struct{}, len(gs.EpochsConsensusAddrs)) + addrsMap = make(map[string]struct{}) + for _, obj := range gs.EpochsConsensusAddrs { + epoch := obj.Epoch + if _, ok := epochs[epoch]; ok { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "duplicate epoch %d", epoch, + ) + } + epochs[epoch] = struct{}{} + if epoch <= 1 { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "epoch %d should be > 1", epoch, + ) + } + addrs := obj.ConsAddrs + if len(addrs) == 0 { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "empty consensus addresses for epoch %d", epoch, + ) + } + for _, addr := range addrs { + if _, err := sdk.ConsAddressFromBech32(addr); err != nil { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "invalid consensus address %s: %s", + addr, err, + ) + } + if _, ok := addrsMap[addr]; ok { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "duplicate consensus address %s", addr, + ) + } + addrsMap[addr] = struct{}{} + } + } + + epochs = make(map[int64]struct{}, len(gs.UndelegationMaturities)) + recordKeysMap := make(map[string]struct{}) + for _, obj := range gs.UndelegationMaturities { + epoch := obj.Epoch + if _, ok := epochs[epoch]; ok { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "duplicate epoch %d", epoch, + ) + } + if epoch <= 1 { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "epoch %d should be > 1", epoch, + ) + } + epochs[epoch] = struct{}{} + recordKeys := obj.UndelegationRecordKeys + if len(recordKeys) == 0 { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "empty record keys for epoch %d", epoch, + ) + } + for _, recordKey := range recordKeys { + if _, ok := recordKeysMap[recordKey]; ok { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "duplicate record key %s", recordKey, + ) + } + if recordBytes, err := hexutil.Decode(recordKey); err != nil { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "invalid record key (non hex) %s: %s", + recordKey, err, + ) + } else if _, err := delegationtypes.ParseUndelegationRecordKey(recordBytes); err != nil { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "invalid record key (parse) %s: %s", + recordKey, err, + ) + } + recordKeysMap[recordKey] = struct{}{} + } + } + + if gs.LastTotalPower.IsNil() { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "nil last total power", + ) + } + + if !gs.LastTotalPower.IsPositive() { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "non-positive last total power %s", + gs.LastTotalPower, + ) + } + + if !gs.LastTotalPower.Equal(math.NewInt(totalPower)) { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "last total power mismatch %s, expected %d", + gs.LastTotalPower, totalPower, + ) + } + + // ValidatorUpdates is a list of updates applied at the end of the previous block. + // since these are only changes and not the sum total, we can't do too much with it. + for _, change := range gs.ValidatorUpdates { + if _, err := cryptocodec.FromTmProtoPublicKey(change.GetPubKey()); err != nil { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "invalid validator update", + ) + } + if change.Power <= 0 { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "invalid validator power %d", + change.Power, + ) + } } return gs.Params.Validate() diff --git a/x/dogfood/types/genesis_test.go b/x/dogfood/types/genesis_test.go index df1887f49..5c6a008c8 100644 --- a/x/dogfood/types/genesis_test.go +++ b/x/dogfood/types/genesis_test.go @@ -3,8 +3,14 @@ package types_test import ( "testing" + "cosmossdk.io/math" + testutiltx "github.com/ExocoreNetwork/exocore/testutil/tx" + delegationtypes "github.com/ExocoreNetwork/exocore/x/delegation/types" "github.com/ExocoreNetwork/exocore/x/dogfood/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/crypto/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/stretchr/testify/suite" ) @@ -22,11 +28,22 @@ func TestGenesisTestSuite(t *testing.T) { func (suite *GenesisTestSuite) TestValidateGenesis() { sharedKey := hexutil.Encode(ed25519.GenPrivKey().PubKey().Bytes()) + operator1 := sdk.AccAddress(testutiltx.GenerateAddress().Bytes()) + consAddr1 := sdk.ConsAddress(operator1) + recordKey := hexutil.Encode( + delegationtypes.GetUndelegationRecordKey( + 1000, // block height + 1, // layer zero nonce + common.BytesToHash([]byte("tx hash")).Hex(), + operator1.String(), + ), + ) params := types.DefaultParams() testCases := []struct { name string genState *types.GenesisState expPass bool + expError string malleate func(*types.GenesisState) }{ { @@ -34,19 +51,27 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { genState: &types.GenesisState{ Params: params, }, - expPass: true, + expPass: false, // difference between 0 and 1 voting power + expError: "nil last total power", }, { name: "default", genState: types.DefaultGenesis(), - expPass: true, + expPass: false, // 0 voting power isn't permitted + expError: "non-positive last total power", }, { name: "NewGenesis call", genState: types.NewGenesis( params, []types.GenesisValidator{}, + []types.EpochToOperatorAddrs{}, + []types.EpochToConsensusAddrs{}, + []types.EpochToUndelegationRecordKeys{}, + math.ZeroInt(), + []abci.ValidatorUpdate{}, ), - expPass: true, + expPass: false, // 0 voting power isn't permitted + expError: "non-positive last total power", }, { name: "too many validators", @@ -60,21 +85,25 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { key := hexutil.Encode( ed25519.GenPrivKey().PubKey().Bytes(), ) - gs.InitialValSet = append(gs.InitialValSet, + gs.ValSet = append(gs.ValSet, types.GenesisValidator{ PublicKey: key, Power: 5, }, ) } + gs.LastTotalPower = math.NewInt( + int64(len(gs.ValSet) * 5), + ) }, - expPass: false, + expPass: false, + expError: "too many validators", }, { name: "duplicate keys", genState: &types.GenesisState{ Params: params, - InitialValSet: []types.GenesisValidator{ + ValSet: []types.GenesisValidator{ { PublicKey: sharedKey, Power: 5, @@ -84,64 +113,534 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { Power: 10, }, }, + LastTotalPower: math.NewInt(10), }, - expPass: false, + expPass: false, + expError: "duplicate public key", }, { name: "key with missing 0x prefix", genState: &types.GenesisState{ Params: params, - InitialValSet: []types.GenesisValidator{ + ValSet: []types.GenesisValidator{ { // remove 2 chars and add 2 chars PublicKey: sharedKey[2:] + "ab", Power: 5, }, }, + LastTotalPower: math.NewInt(5), }, - expPass: false, + expPass: false, + expError: "invalid public key", }, { // also covers empty key name: "key with the wrong length", genState: &types.GenesisState{ Params: params, - InitialValSet: []types.GenesisValidator{ + ValSet: []types.GenesisValidator{ { PublicKey: sharedKey + "ab", Power: 5, }, }, + LastTotalPower: math.NewInt(5), }, - expPass: false, + expPass: false, + expError: "invalid public key", }, { name: "non hex key", genState: &types.GenesisState{ Params: params, - InitialValSet: []types.GenesisValidator{ + ValSet: []types.GenesisValidator{ { // replace last 2 chars with non-hex PublicKey: sharedKey[:64] + "ss", Power: 5, }, }, + LastTotalPower: math.NewInt(5), + }, + expPass: false, + expError: "invalid public key", + }, + { + name: "negative vote power", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: -1, + }, + }, + LastTotalPower: math.NewInt(1), }, - expPass: false, + expPass: false, + expError: "invalid power", }, { name: "valid genesis with one validator", genState: &types.GenesisState{ Params: params, - InitialValSet: []types.GenesisValidator{ + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + }, + expPass: true, + }, + { + name: "duplicate epoch in expiries", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + EpochsOptOutExpiries: []types.EpochToOperatorAddrs{ + { + Epoch: 2, + OperatorAccAddrs: []string{ + operator1.String(), + }, + }, + { + Epoch: 2, + OperatorAccAddrs: []string{ + operator1.String(), + }, + }, + }, + }, + expPass: false, + expError: "duplicate epoch", + }, + { + name: "epoch 1 for expiries", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + EpochsOptOutExpiries: []types.EpochToOperatorAddrs{ + { + Epoch: 1, + OperatorAccAddrs: []string{ + operator1.String(), + }, + }, + }, + }, + expPass: false, + expError: "should be > 1", + }, + { + name: "empty operator addrs for expiry epoch", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + EpochsOptOutExpiries: []types.EpochToOperatorAddrs{ + { + Epoch: 2, + }, + }, + }, + expPass: false, + expError: "empty operator addresses for epoch", + }, + { + name: "duplicate addrs for expiry epoch", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + EpochsOptOutExpiries: []types.EpochToOperatorAddrs{ + { + Epoch: 2, + OperatorAccAddrs: []string{ + operator1.String(), + operator1.String(), + }, + }, + }, + }, + expPass: false, + expError: "duplicate operator address", + }, + { + name: "invalid addr for expiry epoch", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + EpochsOptOutExpiries: []types.EpochToOperatorAddrs{ + { + Epoch: 2, + OperatorAccAddrs: []string{ + "invalid address", + }, + }, + }, + }, + expPass: false, + expError: "invalid operator address", + }, + { + name: "valid with expiries", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + EpochsOptOutExpiries: []types.EpochToOperatorAddrs{ + { + Epoch: 2, + OperatorAccAddrs: []string{ + operator1.String(), + }, + }, + }, + }, + expPass: true, + }, + { + name: "duplicate epoch in pruning", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + EpochsConsensusAddrs: []types.EpochToConsensusAddrs{ + { + Epoch: 2, + ConsAddrs: []string{ + consAddr1.String(), + }, + }, + { + Epoch: 2, + ConsAddrs: []string{ + consAddr1.String(), + }, + }, + }, + }, + expPass: false, + expError: "duplicate epoch", + }, + { + name: "epoch 1 for pruning", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + EpochsConsensusAddrs: []types.EpochToConsensusAddrs{ + { + Epoch: 1, + ConsAddrs: []string{ + consAddr1.String(), + }, + }, + }, + }, + expPass: false, + expError: "should be > 1", + }, + { + name: "empty cons addrs for pruning", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + EpochsConsensusAddrs: []types.EpochToConsensusAddrs{ + { + Epoch: 2, + }, + }, + }, + expPass: false, + expError: "empty consensus addresses for epoch", + }, + { + name: "duplicate cons addrs for pruning", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + EpochsConsensusAddrs: []types.EpochToConsensusAddrs{ + { + Epoch: 2, + ConsAddrs: []string{ + consAddr1.String(), + consAddr1.String(), + }, + }, + }, + }, + expPass: false, + expError: "duplicate consensus address", + }, + { + name: "valid with pruning", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ { PublicKey: sharedKey, Power: 5, }, }, + LastTotalPower: math.NewInt(5), + EpochsConsensusAddrs: []types.EpochToConsensusAddrs{ + { + Epoch: 2, + ConsAddrs: []string{ + consAddr1.String(), + }, + }, + }, }, expPass: true, }, + { + name: "invalid cons addrs for pruning", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + EpochsConsensusAddrs: []types.EpochToConsensusAddrs{ + { + Epoch: 2, + ConsAddrs: []string{ + "invalid cons address", + }, + }, + }, + }, + expPass: false, + expError: "invalid consensus address", + }, + { + name: "duplicate epoch in undelegations", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + UndelegationMaturities: []types.EpochToUndelegationRecordKeys{ + { + Epoch: 2, + UndelegationRecordKeys: []string{ + recordKey, + }, + }, + { + Epoch: 2, + UndelegationRecordKeys: []string{ + recordKey, + }, + }, + }, + }, + expPass: false, + expError: "duplicate epoch", + }, + { + name: "epoch 1 for undelegations", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + UndelegationMaturities: []types.EpochToUndelegationRecordKeys{ + { + Epoch: 1, + UndelegationRecordKeys: []string{ + recordKey, + }, + }, + }, + }, + expPass: false, + expError: "should be > 1", + }, + { + name: "empty record keys for undelegations", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + UndelegationMaturities: []types.EpochToUndelegationRecordKeys{ + { + Epoch: 2, + }, + }, + }, + expPass: false, + expError: "empty record keys for epoch", + }, + { + name: "duplicate undelegation record keys", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + UndelegationMaturities: []types.EpochToUndelegationRecordKeys{ + { + Epoch: 2, + UndelegationRecordKeys: []string{ + recordKey, + recordKey, + }, + }, + }, + }, + expPass: false, + expError: "duplicate record key", + }, + { + name: "valid with undelegation record key", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + UndelegationMaturities: []types.EpochToUndelegationRecordKeys{ + { + Epoch: 2, + UndelegationRecordKeys: []string{ + recordKey, + }, + }, + }, + }, + expPass: true, + }, + { + name: "undelegation record key: not hex", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + UndelegationMaturities: []types.EpochToUndelegationRecordKeys{ + { + Epoch: 2, + UndelegationRecordKeys: []string{ + "not hex", + }, + }, + }, + }, + expPass: false, + expError: "invalid record key (non hex)", + }, + { + name: "undelegation record key: can't parse", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + UndelegationMaturities: []types.EpochToUndelegationRecordKeys{ + { + Epoch: 2, + UndelegationRecordKeys: []string{ + "0x1234", + }, + }, + }, + }, + expPass: false, + expError: "invalid record key (parse)", + }, } for _, tc := range testCases { @@ -154,6 +653,10 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { suite.Require().NoError(err, tc.name) } else { suite.Require().Error(err, tc.name) + suite.Require().Condition(func() bool { + return len(tc.expError) > 0 + }, "expError not set for %s", tc.name) + suite.Require().ErrorContains(err, tc.expError, tc.name) } // fmt.Println(tc.name, err) } From 89591f34bdfead226115c359d72376e1d9ccf3bf Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 10 Jun 2024 21:37:25 +0000 Subject: [PATCH 04/27] refactor(dogfood): - validatorupdate from gen --- app/ethtest_helper.go | 2 +- app/test_helpers.go | 2 +- cmd/exocored/testnet.go | 2 - proto/exocore/dogfood/v1/genesis.proto | 8 +- testutil/utils.go | 1 - x/dogfood/types/genesis.go | 23 ---- x/dogfood/types/genesis.pb.go | 147 +++++++------------------ x/dogfood/types/genesis_test.go | 2 - 8 files changed, 44 insertions(+), 143 deletions(-) diff --git a/app/ethtest_helper.go b/app/ethtest_helper.go index 7b5ebea07..44bc857ef 100644 --- a/app/ethtest_helper.go +++ b/app/ethtest_helper.go @@ -254,7 +254,7 @@ func genesisStateWithValSet(codec codec.Codec, genesisState simapp.GenesisState, }, }, []dogfoodtypes.EpochToOperatorAddrs{}, []dogfoodtypes.EpochToConsensusAddrs{}, - []dogfoodtypes.EpochToUndelegationRecordKeys{}, math.NewInt(1), []abci.ValidatorUpdate{}, + []dogfoodtypes.EpochToUndelegationRecordKeys{}, math.NewInt(1), ) genesisState[dogfoodtypes.ModuleName] = codec.MustMarshalJSON(dogfoodGenesis) diff --git a/app/test_helpers.go b/app/test_helpers.go index d5a5f84bb..f1c223244 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -276,7 +276,7 @@ func GenesisStateWithValSet(app *ExocoreApp, genesisState simapp.GenesisState, }, }, []dogfoodtypes.EpochToOperatorAddrs{}, []dogfoodtypes.EpochToConsensusAddrs{}, - []dogfoodtypes.EpochToUndelegationRecordKeys{}, math.NewInt(1), []abci.ValidatorUpdate{}, + []dogfoodtypes.EpochToUndelegationRecordKeys{}, math.NewInt(1), ) genesisState[dogfoodtypes.ModuleName] = app.AppCodec().MustMarshalJSON(dogfoodGenesis) diff --git a/cmd/exocored/testnet.go b/cmd/exocored/testnet.go index a61d0b637..77c165446 100644 --- a/cmd/exocored/testnet.go +++ b/cmd/exocored/testnet.go @@ -13,7 +13,6 @@ import ( "strings" "cosmossdk.io/math" - abci "github.com/cometbft/cometbft/abci/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -489,7 +488,6 @@ func getTestExocoreGenesis( []dogfoodtypes.EpochToConsensusAddrs{}, []dogfoodtypes.EpochToUndelegationRecordKeys{}, totalPower, - []abci.ValidatorUpdate{}, ) } diff --git a/proto/exocore/dogfood/v1/genesis.proto b/proto/exocore/dogfood/v1/genesis.proto index f87b04b83..678d1eabd 100644 --- a/proto/exocore/dogfood/v1/genesis.proto +++ b/proto/exocore/dogfood/v1/genesis.proto @@ -64,11 +64,9 @@ message GenesisState { // validator_updates is a list of validator updates applied at the end of the previous // block. it is then cleared at the end of the next block, and hence, is available - // for other modules to access during that block. it must, therefore, be exported. - repeated .tendermint.abci.ValidatorUpdate validator_updates = 7 [ - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"validator_updates\"" - ]; + // for other modules to access during that block. however, for a new chain, it does + // not make sense for it to exist, since all of the validators should be considered + // as an update. this behaviour is the same as the Cosmos SDK. } // GenesisValidator defines a genesis validator. It is a helper struct diff --git a/testutil/utils.go b/testutil/utils.go index 047682a82..09ba99cee 100644 --- a/testutil/utils.go +++ b/testutil/utils.go @@ -244,7 +244,6 @@ func (suite *BaseTestSuite) SetupWithGenesisValSet(genAccs []authtypes.GenesisAc []dogfoodtypes.EpochToConsensusAddrs{}, []dogfoodtypes.EpochToUndelegationRecordKeys{}, math.NewInt(2), - []abci.ValidatorUpdate{}, ) genesisState[dogfoodtypes.ModuleName] = app.AppCodec().MustMarshalJSON(dogfoodGenesis) diff --git a/x/dogfood/types/genesis.go b/x/dogfood/types/genesis.go index cf18e913d..7f9c53381 100644 --- a/x/dogfood/types/genesis.go +++ b/x/dogfood/types/genesis.go @@ -5,8 +5,6 @@ import ( "cosmossdk.io/math" delegationtypes "github.com/ExocoreNetwork/exocore/x/delegation/types" operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" - abci "github.com/cometbft/cometbft/abci/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common/hexutil" ) @@ -20,7 +18,6 @@ func NewGenesis( consAddrs []EpochToConsensusAddrs, recordKeys []EpochToUndelegationRecordKeys, power math.Int, - valUpdates []abci.ValidatorUpdate, ) *GenesisState { return &GenesisState{ Params: params, @@ -29,7 +26,6 @@ func NewGenesis( EpochsConsensusAddrs: consAddrs, UndelegationMaturities: recordKeys, LastTotalPower: power, - ValidatorUpdates: valUpdates, } } @@ -42,7 +38,6 @@ func DefaultGenesis() *GenesisState { []EpochToConsensusAddrs{}, []EpochToUndelegationRecordKeys{}, math.ZeroInt(), - []abci.ValidatorUpdate{}, ) } @@ -255,23 +250,5 @@ func (gs GenesisState) Validate() error { ) } - // ValidatorUpdates is a list of updates applied at the end of the previous block. - // since these are only changes and not the sum total, we can't do too much with it. - for _, change := range gs.ValidatorUpdates { - if _, err := cryptocodec.FromTmProtoPublicKey(change.GetPubKey()); err != nil { - return errorsmod.Wrapf( - ErrInvalidGenesisData, - "invalid validator update", - ) - } - if change.Power <= 0 { - return errorsmod.Wrapf( - ErrInvalidGenesisData, - "invalid validator power %d", - change.Power, - ) - } - } - return gs.Params.Validate() } diff --git a/x/dogfood/types/genesis.pb.go b/x/dogfood/types/genesis.pb.go index 03286eded..85d7f7bf5 100644 --- a/x/dogfood/types/genesis.pb.go +++ b/x/dogfood/types/genesis.pb.go @@ -5,7 +5,7 @@ package types import ( fmt "fmt" - types "github.com/cometbft/cometbft/abci/types" + _ "github.com/cometbft/cometbft/abci/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" @@ -52,10 +52,6 @@ type GenesisState struct { // beginning of this one, to be more precise) and less likely to be at other blocks, // since the validator set can otherwise only change as a result of slashing events. LastTotalPower github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=last_total_power,json=lastTotalPower,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"last_total_power"` - // validator_updates is a list of validator updates applied at the end of the previous - // block. it is then cleared at the end of the next block, and hence, is available - // for other modules to access during that block. it must, therefore, be exported. - ValidatorUpdates []types.ValidatorUpdate `protobuf:"bytes,7,rep,name=validator_updates,json=validatorUpdates,proto3" json:"validator_updates" yaml:"validator_updates"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -126,13 +122,6 @@ func (m *GenesisState) GetUndelegationMaturities() []EpochToUndelegationRecordKe return nil } -func (m *GenesisState) GetValidatorUpdates() []types.ValidatorUpdate { - if m != nil { - return m.ValidatorUpdates - } - return nil -} - // GenesisValidator defines a genesis validator. It is a helper struct // used for serializing the genesis state. The only reason it is a different // structure is to support importing hex public keys from Solidity. @@ -377,48 +366,44 @@ func init() { func init() { proto.RegisterFile("exocore/dogfood/v1/genesis.proto", fileDescriptor_1a9d908a27866b1b) } var fileDescriptor_1a9d908a27866b1b = []byte{ - // 643 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0xcf, 0x4e, 0xdb, 0x4a, - 0x18, 0xc5, 0x63, 0xc2, 0x1f, 0x65, 0x40, 0x57, 0xc1, 0xca, 0x05, 0x2b, 0x57, 0x24, 0x56, 0x74, - 0x75, 0x95, 0x5b, 0xb5, 0xb6, 0x02, 0x1b, 0xd4, 0x1d, 0x20, 0x84, 0x2a, 0xda, 0x82, 0x0c, 0x74, - 0x81, 0x54, 0x59, 0x13, 0xfb, 0x6b, 0xb0, 0xb0, 0xfd, 0x59, 0x33, 0xe3, 0x40, 0xde, 0xa2, 0x2f, - 0xd0, 0x7d, 0x97, 0x7d, 0x0c, 0x96, 0x2c, 0xab, 0x2e, 0x50, 0x05, 0x8b, 0xee, 0xfb, 0x04, 0xd5, - 0x8c, 0xc7, 0x34, 0x29, 0x81, 0x4d, 0x92, 0x99, 0x39, 0xe7, 0x77, 0x66, 0x32, 0x47, 0x43, 0x6c, - 0xb8, 0xc4, 0x00, 0x19, 0xb8, 0x21,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x7f, 0x36, 0xc6, 0x5c, 0x23, 0x24, 0xcb, 0xfb, 0x71, 0x14, 0xf8, - 0xe7, 0x30, 0x52, 0x35, 0xad, 0x79, 0xb5, 0x62, 0x66, 0x1f, 0x46, 0x66, 0x83, 0xcc, 0x15, 0xe7, - 0x9e, 0xb1, 0x8d, 0x6e, 0xd5, 0x2b, 0x06, 0x9d, 0x53, 0xd2, 0x98, 0xd6, 0x12, 0xa9, 0x56, 0x57, - 0xa7, 0x38, 0x55, 0xaf, 0x18, 0x98, 0xcf, 0x89, 0x89, 0x5a, 0xe6, 0xd3, 0x20, 0xd0, 0xdd, 0x90, - 0xb5, 0xae, 0x79, 0xf5, 0x72, 0x65, 0x2b, 0x08, 0x14, 0xa3, 0xf3, 0x9a, 0xfc, 0x3d, 0xb5, 0x1b, - 0x8f, 0xc0, 0xd7, 0x08, 0x91, 0xad, 0x9b, 0x80, 0xd6, 0xe4, 0x4c, 0x41, 0x43, 0xb2, 0xf6, 0x64, - 0x03, 0x1e, 0xa1, 0x6e, 0x12, 0x6b, 0xa2, 0x6b, 0x4c, 0x19, 0xe4, 0x5f, 0x54, 0x66, 0x4c, 0x74, - 0x66, 0xac, 0x51, 0xfb, 0x57, 0xb7, 0x2d, 0xe3, 0xfa, 0xb6, 0x65, 0x7c, 0xbf, 0x6d, 0x19, 0x1f, - 0xef, 0x5a, 0x95, 0xeb, 0xbb, 0x56, 0xe5, 0xeb, 0x5d, 0xab, 0x72, 0xda, 0x1b, 0xeb, 0xca, 0x6e, - 0x51, 0xd4, 0xb7, 0x20, 0x2e, 0x90, 0x9d, 0xbb, 0xe5, 0xc3, 0x72, 0x79, 0xff, 0xb4, 0xa8, 0xea, - 0xf4, 0xe7, 0xd5, 0xbb, 0xb2, 0xf1, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x85, 0xe8, 0x0e, 0xe5, 0xf6, - 0x04, 0x00, 0x00, + // 589 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0x41, 0x4f, 0x13, 0x41, + 0x14, 0xc7, 0xbb, 0x14, 0x30, 0x1d, 0x88, 0xc1, 0x49, 0x85, 0xa6, 0x86, 0xd2, 0x34, 0xc6, 0x54, + 0xa3, 0xdd, 0x14, 0x2e, 0x5c, 0x81, 0x10, 0x62, 0x50, 0x21, 0x0b, 0x7a, 0x20, 0x31, 0x9b, 0xe9, + 0xec, 0xb3, 0x6c, 0xd8, 0xdd, 0xb7, 0x99, 0x99, 0x2d, 0xf4, 0x5b, 0xf8, 0x31, 0x3c, 0x78, 0xf0, + 0x63, 0x70, 0xe4, 0x68, 0x3c, 0x10, 0x03, 0x07, 0xbf, 0x86, 0x99, 0xd9, 0x59, 0xd2, 0xea, 0xc2, + 0xa5, 0xed, 0xcc, 0xfc, 0xdf, 0xef, 0xff, 0x3a, 0xff, 0x37, 0xa4, 0x0d, 0x17, 0xc8, 0x51, 0x80, + 0x1b, 0xe0, 0xf0, 0x0b, 0x62, 0xe0, 0x8e, 0xfa, 0xee, 0x10, 0x12, 0x90, 0xa1, 0xec, 0xa5, 0x02, + 0x15, 0x52, 0x6a, 0x15, 0x3d, 0xab, 0xe8, 0x8d, 0xfa, 0xcd, 0xfa, 0x10, 0x87, 0x68, 0x8e, 0x5d, + 0xfd, 0x2b, 0x57, 0x36, 0x9f, 0xb0, 0x38, 0x4c, 0xd0, 0x35, 0x9f, 0x76, 0xeb, 0x99, 0x82, 0x24, + 0x00, 0x11, 0x87, 0x89, 0x72, 0xd9, 0x80, 0x87, 0xae, 0x1a, 0xa7, 0x60, 0xc9, 0xcd, 0xb5, 0x12, + 0xef, 0x94, 0x09, 0x16, 0x5b, 0x41, 0xe7, 0xfb, 0x2c, 0x59, 0xdc, 0xcb, 0x9b, 0x39, 0x52, 0x4c, + 0x01, 0xdd, 0x24, 0xf3, 0xb9, 0xa0, 0xe1, 0xb4, 0x9d, 0xee, 0xc2, 0x7a, 0xb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 0xba, 0xdd, 0x7c, 0x6e, 0x3e, 0x80, 0x3a, 0x47, + 0x71, 0xe6, 0x16, 0xef, 0xfc, 0xe2, 0xee, 0xa5, 0x9b, 0x24, 0x07, 0xf3, 0xe6, 0x99, 0x6f, 0xfc, + 0x0d, 0x00, 0x00, 0xff, 0xff, 0x8f, 0x60, 0xbe, 0x35, 0x85, 0x04, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -441,20 +426,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ValidatorUpdates) > 0 { - for iNdEx := len(m.ValidatorUpdates) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ValidatorUpdates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } { size := m.LastTotalPower.Size() i -= size @@ -725,12 +696,6 @@ func (m *GenesisState) Size() (n int) { } l = m.LastTotalPower.Size() n += 1 + l + sovGenesis(uint64(l)) - if len(m.ValidatorUpdates) > 0 { - for _, e := range m.ValidatorUpdates { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } return n } @@ -1041,40 +1006,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorUpdates", 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 - } - m.ValidatorUpdates = append(m.ValidatorUpdates, types.ValidatorUpdate{}) - if err := m.ValidatorUpdates[len(m.ValidatorUpdates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/dogfood/types/genesis_test.go b/x/dogfood/types/genesis_test.go index 5c6a008c8..96be2649c 100644 --- a/x/dogfood/types/genesis_test.go +++ b/x/dogfood/types/genesis_test.go @@ -7,7 +7,6 @@ import ( testutiltx "github.com/ExocoreNetwork/exocore/testutil/tx" delegationtypes "github.com/ExocoreNetwork/exocore/x/delegation/types" "github.com/ExocoreNetwork/exocore/x/dogfood/types" - abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/crypto/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" @@ -68,7 +67,6 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { []types.EpochToConsensusAddrs{}, []types.EpochToUndelegationRecordKeys{}, math.ZeroInt(), - []abci.ValidatorUpdate{}, ), expPass: false, // 0 voting power isn't permitted expError: "non-positive last total power", From 686631a2ec6c8c9ac7ca9fa0426f6e0e31f918f4 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 10 Jun 2024 21:52:36 +0000 Subject: [PATCH 05/27] refactor(dogfood): update ImportGenesis ...for new genesis structure --- x/dogfood/keeper/genesis.go | 44 +++++++++++++++++++++++++++++++++---- x/dogfood/types/genesis.go | 1 + 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/x/dogfood/keeper/genesis.go b/x/dogfood/keeper/genesis.go index 69a3ade15..1225b80d1 100644 --- a/x/dogfood/keeper/genesis.go +++ b/x/dogfood/keeper/genesis.go @@ -7,6 +7,7 @@ import ( operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" abci "github.com/cometbft/cometbft/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common/hexutil" ) // InitGenesis initializes the module's state from a provided genesis state. @@ -19,7 +20,7 @@ func (k Keeper) InitGenesis( // so, it must be done here. by extension, the `InitGenesis` of the epochs module // should be called before that of this module. epochID := genState.Params.EpochIdentifier - _, found := k.epochsKeeper.GetEpochInfo(ctx, epochID) + epochInfo, found := k.epochsKeeper.GetEpochInfo(ctx, epochID) if !found { // the panic is suitable here because it is being done at genesis, when the node // is not running. it means that the genesis file is malformed. @@ -35,7 +36,6 @@ func (k Keeper) InitGenesis( // validator. this is because the operator may not have enough minimum self delegation // to be considered, or may not be in the top N operators. so checking that count here // is meaningless as well. - totalPower := sdk.NewInt(0) out := make([]abci.ValidatorUpdate, len(genState.ValSet)) for _, val := range genState.ValSet { // #nosec G703 // already validated @@ -55,9 +55,45 @@ func (k Keeper) InitGenesis( PubKey: *consKey, Power: val.Power, }) - totalPower = totalPower.Add(sdk.NewInt(val.Power)) } - k.SetLastTotalPower(ctx, totalPower) + for i := range genState.EpochsOptOutExpiries { + obj := genState.EpochsOptOutExpiries[i] + epoch := obj.Epoch + if epoch < epochInfo.CurrentEpoch { + panic(fmt.Sprintf("epoch %d is in the past", epoch)) + } + for _, addr := range obj.OperatorAccAddrs { + // #nosec G703 // already validated + operatorAddr, _ := sdk.AccAddressFromBech32(addr) + k.AppendOptOutToFinish(ctx, epoch, operatorAddr) + } + } + for i := range genState.EpochsConsensusAddrs { + obj := genState.EpochsConsensusAddrs[i] + epoch := obj.Epoch + if epoch < epochInfo.CurrentEpoch { + panic(fmt.Sprintf("epoch %d is in the past", epoch)) + } + for _, addr := range obj.ConsAddrs { + // #nosec G703 // already validated + accAddr, _ := sdk.ConsAddressFromBech32(addr) + k.AppendConsensusAddrToPrune(ctx, epoch, accAddr) + } + } + for i := range genState.UndelegationMaturities { + obj := genState.UndelegationMaturities[i] + epoch := obj.Epoch + if epoch < epochInfo.CurrentEpoch { + panic(fmt.Sprintf("epoch %d is in the past", epoch)) + } + for _, recordKey := range obj.UndelegationRecordKeys { + // #nosec G703 // already validated + recordKeyBytes, _ := hexutil.Decode(recordKey) + k.AppendUndelegationToMature(ctx, epoch, recordKeyBytes) + } + } + // ApplyValidatorChanges only gets changes and hence the vote power must be set here. + k.SetLastTotalPower(ctx, genState.LastTotalPower) // ApplyValidatorChanges will sort it internally return k.ApplyValidatorChanges( diff --git a/x/dogfood/types/genesis.go b/x/dogfood/types/genesis.go index 7f9c53381..a502e9335 100644 --- a/x/dogfood/types/genesis.go +++ b/x/dogfood/types/genesis.go @@ -105,6 +105,7 @@ func (gs GenesisState) Validate() error { // incremented, and then AfterEpochEnd is called with a value of 2. // therefore, the first epoch in the dogfood module is 2. all expiries // must happen at the end of this epoch or any epoch thereafter. + // TODO: we should fix this bug in our fork of the epochs module. if epoch <= 1 { return errorsmod.Wrapf( ErrInvalidGenesisData, From 9192a9c4e9aff35d07aa7dc3a8bdf778447e23dd Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 10 Jun 2024 22:03:47 +0000 Subject: [PATCH 06/27] refactor(dogfood): simplify gen state names --- proto/exocore/dogfood/v1/genesis.proto | 6 +- x/dogfood/keeper/genesis.go | 8 +- x/dogfood/types/genesis.go | 12 +-- x/dogfood/types/genesis.pb.go | 123 +++++++++++++------------ 4 files changed, 75 insertions(+), 74 deletions(-) diff --git a/proto/exocore/dogfood/v1/genesis.proto b/proto/exocore/dogfood/v1/genesis.proto index 678d1eabd..2d50a825d 100644 --- a/proto/exocore/dogfood/v1/genesis.proto +++ b/proto/exocore/dogfood/v1/genesis.proto @@ -24,15 +24,15 @@ message GenesisState { repeated GenesisValidator val_set = 2 [ (gogoproto.nullable) = false ]; - // epochs_opt_out_expiries is a list of (future) epochs at the end of which the + // opt_out_expiries is a list of (future) epochs at the end of which the // corresponding operators' opt-out will expire. we store this, as well as its reverse // lookup. - repeated EpochToOperatorAddrs epochs_opt_out_expiries = 3 + repeated EpochToOperatorAddrs opt_out_expiries = 3 [ (gogoproto.nullable) = false ]; // epochs_consensus_addrs is a list of epochs at the end of which the corresponding // consensus addresses should be pruned from the operator module. - repeated EpochToConsensusAddrs epochs_consensus_addrs = 4 + repeated EpochToConsensusAddrs consensus_addrs_to_prune = 4 [ (gogoproto.nullable) = false ]; // undelegation_maturities is a list of epochs at the end of which the corresponding diff --git a/x/dogfood/keeper/genesis.go b/x/dogfood/keeper/genesis.go index 1225b80d1..caaf78db1 100644 --- a/x/dogfood/keeper/genesis.go +++ b/x/dogfood/keeper/genesis.go @@ -56,8 +56,8 @@ func (k Keeper) InitGenesis( Power: val.Power, }) } - for i := range genState.EpochsOptOutExpiries { - obj := genState.EpochsOptOutExpiries[i] + for i := range genState.OptOutExpiries { + obj := genState.OptOutExpiries[i] epoch := obj.Epoch if epoch < epochInfo.CurrentEpoch { panic(fmt.Sprintf("epoch %d is in the past", epoch)) @@ -68,8 +68,8 @@ func (k Keeper) InitGenesis( k.AppendOptOutToFinish(ctx, epoch, operatorAddr) } } - for i := range genState.EpochsConsensusAddrs { - obj := genState.EpochsConsensusAddrs[i] + for i := range genState.ConsensusAddrsToPrune { + obj := genState.ConsensusAddrsToPrune[i] epoch := obj.Epoch if epoch < epochInfo.CurrentEpoch { panic(fmt.Sprintf("epoch %d is in the past", epoch)) diff --git a/x/dogfood/types/genesis.go b/x/dogfood/types/genesis.go index a502e9335..619b6b1d5 100644 --- a/x/dogfood/types/genesis.go +++ b/x/dogfood/types/genesis.go @@ -22,8 +22,8 @@ func NewGenesis( return &GenesisState{ Params: params, ValSet: vals, - EpochsOptOutExpiries: expiries, - EpochsConsensusAddrs: consAddrs, + OptOutExpiries: expiries, + ConsensusAddrsToPrune: consAddrs, UndelegationMaturities: recordKeys, LastTotalPower: power, } @@ -90,10 +90,10 @@ func (gs GenesisState) Validate() error { // we don't know the current epoch, since this is stateless validation. // to check epoochs aren't duplicated. - epochs := make(map[int64]struct{}, len(gs.EpochsOptOutExpiries)) + epochs := make(map[int64]struct{}, len(gs.OptOutExpiries)) // to check that there is no duplicate address - not by per epoch but overall. addrsMap := make(map[string]struct{}) - for _, obj := range gs.EpochsOptOutExpiries { + for _, obj := range gs.OptOutExpiries { epoch := obj.Epoch if _, ok := epochs[epoch]; ok { return errorsmod.Wrapf( @@ -138,9 +138,9 @@ func (gs GenesisState) Validate() error { } } - epochs = make(map[int64]struct{}, len(gs.EpochsConsensusAddrs)) + epochs = make(map[int64]struct{}, len(gs.ConsensusAddrsToPrune)) addrsMap = make(map[string]struct{}) - for _, obj := range gs.EpochsConsensusAddrs { + for _, obj := range gs.ConsensusAddrsToPrune { epoch := obj.Epoch if _, ok := epochs[epoch]; ok { return errorsmod.Wrapf( diff --git a/x/dogfood/types/genesis.pb.go b/x/dogfood/types/genesis.pb.go index 85d7f7bf5..eb1404793 100644 --- a/x/dogfood/types/genesis.pb.go +++ b/x/dogfood/types/genesis.pb.go @@ -37,13 +37,13 @@ type GenesisState struct { // val_set is the initial validator set. it onyl represents the active // validators. ValSet []GenesisValidator `protobuf:"bytes,2,rep,name=val_set,json=valSet,proto3" json:"val_set"` - // epochs_opt_out_expiries is a list of (future) epochs at the end of which the + // opt_out_expiries is a list of (future) epochs at the end of which the // corresponding operators' opt-out will expire. we store this, as well as its reverse // lookup. - EpochsOptOutExpiries []EpochToOperatorAddrs `protobuf:"bytes,3,rep,name=epochs_opt_out_expiries,json=epochsOptOutExpiries,proto3" json:"epochs_opt_out_expiries"` + OptOutExpiries []EpochToOperatorAddrs `protobuf:"bytes,3,rep,name=opt_out_expiries,json=optOutExpiries,proto3" json:"opt_out_expiries"` // epochs_consensus_addrs is a list of epochs at the end of which the corresponding // consensus addresses should be pruned from the operator module. - EpochsConsensusAddrs []EpochToConsensusAddrs `protobuf:"bytes,4,rep,name=epochs_consensus_addrs,json=epochsConsensusAddrs,proto3" json:"epochs_consensus_addrs"` + ConsensusAddrsToPrune []EpochToConsensusAddrs `protobuf:"bytes,4,rep,name=consensus_addrs_to_prune,json=consensusAddrsToPrune,proto3" json:"consensus_addrs_to_prune"` // undelegation_maturities is a list of epochs at the end of which the corresponding // undelegations will mature. we store its reverse lookup as well. UndelegationMaturities []EpochToUndelegationRecordKeys `protobuf:"bytes,5,rep,name=undelegation_maturities,json=undelegationMaturities,proto3" json:"undelegation_maturities"` @@ -101,16 +101,16 @@ func (m *GenesisState) GetValSet() []GenesisValidator { return nil } -func (m *GenesisState) GetEpochsOptOutExpiries() []EpochToOperatorAddrs { +func (m *GenesisState) GetOptOutExpiries() []EpochToOperatorAddrs { if m != nil { - return m.EpochsOptOutExpiries + return m.OptOutExpiries } return nil } -func (m *GenesisState) GetEpochsConsensusAddrs() []EpochToConsensusAddrs { +func (m *GenesisState) GetConsensusAddrsToPrune() []EpochToConsensusAddrs { if m != nil { - return m.EpochsConsensusAddrs + return m.ConsensusAddrsToPrune } return nil } @@ -366,44 +366,45 @@ func init() { func init() { proto.RegisterFile("exocore/dogfood/v1/genesis.proto", fileDescriptor_1a9d908a27866b1b) } var fileDescriptor_1a9d908a27866b1b = []byte{ - // 589 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0x41, 0x4f, 0x13, 0x41, - 0x14, 0xc7, 0xbb, 0x14, 0x30, 0x1d, 0x88, 0xc1, 0x49, 0x85, 0xa6, 0x86, 0xd2, 0x34, 0xc6, 0x54, - 0xa3, 0xdd, 0x14, 0x2e, 0x5c, 0x81, 0x10, 0x62, 0x50, 0x21, 0x0b, 0x7a, 0x20, 0x31, 0x9b, 0xe9, - 0xec, 0xb3, 0x6c, 0xd8, 0xdd, 0xb7, 0x99, 0x99, 0x2d, 0xf4, 0x5b, 0xf8, 0x31, 0x3c, 0x78, 0xf0, - 0x63, 0x70, 0xe4, 0x68, 0x3c, 0x10, 0x03, 0x07, 0xbf, 0x86, 0x99, 0xd9, 0x59, 0xd2, 0xea, 0xc2, - 0xa5, 0xed, 0xcc, 0xfc, 0xdf, 0x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0x8b, 0xce, 0x09, 0xa9, 0x97, 0x85, 0xa6, 0xd5, 0xe6, 0x26, 0x0d, 0xa7, 0xea, 0xe5, - 0x0b, 0xfa, 0x9a, 0x50, 0xb4, 0x32, 0x9f, 0x71, 0x6e, 0xa3, 0xd2, 0x53, 0x56, 0xf3, 0x96, 0x8a, - 0x93, 0x2d, 0xce, 0x0d, 0xa3, 0xf3, 0x8e, 0x3c, 0x2d, 0x8d, 0xea, 0x1e, 0xf8, 0x2a, 0x21, 0x7a, - 0x08, 0xa6, 0xa0, 0x35, 0xbd, 0x93, 0xd3, 0x90, 0xac, 0x3e, 0x18, 0xc8, 0x3d, 0xd4, 0x4d, 0xd2, - 0x98, 0x8a, 0x5e, 0x98, 0x02, 0x7d, 0x45, 0x85, 0xc7, 0x54, 0x84, 0x13, 0x01, 0xef, 0x5f, 0xde, - 0xb4, 0x9c, 0xab, 0x9b, 0x96, 0xf3, 0xfb, 0xa6, 0xe5, 0x7c, 0xbd, 0x6d, 0x55, 0xae, 0x6e, 0x5b, - 0x95, 0x9f, 0xb7, 0xad, 0xca, 0x49, 0x7f, 0x22, 0xba, 0xdd, 0x7c, 0x6e, 0x3e, 0x80, 0x3a, 0x47, - 0x71, 0xe6, 0x16, 0xef, 0xfc, 0xe2, 0xee, 0xa5, 0x9b, 0x24, 0x07, 0xf3, 0xe6, 0x99, 0x6f, 0xfc, - 0x0d, 0x00, 0x00, 0xff, 0xff, 0x8f, 0x60, 0xbe, 0x35, 0x85, 0x04, 0x00, 0x00, + // 595 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0xc1, 0x4e, 0xdb, 0x4e, + 0x10, 0xc6, 0x63, 0x02, 0xfc, 0x95, 0x05, 0xa1, 0xfc, 0x57, 0xd0, 0x5a, 0xa9, 0x08, 0x51, 0x54, + 0x55, 0x69, 0xd5, 0xda, 0x0a, 0x5c, 0xb8, 0x02, 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 0xff, 0x5c, 0xe3, 0xbd, 0xfa, 0x7b, + 0x04, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -450,10 +451,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x2a } } - if len(m.EpochsConsensusAddrs) > 0 { - for iNdEx := len(m.EpochsConsensusAddrs) - 1; iNdEx >= 0; iNdEx-- { + if len(m.ConsensusAddrsToPrune) > 0 { + for iNdEx := len(m.ConsensusAddrsToPrune) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.EpochsConsensusAddrs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ConsensusAddrsToPrune[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -464,10 +465,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x22 } } - if len(m.EpochsOptOutExpiries) > 0 { - for iNdEx := len(m.EpochsOptOutExpiries) - 1; iNdEx >= 0; iNdEx-- { + if len(m.OptOutExpiries) > 0 { + for iNdEx := len(m.OptOutExpiries) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.EpochsOptOutExpiries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.OptOutExpiries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -676,14 +677,14 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.EpochsOptOutExpiries) > 0 { - for _, e := range m.EpochsOptOutExpiries { + if len(m.OptOutExpiries) > 0 { + for _, e := range m.OptOutExpiries { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.EpochsConsensusAddrs) > 0 { - for _, e := range m.EpochsConsensusAddrs { + if len(m.ConsensusAddrsToPrune) > 0 { + for _, e := range m.ConsensusAddrsToPrune { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -873,7 +874,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EpochsOptOutExpiries", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OptOutExpiries", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -900,14 +901,14 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.EpochsOptOutExpiries = append(m.EpochsOptOutExpiries, EpochToOperatorAddrs{}) - if err := m.EpochsOptOutExpiries[len(m.EpochsOptOutExpiries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.OptOutExpiries = append(m.OptOutExpiries, EpochToOperatorAddrs{}) + if err := m.OptOutExpiries[len(m.OptOutExpiries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EpochsConsensusAddrs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsensusAddrsToPrune", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -934,8 +935,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.EpochsConsensusAddrs = append(m.EpochsConsensusAddrs, EpochToConsensusAddrs{}) - if err := m.EpochsConsensusAddrs[len(m.EpochsConsensusAddrs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ConsensusAddrsToPrune = append(m.ConsensusAddrsToPrune, EpochToConsensusAddrs{}) + if err := m.ConsensusAddrsToPrune[len(m.ConsensusAddrsToPrune)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex From 0b4957bb7518590f1a14fb552e4ff83f90b4d74a Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 10 Jun 2024 22:21:27 +0000 Subject: [PATCH 07/27] feat(dogfood): implement ExportGenesis Partially resolves #54 --- app/export.go | 8 ++---- x/dogfood/keeper/genesis.go | 28 ++++++++++++++++-- x/dogfood/keeper/impl_sdk.go | 43 ---------------------------- x/dogfood/keeper/opt_out.go | 54 +++++++++++++++++++++++++++++++++++ x/dogfood/keeper/unbonding.go | 28 ++++++++++++++++++ 5 files changed, 110 insertions(+), 51 deletions(-) diff --git a/app/export.go b/app/export.go index 5e88b207b..28b759397 100644 --- a/app/export.go +++ b/app/export.go @@ -16,6 +16,7 @@ import ( slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" evmtypes "github.com/evmos/evmos/v14/x/evm/types" + tmtypes "github.com/cometbft/cometbft/types" "github.com/evmos/evmos/v14/encoding" ) @@ -75,14 +76,9 @@ func (app *ExocoreApp) ExportAppStateAndValidators( return servertypes.ExportedApp{}, err } - validators, err := app.StakingKeeper.WriteValidators(ctx) - if err != nil { - return servertypes.ExportedApp{}, err - } - return servertypes.ExportedApp{ AppState: appState, - Validators: validators, + Validators: []tmtypes.GenesisValidator{}, // exported directly in dogfood Height: height, ConsensusParams: app.BaseApp.GetConsensusParams(ctx), }, nil diff --git a/x/dogfood/keeper/genesis.go b/x/dogfood/keeper/genesis.go index caaf78db1..e206005b5 100644 --- a/x/dogfood/keeper/genesis.go +++ b/x/dogfood/keeper/genesis.go @@ -6,7 +6,9 @@ import ( "github.com/ExocoreNetwork/exocore/x/dogfood/types" operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" abci "github.com/cometbft/cometbft/abci/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/ethereum/go-ethereum/common/hexutil" ) @@ -66,6 +68,7 @@ func (k Keeper) InitGenesis( // #nosec G703 // already validated operatorAddr, _ := sdk.AccAddressFromBech32(addr) k.AppendOptOutToFinish(ctx, epoch, operatorAddr) + k.SetOperatorOptOutFinishEpoch(ctx, operatorAddr, epoch) } } for i := range genState.ConsensusAddrsToPrune { @@ -90,6 +93,7 @@ func (k Keeper) InitGenesis( // #nosec G703 // already validated recordKeyBytes, _ := hexutil.Decode(recordKey) k.AppendUndelegationToMature(ctx, epoch, recordKeyBytes) + k.SetUndelegationMaturityEpoch(ctx, recordKeyBytes, epoch) } } // ApplyValidatorChanges only gets changes and hence the vote power must be set here. @@ -105,6 +109,26 @@ func (k Keeper) InitGenesis( func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetDogfoodParams(ctx) - // TODO(mm) - return genesis + validators := []types.GenesisValidator{} + k.IterateBondedValidatorsByPower(ctx, func(i int64, val stakingtypes.ValidatorI) bool { + // #nosec G703 // already validated + pubKey, _ := val.ConsPubKey() + // #nosec G703 // already validated + convKey, _ := cryptocodec.ToTmPubKeyInterface(pubKey) + validators = append(validators, + types.GenesisValidator{ + PublicKey: hexutil.Encode(convKey.Bytes()), + Power: val.GetConsensusPower(sdk.DefaultPowerReduction), + }, + ) + return true + }) + return types.NewGenesis( + k.GetDogfoodParams(ctx), + validators, + k.GetAllOptOutsToFinish(ctx), + k.GetAllConsAddrsToPrune(ctx), + k.GetAllUndelegationsToMature(ctx), + k.GetLastTotalPower(ctx), + ) } diff --git a/x/dogfood/keeper/impl_sdk.go b/x/dogfood/keeper/impl_sdk.go index 1832fae07..b29aace59 100644 --- a/x/dogfood/keeper/impl_sdk.go +++ b/x/dogfood/keeper/impl_sdk.go @@ -4,10 +4,7 @@ import ( "sort" "cosmossdk.io/math" - operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" abci "github.com/cometbft/cometbft/abci/types" - tmtypes "github.com/cometbft/cometbft/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" @@ -218,43 +215,3 @@ func (k Keeper) IterateDelegations( ) { panic("unimplemented on this keeper") } - -// WriteValidators returns all the currently active validators. This is called by the export -// CLI. which must ensure that `ctx.ChainID()` is set. -func (k Keeper) WriteValidators( - ctx sdk.Context, -) ([]tmtypes.GenesisValidator, error) { - validators := k.GetAllExocoreValidators(ctx) - sort.SliceStable(validators, func(i, j int) bool { - return validators[i].Power > validators[j].Power - }) - vals := make([]tmtypes.GenesisValidator, len(validators)) - var retErr error - for i, val := range validators { - pk, err := val.ConsPubKey() - if err != nil { - retErr = err - break - } - tmPk, err := cryptocodec.ToTmPubKeyInterface(pk) - if err != nil { - retErr = err - break - } - consAddress := sdk.GetConsAddress(pk) - found, addr := k.operatorKeeper.GetOperatorAddressForChainIDAndConsAddr( - ctx, ctx.ChainID(), consAddress, - ) - if !found { - retErr = operatortypes.ErrNoKeyInTheStore - break - } - vals[i] = tmtypes.GenesisValidator{ - Address: consAddress.Bytes(), - PubKey: tmPk, - Power: val.Power, - Name: addr.String(), // TODO - } - } - return vals, retErr -} diff --git a/x/dogfood/keeper/opt_out.go b/x/dogfood/keeper/opt_out.go index 8a9352b88..4f5b1a513 100644 --- a/x/dogfood/keeper/opt_out.go +++ b/x/dogfood/keeper/opt_out.go @@ -56,6 +56,33 @@ func (k Keeper) ClearOptOutsToFinish(ctx sdk.Context, epoch int64) { store.Delete(key) } +// GetAllOptOutsToFinish gets a list of epochs and the corresponding operator addresses +// whose opt outs are scheduled to finish at the end of those epochs. It is ordered, +// first by the epoch and then by the operator address bytes. +func (k Keeper) GetAllOptOutsToFinish(ctx sdk.Context) []types.EpochToOperatorAddrs { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, []byte{types.OptOutsToFinishBytePrefix}) + defer iterator.Close() + + res := []types.EpochToOperatorAddrs{} + + for ; iterator.Valid(); iterator.Next() { + epoch, _ := types.SafeUint64ToInt64(sdk.BigEndianToUint64(iterator.Key()[1:])) + var addrs types.AccountAddresses + k.cdc.MustUnmarshal(iterator.Value(), &addrs) + subRes := []string{} + for _, addr := range addrs.GetList() { + subRes = append(subRes, sdk.AccAddress(addr).String()) + } + res = append(res, types.EpochToOperatorAddrs{ + Epoch: epoch, + OperatorAccAddrs: subRes, + }) + } + + return res +} + // SetOperatorOptOutFinishEpoch sets the epoch at which an operator's opt out will be finished. func (k Keeper) SetOperatorOptOutFinishEpoch( ctx sdk.Context, operatorAddr sdk.AccAddress, epoch int64, @@ -142,3 +169,30 @@ func (k Keeper) setConsensusAddrsToPrune( } store.Set(key, bz) } + +// GetAllConsAddrsToPrune gets a list of epochs and the corresponding consensus addresses +// which should be pruned from the operator module at the end of that epoch. It is ordered, +// first by the epoch and then by the consensus address bytes. +func (k Keeper) GetAllConsAddrsToPrune(ctx sdk.Context) []types.EpochToConsensusAddrs { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, []byte{types.OptOutsToFinishBytePrefix}) + defer iterator.Close() + + res := []types.EpochToConsensusAddrs{} + + for ; iterator.Valid(); iterator.Next() { + epoch, _ := types.SafeUint64ToInt64(sdk.BigEndianToUint64(iterator.Key()[1:])) + var addrs types.ConsensusAddresses + k.cdc.MustUnmarshal(iterator.Value(), &addrs) + subRes := []string{} + for _, addr := range addrs.GetList() { + subRes = append(subRes, sdk.ConsAddress(addr).String()) + } + res = append(res, types.EpochToConsensusAddrs{ + Epoch: epoch, + ConsAddrs: subRes, + }) + } + + return res +} diff --git a/x/dogfood/keeper/unbonding.go b/x/dogfood/keeper/unbonding.go index 45caaa0d2..53282649c 100644 --- a/x/dogfood/keeper/unbonding.go +++ b/x/dogfood/keeper/unbonding.go @@ -3,6 +3,7 @@ package keeper import ( "github.com/ExocoreNetwork/exocore/x/dogfood/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common/hexutil" ) // SetOptOutInformation sets information related to an operator's opt out. @@ -87,6 +88,33 @@ func (k Keeper) setUndelegationsToMature( store.Set(key, val) } +// GetAllUndelegationsToMature gets a list of epochs and the corresponding undelegation record +// keys which are scheduled to mature at the end of that epoch. It is ordered, first by the +// epoch and then by the record key's bytes. +func (k Keeper) GetAllUndelegationsToMature(ctx sdk.Context) []types.EpochToUndelegationRecordKeys { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, []byte{types.OptOutsToFinishBytePrefix}) + defer iterator.Close() + + res := []types.EpochToUndelegationRecordKeys{} + + for ; iterator.Valid(); iterator.Next() { + epoch, _ := types.SafeUint64ToInt64(sdk.BigEndianToUint64(iterator.Key()[1:])) + var recordKeys types.UndelegationRecordKeys + k.cdc.MustUnmarshal(iterator.Value(), &recordKeys) + subRes := []string{} + for _, recordKey := range recordKeys.GetList() { + subRes = append(subRes, hexutil.Encode(recordKey)) + } + res = append(res, types.EpochToUndelegationRecordKeys{ + Epoch: epoch, + UndelegationRecordKeys: subRes, + }) + } + + return res +} + // GetUndelegationMaturityEpoch gets the maturity epoch for the undelegation record. func (k Keeper) GetUndelegationMaturityEpoch( ctx sdk.Context, recordKey []byte, From 12aa144e47ca9da93fa68f49416da321b167efbd Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 10 Jun 2024 22:23:43 +0000 Subject: [PATCH 08/27] chore: lint --- x/dogfood/keeper/genesis.go | 2 +- x/dogfood/types/keys.go | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/x/dogfood/keeper/genesis.go b/x/dogfood/keeper/genesis.go index e206005b5..f59a61c46 100644 --- a/x/dogfood/keeper/genesis.go +++ b/x/dogfood/keeper/genesis.go @@ -110,7 +110,7 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetDogfoodParams(ctx) validators := []types.GenesisValidator{} - k.IterateBondedValidatorsByPower(ctx, func(i int64, val stakingtypes.ValidatorI) bool { + k.IterateBondedValidatorsByPower(ctx, func(_ int64, val stakingtypes.ValidatorI) bool { // #nosec G703 // already validated pubKey, _ := val.ConsPubKey() // #nosec G703 // already validated diff --git a/x/dogfood/types/keys.go b/x/dogfood/types/keys.go index c1acb9bff..05852c96b 100644 --- a/x/dogfood/types/keys.go +++ b/x/dogfood/types/keys.go @@ -18,10 +18,9 @@ const ( // ExocoreValidatorBytePrefix is the prefix for the validator store. ExocoreValidatorBytePrefix byte = iota + 1 - // queuedOperationsByte is the byte used to store the queue of operations. - // It is no longer used, but it is retained for backward compatibility, - // which is also why it is lower case (not exported). - queuedOperationsByte + // QueuedOperationsByte was the byte used to store the queue of operations. + // It is no longer used, but it is retained for backward compatibility. + _ // OptOutsToFinishBytePrefix is the byte used to store the list of operator addresses whose // opt outs are maturing at the provided epoch. @@ -39,10 +38,10 @@ const ( // that will mature at the provided epoch. UnbondingReleaseMaturityBytePrefix - // pendingOperationsByte is the byte used to store the list of operations to be applied at + // PendingOperationsByte was the byte used to store the list of operations to be applied at // the end of the current block. It is no longer used, and is retained for backward // compatibility. - pendingOperationsByte + _ // PendingOptOutsByte is the byte used to store the list of operator addresses whose opt // outs will be made effective at the end of the current block. From 3f28fc252a903949379f99ab4da939ee30672f1b Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 10 Jun 2024 22:30:08 +0000 Subject: [PATCH 09/27] proto(dogfood): remove unused import --- proto/exocore/dogfood/v1/genesis.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/proto/exocore/dogfood/v1/genesis.proto b/proto/exocore/dogfood/v1/genesis.proto index 2d50a825d..5f4f71880 100644 --- a/proto/exocore/dogfood/v1/genesis.proto +++ b/proto/exocore/dogfood/v1/genesis.proto @@ -4,7 +4,6 @@ package exocore.dogfood.v1; import "gogoproto/gogo.proto"; import "amino/amino.proto"; -import "tendermint/abci/types.proto"; import "exocore/dogfood/v1/params.proto"; From 9a7912e4a151138f12591c05cf68361e5f486969 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 10 Jun 2024 22:31:58 +0000 Subject: [PATCH 10/27] fix(local): compat with new dogfood genesis --- local_node.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/local_node.sh b/local_node.sh index a6df40561..a9446c33a 100755 --- a/local_node.sh +++ b/local_node.sh @@ -115,10 +115,11 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then jq '.app_state["delegation"]["delegations"][0]["delegations"][0]["per_operator_amounts"][0]["value"]["amount"]="5000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" # x/dogfood - jq '.app_state["dogfood"]["initial_val_set"][0]["public_key"]="0xf0f6919e522c5b97db2c8255bff743f9dfddd7ad9fc37cb0c1670b480d0f9914"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" - jq '.app_state["dogfood"]["initial_val_set"][0]["power"]="5000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["dogfood"]["val_set"][0]["public_key"]="0xf0f6919e522c5b97db2c8255bff743f9dfddd7ad9fc37cb0c1670b480d0f9914"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["dogfood"]["val_set"][0]["power"]="5000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" # change the epoch to an hour when starting a local node, which facilitates the testing. jq '.app_state["dogfood"]["params"]["epoch_identifier"]="hour"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["dogfood"]["last_total_power"]="5000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" # x/epochs HOUR_EPOCH='{ From ddc8e4890c7e5d84198c0a26f23adb89f658eff9 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 10 Jun 2024 22:37:27 +0000 Subject: [PATCH 11/27] chore: lint proto file and gen --- proto/exocore/dogfood/v1/genesis.proto | 12 ++-- x/dogfood/types/genesis.pb.go | 78 +++++++++++++------------- 2 files changed, 44 insertions(+), 46 deletions(-) diff --git a/proto/exocore/dogfood/v1/genesis.proto b/proto/exocore/dogfood/v1/genesis.proto index 5f4f71880..ee2005560 100644 --- a/proto/exocore/dogfood/v1/genesis.proto +++ b/proto/exocore/dogfood/v1/genesis.proto @@ -2,8 +2,8 @@ syntax = "proto3"; package exocore.dogfood.v1; -import "gogoproto/gogo.proto"; import "amino/amino.proto"; +import "gogoproto/gogo.proto"; import "exocore/dogfood/v1/params.proto"; @@ -75,11 +75,11 @@ message GenesisState { // optimization between dogfood and operator modules. // https://github.com/ExocoreNetwork/exocore/issues/73 message GenesisValidator { - // public_key is the consensus public key of the validator. It should - // be exactly 32 bytes, but this is not enforced in protobuf. - string public_key = 1; - // power is the voting power of the validator. - int64 power = 2; + // public_key is the consensus public key of the validator. It should + // be exactly 32 bytes, but this is not enforced in protobuf. + string public_key = 1; + // power is the voting power of the validator. + int64 power = 2; } // EpochToOperatorAddress is used to store a mapping from epoch to a list of diff --git a/x/dogfood/types/genesis.pb.go b/x/dogfood/types/genesis.pb.go index eb1404793..ae2a4b767 100644 --- a/x/dogfood/types/genesis.pb.go +++ b/x/dogfood/types/genesis.pb.go @@ -5,7 +5,6 @@ package types import ( fmt "fmt" - _ "github.com/cometbft/cometbft/abci/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" @@ -366,45 +365,44 @@ func init() { func init() { proto.RegisterFile("exocore/dogfood/v1/genesis.proto", fileDescriptor_1a9d908a27866b1b) } var fileDescriptor_1a9d908a27866b1b = []byte{ - // 595 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0xc1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xba, 0xdd, - 0x62, 0x6f, 0xde, 0x81, 0x3a, 0x47, 0x79, 0xe6, 0x56, 0xb7, 0xfb, 0xe2, 0xee, 0x7e, 0x9b, 0x24, - 0x07, 0xf3, 0xe6, 0x72, 0x6f, 0xfc, 0x09, 0x00, 0x00, 0xff, 0xff, 0x5c, 0xe3, 0xbd, 0xfa, 0x7b, - 0x04, 0x00, 0x00, + // 578 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0xc1, 0x4e, 0xdb, 0x30, + 0x18, 0xc7, 0x1b, 0x0a, 0x4c, 0x35, 0x08, 0x75, 0x16, 0x6c, 0x11, 0x12, 0xa1, 0xaa, 0xa6, 0xa9, + 0x9b, 0xb6, 0x44, 0x85, 0x0b, 0x57, 0x40, 0x08, 0x4d, 0x6c, 0x03, 0x05, 0x36, 0x4d, 0x48, 0x53, + 0x64, 0x1c, 0x2f, 0x8d, 0x9a, 0xe6, 0xb3, 0x6c, 0xa7, 0xb4, 0x6f, 0xb1, 0x67, 0xd8, 0x69, 0xc7, + 0x3d, 0x06, 0x47, 0x8e, 0xd3, 0x0e, 0x68, 0x6a, 0x0f, 0x7b, 0x8d, 0xc9, 0x4e, 0x82, 0xda, 0xad, + 0xf4, 0xd2, 0xda, 0x5f, 0xfe, 0xdf, 0xef, 0xef, 0xe4, 0xef, 0x0f, 0x35, 0xd8, 0x00, 0x28, 0x08, + 0xe6, 0x85, 0x10, 0x7d, 0x01, 0x08, 0xbd, 0x7e, 0xdb, 0x8b, 0x58, 0xca, 0x64, 0x2c, 0x5d, 0x2e, + 0x40, 0x01, 0xc6, 0x85, 0xc2, 0x2d, 0x14, 0x6e, 0xbf, 0xbd, 0xf9, 0x98, 0xf4, 0xe2, 0x14, 0x3c, + 0xf3, 0x9b, 0xcb, 0x36, 0xd7, 0x23, 0x88, 0xc0, 0x2c, 0x3d, 0xbd, 0x2a, 0xaa, 0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0b, 0xd3, 0xa0, 0x3f, 0x51, 0xe9, 0x31, + 0x15, 0xe1, 0x44, 0xc0, 0x27, 0x37, 0x23, 0xc7, 0xba, 0x1d, 0x39, 0xd6, 0xef, 0x91, 0x63, 0x7d, + 0x1d, 0x3b, 0x95, 0xdb, 0xb1, 0x53, 0xf9, 0x39, 0x76, 0x2a, 0x97, 0xed, 0x89, 0xe8, 0x8e, 0xf2, + 0x7b, 0xf3, 0x9e, 0xa9, 0x6b, 0x10, 0x5d, 0xaf, 0x9c, 0xee, 0xc1, 0xfd, 0x7c, 0x9b, 0x24, 0xaf, + 0x96, 0xcd, 0x70, 0xef, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x73, 0x71, 0xf4, 0x5e, 0x04, + 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { From dab2d5e2d7cb82573d7720cc9b4647dd04049114 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 10 Jun 2024 22:38:47 +0000 Subject: [PATCH 12/27] fix(test): use correct struct member name --- x/dogfood/types/genesis_test.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/x/dogfood/types/genesis_test.go b/x/dogfood/types/genesis_test.go index 96be2649c..a7a129a49 100644 --- a/x/dogfood/types/genesis_test.go +++ b/x/dogfood/types/genesis_test.go @@ -204,7 +204,7 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { }, }, LastTotalPower: math.NewInt(5), - EpochsOptOutExpiries: []types.EpochToOperatorAddrs{ + OptOutExpiries: []types.EpochToOperatorAddrs{ { Epoch: 2, OperatorAccAddrs: []string{ @@ -233,7 +233,7 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { }, }, LastTotalPower: math.NewInt(5), - EpochsOptOutExpiries: []types.EpochToOperatorAddrs{ + OptOutExpiries: []types.EpochToOperatorAddrs{ { Epoch: 1, OperatorAccAddrs: []string{ @@ -256,7 +256,7 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { }, }, LastTotalPower: math.NewInt(5), - EpochsOptOutExpiries: []types.EpochToOperatorAddrs{ + OptOutExpiries: []types.EpochToOperatorAddrs{ { Epoch: 2, }, @@ -276,7 +276,7 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { }, }, LastTotalPower: math.NewInt(5), - EpochsOptOutExpiries: []types.EpochToOperatorAddrs{ + OptOutExpiries: []types.EpochToOperatorAddrs{ { Epoch: 2, OperatorAccAddrs: []string{ @@ -300,7 +300,7 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { }, }, LastTotalPower: math.NewInt(5), - EpochsOptOutExpiries: []types.EpochToOperatorAddrs{ + OptOutExpiries: []types.EpochToOperatorAddrs{ { Epoch: 2, OperatorAccAddrs: []string{ @@ -323,7 +323,7 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { }, }, LastTotalPower: math.NewInt(5), - EpochsOptOutExpiries: []types.EpochToOperatorAddrs{ + OptOutExpiries: []types.EpochToOperatorAddrs{ { Epoch: 2, OperatorAccAddrs: []string{ @@ -345,7 +345,7 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { }, }, LastTotalPower: math.NewInt(5), - EpochsConsensusAddrs: []types.EpochToConsensusAddrs{ + ConsensusAddrsToPrune: []types.EpochToConsensusAddrs{ { Epoch: 2, ConsAddrs: []string{ @@ -374,7 +374,7 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { }, }, LastTotalPower: math.NewInt(5), - EpochsConsensusAddrs: []types.EpochToConsensusAddrs{ + ConsensusAddrsToPrune: []types.EpochToConsensusAddrs{ { Epoch: 1, ConsAddrs: []string{ @@ -397,7 +397,7 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { }, }, LastTotalPower: math.NewInt(5), - EpochsConsensusAddrs: []types.EpochToConsensusAddrs{ + ConsensusAddrsToPrune: []types.EpochToConsensusAddrs{ { Epoch: 2, }, @@ -417,7 +417,7 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { }, }, LastTotalPower: math.NewInt(5), - EpochsConsensusAddrs: []types.EpochToConsensusAddrs{ + ConsensusAddrsToPrune: []types.EpochToConsensusAddrs{ { Epoch: 2, ConsAddrs: []string{ @@ -441,7 +441,7 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { }, }, LastTotalPower: math.NewInt(5), - EpochsConsensusAddrs: []types.EpochToConsensusAddrs{ + ConsensusAddrsToPrune: []types.EpochToConsensusAddrs{ { Epoch: 2, ConsAddrs: []string{ @@ -463,7 +463,7 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { }, }, LastTotalPower: math.NewInt(5), - EpochsConsensusAddrs: []types.EpochToConsensusAddrs{ + ConsensusAddrsToPrune: []types.EpochToConsensusAddrs{ { Epoch: 2, ConsAddrs: []string{ From b2ea28450d553f490016b1b42fe7dbd32ff33ad5 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 10 Jun 2024 22:40:20 +0000 Subject: [PATCH 13/27] chore: update go version to 1.21.11 --- .github/workflows/ante-benchmark.yml | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/dependencies.yml | 2 +- .github/workflows/goreleaser.yml | 2 +- .github/workflows/lint.yml | 2 +- .golangci.yml | 2 +- Dockerfile | 2 +- Makefile | 2 +- go.mod | 2 +- networks/local/exocore/Dockerfile | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ante-benchmark.yml b/.github/workflows/ante-benchmark.yml index 54036daa5..aa40533ba 100644 --- a/.github/workflows/ante-benchmark.yml +++ b/.github/workflows/ante-benchmark.yml @@ -29,7 +29,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v4 with: - go-version: '1.21.9' + go-version: '1.21.11' check-latest: true - name: Run benchmark tests diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4c3dfb697..eaa39e5e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: '1.21.9' + go-version: '1.21.11' check-latest: true - uses: technote-space/get-diff-action@v6.1.2 id: git_diff diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 1e846db7c..5c613edab 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/setup-go@v4 with: - go-version: '1.21.9' + go-version: '1.21.11' check-latest: true - name: "Checkout Repository" uses: actions/checkout@v4 diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 7419114ea..3c451f402 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.21.9' + go-version: '1.21.11' check-latest: true - name: release dry run run: make release-dry-run diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9c9154031..ed0476abd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,7 +21,7 @@ jobs: # Required: setup-go, for all versions v3.0.0+ of golangci-lint - uses: actions/setup-go@v5 with: - go-version: '1.21.9' + go-version: '1.21.11' # Use pinned versions, not git versions check-latest: false # Match `golangci-lint-action` recommendation diff --git a/.golangci.yml b/.golangci.yml index fe4c5c5e3..b31d2cb00 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -2,7 +2,7 @@ run: tests: false timeout: 5m concurrency: 4 - go: "1.21.9" + go: "1.21.11" linters: enable: diff --git a/Dockerfile b/Dockerfile index 4a64abccc..3c0fd350e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # This is the published docker image for exocore. -FROM golang:1.21.9-alpine3.18 AS build-env +FROM golang:1.21.11-alpine3.18 AS build-env WORKDIR /go/src/github.com/ExocoreNetwork/exocore diff --git a/Makefile b/Makefile index 653c3663c..943e9a275 100644 --- a/Makefile +++ b/Makefile @@ -525,7 +525,7 @@ localnet-show-logstream: ############################################################################### PACKAGE_NAME:=github.com/ExocoreNetwork/exocore -GOLANG_CROSS_VERSION = v1.21.9 +GOLANG_CROSS_VERSION = v1.21.11 GOPATH ?= '$(HOME)/go' release-dry-run: docker run \ diff --git a/go.mod b/go.mod index 81e9db711..35933663c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/ExocoreNetwork/exocore -go 1.21.9 +go 1.21.11 require ( cosmossdk.io/errors v1.0.1 diff --git a/networks/local/exocore/Dockerfile b/networks/local/exocore/Dockerfile index 26042357a..5d6a67b70 100644 --- a/networks/local/exocore/Dockerfile +++ b/networks/local/exocore/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.9-alpine3.18 AS build +FROM golang:1.21.11-alpine3.18 AS build RUN apk add --no-cache build-base=0.5-r3 linux-headers=6.3-r0 git=2.40.1-r0 # Set working directory for the build WORKDIR /go/work From 685f68f4a5ec034315b73695a78ae49adffc3fd4 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 10 Jun 2024 22:45:40 +0000 Subject: [PATCH 14/27] fix(ci): disable buggy workflows till they can be fixed --- .github/workflows/proto-comment.yml | 3 ++- .github/workflows/test-comment.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/proto-comment.yml b/.github/workflows/proto-comment.yml index 596243c10..bdb58cc6c 100644 --- a/.github/workflows/proto-comment.yml +++ b/.github/workflows/proto-comment.yml @@ -18,7 +18,8 @@ jobs: download-artifact-and-comment: runs-on: ubuntu-latest if: > - github.event.workflow_run.conclusion == 'success' + github.event.workflow_run.conclusion == 'success' && + ${{ false }} steps: - name: 'Download artifact' uses: actions/github-script@v7.0.1 diff --git a/.github/workflows/test-comment.yml b/.github/workflows/test-comment.yml index 9fc63ddca..cbe7a5722 100644 --- a/.github/workflows/test-comment.yml +++ b/.github/workflows/test-comment.yml @@ -20,7 +20,8 @@ jobs: runs-on: ubuntu-latest if: > github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' + github.event.workflow_run.conclusion == 'success' && + ${{ false }} steps: - name: Download artifact uses: actions/github-script@v7.0.1 From 1b4365a9707981c23627d97a286f28a0e992ba5f Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 10 Jun 2024 22:57:07 +0000 Subject: [PATCH 15/27] chore: lint --- .github/workflows/proto-comment.yml | 4 +--- .github/workflows/test-comment.yml | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/proto-comment.yml b/.github/workflows/proto-comment.yml index bdb58cc6c..8c727c076 100644 --- a/.github/workflows/proto-comment.yml +++ b/.github/workflows/proto-comment.yml @@ -17,9 +17,7 @@ on: jobs: download-artifact-and-comment: runs-on: ubuntu-latest - if: > - github.event.workflow_run.conclusion == 'success' && - ${{ false }} + if: ${{ false }} steps: - name: 'Download artifact' uses: actions/github-script@v7.0.1 diff --git a/.github/workflows/test-comment.yml b/.github/workflows/test-comment.yml index cbe7a5722..eac81ec3f 100644 --- a/.github/workflows/test-comment.yml +++ b/.github/workflows/test-comment.yml @@ -18,10 +18,7 @@ on: jobs: download-artifact-and-comment: runs-on: ubuntu-latest - if: > - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' && - ${{ false }} + if: ${{ false }} steps: - name: Download artifact uses: actions/github-script@v7.0.1 From 97723ede43249cb97cfca1729de8f14e973b8f85 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Wed, 12 Jun 2024 03:38:10 +0000 Subject: [PATCH 16/27] fix(dogfood): don't stop iterating in export The return value should be `false` to continue --- x/dogfood/keeper/genesis.go | 2 +- x/dogfood/keeper/impl_sdk.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x/dogfood/keeper/genesis.go b/x/dogfood/keeper/genesis.go index f59a61c46..8945918c7 100644 --- a/x/dogfood/keeper/genesis.go +++ b/x/dogfood/keeper/genesis.go @@ -121,7 +121,7 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { Power: val.GetConsensusPower(sdk.DefaultPowerReduction), }, ) - return true + return false /* stop */ }) return types.NewGenesis( k.GetDogfoodParams(ctx), diff --git a/x/dogfood/keeper/impl_sdk.go b/x/dogfood/keeper/impl_sdk.go index b29aace59..ded2d6300 100644 --- a/x/dogfood/keeper/impl_sdk.go +++ b/x/dogfood/keeper/impl_sdk.go @@ -164,7 +164,7 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates( // IterateBondedValidatorsByPower is an implementation of the staking interface expected by // the SDK's gov module and by our oracle module. func (k Keeper) IterateBondedValidatorsByPower( - ctx sdk.Context, f func(int64, stakingtypes.ValidatorI) bool, + ctx sdk.Context, f func(int64, stakingtypes.ValidatorI) (stop bool), ) { prevList := k.GetAllExocoreValidators(ctx) sort.SliceStable(prevList, func(i, j int) bool { From 2a8f1ae3465584e746728c2054cdef56a21305be Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Wed, 12 Jun 2024 04:02:34 +0000 Subject: [PATCH 17/27] fix(doc): add comment about exported validators --- app/export.go | 7 +++++-- app/test_helpers.go | 5 ++++- testutil/utils.go | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/export.go b/app/export.go index 28b759397..20d95fb8d 100644 --- a/app/export.go +++ b/app/export.go @@ -16,7 +16,6 @@ import ( slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" evmtypes "github.com/evmos/evmos/v14/x/evm/types" - tmtypes "github.com/cometbft/cometbft/types" "github.com/evmos/evmos/v14/encoding" ) @@ -76,9 +75,13 @@ func (app *ExocoreApp) ExportAppStateAndValidators( return servertypes.ExportedApp{}, err } + // the x/dogfood validator set is exported in its `val_set` key, and hence, + // does not need to be part of the app export. in other words, we do not + // duplicate the exported validator set. besides, as far as i can tell, the + // SDK does not use the Validators member of the ExportedApp struct. + return servertypes.ExportedApp{ AppState: appState, - Validators: []tmtypes.GenesisValidator{}, // exported directly in dogfood Height: height, ConsensusParams: app.BaseApp.GetConsensusParams(ctx), }, nil diff --git a/app/test_helpers.go b/app/test_helpers.go index f1c223244..84f1cedda 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -268,6 +268,8 @@ func GenesisStateWithValSet(app *ExocoreApp, genesisState simapp.GenesisState, delegationGenesis := delegationtypes.NewGenesis(delegationsByStaker) genesisState[delegationtypes.ModuleName] = app.AppCodec().MustMarshalJSON(delegationGenesis) + // create a dogfood genesis with just the validator set, that is, the bare + // minimum valid genesis required to start a chain. dogfoodGenesis := dogfoodtypes.NewGenesis( dogfoodtypes.DefaultParams(), []dogfoodtypes.GenesisValidator{ { @@ -276,7 +278,8 @@ func GenesisStateWithValSet(app *ExocoreApp, genesisState simapp.GenesisState, }, }, []dogfoodtypes.EpochToOperatorAddrs{}, []dogfoodtypes.EpochToConsensusAddrs{}, - []dogfoodtypes.EpochToUndelegationRecordKeys{}, math.NewInt(1), + []dogfoodtypes.EpochToUndelegationRecordKeys{}, + math.NewInt(1), // total vote power ) genesisState[dogfoodtypes.ModuleName] = app.AppCodec().MustMarshalJSON(dogfoodGenesis) diff --git a/testutil/utils.go b/testutil/utils.go index 09ba99cee..a1ad89754 100644 --- a/testutil/utils.go +++ b/testutil/utils.go @@ -229,6 +229,8 @@ func (suite *BaseTestSuite) SetupWithGenesisValSet(genAccs []authtypes.GenesisAc delegationGenesis := delegationtypes.NewGenesis(delegationsByStaker) genesisState[delegationtypes.ModuleName] = app.AppCodec().MustMarshalJSON(delegationGenesis) + // create a dogfood genesis with just the validator set, that is, the bare + // minimum valid genesis required to start a chain. dogfoodGenesis := dogfoodtypes.NewGenesis( dogfoodtypes.DefaultParams(), []dogfoodtypes.GenesisValidator{ { @@ -243,7 +245,7 @@ func (suite *BaseTestSuite) SetupWithGenesisValSet(genAccs []authtypes.GenesisAc []dogfoodtypes.EpochToOperatorAddrs{}, []dogfoodtypes.EpochToConsensusAddrs{}, []dogfoodtypes.EpochToUndelegationRecordKeys{}, - math.NewInt(2), + math.NewInt(2), // must match total vote power ) genesisState[dogfoodtypes.ModuleName] = app.AppCodec().MustMarshalJSON(dogfoodGenesis) From e8731d0f95f092f5193c46c9c6a3a00226a6af29 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Wed, 12 Jun 2024 04:16:18 +0000 Subject: [PATCH 18/27] doc(dogfood): log iteration failure If such an iteration failure happens during export, a pipe to `jq` will fail and inform the user of the failure. --- x/dogfood/keeper/impl_sdk.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/dogfood/keeper/impl_sdk.go b/x/dogfood/keeper/impl_sdk.go index ded2d6300..a3c74e5c3 100644 --- a/x/dogfood/keeper/impl_sdk.go +++ b/x/dogfood/keeper/impl_sdk.go @@ -173,14 +173,14 @@ func (k Keeper) IterateBondedValidatorsByPower( for i, v := range prevList { pk, err := v.ConsPubKey() if err != nil { - // will only happen if there is an error in deserialization. + ctx.Logger().Error("Failed to deserialize public key; skipping", "error", err, "i", i) continue } found, addr := k.operatorKeeper.GetOperatorAddressForChainIDAndConsAddr( ctx, ctx.ChainID(), sdk.GetConsAddress(pk), ) if !found { - // this should never happen. should we panic? + ctx.Logger().Error("Operator address not found; skipping", "consAddress", sdk.GetConsAddress(pk), "i", i) continue } val, err := stakingtypes.NewValidator( @@ -188,7 +188,7 @@ func (k Keeper) IterateBondedValidatorsByPower( pk, stakingtypes.Description{ /* TODO */ }, ) if err != nil { - // will only happen if there is an error in deserialization. + ctx.Logger().Error("Failed to create validator; skipping", "error", err, "i", i) continue } // allow calculation of power From e983c46aac8327d014421ffdcb497f0d40b90d28 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Wed, 12 Jun 2024 04:26:29 +0000 Subject: [PATCH 19/27] docs(delegation): validation of record key params --- x/delegation/types/keys.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x/delegation/types/keys.go b/x/delegation/types/keys.go index 83bf0f984..9fb5ba84a 100644 --- a/x/delegation/types/keys.go +++ b/x/delegation/types/keys.go @@ -75,6 +75,8 @@ func ParseStakerAssetIDAndOperatorAddrFromKey(key []byte) (keys *SingleDelegatio return &SingleDelegationInfoReq{StakerID: stringList[0], AssetID: stringList[1], OperatorAddr: stringList[2]}, nil } +// GetUndelegationRecordKey returns the key for the undelegation record. The caller must ensure that the parameters +// are valid; this function performs no validation whatsoever. func GetUndelegationRecordKey(blockHeight, lzNonce uint64, txHash string, operatorAddr string) []byte { return []byte(strings.Join([]string{operatorAddr, hexutil.EncodeUint64(blockHeight), hexutil.EncodeUint64(lzNonce), txHash}, "/")) } From e1a9294ffe15c01fefddc5738db18115944954d0 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Sun, 16 Jun 2024 11:32:30 +0000 Subject: [PATCH 20/27] fix(app): register operator hooks for dogfood --- app/app.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/app.go b/app/app.go index cca9e7c28..8b5ac52d9 100644 --- a/app/app.go +++ b/app/app.go @@ -591,6 +591,10 @@ func NewExocoreApp( app.AssetsKeeper, // assets for vote power ) + (&app.OperatorKeeper).SetHooks( + app.StakingKeeper.OperatorHooks(), + ) + (&app.EpochsKeeper).SetHooks( app.StakingKeeper.EpochsHooks(), ) From e72979a1b68f58a9af321fcd4fe48a584546c15f Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Sun, 16 Jun 2024 11:33:51 +0000 Subject: [PATCH 21/27] feat(operator): return `OptingOut` status Whenever a query for consensus keys or addresses is answered, it should specify whether the operator is currently in the process of opting out. This is because the data is retained until the opt out is complete, even though the operator may not be actively validating. The purpose of the data retention, as always, is to slash the operator (if required), based on the key. --- proto/exocore/operator/v1/query.proto | 8 + x/operator/keeper/grpc_query.go | 6 +- x/operator/types/query.pb.go | 284 ++++++++++++++++++++------ 3 files changed, 240 insertions(+), 58 deletions(-) diff --git a/proto/exocore/operator/v1/query.proto b/proto/exocore/operator/v1/query.proto index e04768f28..757d093c8 100644 --- a/proto/exocore/operator/v1/query.proto +++ b/proto/exocore/operator/v1/query.proto @@ -45,6 +45,8 @@ message QueryOperatorConsKeyRequest { message QueryOperatorConsKeyResponse { // public_key is the consensus public key of the operator. tendermint.crypto.PublicKey public_key = 1 [ (gogoproto.nullable) = false ]; + // opting_out is a flag to indicate if the operator is opting out of consensus. + bool opting_out = 2; } // QueryOperatorConsAddressRequest is the request to obtain the consensus address of the operator @@ -63,6 +65,8 @@ message QueryOperatorConsAddressResponse { // cons_addr is the consensus address corresponding to the consensus public key // currently in use by the operator. string cons_addr = 1; + // opting_out is a flag to indicate if the operator is opting out of consensus. + bool opting_out = 2; } // QueryAllOperatorConsKeysByChainIDRequest is the request to obtain all operator addresses @@ -92,6 +96,8 @@ message OperatorConsKeyPair { string operator_acc_addr = 1; // public_key is the consensus public key of the operator. tendermint.crypto.PublicKey public_key = 2; + // opting_out is a flag to indicate if the operator is opting out of consensus. + bool opting_out = 3; } // QueryAllOperatorConsAddrsByChainIDRequest is the request to obtain all operator addresses @@ -121,6 +127,8 @@ message OperatorConsAddrPair { // cons_addr is the consensus address corresponding to the consensus public key // currently in use by the operator. string cons_addr = 2; + // opting_out is a flag to indicate if the operator is opting out of consensus. + bool opting_out = 3; } // Query defines the gRPC querier service. diff --git a/x/operator/keeper/grpc_query.go b/x/operator/keeper/grpc_query.go index c8a5fcaea..30040819b 100644 --- a/x/operator/keeper/grpc_query.go +++ b/x/operator/keeper/grpc_query.go @@ -63,6 +63,7 @@ func (k *Keeper) QueryOperatorConsKeyForChainID( } return &operatortypes.QueryOperatorConsKeyResponse{ PublicKey: *key, + OptingOut: k.IsOperatorRemovingKeyFromChainID(ctx, addr, req.Chain), }, nil } @@ -91,7 +92,8 @@ func (k Keeper) QueryOperatorConsAddressForChainID( return nil, err } return &operatortypes.QueryOperatorConsAddressResponse{ - ConsAddr: consAddr.String(), + ConsAddr: consAddr.String(), + OptingOut: k.IsOperatorRemovingKeyFromChainID(ctx, addr, req.Chain), }, nil } @@ -118,6 +120,7 @@ func (k Keeper) QueryAllOperatorConsKeysByChainID( res = append(res, &operatortypes.OperatorConsKeyPair{ OperatorAccAddr: addr.String(), PublicKey: ret, + OptingOut: k.IsOperatorRemovingKeyFromChainID(ctx, addr, req.Chain), }) return nil }) @@ -157,6 +160,7 @@ func (k Keeper) QueryAllOperatorConsAddrsByChainID( res = append(res, &operatortypes.OperatorConsAddrPair{ OperatorAccAddr: addr.String(), ConsAddr: consAddr.String(), + OptingOut: k.IsOperatorRemovingKeyFromChainID(ctx, addr, req.Chain), }) return nil }) diff --git a/x/operator/types/query.pb.go b/x/operator/types/query.pb.go index 8c82284c4..63ed4f8e5 100644 --- a/x/operator/types/query.pb.go +++ b/x/operator/types/query.pb.go @@ -240,6 +240,8 @@ func (m *QueryOperatorConsKeyRequest) GetChain() string { type QueryOperatorConsKeyResponse struct { // public_key is the consensus public key of the operator. PublicKey crypto.PublicKey `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key"` + // opting_out is a flag to indicate if the operator is opting out of consensus. + OptingOut bool `protobuf:"varint,2,opt,name=opting_out,json=optingOut,proto3" json:"opting_out,omitempty"` } func (m *QueryOperatorConsKeyResponse) Reset() { *m = QueryOperatorConsKeyResponse{} } @@ -282,6 +284,13 @@ func (m *QueryOperatorConsKeyResponse) GetPublicKey() crypto.PublicKey { return crypto.PublicKey{} } +func (m *QueryOperatorConsKeyResponse) GetOptingOut() bool { + if m != nil { + return m.OptingOut + } + return false +} + // QueryOperatorConsAddressRequest is the request to obtain the consensus address of the operator // for a specific chain ID. type QueryOperatorConsAddressRequest struct { @@ -345,6 +354,8 @@ type QueryOperatorConsAddressResponse struct { // cons_addr is the consensus address corresponding to the consensus public key // currently in use by the operator. ConsAddr string `protobuf:"bytes,1,opt,name=cons_addr,json=consAddr,proto3" json:"cons_addr,omitempty"` + // opting_out is a flag to indicate if the operator is opting out of consensus. + OptingOut bool `protobuf:"varint,2,opt,name=opting_out,json=optingOut,proto3" json:"opting_out,omitempty"` } func (m *QueryOperatorConsAddressResponse) Reset() { *m = QueryOperatorConsAddressResponse{} } @@ -387,6 +398,13 @@ func (m *QueryOperatorConsAddressResponse) GetConsAddr() string { return "" } +func (m *QueryOperatorConsAddressResponse) GetOptingOut() bool { + if m != nil { + return m.OptingOut + } + return false +} + // QueryAllOperatorConsKeysByChainIDRequest is the request to obtain all operator addresses // and consensus keys for a specific chain ID, with pagination. type QueryAllOperatorConsKeysByChainIDRequest struct { @@ -514,6 +532,8 @@ type OperatorConsKeyPair struct { OperatorAccAddr string `protobuf:"bytes,1,opt,name=operator_acc_addr,json=operatorAccAddr,proto3" json:"operator_acc_addr,omitempty"` // public_key is the consensus public key of the operator. PublicKey *crypto.PublicKey `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` + // opting_out is a flag to indicate if the operator is opting out of consensus. + OptingOut bool `protobuf:"varint,3,opt,name=opting_out,json=optingOut,proto3" json:"opting_out,omitempty"` } func (m *OperatorConsKeyPair) Reset() { *m = OperatorConsKeyPair{} } @@ -563,6 +583,13 @@ func (m *OperatorConsKeyPair) GetPublicKey() *crypto.PublicKey { return nil } +func (m *OperatorConsKeyPair) GetOptingOut() bool { + if m != nil { + return m.OptingOut + } + return false +} + // QueryAllOperatorConsAddrsByChainIDRequest is the request to obtain all operator addresses // and consensus addresses for a specific chain ID, with pagination. type QueryAllOperatorConsAddrsByChainIDRequest struct { @@ -692,6 +719,8 @@ type OperatorConsAddrPair struct { // cons_addr is the consensus address corresponding to the consensus public key // currently in use by the operator. ConsAddr string `protobuf:"bytes,2,opt,name=cons_addr,json=consAddr,proto3" json:"cons_addr,omitempty"` + // opting_out is a flag to indicate if the operator is opting out of consensus. + OptingOut bool `protobuf:"varint,3,opt,name=opting_out,json=optingOut,proto3" json:"opting_out,omitempty"` } func (m *OperatorConsAddrPair) Reset() { *m = OperatorConsAddrPair{} } @@ -741,6 +770,13 @@ func (m *OperatorConsAddrPair) GetConsAddr() string { return "" } +func (m *OperatorConsAddrPair) GetOptingOut() bool { + if m != nil { + return m.OptingOut + } + return false +} + func init() { proto.RegisterType((*GetOperatorInfoReq)(nil), "exocore.operator.v1.GetOperatorInfoReq") proto.RegisterType((*QueryAllOperatorsRequest)(nil), "exocore.operator.v1.QueryAllOperatorsRequest") @@ -760,63 +796,65 @@ func init() { func init() { proto.RegisterFile("exocore/operator/v1/query.proto", fileDescriptor_f91e795a3cecbdbf) } var fileDescriptor_f91e795a3cecbdbf = []byte{ - // 891 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xdf, 0x4f, 0xd3, 0x50, - 0x14, 0x5e, 0xa7, 0x18, 0x77, 0xd1, 0x28, 0x97, 0x3d, 0x8c, 0x42, 0x06, 0x34, 0x46, 0xc6, 0x22, - 0xad, 0x1b, 0xe0, 0x83, 0x88, 0x84, 0xf1, 0x2b, 0x88, 0x51, 0x2c, 0x89, 0x89, 0xbe, 0x2c, 0x5d, - 0x77, 0x29, 0x0d, 0xa3, 0xb7, 0xb4, 0x1d, 0xd2, 0x10, 0x7c, 0xf0, 0x49, 0xdf, 0x8c, 0x3e, 0x9a, - 0xf8, 0x57, 0xf8, 0x1f, 0xf8, 0xc2, 0x83, 0x0f, 0xa8, 0x2f, 0x3e, 0xa1, 0x61, 0xfe, 0x21, 0xa6, - 0xb7, 0xb7, 0x5b, 0x3b, 0xba, 0xad, 0x23, 0xc4, 0xb7, 0xb5, 0x3d, 0xf7, 0x7c, 0xdf, 0x77, 0xce, - 0x77, 0xcf, 0x19, 0x18, 0x46, 0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x8a, 0x4c, 0x0b, - 0x2e, 0x03, 0xd0, 0xa8, 0x07, 0xc9, 0xdb, 0x9b, 0xbf, 0xcd, 0xd3, 0xa4, 0x4e, 0xf1, 0x78, 0xb7, - 0xd4, 0xb4, 0x78, 0xfc, 0xba, 0xa4, 0x20, 0x7a, 0x56, 0xf4, 0x9d, 0xe4, 0x3e, 0x30, 0x60, 0x20, - 0x04, 0xc4, 0xd4, 0xb1, 0x66, 0x22, 0x78, 0x07, 0xc0, 0x86, 0x00, 0x59, 0x26, 0x22, 0xcc, 0x14, - 0x33, 0x72, 0x29, 0x93, 0x10, 0x6f, 0xd6, 0xb9, 0xca, 0xb2, 0x43, 0xd7, 0x84, 0x2b, 0x01, 0x4e, - 0x71, 0xc2, 0x69, 0xac, 0x23, 0x27, 0x17, 0x2a, 0x40, 0xaa, 0x08, 0x06, 0x09, 0x27, 0x8f, 0xd0, - 0x02, 0xd6, 0xcc, 0x35, 0x64, 0x7b, 0xda, 0xb3, 0xa0, 0xef, 0x0c, 0x2b, 0xb7, 0xb4, 0xe2, 0x8d, - 0x26, 0x52, 0x30, 0x09, 0x7a, 0xe4, 0x2d, 0x49, 0x75, 0xe9, 0x24, 0x44, 0xf7, 0x81, 0x93, 0xc0, - 0x50, 0x38, 0x00, 0xd5, 0x3d, 0x0f, 0x80, 0x5e, 0x2d, 0x55, 0x54, 0xb9, 0xb8, 0x8d, 0x6c, 0x5a, - 0xdd, 0x21, 0xbe, 0xe1, 0x00, 0xde, 0x75, 0x00, 0xbf, 0x4e, 0x82, 0xd6, 0x90, 0x5d, 0xb8, 0x7c, - 0x74, 0x32, 0x1c, 0x13, 0x13, 0xba, 0xf7, 0x82, 0x93, 0xc1, 0xf0, 0x19, 0x08, 0xda, 0xec, 0x8b, - 0xd3, 0x31, 0x07, 0x46, 0x5a, 0x83, 0x50, 0x2d, 0x83, 0x20, 0x21, 0x63, 0xcd, 0xf4, 0x67, 0xbf, - 0x2a, 0xd3, 0x38, 0xee, 0x2d, 0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, 0x1d, 0x3b, 0xae, 0xa5, 0x63, 0xbf, 0x6a, 0xe9, 0xd8, 0xcb, 0xbc, 0xa2, 0x5a, 0x5b, - 0xd5, 0x12, 0x2f, 0xe3, 0x1d, 0x61, 0xc9, 0xcd, 0xfc, 0x04, 0x59, 0xaf, 0xb0, 0xb1, 0x5d, 0x07, - 0xda, 0x6f, 0x40, 0x59, 0xb6, 0x8e, 0xcc, 0xd2, 0x15, 0xf2, 0x67, 0x7b, 0xf2, 0x5f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xae, 0x71, 0x00, 0xfa, 0x5b, 0x0c, 0x00, 0x00, + // 928 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x4f, 0xe3, 0x46, + 0x14, 0xce, 0x84, 0x52, 0x91, 0xa1, 0x55, 0xcb, 0x90, 0x43, 0x30, 0x34, 0x80, 0x55, 0x95, 0x10, + 0x15, 0xbb, 0x09, 0xd0, 0x43, 0x29, 0xad, 0x08, 0xbf, 0x44, 0xa9, 0x0a, 0x35, 0x52, 0xa5, 0xf6, + 0xd0, 0xc8, 0x71, 0x06, 0x63, 0x11, 0x3c, 0xc6, 0x9e, 0x50, 0x2c, 0x44, 0x55, 0xf5, 0xd4, 0xde, + 0xaa, 0xf6, 0x58, 0xb5, 0x7f, 0xc5, 0xfe, 0x07, 0x7b, 0xe1, 0xb0, 0x07, 0x76, 0xf7, 0xb2, 0x27, + 0x76, 0x45, 0xf6, 0x0f, 0x59, 0x79, 0x3c, 0x4e, 0xe2, 0xe0, 0x24, 0x0e, 0x42, 0x7b, 0x8b, 0xed, + 0x37, 0xef, 0xfb, 0xbe, 0xf7, 0xbe, 0x79, 0x2f, 0x70, 0x1a, 0x9f, 0x13, 0x8d, 0xd8, 0x58, 0x26, + 0x16, 0xb6, 0x55, 0x4a, 0x6c, 0xf9, 0xac, 0x20, 0x9f, 0xd6, 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78, 0x92, 0x5f, 0x6a, 0x5e, 0x3c, 0x69, 0x5f, 0xd5, 0x31, 0x3f, 0xab, 0xb4, 0x9d, 0x14, + 0xff, 0x06, 0x70, 0x22, 0x02, 0xc4, 0xb1, 0x88, 0xe9, 0x60, 0xf4, 0x29, 0x44, 0x2d, 0x01, 0x9a, + 0xc6, 0x44, 0x38, 0x19, 0x30, 0x33, 0x94, 0x4b, 0x29, 0x1f, 0x36, 0xb9, 0x6a, 0x9a, 0x47, 0xd7, + 0x41, 0xdb, 0x21, 0x4e, 0x49, 0xc6, 0x69, 0xae, 0x2f, 0x27, 0x1f, 0x2a, 0x44, 0xaa, 0x0c, 0x27, + 0x19, 0xa7, 0x80, 0xd0, 0x3a, 0x31, 0x9d, 0x5d, 0xec, 0x06, 0xda, 0xf3, 0x70, 0xec, 0x0e, 0x2b, + 0xbf, 0xb4, 0xca, 0x07, 0x1d, 0xa4, 0x50, 0x1a, 0x0e, 0x6b, 0x47, 0xaa, 0xe1, 0xd3, 0x49, 0x29, + 0xfe, 0x83, 0xf8, 0x1b, 0x80, 0x53, 0xd1, 0x08, 0x5c, 0xf8, 0x1a, 0x84, 0x56, 0xbd, 0x52, 0x33, + 0xb4, 0xf2, 0x31, 0x76, 0x79, 0x79, 0xa7, 0xa4, 0x96, 0x05, 0x24, 0xdf, 0x02, 0xd2, 0x3e, 0x0b, + 0xda, 0xc5, 0x6e, 0xe9, 0x9d, 0xab, 0x9b, 0xe9, 0x84, 0x92, 0xb2, 0x82, 0x17, 0xe8, 0x23, 0x08, + 0x89, 0x45, 0x0d, 0x53, 0x2f, 0x93, 0x3a, 0x65, 0xf0, 0x23, 0x4a, 0xca, 0x7f, 0xb3, 0x57, 0xa7, + 0xa2, 0x06, 0xa7, 0xef, 0x30, 0xe0, 0x66, 0x78, 0x38, 0x9d, 0x3f, 0xc3, 0x99, 0xee, 0x20, 0x5c, + 0xea, 0x24, 0x4c, 0x69, 0xc4, 0x74, 0xda, 0xb3, 0x8f, 0x68,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0x24, 0x1b, 0xe5, 0x81, 0xca, 0xd2, 0xb7, 0x57, 0xb7, 0x59, 0x70, 0x7d, 0x9b, + 0x05, 0xaf, 0x6e, 0xb3, 0xe0, 0xaf, 0x46, 0x36, 0x71, 0xdd, 0xc8, 0x26, 0x5e, 0x34, 0xb2, 0x89, + 0x9f, 0x8a, 0xba, 0x41, 0x8f, 0xea, 0x15, 0x49, 0x23, 0x27, 0xf2, 0xa6, 0x9f, 0xf9, 0x3b, 0x4c, + 0x7f, 0x21, 0xf6, 0x71, 0x13, 0xe8, 0xbc, 0x05, 0x45, 0x5d, 0x0b, 0x3b, 0x95, 0x77, 0xd9, 0x5f, + 0xfd, 0xc5, 0x37, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3a, 0xfd, 0xf5, 0x2b, 0xd9, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1261,6 +1299,16 @@ func (m *QueryOperatorConsKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, e _ = i var l int _ = l + if m.OptingOut { + i-- + if m.OptingOut { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } { size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1331,6 +1379,16 @@ func (m *QueryOperatorConsAddressResponse) MarshalToSizedBuffer(dAtA []byte) (in _ = i var l int _ = l + if m.OptingOut { + i-- + if m.OptingOut { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } if len(m.ConsAddr) > 0 { i -= len(m.ConsAddr) copy(dAtA[i:], m.ConsAddr) @@ -1452,6 +1510,16 @@ func (m *OperatorConsKeyPair) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.OptingOut { + i-- + if m.OptingOut { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } if m.PublicKey != nil { { size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i]) @@ -1585,6 +1653,16 @@ func (m *OperatorConsAddrPair) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.OptingOut { + i-- + if m.OptingOut { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } if len(m.ConsAddr) > 0 { i -= len(m.ConsAddr) copy(dAtA[i:], m.ConsAddr) @@ -1683,6 +1761,9 @@ func (m *QueryOperatorConsKeyResponse) Size() (n int) { _ = l l = m.PublicKey.Size() n += 1 + l + sovQuery(uint64(l)) + if m.OptingOut { + n += 2 + } return n } @@ -1713,6 +1794,9 @@ func (m *QueryOperatorConsAddressResponse) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + if m.OptingOut { + n += 2 + } return n } @@ -1766,6 +1850,9 @@ func (m *OperatorConsKeyPair) Size() (n int) { l = m.PublicKey.Size() n += 1 + l + sovQuery(uint64(l)) } + if m.OptingOut { + n += 2 + } return n } @@ -1819,6 +1906,9 @@ func (m *OperatorConsAddrPair) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + if m.OptingOut { + n += 2 + } return n } @@ -2290,6 +2380,26 @@ func (m *QueryOperatorConsKeyResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptingOut", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptingOut = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -2486,6 +2596,26 @@ func (m *QueryOperatorConsAddressResponse) Unmarshal(dAtA []byte) error { } m.ConsAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptingOut", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptingOut = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -2842,6 +2972,26 @@ func (m *OperatorConsKeyPair) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptingOut", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptingOut = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3194,6 +3344,26 @@ func (m *OperatorConsAddrPair) Unmarshal(dAtA []byte) error { } m.ConsAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptingOut", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptingOut = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) From 03623e626cb6004d1422399ef669ce103a1188b9 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Sun, 16 Jun 2024 11:39:08 +0000 Subject: [PATCH 22/27] refactor(operator): rationalize opt-in/out When an operator opts into an AVS, they should be required to supply the consensus (or other) key to opt-in. Similarly, when they opt-out, the key should automatically be removed. This commit implements that functionality, however, it is restricted to `ctx.ChainID()`. For an overbroad implementation, an AVS registry from AVS address -> key type should be implemented. --- proto/exocore/operator/v1/tx.proto | 26 +- x/operator/client/cli/tx.go | 33 +- x/operator/keeper/consensus_keys.go | 36 +- x/operator/keeper/msg_server.go | 61 ++- x/operator/keeper/operator.go | 9 +- x/operator/keeper/opt.go | 39 +- x/operator/types/codec.go | 1 - x/operator/types/consensus_keys.go | 15 + x/operator/types/msg.go | 43 +- x/operator/types/tx.pb.go | 581 ++++++---------------------- 10 files changed, 231 insertions(+), 613 deletions(-) diff --git a/proto/exocore/operator/v1/tx.proto b/proto/exocore/operator/v1/tx.proto index 51375767b..889a7ac4e 100644 --- a/proto/exocore/operator/v1/tx.proto +++ b/proto/exocore/operator/v1/tx.proto @@ -145,6 +145,9 @@ message OptIntoAVSReq { [(cosmos_proto.scalar) = "cosmos.AddressString"]; // avs_address is the address of the AVS - either an 0x address or a chainID. string avs_address = 2; + // optional parameter to provide the consensus key or the BLS key, depending + // on the AVS. we still have to design this fully. + string public_key = 3; } // OptIntoAVSResponse is the response to a opt into an AVS request. @@ -187,33 +190,16 @@ message SetConsKeyReq { // SetConsKeyResponse is the response to SetConsKeyReq. message SetConsKeyResponse {} -// InitConsKeyRemovalReq is the request for an operator to stop validating on a chain. It -// allows the operator to remove their consensus key from the specified chain. It must be -// followed by a separate call to OptOutOfAVS to remove the operator from the AVS. -message InitConsKeyRemovalReq { - option (cosmos.msg.v1.signer) = "address"; - option (amino.name) = "cosmos-sdk/InitConsKeyRemovalReq"; - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - // address is the operator address - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // chain_id is the identifier for the chain that wants to opt out. - string chain_id = 2 [(gogoproto.customname) = "ChainID"]; -} - -// InitConsKeyRemovalResponse defines the InitConsKeyRemovalReq response. -message InitConsKeyRemovalResponse {} - // Msg defines the operator Msg service. service Msg { option (cosmos.msg.v1.service) = true; // RegisterOperator registers a new operator. rpc RegisterOperator(RegisterOperatorReq) returns (RegisterOperatorResponse); - // SetConsKey sets the operator's consensus key for a chain. + // SetConsKey sets the operator's consensus key for a chain. To do this, the operator + // must have previously opted into the chain. + // TODO; rationalize this with non-chain AVSs wherein other keys can be set. rpc SetConsKey(SetConsKeyReq) returns (SetConsKeyResponse) {}; - // InitConsKeyRemoval removes the operator's consensus key for a chain. - rpc InitConsKeyRemoval(InitConsKeyRemovalReq) returns (InitConsKeyRemovalResponse) {}; // OptIntoAVS opts an operator into an AVS. rpc OptIntoAVS(OptIntoAVSReq) returns (OptIntoAVSResponse); diff --git a/x/operator/client/cli/tx.go b/x/operator/client/cli/tx.go index 1131d7711..b36347d63 100644 --- a/x/operator/client/cli/tx.go +++ b/x/operator/client/cli/tx.go @@ -42,7 +42,6 @@ func NewTxCmd() *cobra.Command { // are they really a property of the operator or of the respective AVS? // operator vs dogfood vs appchain coordinator CmdSetConsKey(), - CmdInitConsKeyRemoval(), ) return txCmd } @@ -194,9 +193,10 @@ func buildCommission(rateStr, maxRateStr, maxChangeRateStr string) ( // CmdOptIntoAVS returns a CLI command handler for creating a OptIntoAVSReq transaction. func CmdOptIntoAVS() *cobra.Command { cmd := &cobra.Command{ - Use: "opt-into-avs ", - Short: "opt into an AVS by specifying its address or the chain id", - Args: cobra.ExactArgs(1), + Use: "opt-into-avs ", + Short: "opt into an AVS by specifying its address or the chain id, with an optional public key", + Example: "exocore tx operator opt-into-avs exocoretestnet_233-1 $(exocored tendermint show-validator)", + Args: cobra.RangeArgs(1, 2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -206,6 +206,9 @@ func CmdOptIntoAVS() *cobra.Command { FromAddress: clientCtx.GetFromAddress().String(), AvsAddress: args[0], } + if len(args) == 2 { + msg.PublicKey = args[1] + } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } @@ -254,25 +257,3 @@ func CmdSetConsKey() *cobra.Command { } return cmd } - -// CmdInitConsKeyRemoval returns a CLI command handler for creating an InitConsKeyRemovalReq -// transaction. -func CmdInitConsKeyRemoval() *cobra.Command { - cmd := &cobra.Command{ - Use: "init-cons-key-removal ", - Short: "initiate consensus key removal for a chain", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - msg := &types.InitConsKeyRemovalReq{ - Address: clientCtx.GetFromAddress().String(), - ChainID: args[0], - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - return cmd -} diff --git a/x/operator/keeper/consensus_keys.go b/x/operator/keeper/consensus_keys.go index 0f403b1fb..2816979d6 100644 --- a/x/operator/keeper/consensus_keys.go +++ b/x/operator/keeper/consensus_keys.go @@ -256,39 +256,19 @@ func (k Keeper) GetOperatorAddressForChainIDAndConsAddr( } // InitiateOperatorKeyRemovalForChainID initiates an operator removing their key from the -// chain id. It validates whether the operator is registered, and that it is not frozen, and -// that the chain is present within the system. It also checks if the operator is already -// removing the key. -// The operator must first call this method, and then call `OptOut` to complete the process. -// TODO: currently there is no penalty for operators failing to complete this and the data -// is also mismatched (ex: while the operator is removed from the validator set, the opt out -// height is the height of calling OptOut). We should rationalize this somehow. +// chain id. The caller must validate that the chainID is registered and that the address +// is an operator, that is not frozen, and that the operator is currently opted in. func (k *Keeper) InitiateOperatorKeyRemovalForChainID( ctx sdk.Context, opAccAddr sdk.AccAddress, chainID string, -) error { - // check if we are an operator - if !k.IsOperator(ctx, opAccAddr) { - return delegationtypes.ErrOperatorNotExist - } - // check for slashing - if k.slashKeeper.IsOperatorFrozen(ctx, opAccAddr) { - return delegationtypes.ErrOperatorIsFrozen - } - // check if the chain id is valid - if chainID != ctx.ChainID() { - return types.ErrUnknownChainID - } - found, key := k.getOperatorConsKeyForChainID(ctx, opAccAddr, chainID) - if !found { - return types.ErrNotOptedIn - } - if k.IsOperatorRemovingKeyFromChainID(ctx, opAccAddr, chainID) { - return types.ErrAlreadyRemovingKey - } +) { + // found will always be true, since the operator has registered into the chain + // and during registration a key must be set. + _, key := k.getOperatorConsKeyForChainID(ctx, opAccAddr, chainID) + // we don't check if the operator is already opted out, because this function + // can only be called if the operator is currently opted in. store := ctx.KVStore(k.storeKey) store.Set(types.KeyForOperatorKeyRemovalForChainID(opAccAddr, chainID), []byte{}) k.Hooks().AfterOperatorKeyRemovalInitiated(ctx, opAccAddr, chainID, key) - return nil } // IsOperatorRemovingKeyFromChainID returns true if the operator is removing the consensus diff --git a/x/operator/keeper/msg_server.go b/x/operator/keeper/msg_server.go index b26fbe44f..2f79e3771 100644 --- a/x/operator/keeper/msg_server.go +++ b/x/operator/keeper/msg_server.go @@ -3,6 +3,7 @@ package keeper import ( context "context" + errorsmod "cosmossdk.io/errors" "github.com/ExocoreNetwork/exocore/x/operator/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -20,23 +21,55 @@ func (k *Keeper) RegisterOperator(ctx context.Context, req *types.RegisterOperat } // OptIntoAVS is an implementation of the msg server for the operator module. -func (k Keeper) OptIntoAVS(ctx context.Context, req *types.OptIntoAVSReq) (*types.OptIntoAVSResponse, error) { - c := sdk.UnwrapSDKContext(ctx) +func (k Keeper) OptIntoAVS(ctx context.Context, req *types.OptIntoAVSReq) (res *types.OptIntoAVSResponse, err error) { + uncachedCtx := sdk.UnwrapSDKContext(ctx) + // only write if both calls succeed + c, writeFunc := uncachedCtx.CacheContext() + defer func() { + if err == nil { + writeFunc() + } + }() + // TODO: use some form of an AVS to key-type registry here, possibly from within the AVS module to determine + // if a key is required and that it is appropriately supplied. + if req.AvsAddress == c.ChainID() { + if len(req.PublicKey) == 0 { + return nil, errorsmod.Wrap(types.ErrInvalidPubKey, "a key is required but was not supplied") + } + } else { + if len(req.PublicKey) > 0 { + return nil, errorsmod.Wrap(types.ErrInvalidPubKey, "a key is not required but was supplied") + } + } // #nosec G703 // already validated accAddr, _ := sdk.AccAddressFromBech32(req.FromAddress) - err := k.OptIn(c, accAddr, req.AvsAddress) + err = k.OptIn(c, accAddr, req.AvsAddress) if err != nil { return nil, err } + if len(req.PublicKey) > 0 { + // we have to validate just the key; we previously validated that ctx.ChainID() == req.AvsAddress + keyObj, _ := types.ValidateConsensusKeyJSON(req.PublicKey) + if err := k.SetOperatorConsKeyForChainID(c, accAddr, req.AvsAddress, keyObj); err != nil { + return nil, err + } + } return &types.OptIntoAVSResponse{}, nil } // OptOutOfAVS is an implementation of the msg server for the operator module. -func (k Keeper) OptOutOfAVS(ctx context.Context, req *types.OptOutOfAVSReq) (*types.OptOutOfAVSResponse, error) { - c := sdk.UnwrapSDKContext(ctx) +func (k Keeper) OptOutOfAVS(ctx context.Context, req *types.OptOutOfAVSReq) (res *types.OptOutOfAVSResponse, err error) { + uncachedCtx := sdk.UnwrapSDKContext(ctx) + // only write if both calls succeed + c, writeFunc := uncachedCtx.CacheContext() + defer func() { + if err == nil { + writeFunc() + } + }() // #nosec G703 // already validated accAddr, _ := sdk.AccAddressFromBech32(req.FromAddress) - err := k.OptOut(c, accAddr, req.AvsAddress) + err = k.OptOut(c, accAddr, req.AvsAddress) if err != nil { return nil, err } @@ -48,24 +81,10 @@ func (k Keeper) SetConsKey(ctx context.Context, req *types.SetConsKeyReq) (*type c := sdk.UnwrapSDKContext(ctx) // #nosec G703 // already validated accAddr, _ := sdk.AccAddressFromBech32(req.Address) - // #nosec G703 // already validated, including type - _, keyString, _ := types.ParseConsensusKeyFromJSON(req.PublicKey) // #nosec G703 // already validated - keyObj, _ := types.StringToPubKey(keyString) + keyObj, _ := types.ValidateConsensusKeyJSON(req.PublicKey) if err := k.SetOperatorConsKeyForChainID(c, accAddr, req.ChainID, keyObj); err != nil { return nil, err } return &types.SetConsKeyResponse{}, nil } - -// InitConsKeyRemoval is an implementation of the msg server for the operator module. -func (k Keeper) InitConsKeyRemoval(ctx context.Context, req *types.InitConsKeyRemovalReq) (*types.InitConsKeyRemovalResponse, error) { - c := sdk.UnwrapSDKContext(ctx) - // #nosec G703 // already validated - accAddr, _ := sdk.AccAddressFromBech32(req.Address) - err := k.InitiateOperatorKeyRemovalForChainID(c, accAddr, req.ChainID) - if err != nil { - return nil, err - } - return &types.InitConsKeyRemovalResponse{}, nil -} diff --git a/x/operator/keeper/operator.go b/x/operator/keeper/operator.go index e0e7afa29..20fde39a2 100644 --- a/x/operator/keeper/operator.go +++ b/x/operator/keeper/operator.go @@ -157,10 +157,7 @@ func (k *Keeper) IsOptedIn(ctx sdk.Context, operatorAddr, avsAddr string) bool { if err != nil { return false } - if optedInfo.OptedOutHeight != operatortypes.DefaultOptedOutHeight { - return false - } - return true + return optedInfo.OptedOutHeight == operatortypes.DefaultOptedOutHeight } func (k *Keeper) IsActive(ctx sdk.Context, operatorAddr sdk.AccAddress, avsAddr string) bool { @@ -177,10 +174,6 @@ func (k *Keeper) IsActive(ctx sdk.Context, operatorAddr sdk.AccAddress, avsAddr // frozen - either temporarily or permanently return false } - if avsAddr == ctx.ChainID() { - // if in the process of opting out, return false - return !k.IsOperatorRemovingKeyFromChainID(ctx, operatorAddr, avsAddr) - } return true } diff --git a/x/operator/keeper/opt.go b/x/operator/keeper/opt.go index 2bfcff6b0..7a9b92105 100644 --- a/x/operator/keeper/opt.go +++ b/x/operator/keeper/opt.go @@ -57,7 +57,21 @@ func (k *Keeper) OptIn(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr } // OptOut call this function to opt out of AVS -func (k *Keeper) OptOut(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr string) error { +func (k *Keeper) OptOut(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr string) (err error) { + // avsAddr should be an evm contract address or a chain id. + if !common.IsHexAddress(avsAddr) { + if avsAddr != ctx.ChainID() { // TODO: other chain ids besides this chain's. + return types.ErrInvalidAvsAddr + } else { + defer func() { + if err == nil { + // does not fail, because it performs no validations that this function + // has not already performed. + k.InitiateOperatorKeyRemovalForChainID(ctx, operatorAddress, avsAddr) + } + }() + } + } if !k.IsOperator(ctx, operatorAddress) { return delegationtypes.ErrOperatorNotExist } @@ -65,26 +79,15 @@ func (k *Keeper) OptOut(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr if !k.IsOptedIn(ctx, operatorAddress.String(), avsAddr) { return types.ErrNotOptedIn } - if !common.IsHexAddress(avsAddr) { - if avsAddr == ctx.ChainID() { - found, _ := k.getOperatorConsKeyForChainID(ctx, operatorAddress, avsAddr) - if found { - // if the key exists, it should be in the process of being removed. - // TODO: if slashing is moved to a snapshot approach, opt out should only be - // performed if the key doesn't exist. - if !k.IsOperatorRemovingKeyFromChainID(ctx, operatorAddress, avsAddr) { - return types.ErrOperatorNotRemovingKey - } - } - } else { - return types.ErrInvalidAvsAddr - } + // do not allow frozen operators to do anything meaningful + if k.slashKeeper.IsOperatorFrozen(ctx, operatorAddress) { + return delegationtypes.ErrOperatorIsFrozen } // DeleteOperatorUSDValue, delete the operator voting power, it can facilitate to // update the voting powers of all opted-in operators at the end of epoch. // there isn't going to be any reward for the operator in this opted-out epoch. - err := k.DeleteOperatorUSDValue(ctx, avsAddr, operatorAddress.String()) + err = k.DeleteOperatorUSDValue(ctx, avsAddr, operatorAddress.String()) if err != nil { return err } @@ -93,6 +96,10 @@ func (k *Keeper) OptOut(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr handleFunc := func(info *types.OptedInfo) { // #nosec G701 info.OptedOutHeight = uint64(ctx.BlockHeight()) + // the opt out, although is requested now, is made effective at the end of the current epoch. + // so this is not necessarily the OptedOutHeight, rather, it is the OptOutRequestHeight. + // the height is not directly used, beyond ascertaining whether the operator is currently opted in/out. + // so the difference due to the epoch scheduling is not too big a concern. } err = k.HandleOptedInfo(ctx, operatorAddress.String(), avsAddr, handleFunc) if err != nil { diff --git a/x/operator/types/codec.go b/x/operator/types/codec.go index 97cd63bab..c070cb825 100644 --- a/x/operator/types/codec.go +++ b/x/operator/types/codec.go @@ -35,7 +35,6 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &OptIntoAVSReq{}, &OptOutOfAVSReq{}, &SetConsKeyReq{}, - &InitConsKeyRemovalReq{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/operator/types/consensus_keys.go b/x/operator/types/consensus_keys.go index a0a2b05dc..7b234279a 100644 --- a/x/operator/types/consensus_keys.go +++ b/x/operator/types/consensus_keys.go @@ -79,3 +79,18 @@ func TMCryptoPublicKeyToConsAddr(k *tmprotocrypto.PublicKey) (sdk.ConsAddress, e } return sdk.GetConsAddress(sdkK), nil } + +// ValidateConsensusKey checks that the key is a JSON with `@type` and `key` keys +// with the former bearing exactly value `/cosmos.crypto.ed25519.PubKey`, and the +// latter being a valid base64-encoded public key. +func ValidateConsensusKeyJSON(key string) (*tmprotocrypto.PublicKey, error) { + if keyType, keyString, err := ParseConsensusKeyFromJSON(key); err != nil { + return nil, errorsmod.Wrap(err, "invalid public key") + } else if keyType != "/cosmos.crypto.ed25519.PubKey" { + return nil, errorsmod.Wrap(ErrParameterInvalid, "invalid public key type") + } else if res, err := StringToPubKey(keyString); err != nil { + return nil, errorsmod.Wrap(err, "invalid public key") + } else { + return res, nil + } +} diff --git a/x/operator/types/msg.go b/x/operator/types/msg.go index bcefbf5df..7c43e9c8c 100644 --- a/x/operator/types/msg.go +++ b/x/operator/types/msg.go @@ -12,8 +12,6 @@ const ( TypeRegisterOperatorReq = "register_operator" // TypeSetConsKeyReq is the type for the SetConsKeyReq message. TypeSetConsKeyReq = "set_cons_key" - // TypeInitConsKeyRemovalReq is the type for the InitConsKeyRemovalReq message. - TypeInitConsKeyRemovalReq = "init_cons_key_removal" // TypeOptIntoAVSReq is the type for the OptIntoAVSReq message. TypeOptIntoAVSReq = "opt_into_avs" // TypeOptOutOfAVSReq is the type for the OptOutOfAVSReq message. @@ -26,7 +24,6 @@ var ( _ sdk.Msg = &OptIntoAVSReq{} _ sdk.Msg = &OptOutOfAVSReq{} _ sdk.Msg = &SetConsKeyReq{} - _ sdk.Msg = &InitConsKeyRemovalReq{} ) // GetSigners returns the expected signers for the message. @@ -72,12 +69,8 @@ func (m *SetConsKeyReq) ValidateBasic() error { if !types.IsValidChainID(m.ChainID) { return errorsmod.Wrap(ErrParameterInvalid, "invalid chain id") } - if keyType, keyString, err := ParseConsensusKeyFromJSON(m.PublicKey); err != nil { - return errorsmod.Wrap(err, "invalid public key") - } else if keyType != "/cosmos.crypto.ed25519.PubKey" { - return errorsmod.Wrap(ErrParameterInvalid, "invalid public key type") - } else if _, err := StringToPubKey(keyString); err != nil { - return errorsmod.Wrap(err, "invalid public key") + if _, err := ValidateConsensusKeyJSON(m.PublicKey); err != nil { + return err } return nil } @@ -97,38 +90,6 @@ func (m *SetConsKeyReq) GetSignBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(m)) } -// GetSigners returns the expected signers for the message. -func (m *InitConsKeyRemovalReq) GetSigners() []sdk.AccAddress { - addr := sdk.MustAccAddressFromBech32(m.Address) - return []sdk.AccAddress{addr} -} - -// ValidateBasic does a sanity check of the provided data -func (m *InitConsKeyRemovalReq) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(m.Address); err != nil { - return errorsmod.Wrap(err, "invalid from address") - } - if !types.IsValidChainID(m.ChainID) { - return errorsmod.Wrap(ErrParameterInvalid, "invalid chain id") - } - return nil -} - -// Route returns the transaction route. -func (m *InitConsKeyRemovalReq) Route() string { - return RouterKey -} - -// Type returns the transaction type. -func (m *InitConsKeyRemovalReq) Type() string { - return TypeInitConsKeyRemovalReq -} - -// GetSignBytes returns the bytes all expected signers must sign over. -func (m *InitConsKeyRemovalReq) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(m)) -} - // GetSigners returns the expected signers for the message. func (m *OptIntoAVSReq) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.FromAddress) diff --git a/x/operator/types/tx.pb.go b/x/operator/types/tx.pb.go index a3fd11a6f..97c8639b1 100644 --- a/x/operator/types/tx.pb.go +++ b/x/operator/types/tx.pb.go @@ -583,6 +583,9 @@ type OptIntoAVSReq struct { FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` // avs_address is the address of the AVS - either an 0x address or a chainID. AvsAddress string `protobuf:"bytes,2,opt,name=avs_address,json=avsAddress,proto3" json:"avs_address,omitempty"` + // optional parameter to provide the consensus key or the BLS key, depending + // on the AVS. we still have to design this fully. + PublicKey string `protobuf:"bytes,3,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` } func (m *OptIntoAVSReq) Reset() { *m = OptIntoAVSReq{} } @@ -816,86 +819,6 @@ func (m *SetConsKeyResponse) XXX_DiscardUnknown() { var xxx_messageInfo_SetConsKeyResponse proto.InternalMessageInfo -// InitConsKeyRemovalReq is the request for an operator to stop validating on a chain. It -// allows the operator to remove their consensus key from the specified chain. It must be -// followed by a separate call to OptOutOfAVS to remove the operator from the AVS. -type InitConsKeyRemovalReq struct { - // address is the operator address - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // chain_id is the identifier for the chain that wants to opt out. - ChainID string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` -} - -func (m *InitConsKeyRemovalReq) Reset() { *m = InitConsKeyRemovalReq{} } -func (m *InitConsKeyRemovalReq) String() string { return proto.CompactTextString(m) } -func (*InitConsKeyRemovalReq) ProtoMessage() {} -func (*InitConsKeyRemovalReq) Descriptor() ([]byte, []int) { - return fileDescriptor_b229d5663e4df167, []int{15} -} -func (m *InitConsKeyRemovalReq) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *InitConsKeyRemovalReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_InitConsKeyRemovalReq.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 *InitConsKeyRemovalReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_InitConsKeyRemovalReq.Merge(m, src) -} -func (m *InitConsKeyRemovalReq) XXX_Size() int { - return m.Size() -} -func (m *InitConsKeyRemovalReq) XXX_DiscardUnknown() { - xxx_messageInfo_InitConsKeyRemovalReq.DiscardUnknown(m) -} - -var xxx_messageInfo_InitConsKeyRemovalReq proto.InternalMessageInfo - -// InitConsKeyRemovalResponse defines the InitConsKeyRemovalReq response. -type InitConsKeyRemovalResponse struct { -} - -func (m *InitConsKeyRemovalResponse) Reset() { *m = InitConsKeyRemovalResponse{} } -func (m *InitConsKeyRemovalResponse) String() string { return proto.CompactTextString(m) } -func (*InitConsKeyRemovalResponse) ProtoMessage() {} -func (*InitConsKeyRemovalResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b229d5663e4df167, []int{16} -} -func (m *InitConsKeyRemovalResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *InitConsKeyRemovalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_InitConsKeyRemovalResponse.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 *InitConsKeyRemovalResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_InitConsKeyRemovalResponse.Merge(m, src) -} -func (m *InitConsKeyRemovalResponse) XXX_Size() int { - return m.Size() -} -func (m *InitConsKeyRemovalResponse) XXX_DiscardUnknown() { - xxx_messageInfo_InitConsKeyRemovalResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_InitConsKeyRemovalResponse proto.InternalMessageInfo - func init() { proto.RegisterEnum("exocore.operator.v1.SlashType", SlashType_name, SlashType_value) proto.RegisterType((*DecValueField)(nil), "exocore.operator.v1.DecValueField") @@ -913,93 +836,88 @@ func init() { proto.RegisterType((*OptOutOfAVSResponse)(nil), "exocore.operator.v1.OptOutOfAVSResponse") proto.RegisterType((*SetConsKeyReq)(nil), "exocore.operator.v1.SetConsKeyReq") proto.RegisterType((*SetConsKeyResponse)(nil), "exocore.operator.v1.SetConsKeyResponse") - proto.RegisterType((*InitConsKeyRemovalReq)(nil), "exocore.operator.v1.InitConsKeyRemovalReq") - proto.RegisterType((*InitConsKeyRemovalResponse)(nil), "exocore.operator.v1.InitConsKeyRemovalResponse") } func init() { proto.RegisterFile("exocore/operator/v1/tx.proto", fileDescriptor_b229d5663e4df167) } var fileDescriptor_b229d5663e4df167 = []byte{ - // 1262 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0x26, 0x69, 0x12, 0x3f, 0xe7, 0xc3, 0x9d, 0xf4, 0xc3, 0x5d, 0x8a, 0x9d, 0x6c, 0x69, - 0x49, 0x23, 0x62, 0x2b, 0x81, 0x22, 0x35, 0x80, 0x84, 0xf3, 0x51, 0xd5, 0x6a, 0x1a, 0x57, 0xeb, - 0xb4, 0x52, 0x29, 0xd2, 0x6a, 0xb3, 0x9e, 0x38, 0x4b, 0x76, 0x77, 0x96, 0x9d, 0xb1, 0x69, 0x7a, - 0x42, 0x88, 0x03, 0xe2, 0xc4, 0x15, 0x89, 0x43, 0x0f, 0x08, 0x71, 0x42, 0x3d, 0xf4, 0x5a, 0x21, - 0x6e, 0x3d, 0x56, 0x3d, 0x21, 0x0e, 0x11, 0x4a, 0x0f, 0xe5, 0x4f, 0xe0, 0x88, 0xe6, 0x63, 0x9d, - 0x75, 0xb3, 0xe9, 0x87, 0x0a, 0x5c, 0x5a, 0xcf, 0x6f, 0x7e, 0xef, 0xcd, 0xef, 0xbd, 0x79, 0xef, - 0x4d, 0x16, 0x4e, 0xe3, 0xdb, 0xc4, 0x21, 0x11, 0xae, 0x90, 0x10, 0x47, 0x36, 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x99, 0x4f, 0xe6, 0x13, 0x8f, 0xe2, 0x8a, 0x74, 0xba, 0x86, 0xd9, 0x17, 0x24, 0xda, - 0xae, 0xc4, 0x9f, 0x3e, 0xb7, 0xf7, 0x3f, 0x7e, 0xc4, 0x23, 0xb9, 0x31, 0x28, 0xbe, 0x32, 0xde, - 0xfd, 0x27, 0x00, 0x00, 0xff, 0xff, 0x85, 0xf8, 0xd5, 0xb9, 0x1d, 0x0d, 0x00, 0x00, + // 1212 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0xc6, 0x69, 0x12, 0x3f, 0xc7, 0xb1, 0x3b, 0x29, 0xad, 0x6b, 0x8a, 0xdd, 0x6c, 0x69, + 0x71, 0x23, 0x62, 0x2b, 0x81, 0x22, 0x51, 0x40, 0xc2, 0x71, 0x5c, 0xd5, 0x6a, 0x6a, 0x57, 0xeb, + 0xb4, 0x52, 0x29, 0xd2, 0x6a, 0xb3, 0x9e, 0x38, 0x4b, 0xec, 0x9d, 0x65, 0x67, 0x6c, 0xea, 0x9e, + 0x10, 0x27, 0xc4, 0x05, 0xae, 0x48, 0x1c, 0x7a, 0x42, 0x1c, 0x7b, 0xe8, 0xb5, 0x42, 0x88, 0x4b, + 0x8f, 0x55, 0x4f, 0x88, 0x43, 0x84, 0x92, 0x43, 0xf8, 0x13, 0x38, 0xa2, 0xf9, 0xb1, 0xce, 0xba, + 0x71, 0x9a, 0x56, 0x41, 0x5c, 0x12, 0xcf, 0xf7, 0xbe, 0xf7, 0xcd, 0x7b, 0x6f, 0xde, 0x9b, 0x1d, + 0x38, 0x87, 0xef, 0x13, 0x9b, 0xf8, 0xb8, 0x48, 0x3c, 0xec, 0x5b, 0x8c, 0xf8, 0xc5, 0xde, 0x62, + 0x91, 0xdd, 0x2f, 0x78, 0x3e, 0x61, 0x04, 0xcd,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 0xad, 0x1e, 0x10, 0x4a, 0xb5, 0x4a, + 0xfd, 0x76, 0x43, 0xd1, 0xc6, 0x96, 0xbe, 0x8f, 0x42, 0xf4, 0x26, 0x6d, 0xa1, 0x2d, 0x48, 0xbd, + 0x38, 0x03, 0x28, 0x3f, 0x72, 0xec, 0x46, 0xcc, 0x7a, 0x66, 0xe1, 0x15, 0x99, 0x32, 0x45, 0x74, + 0x0f, 0x60, 0x3f, 0x71, 0xa4, 0x8f, 0xbe, 0x6b, 0xc2, 0xa5, 0xca, 0xbc, 0x73, 0x24, 0x47, 0xf5, + 0x44, 0x04, 0xdd, 0x05, 0xd8, 0xef, 0xf5, 0x43, 0xc4, 0x87, 0xa6, 0xe3, 0x10, 0xf1, 0x83, 0x03, + 0x83, 0x3e, 0x87, 0x78, 0xa8, 0x0f, 0xd1, 0x85, 0xc3, 0xfc, 0x42, 0xbd, 0x9b, 0xc9, 0x1f, 0x4d, + 0x92, 0xea, 0x99, 0x13, 0x5f, 0xf3, 0x57, 0xc3, 0xf2, 0xea, 0xd3, 0x9d, 0xac, 0xf6, 0x6c, 0x27, + 0xab, 0xfd, 0xb5, 0x93, 0xd5, 0x7e, 0xd8, 0xcd, 0x46, 0x9e, 0xed, 0x66, 0x23, 0x7f, 0xec, 0x66, + 0x23, 0x9f, 0x2d, 0x85, 0xee, 0xfb, 0x8a, 0x14, 0xad, 0x61, 0xf6, 0x15, 0xf1, 0xb7, 0x8a, 0xc1, + 0xab, 0xfe, 0xfe, 0xfe, 0xbb, 0x5e, 0xdc, 0xff, 0xeb, 0x13, 0xe2, 0x01, 0xfd, 0xde, 0xbf, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x31, 0x4a, 0x45, 0x23, 0xf8, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1016,10 +934,10 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { // RegisterOperator registers a new operator. RegisterOperator(ctx context.Context, in *RegisterOperatorReq, opts ...grpc.CallOption) (*RegisterOperatorResponse, error) - // SetConsKey sets the operator's consensus key for a chain. + // SetConsKey sets the operator's consensus key for a chain. To do this, the operator + // must have previously opted into the chain. + // TODO; rationalize this with non-chain AVSs wherein other keys can be set. SetConsKey(ctx context.Context, in *SetConsKeyReq, opts ...grpc.CallOption) (*SetConsKeyResponse, error) - // InitConsKeyRemoval removes the operator's consensus key for a chain. - InitConsKeyRemoval(ctx context.Context, in *InitConsKeyRemovalReq, opts ...grpc.CallOption) (*InitConsKeyRemovalResponse, error) // OptIntoAVS opts an operator into an AVS. OptIntoAVS(ctx context.Context, in *OptIntoAVSReq, opts ...grpc.CallOption) (*OptIntoAVSResponse, error) // OptOutOfAVS opts an operator out of an AVS. @@ -1052,15 +970,6 @@ func (c *msgClient) SetConsKey(ctx context.Context, in *SetConsKeyReq, opts ...g return out, nil } -func (c *msgClient) InitConsKeyRemoval(ctx context.Context, in *InitConsKeyRemovalReq, opts ...grpc.CallOption) (*InitConsKeyRemovalResponse, error) { - out := new(InitConsKeyRemovalResponse) - err := c.cc.Invoke(ctx, "/exocore.operator.v1.Msg/InitConsKeyRemoval", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) OptIntoAVS(ctx context.Context, in *OptIntoAVSReq, opts ...grpc.CallOption) (*OptIntoAVSResponse, error) { out := new(OptIntoAVSResponse) err := c.cc.Invoke(ctx, "/exocore.operator.v1.Msg/OptIntoAVS", in, out, opts...) @@ -1083,10 +992,10 @@ func (c *msgClient) OptOutOfAVS(ctx context.Context, in *OptOutOfAVSReq, opts .. type MsgServer interface { // RegisterOperator registers a new operator. RegisterOperator(context.Context, *RegisterOperatorReq) (*RegisterOperatorResponse, error) - // SetConsKey sets the operator's consensus key for a chain. + // SetConsKey sets the operator's consensus key for a chain. To do this, the operator + // must have previously opted into the chain. + // TODO; rationalize this with non-chain AVSs wherein other keys can be set. SetConsKey(context.Context, *SetConsKeyReq) (*SetConsKeyResponse, error) - // InitConsKeyRemoval removes the operator's consensus key for a chain. - InitConsKeyRemoval(context.Context, *InitConsKeyRemovalReq) (*InitConsKeyRemovalResponse, error) // OptIntoAVS opts an operator into an AVS. OptIntoAVS(context.Context, *OptIntoAVSReq) (*OptIntoAVSResponse, error) // OptOutOfAVS opts an operator out of an AVS. @@ -1103,9 +1012,6 @@ func (*UnimplementedMsgServer) RegisterOperator(ctx context.Context, req *Regist func (*UnimplementedMsgServer) SetConsKey(ctx context.Context, req *SetConsKeyReq) (*SetConsKeyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SetConsKey not implemented") } -func (*UnimplementedMsgServer) InitConsKeyRemoval(ctx context.Context, req *InitConsKeyRemovalReq) (*InitConsKeyRemovalResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method InitConsKeyRemoval not implemented") -} func (*UnimplementedMsgServer) OptIntoAVS(ctx context.Context, req *OptIntoAVSReq) (*OptIntoAVSResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method OptIntoAVS not implemented") } @@ -1153,24 +1059,6 @@ func _Msg_SetConsKey_Handler(srv interface{}, ctx context.Context, dec func(inte return interceptor(ctx, in, info, handler) } -func _Msg_InitConsKeyRemoval_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(InitConsKeyRemovalReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).InitConsKeyRemoval(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/exocore.operator.v1.Msg/InitConsKeyRemoval", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).InitConsKeyRemoval(ctx, req.(*InitConsKeyRemovalReq)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_OptIntoAVS_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(OptIntoAVSReq) if err := dec(in); err != nil { @@ -1219,10 +1107,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "SetConsKey", Handler: _Msg_SetConsKey_Handler, }, - { - MethodName: "InitConsKeyRemoval", - Handler: _Msg_InitConsKeyRemoval_Handler, - }, { MethodName: "OptIntoAVS", Handler: _Msg_OptIntoAVS_Handler, @@ -1655,6 +1539,13 @@ func (m *OptIntoAVSReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.PublicKey) > 0 { + i -= len(m.PublicKey) + copy(dAtA[i:], m.PublicKey) + i = encodeVarintTx(dAtA, i, uint64(len(m.PublicKey))) + i-- + dAtA[i] = 0x1a + } if len(m.AvsAddress) > 0 { i -= len(m.AvsAddress) copy(dAtA[i:], m.AvsAddress) @@ -1822,66 +1713,6 @@ func (m *SetConsKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *InitConsKeyRemovalReq) 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 *InitConsKeyRemovalReq) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *InitConsKeyRemovalReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ChainID) > 0 { - i -= len(m.ChainID) - copy(dAtA[i:], m.ChainID) - i = encodeVarintTx(dAtA, i, uint64(len(m.ChainID))) - i-- - dAtA[i] = 0x12 - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *InitConsKeyRemovalResponse) 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 *InitConsKeyRemovalResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *InitConsKeyRemovalResponse) 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 @@ -2067,6 +1898,10 @@ func (m *OptIntoAVSReq) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.PublicKey) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -2135,32 +1970,6 @@ func (m *SetConsKeyResponse) Size() (n int) { return n } -func (m *InitConsKeyRemovalReq) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ChainID) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *InitConsKeyRemovalResponse) 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 } @@ -3382,6 +3191,38 @@ func (m *OptIntoAVSReq) Unmarshal(dAtA []byte) error { } m.AvsAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", 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.PublicKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3813,170 +3654,6 @@ func (m *SetConsKeyResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *InitConsKeyRemovalReq) 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: InitConsKeyRemovalReq: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: InitConsKeyRemovalReq: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", 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.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainID", 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.ChainID = string(dAtA[iNdEx:postIndex]) - 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 *InitConsKeyRemovalResponse) 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: InitConsKeyRemovalResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: InitConsKeyRemovalResponse: 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 From 5cd3ac122d5611b480b4d0f493cca8d1315ec70b Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Sun, 16 Jun 2024 11:40:52 +0000 Subject: [PATCH 23/27] refactor(delegation): verbose panic --- x/delegation/keeper/genesis.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x/delegation/keeper/genesis.go b/x/delegation/keeper/genesis.go index 7dd1577bd..9f029d661 100644 --- a/x/delegation/keeper/genesis.go +++ b/x/delegation/keeper/genesis.go @@ -1,6 +1,7 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" assetstype "github.com/ExocoreNetwork/exocore/x/assets/types" delegationtype "github.com/ExocoreNetwork/exocore/x/delegation/types" abci "github.com/cometbft/cometbft/abci/types" @@ -44,7 +45,7 @@ func (k Keeper) InitGenesis( // they are the LzNonce and TxHash } if err := k.delegateTo(ctx, delegationParams, false); err != nil { - panic(err) + panic(errorsmod.Wrap(err, "failed to delegate to operator")) } } } From b7c4dabc71013723d17fc241bbf4b16241a184be Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Sun, 16 Jun 2024 11:41:44 +0000 Subject: [PATCH 24/27] fix(dogfood): query validator by cons addr not hex --- x/dogfood/keeper/query.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/x/dogfood/keeper/query.go b/x/dogfood/keeper/query.go index 6bf6bfe73..0208d7632 100644 --- a/x/dogfood/keeper/query.go +++ b/x/dogfood/keeper/query.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "encoding/hex" "github.com/ExocoreNetwork/exocore/x/dogfood/types" "google.golang.org/grpc/codes" @@ -93,11 +92,11 @@ func (k Keeper) QueryValidator( } ctx := sdk.UnwrapSDKContext(goCtx) consAddress := req.ConsAddr - consAddressbytes, err := hex.DecodeString(consAddress) + consAddressBytes, err := sdk.ConsAddressFromBech32(consAddress) if err != nil { return nil, status.Error(codes.InvalidArgument, "invalid consensus address") } - validator, found := k.GetExocoreValidator(ctx, consAddressbytes) + validator, found := k.GetExocoreValidator(ctx, consAddressBytes) if !found { return nil, status.Error(codes.NotFound, "validator not found") } From 7a2611ebe7d9e181053729d10a6fcc58a22339c5 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Sun, 16 Jun 2024 11:42:05 +0000 Subject: [PATCH 25/27] refactor(dogfood): move opt func to correct loc --- x/dogfood/keeper/opt_out.go | 11 +++++++++++ x/dogfood/keeper/unbonding.go | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/x/dogfood/keeper/opt_out.go b/x/dogfood/keeper/opt_out.go index 4f5b1a513..0c6299bca 100644 --- a/x/dogfood/keeper/opt_out.go +++ b/x/dogfood/keeper/opt_out.go @@ -5,6 +5,17 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) +// SetOptOutInformation sets information related to an operator's opt out. +func (k Keeper) SetOptOutInformation( + ctx sdk.Context, addr sdk.AccAddress, +) { + unbondingCompletionEpoch := k.GetUnbondingCompletionEpoch(ctx) + k.AppendOptOutToFinish(ctx, unbondingCompletionEpoch, addr) + k.SetOperatorOptOutFinishEpoch(ctx, addr, unbondingCompletionEpoch) + // CompleteOperatorKeyRemovalForChainID calls DeleteOperatorAddressForChainIDAndConsAddr, + // so we do not need to save ConsensusAddrToPrune in the unbonding case. +} + // AppendOptOutToFinish appends an operator address to the list of operator addresses that have // opted out and will be finished at the end of the provided epoch. func (k Keeper) AppendOptOutToFinish( diff --git a/x/dogfood/keeper/unbonding.go b/x/dogfood/keeper/unbonding.go index 53282649c..3bc21dd22 100644 --- a/x/dogfood/keeper/unbonding.go +++ b/x/dogfood/keeper/unbonding.go @@ -6,17 +6,6 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ) -// SetOptOutInformation sets information related to an operator's opt out. -func (k Keeper) SetOptOutInformation( - ctx sdk.Context, addr sdk.AccAddress, -) { - unbondingCompletionEpoch := k.GetUnbondingCompletionEpoch(ctx) - k.AppendOptOutToFinish(ctx, unbondingCompletionEpoch, addr) - k.SetOperatorOptOutFinishEpoch(ctx, addr, unbondingCompletionEpoch) - // CompleteOperatorKeyRemovalForChainID calls DeleteOperatorAddressForChainIDAndConsAddr, - // so we do not need to save ConsensusAddrToPrune in the unbonding case. -} - // GetUnbondingCompletionEpoch returns the epoch at the end of which // an unbonding triggered in this epoch will be completed. func (k Keeper) GetUnbondingCompletionEpoch( From d0c2e6e833b0db8f6433927e6d22f09f8ccaf394 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Sun, 16 Jun 2024 11:54:05 +0000 Subject: [PATCH 26/27] chore(x/operator): lint go --- x/operator/keeper/opt.go | 15 +++++++-------- x/operator/types/consensus_keys.go | 7 +++---- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/x/operator/keeper/opt.go b/x/operator/keeper/opt.go index 7a9b92105..1c474a447 100644 --- a/x/operator/keeper/opt.go +++ b/x/operator/keeper/opt.go @@ -62,15 +62,14 @@ func (k *Keeper) OptOut(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr if !common.IsHexAddress(avsAddr) { if avsAddr != ctx.ChainID() { // TODO: other chain ids besides this chain's. return types.ErrInvalidAvsAddr - } else { - defer func() { - if err == nil { - // does not fail, because it performs no validations that this function - // has not already performed. - k.InitiateOperatorKeyRemovalForChainID(ctx, operatorAddress, avsAddr) - } - }() } + defer func() { + if err == nil { + // does not fail, because it performs no validations, just stores a key-value pair. + // all validations are instead performed by this function. + k.InitiateOperatorKeyRemovalForChainID(ctx, operatorAddress, avsAddr) + } + }() } if !k.IsOperator(ctx, operatorAddress) { return delegationtypes.ErrOperatorNotExist diff --git a/x/operator/types/consensus_keys.go b/x/operator/types/consensus_keys.go index 7b234279a..b02123877 100644 --- a/x/operator/types/consensus_keys.go +++ b/x/operator/types/consensus_keys.go @@ -83,14 +83,13 @@ func TMCryptoPublicKeyToConsAddr(k *tmprotocrypto.PublicKey) (sdk.ConsAddress, e // ValidateConsensusKey checks that the key is a JSON with `@type` and `key` keys // with the former bearing exactly value `/cosmos.crypto.ed25519.PubKey`, and the // latter being a valid base64-encoded public key. -func ValidateConsensusKeyJSON(key string) (*tmprotocrypto.PublicKey, error) { +func ValidateConsensusKeyJSON(key string) (res *tmprotocrypto.PublicKey, err error) { if keyType, keyString, err := ParseConsensusKeyFromJSON(key); err != nil { return nil, errorsmod.Wrap(err, "invalid public key") } else if keyType != "/cosmos.crypto.ed25519.PubKey" { return nil, errorsmod.Wrap(ErrParameterInvalid, "invalid public key type") - } else if res, err := StringToPubKey(keyString); err != nil { + } else if res, err = StringToPubKey(keyString); err != nil { return nil, errorsmod.Wrap(err, "invalid public key") - } else { - return res, nil } + return res, nil } From add0753ede5df98839ddbc9b8f3938093eedc8cf Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Sun, 16 Jun 2024 12:06:01 +0000 Subject: [PATCH 27/27] fix(operator): wrap and return error --- x/operator/types/msg.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/operator/types/msg.go b/x/operator/types/msg.go index 7c43e9c8c..588fb4f16 100644 --- a/x/operator/types/msg.go +++ b/x/operator/types/msg.go @@ -70,7 +70,7 @@ func (m *SetConsKeyReq) ValidateBasic() error { return errorsmod.Wrap(ErrParameterInvalid, "invalid chain id") } if _, err := ValidateConsensusKeyJSON(m.PublicKey); err != nil { - return err + return errorsmod.Wrapf(ErrParameterInvalid, "invalid public key because %s", err) } return nil }