diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 34d81dac..336d123a 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -325,19 +325,6 @@ func NewAppKeeper( // appKeepers.tkeys[feemarkettypes.TransientKey], appKeepers.GetSubspace(feemarkettypes.ModuleName), ) - allKeys := make(map[string]storetypes.StoreKey, len(appKeepers.keys)+len(appKeepers.tkeys)+len(appKeepers.memKeys)+len(appKeepers.objKeys)) - for k, v := range appKeepers.keys { - allKeys[k] = v - } - for k, v := range appKeepers.tkeys { - allKeys[k] = v - } - for k, v := range appKeepers.memKeys { - allKeys[k] = v - } - for k, v := range appKeepers.objKeys { - allKeys[k] = v - } // cross chain precompile precompileRouter := crosschainprecompile.NewRouter() diff --git a/cmd/root.go b/cmd/root.go index 79c8b781..cf8bcd63 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -194,7 +194,6 @@ func queryCommand() *cobra.Command { authcmd.QueryTxCmd(), authcmd.QueryTxsByEventsCmd(), rpc.ValidatorCommand(), - rpc.QueryEventForTxCmd(), rpc.WaitTxCmd(), sdkserver.QueryBlocksCmd(), sdkserver.QueryBlockCmd(), diff --git a/proto/fx/staking/v1/tx.proto b/proto/fx/staking/v1/tx.proto deleted file mode 100644 index a0d7d1e5..00000000 --- a/proto/fx/staking/v1/tx.proto +++ /dev/null @@ -1,33 +0,0 @@ -syntax = "proto3"; -package fx.staking.v1; - -import "cosmos_proto/cosmos.proto"; -import "google/protobuf/any.proto"; -import "cosmos/msg/v1/msg.proto"; -import "amino/amino.proto"; - -option go_package = "github.com/functionx/fx-core/x/staking/types"; - -// Deprecated: MsgGrantPrivilege -message MsgGrantPrivilege { - option (cosmos.msg.v1.signer) = "from_address"; - option (amino.name) = "staking/MsgGrantPrivilege"; - - string validator_address = 1; // validator address - string from_address = 2; // from address - google.protobuf.Any to_pubkey = 3 - [ (cosmos_proto.accepts_interface) = - "cosmos.crypto.PubKey" ]; // to pub_key - string signature = 4; // signature -} - -// Deprecated: MsgEditConsensusPubKey -message MsgEditConsensusPubKey { - option (cosmos.msg.v1.signer) = "from"; - option (amino.name) = "staking/MsgEditConsensusPubKey"; - - string validator_address = 1; - string from = 2; - google.protobuf.Any pubkey = 3 - [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey" ]; -} diff --git a/x/staking/module.go b/x/staking/module.go index 1ad473c3..ba915d0b 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -1,19 +1,14 @@ package staking import ( - "context" - "cosmossdk.io/core/appmodule" - abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/staking/exported" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/functionx/fx-core/v8/x/staking/keeper" - fxstakingtypes "github.com/functionx/fx-core/v8/x/staking/types" ) var ( @@ -30,20 +25,9 @@ type AppModuleBasic struct { staking.AppModuleBasic } -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - stakingtypes.RegisterLegacyAminoCodec(cdc) - fxstakingtypes.RegisterLegacyAminoCodec(cdc) -} - -func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { - stakingtypes.RegisterInterfaces(registry) - fxstakingtypes.RegisterInterfaces(registry) -} - type AppModule struct { staking.AppModule AppModuleBasic AppModuleBasic - Keeper *keeper.Keeper } // NewAppModule creates a new AppModule object @@ -52,12 +36,5 @@ func NewAppModule(cdc codec.Codec, keeper *keeper.Keeper, ak stakingtypes.Accoun return AppModule{ AppModuleBasic: AppModuleBasic{AppModuleBasic: stakingAppModule.AppModuleBasic}, AppModule: stakingAppModule, - Keeper: keeper, } } - -// EndBlock returns the end blocker for the staking module. It returns no validator -// updates. -func (am AppModule) EndBlock(ctx context.Context) ([]abci.ValidatorUpdate, error) { - return am.Keeper.EndBlocker(ctx) -} diff --git a/x/staking/types/codec.go b/x/staking/types/codec.go deleted file mode 100644 index 0987357d..00000000 --- a/x/staking/types/codec.go +++ /dev/null @@ -1,22 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// RegisterInterfaces registers the client interfaces to protobuf Any. -func RegisterInterfaces(registry codectypes.InterfaceRegistry) { - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgGrantPrivilege{}, - &MsgEditConsensusPubKey{}, - ) -} - -// RegisterLegacyAminoCodec registers concrete types on the Amino codec -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgGrantPrivilege{}, "staking/MsgGrantPrivilege", nil) - cdc.RegisterConcrete(&MsgEditConsensusPubKey{}, "staking/MsgEditConsensusPubKey", nil) -} diff --git a/x/staking/types/events.go b/x/staking/types/events.go deleted file mode 100644 index 6a7ccef1..00000000 --- a/x/staking/types/events.go +++ /dev/null @@ -1,12 +0,0 @@ -package types - -const ( - EventTypeApproveShares = "approve_shares" - EventTypeTransferShares = "transfer_shares" - - AttributeKeyOwner = "owner" - AttributeKeySpender = "spender" - AttributeKeyShares = "shares" - AttributeKeyFrom = "from" - AttributeKeyRecipient = "recipient" -) diff --git a/x/staking/types/keys.go b/x/staking/types/keys.go index 4dd5775c..c2f6b4a7 100644 --- a/x/staking/types/keys.go +++ b/x/staking/types/keys.go @@ -5,7 +5,8 @@ import ( ) var ( - AllowanceKey = []byte{0x90} + AllowanceKey = []byte{0x90} + // todo: remove this key in migrate v8 ValidatorOperatorKey = []byte{0x91} ConsensusPubKey = []byte{0x92} ConsensusProcessKey = []byte{0x93} diff --git a/x/staking/types/tx.pb.go b/x/staking/types/tx.pb.go deleted file mode 100644 index 6b2851dd..00000000 --- a/x/staking/types/tx.pb.go +++ /dev/null @@ -1,779 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: fx/staking/v1/tx.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - types "github.com/cosmos/cosmos-sdk/codec/types" - _ "github.com/cosmos/cosmos-sdk/types/msgservice" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Deprecated: MsgGrantPrivilege -type MsgGrantPrivilege struct { - ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` - FromAddress string `protobuf:"bytes,2,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` - ToPubkey *types.Any `protobuf:"bytes,3,opt,name=to_pubkey,json=toPubkey,proto3" json:"to_pubkey,omitempty"` - Signature string `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` -} - -func (m *MsgGrantPrivilege) Reset() { *m = MsgGrantPrivilege{} } -func (m *MsgGrantPrivilege) String() string { return proto.CompactTextString(m) } -func (*MsgGrantPrivilege) ProtoMessage() {} -func (*MsgGrantPrivilege) Descriptor() ([]byte, []int) { - return fileDescriptor_d3dddf27d0fc9580, []int{0} -} -func (m *MsgGrantPrivilege) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgGrantPrivilege) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgGrantPrivilege.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 *MsgGrantPrivilege) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgGrantPrivilege.Merge(m, src) -} -func (m *MsgGrantPrivilege) XXX_Size() int { - return m.Size() -} -func (m *MsgGrantPrivilege) XXX_DiscardUnknown() { - xxx_messageInfo_MsgGrantPrivilege.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgGrantPrivilege proto.InternalMessageInfo - -func (m *MsgGrantPrivilege) GetValidatorAddress() string { - if m != nil { - return m.ValidatorAddress - } - return "" -} - -func (m *MsgGrantPrivilege) GetFromAddress() string { - if m != nil { - return m.FromAddress - } - return "" -} - -func (m *MsgGrantPrivilege) GetToPubkey() *types.Any { - if m != nil { - return m.ToPubkey - } - return nil -} - -func (m *MsgGrantPrivilege) GetSignature() string { - if m != nil { - return m.Signature - } - return "" -} - -// Deprecated: MsgEditConsensusPubKey -type MsgEditConsensusPubKey struct { - ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` - From string `protobuf:"bytes,2,opt,name=from,proto3" json:"from,omitempty"` - Pubkey *types.Any `protobuf:"bytes,3,opt,name=pubkey,proto3" json:"pubkey,omitempty"` -} - -func (m *MsgEditConsensusPubKey) Reset() { *m = MsgEditConsensusPubKey{} } -func (m *MsgEditConsensusPubKey) String() string { return proto.CompactTextString(m) } -func (*MsgEditConsensusPubKey) ProtoMessage() {} -func (*MsgEditConsensusPubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_d3dddf27d0fc9580, []int{1} -} -func (m *MsgEditConsensusPubKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgEditConsensusPubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgEditConsensusPubKey.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 *MsgEditConsensusPubKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgEditConsensusPubKey.Merge(m, src) -} -func (m *MsgEditConsensusPubKey) XXX_Size() int { - return m.Size() -} -func (m *MsgEditConsensusPubKey) XXX_DiscardUnknown() { - xxx_messageInfo_MsgEditConsensusPubKey.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgEditConsensusPubKey proto.InternalMessageInfo - -func (m *MsgEditConsensusPubKey) GetValidatorAddress() string { - if m != nil { - return m.ValidatorAddress - } - return "" -} - -func (m *MsgEditConsensusPubKey) GetFrom() string { - if m != nil { - return m.From - } - return "" -} - -func (m *MsgEditConsensusPubKey) GetPubkey() *types.Any { - if m != nil { - return m.Pubkey - } - return nil -} - -func init() { - proto.RegisterType((*MsgGrantPrivilege)(nil), "fx.staking.v1.MsgGrantPrivilege") - proto.RegisterType((*MsgEditConsensusPubKey)(nil), "fx.staking.v1.MsgEditConsensusPubKey") -} - -func init() { proto.RegisterFile("fx/staking/v1/tx.proto", fileDescriptor_d3dddf27d0fc9580) } - -var fileDescriptor_d3dddf27d0fc9580 = []byte{ - // 410 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0x31, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0x73, 0x50, 0x55, 0xe4, 0x0a, 0x12, 0xb1, 0xaa, 0xe2, 0x54, 0xc8, 0x2a, 0x9d, 0xaa, - 0xd2, 0xde, 0xa9, 0xb0, 0x75, 0x6b, 0x11, 0x65, 0x88, 0x22, 0x45, 0x19, 0x59, 0xa2, 0xb3, 0x7d, - 0x3e, 0x4e, 0x89, 0xef, 0x59, 0x77, 0x67, 0xcb, 0x5e, 0x19, 0x99, 0xf8, 0x28, 0x19, 0xf8, 0x10, - 0x88, 0x85, 0x8c, 0x8c, 0x28, 0x19, 0xf2, 0x31, 0x40, 0x3e, 0x3b, 0x09, 0x08, 0x16, 0xc4, 0x62, - 0xf9, 0xfe, 0xff, 0xff, 0xbd, 0xf7, 0x7e, 0x4f, 0x87, 0x8f, 0x92, 0x92, 0x1a, 0xcb, 0xa6, 0x52, - 0x09, 0x5a, 0x5c, 0x51, 0x5b, 0x92, 0x4c, 0x83, 0x05, 0xef, 0x51, 0x52, 0x92, 0x56, 0x27, 0xc5, - 0xd5, 0x71, 0x3f, 0x02, 0x93, 0x82, 0x99, 0x38, 0x93, 0x36, 0x87, 0x26, 0x79, 0xdc, 0x17, 0x00, - 0x62, 0xc6, 0xa9, 0x3b, 0x85, 0x79, 0x42, 0x99, 0xaa, 0x5a, 0xeb, 0x49, 0x13, 0xa4, 0xa9, 0x71, - 0xc5, 0x53, 0x23, 0x5a, 0xa3, 0xc7, 0x52, 0xa9, 0x80, 0xba, 0x6f, 0x23, 0x9d, 0xfe, 0x40, 0xb8, - 0x37, 0x34, 0xe2, 0x8d, 0x66, 0xca, 0x8e, 0xb4, 0x2c, 0xe4, 0x8c, 0x0b, 0xee, 0x3d, 0xc7, 0xbd, - 0x82, 0xcd, 0x64, 0xcc, 0x2c, 0xe8, 0x09, 0x8b, 0x63, 0xcd, 0x8d, 0xf1, 0xd1, 0x09, 0x3a, 0xeb, - 0x8e, 0x1f, 0x6f, 0x8d, 0x9b, 0x46, 0xf7, 0x9e, 0xe1, 0x87, 0x89, 0x86, 0x74, 0x9b, 0xbb, 0xe7, - 0x72, 0x07, 0xb5, 0xb6, 0x89, 0x0c, 0x70, 0xd7, 0xc2, 0x24, 0xcb, 0xc3, 0x29, 0xaf, 0xfc, 0xfb, - 0x27, 0xe8, 0xec, 0xe0, 0xc5, 0x21, 0x69, 0x00, 0xc8, 0x06, 0x80, 0xdc, 0xa8, 0xea, 0xd6, 0xff, - 0xf2, 0xe9, 0xf2, 0xb0, 0xe5, 0x8c, 0x74, 0x95, 0x59, 0x20, 0xa3, 0x3c, 0x1c, 0xf0, 0x6a, 0xfc, - 0xc0, 0xc2, 0xc8, 0xdd, 0xf7, 0x9e, 0xe2, 0xae, 0x91, 0x42, 0x31, 0x9b, 0x6b, 0xee, 0xef, 0xb9, - 0x66, 0x3b, 0xe1, 0x9a, 0xbe, 0x5f, 0xcf, 0xcf, 0x7f, 0x1b, 0xe8, 0xc3, 0x7a, 0x7e, 0xde, 0xdf, - 0x2c, 0xfb, 0x0f, 0xd6, 0xd3, 0xaf, 0x08, 0x1f, 0x0d, 0x8d, 0x78, 0x1d, 0x4b, 0xfb, 0x0a, 0x94, - 0xe1, 0xca, 0xe4, 0xa6, 0xe9, 0xf9, 0x6f, 0x6b, 0xf0, 0xf0, 0x5e, 0xdd, 0xb5, 0xc5, 0x77, 0xff, - 0xde, 0x1d, 0xde, 0xff, 0x2f, 0xe8, 0xf6, 0xf6, 0xf5, 0x45, 0x0d, 0xe5, 0x4a, 0xd6, 0x30, 0xc1, - 0x2f, 0x30, 0x7f, 0x19, 0xfb, 0xf6, 0xee, 0xf3, 0x32, 0x40, 0x8b, 0x65, 0x80, 0xbe, 0x2f, 0x03, - 0xf4, 0x71, 0x15, 0x74, 0x16, 0xab, 0xa0, 0xf3, 0x6d, 0x15, 0x74, 0xde, 0x5e, 0x08, 0x69, 0xdf, - 0xe5, 0x21, 0x89, 0x20, 0xa5, 0x49, 0xae, 0x22, 0x2b, 0x41, 0x95, 0x34, 0x29, 0x2f, 0x23, 0xd0, - 0x9c, 0xee, 0x9e, 0xa4, 0xad, 0x32, 0x6e, 0xc2, 0x7d, 0x37, 0xe5, 0xcb, 0x9f, 0x01, 0x00, 0x00, - 0xff, 0xff, 0x48, 0xb4, 0xf8, 0x15, 0xad, 0x02, 0x00, 0x00, -} - -func (m *MsgGrantPrivilege) 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 *MsgGrantPrivilege) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgGrantPrivilege) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x22 - } - if m.ToPubkey != nil { - { - size, err := m.ToPubkey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.FromAddress) > 0 { - i -= len(m.FromAddress) - copy(dAtA[i:], m.FromAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgEditConsensusPubKey) 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 *MsgEditConsensusPubKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgEditConsensusPubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pubkey != nil { - { - size, err := m.Pubkey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.From) > 0 { - i -= len(m.From) - copy(dAtA[i:], m.From) - i = encodeVarintTx(dAtA, i, uint64(len(m.From))) - i-- - dAtA[i] = 0x12 - } - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgGrantPrivilege) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.FromAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.ToPubkey != nil { - l = m.ToPubkey.Size() - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgEditConsensusPubKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.From) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Pubkey != nil { - l = m.Pubkey.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgGrantPrivilege) 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: MsgGrantPrivilege: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgGrantPrivilege: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", 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.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", 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.FromAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ToPubkey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ToPubkey == nil { - m.ToPubkey = &types.Any{} - } - if err := m.ToPubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", 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.Signature = 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 *MsgEditConsensusPubKey) 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: MsgEditConsensusPubKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEditConsensusPubKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", 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.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field From", 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.From = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pubkey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pubkey == nil { - m.Pubkey = &types.Any{} - } - if err := m.Pubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -)