diff --git a/app/app.go b/app/app.go index d2e0bde4..29d781b2 100644 --- a/app/app.go +++ b/app/app.go @@ -136,9 +136,9 @@ import ( dataproxy "github.com/sedaprotocol/seda-chain/x/data-proxy" dataproxykeeper "github.com/sedaprotocol/seda-chain/x/data-proxy/keeper" dataproxytypes "github.com/sedaprotocol/seda-chain/x/data-proxy/types" - "github.com/sedaprotocol/seda-chain/x/pkr" - pkrkeeper "github.com/sedaprotocol/seda-chain/x/pkr/keeper" - pkrtypes "github.com/sedaprotocol/seda-chain/x/pkr/types" + "github.com/sedaprotocol/seda-chain/x/pubkey" + pubkeykeeper "github.com/sedaprotocol/seda-chain/x/pubkey/keeper" + pubkeytypes "github.com/sedaprotocol/seda-chain/x/pubkey/types" "github.com/sedaprotocol/seda-chain/x/staking" stakingkeeper "github.com/sedaprotocol/seda-chain/x/staking/keeper" "github.com/sedaprotocol/seda-chain/x/tally" @@ -186,7 +186,7 @@ var ( ibcfee.AppModuleBasic{}, transfer.AppModuleBasic{}, wasmstorage.AppModuleBasic{}, - pkr.AppModuleBasic{}, + pubkey.AppModuleBasic{}, ica.AppModuleBasic{}, crisis.AppModuleBasic{}, packetforward.AppModuleBasic{}, @@ -250,7 +250,7 @@ type App struct { WasmStorageKeeper wasmstoragekeeper.Keeper TallyKeeper tallykeeper.Keeper DataProxyKeeper dataproxykeeper.Keeper - PkrKeeper pkrkeeper.Keeper + PubKeyKeeper pubkeykeeper.Keeper mm *module.Manager bmm module.BasicManager @@ -315,7 +315,7 @@ func NewApp( feegrant.StoreKey, evidencetypes.StoreKey, circuittypes.StoreKey, authzkeeper.StoreKey, group.StoreKey, capabilitytypes.StoreKey, ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey, wasmtypes.StoreKey, icahosttypes.StoreKey, icacontrollertypes.StoreKey, packetforwardtypes.StoreKey, - crisistypes.StoreKey, wasmstoragetypes.StoreKey, dataproxytypes.StoreKey, pkrtypes.StoreKey, + crisistypes.StoreKey, wasmstoragetypes.StoreKey, dataproxytypes.StoreKey, pubkeytypes.StoreKey, ) memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) @@ -635,9 +635,9 @@ func NewApp( app.TallyKeeper = tallykeeper.NewKeeper(app.WasmStorageKeeper, contractKeeper, app.WasmKeeper) app.DataProxyKeeper = *dataproxykeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[dataproxytypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String()) - app.PkrKeeper = *pkrkeeper.NewKeeper( + app.PubKeyKeeper = *pubkeykeeper.NewKeeper( appCodec, - runtime.NewKVStoreService(keys[pkrtypes.StoreKey]), + runtime.NewKVStoreService(keys[pubkeytypes.StoreKey]), app.StakingKeeper, authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), ) @@ -756,7 +756,7 @@ func NewApp( wasmstorage.NewAppModule(appCodec, app.WasmStorageKeeper), tally.NewAppModule(app.TallyKeeper), dataproxy.NewAppModule(appCodec, app.DataProxyKeeper), - pkr.NewAppModule(appCodec, app.PkrKeeper), + pubkey.NewAppModule(appCodec, app.PubKeyKeeper), crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, nil), // always be last to make sure that it checks for all invariants and not only part of them ) @@ -814,7 +814,7 @@ func NewApp( wasmstoragetypes.ModuleName, tallytypes.ModuleName, dataproxytypes.ModuleName, - pkrtypes.ModuleName, + pubkeytypes.ModuleName, ) app.mm.SetOrderEndBlockers( @@ -846,7 +846,7 @@ func NewApp( wasmstoragetypes.ModuleName, tallytypes.ModuleName, dataproxytypes.ModuleName, - pkrtypes.ModuleName, + pubkeytypes.ModuleName, ) // NOTE: The genutils module must occur after sdkstaking so that pools are @@ -884,7 +884,7 @@ func NewApp( wasmstoragetypes.ModuleName, tallytypes.ModuleName, dataproxytypes.ModuleName, - pkrtypes.ModuleName, + pubkeytypes.ModuleName, } app.mm.SetOrderInitGenesis(genesisModuleOrder...) app.mm.SetOrderExportGenesis(genesisModuleOrder...) diff --git a/proto/sedachain/pkr/v1/genesis.proto b/proto/sedachain/pubkey/v1/genesis.proto similarity index 65% rename from proto/sedachain/pkr/v1/genesis.proto rename to proto/sedachain/pubkey/v1/genesis.proto index dd09ec5f..19ee63be 100644 --- a/proto/sedachain/pkr/v1/genesis.proto +++ b/proto/sedachain/pubkey/v1/genesis.proto @@ -1,19 +1,19 @@ syntax = "proto3"; -package sedachain.pkr.v1; +package sedachain.pubkey.v1; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; -import "sedachain/pkr/v1/pkr.proto"; +import "sedachain/pubkey/v1/pubkey.proto"; -option go_package = "github.com/sedaprotocol/seda-chain/x/pkr/types"; +option go_package = "github.com/sedaprotocol/seda-chain/x/pubkey/types"; -// GenesisState defines pkr module's genesis state. +// GenesisState defines pubkey module's genesis state. message GenesisState { repeated ValidatorPubKeys validator_pub_keys = 1 [(gogoproto.nullable) = false]; } // ValidatorPubKeys defines a validator's list of registered public keys -// primarily used in the x/pkr genesis state. +// primarily used in the x/pubkey genesis state. message ValidatorPubKeys { string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; repeated IndexedPubKey indexed_pub_keys = 2 [(gogoproto.nullable) = false]; diff --git a/proto/sedachain/pkr/v1/pkr.proto b/proto/sedachain/pubkey/v1/pubkey.proto similarity index 76% rename from proto/sedachain/pkr/v1/pkr.proto rename to proto/sedachain/pubkey/v1/pubkey.proto index 308bda4f..4a76f701 100644 --- a/proto/sedachain/pkr/v1/pkr.proto +++ b/proto/sedachain/pubkey/v1/pubkey.proto @@ -1,11 +1,11 @@ syntax = "proto3"; -package sedachain.pkr.v1; +package sedachain.pubkey.v1; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; import "cosmos_proto/cosmos.proto"; -option go_package = "github.com/sedaprotocol/seda-chain/x/pkr/types"; +option go_package = "github.com/sedaprotocol/seda-chain/x/pubkey/types"; // IndexPubKeyPair defines an index - public key pair. message IndexedPubKey { diff --git a/proto/sedachain/pkr/v1/query.proto b/proto/sedachain/pubkey/v1/query.proto similarity index 76% rename from proto/sedachain/pkr/v1/query.proto rename to proto/sedachain/pubkey/v1/query.proto index afe915ec..4203210d 100644 --- a/proto/sedachain/pkr/v1/query.proto +++ b/proto/sedachain/pubkey/v1/query.proto @@ -1,19 +1,19 @@ syntax = "proto3"; -package sedachain.pkr.v1; +package sedachain.pubkey.v1; import "google/api/annotations.proto"; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; -import "sedachain/pkr/v1/genesis.proto"; +import "sedachain/pubkey/v1/genesis.proto"; -option go_package = "github.com/sedaprotocol/seda-chain/x/pkr/types"; +option go_package = "github.com/sedaprotocol/seda-chain/x/pubkey/types"; // Query defines the gRPC querier service. service Query { // ValidatorKeys returns a given validator's registered keys. rpc ValidatorKeys(QueryValidatorKeysRequest) returns (QueryValidatorKeysResponse) { - option (google.api.http).get = "/seda-chain/pkr/validator_keys/{validator_addr}"; + option (google.api.http).get = "/seda-chain/pubkey/validator_keys/{validator_addr}"; } } diff --git a/proto/sedachain/pkr/v1/tx.proto b/proto/sedachain/pubkey/v1/tx.proto similarity index 80% rename from proto/sedachain/pkr/v1/tx.proto rename to proto/sedachain/pubkey/v1/tx.proto index 6de2e87a..41cc5367 100644 --- a/proto/sedachain/pkr/v1/tx.proto +++ b/proto/sedachain/pubkey/v1/tx.proto @@ -1,15 +1,15 @@ syntax = "proto3"; -package sedachain.pkr.v1; +package sedachain.pubkey.v1; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; -import "sedachain/pkr/v1/pkr.proto"; +import "sedachain/pubkey/v1/pubkey.proto"; -option go_package = "github.com/sedaprotocol/seda-chain/x/pkr/types"; +option go_package = "github.com/sedaprotocol/seda-chain/x/pubkey/types"; -// Msg defines the pkr Msg service. +// Msg defines the pubkey Msg service. service Msg { option (cosmos.msg.v1.service) = true; diff --git a/scripts/mockgen.sh b/scripts/mockgen.sh index 7663c244..6640e428 100755 --- a/scripts/mockgen.sh +++ b/scripts/mockgen.sh @@ -10,4 +10,4 @@ fi # Generate mocks for the given package $mockgen_cmd -source=$GOPATH/pkg/mod/github.com/\!cosm\!wasm/wasmd@v0.50.0/x/wasm/types/exported_keepers.go -package testutil -destination x/wasm-storage/keeper/testutil/wasm_keepers_mock.go $mockgen_cmd -source=x/wasm-storage/types/expected_keepers.go -package testutil -destination x/wasm-storage/keeper/testutil/expected_keepers_mock.go -$mockgen_cmd -source=x/pkr/types/expected_keepers.go -package testutil -destination x/pkr/keeper/testutil/expected_keepers_mock.go +$mockgen_cmd -source=x/pubkey/types/expected_keepers.go -package testutil -destination x/pubkey/keeper/testutil/expected_keepers_mock.go diff --git a/x/pkr/keeper/msg_server_test.go b/x/pkr/keeper/msg_server_test.go deleted file mode 100644 index 76362b9b..00000000 --- a/x/pkr/keeper/msg_server_test.go +++ /dev/null @@ -1,87 +0,0 @@ -package keeper_test - -import ( - "os" - "path/filepath" - - "cosmossdk.io/collections" - gomock "go.uber.org/mock/gomock" - - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - "github.com/sedaprotocol/seda-chain/x/pkr/types" -) - -func (s *KeeperTestSuite) TestMsgServer_AddKey() { - pubKeys, valAddrs := s.generatePubKeysAndValAddrs(2) - - tests := []struct { - name string - msg *types.MsgAddKey - valAddrBytes []byte - wantErr error - }{ - { - name: "Happy path", - msg: &types.MsgAddKey{ - ValidatorAddr: valAddrs[0].String(), - IndexedPubKeys: []types.IndexedPubKey{ - { - Index: 0, - PubKey: pubKeys[0], - }, - }, - }, - valAddrBytes: valAddrs[0].Bytes(), - wantErr: nil, - }, - { - name: "Invalid Any", - msg: &types.MsgAddKey{ - ValidatorAddr: valAddrs[1].String(), - IndexedPubKeys: []types.IndexedPubKey{ - { - Index: 0, - PubKey: func() *codectypes.Any { - any, err := codectypes.NewAnyWithValue(&stakingtypes.Commission{}) - s.Require().NoError(err) - return any - }(), - }, - }, - }, - valAddrBytes: valAddrs[1].Bytes(), - wantErr: sdkerrors.ErrInvalidType, - }, - } - for _, tt := range tests { - s.Run(tt.name, func() { - s.T().Cleanup(func() { - path := s.serverCtx.Config.PrivValidatorKeyFile() - path = filepath.Dir(path) - s.Require().NoError(os.RemoveAll(path)) - }) - - // Validator must exist. - s.mockStakingKeeper.EXPECT().GetValidator(gomock.Any(), tt.valAddrBytes).Return(stakingtypes.Validator{}, nil) - - got, err := s.msgSrvr.AddKey(s.ctx, tt.msg) - if tt.wantErr != nil { - s.Require().ErrorIs(err, tt.wantErr) - s.Require().Nil(got) - return - } - s.Require().NoError(err) - s.Require().NotNil(got) - - pkActual, err := s.keeper.PubKeys.Get(s.ctx, collections.Join(tt.valAddrBytes, tt.msg.IndexedPubKeys[0].Index)) - s.Require().NoError(err) - pkExpected, ok := tt.msg.IndexedPubKeys[0].PubKey.GetCachedValue().(cryptotypes.PubKey) - s.Require().True(ok) - s.Require().Equal(pkExpected, pkActual) - }) - } -} diff --git a/x/pkr/types/errors.go b/x/pkr/types/errors.go deleted file mode 100644 index 68d1a70f..00000000 --- a/x/pkr/types/errors.go +++ /dev/null @@ -1,9 +0,0 @@ -package types - -import "cosmossdk.io/errors" - -var ( - ErrEmptyValue = errors.Register("pkr", 1, "empty value") - ErrInvalidType = errors.Register("pkr", 2, "invalid type") - ErrValidatorNotFound = errors.Register("pkr", 3, "validator not found") -) diff --git a/x/pkr/client/cli/query.go b/x/pubkey/client/cli/query.go similarity index 93% rename from x/pkr/client/cli/query.go rename to x/pubkey/client/cli/query.go index 1e13b57f..a4f7da95 100644 --- a/x/pkr/client/cli/query.go +++ b/x/pubkey/client/cli/query.go @@ -8,11 +8,11 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/sedaprotocol/seda-chain/x/pkr/types" + "github.com/sedaprotocol/seda-chain/x/pubkey/types" ) // GetQueryCmd returns the CLI query commands for this module -func GetQueryCmd(_ string) *cobra.Command { +func GetQueryCmd() *cobra.Command { cmd := &cobra.Command{ Use: types.ModuleName, Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), diff --git a/x/pkr/client/cli/tx.go b/x/pubkey/client/cli/tx.go similarity index 59% rename from x/pkr/client/cli/tx.go rename to x/pubkey/client/cli/tx.go index 93f33804..1d3ee8b5 100644 --- a/x/pkr/client/cli/tx.go +++ b/x/pubkey/client/cli/tx.go @@ -7,7 +7,8 @@ import ( "github.com/spf13/cobra" - cfg "github.com/cometbft/cometbft/config" + cmtcrypto "github.com/cometbft/cometbft/crypto" + "github.com/cometbft/cometbft/crypto/secp256k1" cmtjson "github.com/cometbft/cometbft/libs/json" cmtos "github.com/cometbft/cometbft/libs/os" @@ -16,11 +17,10 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - crypto "github.com/cosmos/cosmos-sdk/crypto/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/server" - "github.com/sedaprotocol/seda-chain/x/pkr/types" + "github.com/sedaprotocol/seda-chain/x/pubkey/types" ) const ( @@ -44,12 +44,12 @@ func GetTxCmd(valAddrCodec address.Codec) *cobra.Command { return cmd } -// AddKey returns the command for adding a new key and uploading its -// public key on chain at a given index. +// AddKey returns the command for generating the SEDA keys and +// uploading their public keys on chain. func AddKey(ac address.Codec) *cobra.Command { cmd := &cobra.Command{ - Use: "add-key", - Short: "Generate the SEDA keys and upload their public keys on chain at a given index", + Use: "add-seda-keys", + Short: "Generate the SEDA keys and upload their public keys.", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) @@ -58,7 +58,11 @@ func AddKey(ac address.Codec) *cobra.Command { } serverCfg := server.GetServerContextFromCmd(cmd).Config - valAddr, err := ac.BytesToString(clientCtx.GetFromAddress()) + fromAddr := clientCtx.GetFromAddress() + if fromAddr.Empty() { + return fmt.Errorf("set the from address using --from flag") + } + valAddr, err := ac.BytesToString(fromAddr) if err != nil { return err } @@ -72,8 +76,8 @@ func AddKey(ac address.Codec) *cobra.Command { } } else { pks, err = generateSEDAKeys( - serverCfg, []privKeyGenerator{secp256k1GenPrivKey}, + filepath.Dir(serverCfg.PrivValidatorKeyFile()), ) if err != nil { return err @@ -93,23 +97,9 @@ func AddKey(ac address.Codec) *cobra.Command { return cmd } -type IndexKey struct { - Index uint32 `json:"index"` - PubKey crypto.PubKey `json:"pub_key"` - PrivKey crypto.PrivKey `json:"priv_key"` -} - -// saveSEDAKeys saves a given list of IndexKeys at a given path. -func saveSEDAKeys(keys []IndexKey, savePath string) error { - jsonBytes, err := cmtjson.MarshalIndent(keys, "", " ") // TODO use simple json.Marshal? - if err != nil { - return fmt.Errorf("failed to marshal SEDA keys: %v", err) - } - err = os.WriteFile(savePath, jsonBytes, 0o600) - if err != nil { - return fmt.Errorf("failed to write SEDA key file: %v", err) - } - return nil +type IndexedPrivKey struct { + Index uint32 `json:"index"` + PrivKey cmtcrypto.PrivKey `json:"priv_key"` } // loadSEDAPubKeys loads the SEDA key file from the given path and @@ -119,68 +109,93 @@ func loadSEDAPubKeys(loadPath string) ([]types.IndexedPubKey, error) { if err != nil { return nil, fmt.Errorf("failed to read SEDA keys from %v: %v", loadPath, err) } - var keys []IndexKey - err = cmtjson.Unmarshal(keysJSONBytes, keys) + var keys []IndexedPrivKey + err = cmtjson.Unmarshal(keysJSONBytes, &keys) if err != nil { return nil, fmt.Errorf("failed to unmarshal SEDA keys from %v: %v", loadPath, err) } - var result []types.IndexedPubKey - for _, key := range keys { - pkAny, err := codectypes.NewAnyWithValue(key.PubKey) + result := make([]types.IndexedPubKey, len(keys)) + for i, key := range keys { + // Convert to SDK type for app-level use. + pubKey, err := cryptocodec.FromCmtPubKeyInterface(key.PrivKey.PubKey()) if err != nil { return nil, err } - result = append(result, types.IndexedPubKey{ + pkAny, err := codectypes.NewAnyWithValue(pubKey) + if err != nil { + return nil, err + } + result[i] = types.IndexedPubKey{ Index: key.Index, PubKey: pkAny, - }) + } } return result, nil } -type privKeyGenerator func() crypto.PrivKey +// saveSEDAKeys saves a given list of IndexedPrivKey in the directory +// at dirPath. +func saveSEDAKeys(keys []IndexedPrivKey, dirPath string) error { + savePath := filepath.Join(dirPath, SEDAKeyFileName) + if cmtos.FileExists(savePath) { + return fmt.Errorf("SEDA key file already exists at %s", savePath) + } + err := cmtos.EnsureDir(filepath.Dir(savePath), 0o700) + if err != nil { + return err + } + jsonBytes, err := cmtjson.MarshalIndent(keys, "", " ") + if err != nil { + return fmt.Errorf("failed to marshal SEDA keys: %v", err) + } + err = os.WriteFile(savePath, jsonBytes, 0o600) + if err != nil { + return fmt.Errorf("failed to write SEDA key file: %v", err) + } + return nil +} -func secp256k1GenPrivKey() crypto.PrivKey { +type privKeyGenerator func() cmtcrypto.PrivKey + +func secp256k1GenPrivKey() cmtcrypto.PrivKey { return secp256k1.GenPrivKey() } // generateSEDAKeys generates SEDA keys given a list of private key // generators, saves them to the SEDA key file, and returns the resulting // index-public key pairs. Index is assigned incrementally in the order -// of the given private key generators. -func generateSEDAKeys(config *cfg.Config, generators []privKeyGenerator) ([]types.IndexedPubKey, error) { - var keys []IndexKey - var result []types.IndexedPubKey +// of the given private key generators. The key file is stored in the +// directory given by dirPath. +func generateSEDAKeys(generators []privKeyGenerator, dirPath string) ([]types.IndexedPubKey, error) { + keys := make([]IndexedPrivKey, len(generators)) + result := make([]types.IndexedPubKey, len(generators)) for i, generator := range generators { privKey := generator() - keys = append(keys, IndexKey{ + keys[i] = IndexedPrivKey{ Index: uint32(i), PrivKey: privKey, - PubKey: privKey.PubKey(), - }) + } - pkAny, err := codectypes.NewAnyWithValue(privKey.PubKey()) + // Convert to SDK type for app-level use. + pubKey, err := cryptocodec.FromCmtPubKeyInterface(privKey.PubKey()) + if err != nil { + return nil, err + } + pkAny, err := codectypes.NewAnyWithValue(pubKey) if err != nil { return nil, err } - result = append(result, types.IndexedPubKey{ + result[i] = types.IndexedPubKey{ Index: uint32(i), PubKey: pkAny, - }) + } } // The key file is placed in the same directory as the validator key file. - pvKeyFile := config.PrivValidatorKeyFile() - savePath := filepath.Join(filepath.Dir(pvKeyFile), SEDAKeyFileName) - if cmtos.FileExists(savePath) { - return nil, fmt.Errorf("SEDA key file already exists at %s", savePath) - } - err := cmtos.EnsureDir(filepath.Dir(pvKeyFile), 0o700) + err := saveSEDAKeys(keys, dirPath) if err != nil { return nil, err } - saveSEDAKeys(keys, savePath) - return result, nil } diff --git a/x/pubkey/client/cli/tx_test.go b/x/pubkey/client/cli/tx_test.go new file mode 100644 index 00000000..856ce381 --- /dev/null +++ b/x/pubkey/client/cli/tx_test.go @@ -0,0 +1,139 @@ +package cli_test + +import ( + "context" + "fmt" + "io" + "os" + "path/filepath" + "testing" + + abci "github.com/cometbft/cometbft/abci/types" + rpcclientmock "github.com/cometbft/cometbft/rpc/client/mock" + "github.com/stretchr/testify/suite" + + sdkmath "cosmossdk.io/math" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/server" + svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + testutilmod "github.com/cosmos/cosmos-sdk/types/module/testutil" + + "github.com/sedaprotocol/seda-chain/app/params" + "github.com/sedaprotocol/seda-chain/x/pubkey/client/cli" +) + +type CLITestSuite struct { + suite.Suite + + kr keyring.Keyring + encCfg testutilmod.TestEncodingConfig + baseCtx client.Context + clientCtx client.Context + commonFlags []string + saveDir string +} + +func TestCLITestSuite(t *testing.T) { + suite.Run(t, new(CLITestSuite)) +} + +func (s *CLITestSuite) SetupSuite() { + config := sdk.GetConfig() + config.SetBech32PrefixForAccount(params.Bech32PrefixAccAddr, params.Bech32PrefixAccPub) + config.SetBech32PrefixForValidator(params.Bech32PrefixValAddr, params.Bech32PrefixValPub) + config.SetBech32PrefixForConsensusNode(params.Bech32PrefixConsAddr, params.Bech32PrefixConsPub) + config.Seal() + + s.encCfg = testutilmod.MakeTestEncodingConfig() + s.kr = keyring.NewInMemory(s.encCfg.Codec) + s.baseCtx = client.Context{}. + WithKeyring(s.kr). + WithTxConfig(s.encCfg.TxConfig). + WithCodec(s.encCfg.Codec). + WithClient(clitestutil.MockCometRPC{Client: rpcclientmock.Client{}}). + WithAccountRetriever(client.MockAccountRetriever{}). + WithOutput(io.Discard). + WithChainID("test-chain") + + ctxGen := func() client.Context { + bz, _ := s.encCfg.Codec.Marshal(&sdk.TxResponse{}) + c := clitestutil.NewMockCometRPC(abci.ResponseQuery{ + Value: bz, + }) + return s.baseCtx.WithClient(c) + } + s.clientCtx = ctxGen() + + // Create a new account and set it as from flag + info, _, err := s.clientCtx.Keyring.NewMnemonic("NewValidator", keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) + s.Require().NoError(err) + pk, err := info.GetPubKey() + s.Require().NoError(err) + account := sdk.AccAddress(pk.Address()) + + s.commonFlags = []string{ + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin("seda", sdkmath.NewInt(10))).String()), + fmt.Sprintf("--%s=%s", flags.FlagFrom, account.String()), + } +} + +func (s *CLITestSuite) TestAddSEDAKeys() { + cmd := cli.AddKey(s.clientCtx.Codec.InterfaceRegistry().SigningContext().ValidatorAddressCodec()) + cmd.SetOutput(io.Discard) + + testCases := []struct { + name string + args []string + expectErrMsg string + }{ + { + "generate new keys", + s.commonFlags, + "", + }, + { + "key-file flag, nonexistent file", + append([]string{fmt.Sprintf("--%s=%s", cli.FlagKeyFile, "./config/seda_keyys.json")}, s.commonFlags...), + "failed to read SEDA keys from ./config/seda_keyys.json: open ./config/seda_keyys.json: no such file or directory", + }, + { + "key-file flag, valid file", + append([]string{fmt.Sprintf("--%s=%s", cli.FlagKeyFile, "./config/seda_keys.json")}, s.commonFlags...), + "", + }, + } + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + ctx := svrcmd.CreateExecuteContext(context.Background()) + cmd.SetContext(ctx) + cmd.SetArgs(tc.args) + + s.Require().NoError(client.SetCmdClientContextHandler(s.baseCtx, cmd)) + s.saveDir = filepath.Dir(server.GetServerContextFromCmd(cmd).Config.PrivValidatorKeyFile()) + + out, err := clitestutil.ExecTestCLICmd(s.baseCtx, cmd, tc.args) + if tc.expectErrMsg != "" { + s.Require().Error(err) + s.Require().Contains(out.String(), tc.expectErrMsg) + } else { + s.Require().NoError(err) + msg := &sdk.TxResponse{} + s.Require().NoError(s.baseCtx.Codec.UnmarshalJSON(out.Bytes(), msg), out.String()) + } + }) + } +} + +func (s *CLITestSuite) TearDownSuite() { + err := os.RemoveAll(s.saveDir) + s.Require().NoError(err) +} diff --git a/x/pkr/keeper/common_test.go b/x/pubkey/keeper/common_test.go similarity index 74% rename from x/pkr/keeper/common_test.go rename to x/pubkey/keeper/common_test.go index 43b50642..0d2d030c 100644 --- a/x/pkr/keeper/common_test.go +++ b/x/pubkey/keeper/common_test.go @@ -18,10 +18,10 @@ import ( moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/sedaprotocol/seda-chain/app/params" - "github.com/sedaprotocol/seda-chain/x/pkr" - "github.com/sedaprotocol/seda-chain/x/pkr/keeper" - "github.com/sedaprotocol/seda-chain/x/pkr/keeper/testutil" - pkrtypes "github.com/sedaprotocol/seda-chain/x/pkr/types" + "github.com/sedaprotocol/seda-chain/x/pubkey" + "github.com/sedaprotocol/seda-chain/x/pubkey/keeper" + "github.com/sedaprotocol/seda-chain/x/pubkey/keeper/testutil" + "github.com/sedaprotocol/seda-chain/x/pubkey/types" ) type KeeperTestSuite struct { @@ -31,8 +31,8 @@ type KeeperTestSuite struct { mockStakingKeeper *testutil.MockStakingKeeper cdc codec.Codec valCdc address.Codec - msgSrvr pkrtypes.MsgServer - queryClient pkrtypes.QueryClient + msgSrvr types.MsgServer + queryClient types.QueryClient serverCtx *server.Context } @@ -43,10 +43,10 @@ func TestKeeperTestSuite(t *testing.T) { func (s *KeeperTestSuite) SetupTest() { t := s.T() t.Helper() - key := storetypes.NewKVStoreKey(pkrtypes.StoreKey) + key := storetypes.NewKVStoreKey(types.StoreKey) testCtx := sdktestutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) - encCfg := moduletestutil.MakeTestEncodingConfig(pkr.AppModuleBasic{}) - pkrtypes.RegisterInterfaces(encCfg.InterfaceRegistry) + encCfg := moduletestutil.MakeTestEncodingConfig(pubkey.AppModuleBasic{}) + types.RegisterInterfaces(encCfg.InterfaceRegistry) ctrl := gomock.NewController(t) s.mockStakingKeeper = testutil.NewMockStakingKeeper(ctrl) @@ -66,6 +66,6 @@ func (s *KeeperTestSuite) SetupTest() { queryHelper := baseapp.NewQueryServerTestHelper(s.ctx, encCfg.InterfaceRegistry) querier := keeper.Querier{Keeper: *s.keeper} - pkrtypes.RegisterQueryServer(queryHelper, querier) - s.queryClient = pkrtypes.NewQueryClient(queryHelper) + types.RegisterQueryServer(queryHelper, querier) + s.queryClient = types.NewQueryClient(queryHelper) } diff --git a/x/pkr/keeper/genesis.go b/x/pubkey/keeper/genesis.go similarity index 96% rename from x/pkr/keeper/genesis.go rename to x/pubkey/keeper/genesis.go index 4f36dc7b..b870982c 100644 --- a/x/pkr/keeper/genesis.go +++ b/x/pubkey/keeper/genesis.go @@ -7,7 +7,7 @@ import ( cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/sedaprotocol/seda-chain/x/pkr/types" + "github.com/sedaprotocol/seda-chain/x/pubkey/types" ) // InitGenesis initializes the store based on the given genesis state. diff --git a/x/pkr/keeper/genesis_test.go b/x/pubkey/keeper/genesis_test.go similarity index 85% rename from x/pkr/keeper/genesis_test.go rename to x/pubkey/keeper/genesis_test.go index decf37a1..2ab7cd4b 100644 --- a/x/pkr/keeper/genesis_test.go +++ b/x/pubkey/keeper/genesis_test.go @@ -6,27 +6,27 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/sedaprotocol/seda-chain/x/pkr/types" + "github.com/sedaprotocol/seda-chain/x/pubkey/types" ) // generatePubKeysAndValAddrs randomly generates a given number of // public keys encoded in codectypes.Any type and their validator // addresses. -func (s *KeeperTestSuite) generatePubKeysAndValAddrs(num uint) ([]*codectypes.Any, []sdk.ValAddress) { - var pubKeys []*codectypes.Any +func (s *KeeperTestSuite) generatePubKeysAndValAddrs(num int) ([]*codectypes.Any, []sdk.ValAddress) { + var pkAnys []*codectypes.Any var valAddrs []sdk.ValAddress - for i := 0; i < 10; i++ { + for i := 0; i < num; i++ { privKey := secp256k1.GenPrivKey() pubKey, err := cryptocodec.FromCmtPubKeyInterface(privKey.PubKey()) s.Require().NoError(err) - any, err := codectypes.NewAnyWithValue(pubKey) + pkAny, err := codectypes.NewAnyWithValue(pubKey) s.Require().NoError(err) - pubKeys = append(pubKeys, any) + pkAnys = append(pkAnys, pkAny) valAddrs = append(valAddrs, sdk.ValAddress(privKey.PubKey().Address())) } - return pubKeys, valAddrs + return pkAnys, valAddrs } func (s *KeeperTestSuite) TestImportExportGenesis() { diff --git a/x/pkr/keeper/grpc_query.go b/x/pubkey/keeper/grpc_query.go similarity index 88% rename from x/pkr/keeper/grpc_query.go rename to x/pubkey/keeper/grpc_query.go index e1def959..a1aba3bc 100644 --- a/x/pkr/keeper/grpc_query.go +++ b/x/pubkey/keeper/grpc_query.go @@ -3,7 +3,7 @@ package keeper import ( "context" - "github.com/sedaprotocol/seda-chain/x/pkr/types" + "github.com/sedaprotocol/seda-chain/x/pubkey/types" ) var _ types.QueryServer = Querier{} diff --git a/x/pkr/keeper/grpc_query_test.go b/x/pubkey/keeper/grpc_query_test.go similarity index 95% rename from x/pkr/keeper/grpc_query_test.go rename to x/pubkey/keeper/grpc_query_test.go index 202f0236..303baaf8 100644 --- a/x/pkr/keeper/grpc_query_test.go +++ b/x/pubkey/keeper/grpc_query_test.go @@ -4,7 +4,7 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" gomock "go.uber.org/mock/gomock" - "github.com/sedaprotocol/seda-chain/x/pkr/types" + "github.com/sedaprotocol/seda-chain/x/pubkey/types" ) func (s *KeeperTestSuite) TestQuerier_ValidatorKeys() { diff --git a/x/pkr/keeper/keeper.go b/x/pubkey/keeper/keeper.go similarity index 97% rename from x/pkr/keeper/keeper.go rename to x/pubkey/keeper/keeper.go index 7756e71e..cb0d9f77 100644 --- a/x/pkr/keeper/keeper.go +++ b/x/pubkey/keeper/keeper.go @@ -11,7 +11,7 @@ import ( cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/sedaprotocol/seda-chain/x/pkr/types" + "github.com/sedaprotocol/seda-chain/x/pubkey/types" ) type Keeper struct { diff --git a/x/pkr/keeper/msg_server.go b/x/pubkey/keeper/msg_server.go similarity index 92% rename from x/pkr/keeper/msg_server.go rename to x/pubkey/keeper/msg_server.go index 3b767da1..0e270e88 100644 --- a/x/pkr/keeper/msg_server.go +++ b/x/pubkey/keeper/msg_server.go @@ -9,7 +9,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/sedaprotocol/seda-chain/x/pkr/types" + "github.com/sedaprotocol/seda-chain/x/pubkey/types" ) type msgServer struct { @@ -36,7 +36,7 @@ func (m msgServer) AddKey(goCtx context.Context, msg *types.MsgAddKey) (*types.M return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", err) } if _, err := m.stakingKeeper.GetValidator(ctx, valAddr); err != nil { - return nil, types.ErrValidatorNotFound + return nil, sdkerrors.ErrNotFound.Wrapf("validator not found %s", msg.ValidatorAddr) } for _, indPubKey := range msg.IndexedPubKeys { diff --git a/x/pubkey/keeper/msg_server_test.go b/x/pubkey/keeper/msg_server_test.go new file mode 100644 index 00000000..df482fd3 --- /dev/null +++ b/x/pubkey/keeper/msg_server_test.go @@ -0,0 +1,138 @@ +package keeper_test + +import ( + "os" + "path/filepath" + + "cosmossdk.io/collections" + gomock "go.uber.org/mock/gomock" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/sedaprotocol/seda-chain/x/pubkey/types" +) + +func (s *KeeperTestSuite) TestMsgServer_AddKey() { + pubKeys, valAddrs := s.generatePubKeysAndValAddrs(10) + + tests := []struct { + name string + msg *types.MsgAddKey + valAddr sdk.ValAddress + wantErr error + wantErrMsg string + }{ + { + name: "Happy path", + msg: &types.MsgAddKey{ + ValidatorAddr: valAddrs[0].String(), + IndexedPubKeys: []types.IndexedPubKey{ + { + Index: 0, + PubKey: pubKeys[0], + }, + { + Index: 3, + PubKey: pubKeys[1], + }, + { + Index: 57, + PubKey: pubKeys[2], + }, + }, + }, + valAddr: valAddrs[0], + wantErr: nil, + }, + { + name: "Duplicate index", + msg: &types.MsgAddKey{ + ValidatorAddr: valAddrs[1].String(), + IndexedPubKeys: []types.IndexedPubKey{ + { + Index: 12, + PubKey: pubKeys[0], + }, + { + Index: 48, + PubKey: pubKeys[1], + }, + { + Index: 5, + PubKey: pubKeys[2], + }, + { + Index: 12, + PubKey: pubKeys[3], + }, + { + Index: 50, + PubKey: pubKeys[4], + }, + }, + }, + valAddr: valAddrs[1], + wantErr: sdkerrors.ErrInvalidRequest, + wantErrMsg: "duplicate index at 12", + }, + { + name: "Invalid Any", + msg: &types.MsgAddKey{ + ValidatorAddr: valAddrs[2].String(), + IndexedPubKeys: []types.IndexedPubKey{ + { + Index: 0, + PubKey: func() *codectypes.Any { + wrongAny, err := codectypes.NewAnyWithValue(&stakingtypes.Commission{}) + s.Require().NoError(err) + return wrongAny + }(), + }, + }, + }, + valAddr: valAddrs[2], + wantErr: sdkerrors.ErrInvalidType, + }, + } + for _, tt := range tests { + s.Run(tt.name, func() { + s.T().Cleanup(func() { + path := s.serverCtx.Config.PrivValidatorKeyFile() + path = filepath.Dir(path) + s.Require().NoError(os.RemoveAll(path)) + }) + + // Mock validator store. + s.mockStakingKeeper.EXPECT().GetValidator(gomock.Any(), tt.valAddr.Bytes()).Return(stakingtypes.Validator{}, nil).AnyTimes() + + got, err := s.msgSrvr.AddKey(s.ctx, tt.msg) + if tt.wantErr != nil { + s.Require().ErrorIs(err, tt.wantErr) + s.Require().Contains(err.Error(), tt.wantErrMsg) + s.Require().Nil(got) + return + } + s.Require().NoError(err) + s.Require().NotNil(got) + + // Check the validator's keys at once. + pksActual, err := s.keeper.GetValidatorKeys(s.ctx, tt.valAddr.String()) + s.Require().NoError(err) + s.Require().Equal(tt.valAddr.String(), pksActual.ValidatorAddr) + s.Require().Equal(len(tt.msg.IndexedPubKeys), len(pksActual.IndexedPubKeys)) + + // Check each index. + for _, indPubKey := range tt.msg.IndexedPubKeys { + pkActual, err := s.keeper.PubKeys.Get(s.ctx, collections.Join(tt.valAddr.Bytes(), indPubKey.Index)) + s.Require().NoError(err) + pkExpected, ok := indPubKey.PubKey.GetCachedValue().(cryptotypes.PubKey) + s.Require().True(ok) + s.Require().Equal(pkExpected, pkActual) + } + }) + } +} diff --git a/x/pkr/keeper/testutil/expected_keepers_mock.go b/x/pubkey/keeper/testutil/expected_keepers_mock.go similarity index 90% rename from x/pkr/keeper/testutil/expected_keepers_mock.go rename to x/pubkey/keeper/testutil/expected_keepers_mock.go index b30a0d7d..7e8aa727 100644 --- a/x/pkr/keeper/testutil/expected_keepers_mock.go +++ b/x/pubkey/keeper/testutil/expected_keepers_mock.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: x/pkr/types/expected_keepers.go +// Source: x/pubkey/types/expected_keepers.go // // Generated by this command: // -// mockgen -source=x/pkr/types/expected_keepers.go -package testutil -destination x/pkr/keeper/testutil/expected_keepers_mock.go +// mockgen -source=x/pubkey/types/expected_keepers.go -package testutil -destination x/pubkey/keeper/testutil/expected_keepers_mock.go // // Package testutil is a generated GoMock package. diff --git a/x/pkr/module.go b/x/pubkey/module.go similarity index 96% rename from x/pkr/module.go rename to x/pubkey/module.go index 9fb5fbf3..b93d468f 100644 --- a/x/pkr/module.go +++ b/x/pubkey/module.go @@ -1,4 +1,4 @@ -package pkr +package pubkey import ( "context" @@ -15,9 +15,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/sedaprotocol/seda-chain/x/pkr/client/cli" - "github.com/sedaprotocol/seda-chain/x/pkr/keeper" - "github.com/sedaprotocol/seda-chain/x/pkr/types" + "github.com/sedaprotocol/seda-chain/x/pubkey/client/cli" + "github.com/sedaprotocol/seda-chain/x/pubkey/keeper" + "github.com/sedaprotocol/seda-chain/x/pubkey/types" ) var ( @@ -88,7 +88,7 @@ func (a AppModuleBasic) GetTxCmd() *cobra.Command { // GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) + return cli.GetQueryCmd() } // ---------------------------------------------------------------------------- diff --git a/x/pkr/types/codec.go b/x/pubkey/types/codec.go similarity index 100% rename from x/pkr/types/codec.go rename to x/pubkey/types/codec.go diff --git a/x/pkr/types/events.go b/x/pubkey/types/events.go similarity index 100% rename from x/pkr/types/events.go rename to x/pubkey/types/events.go diff --git a/x/pkr/types/expected_keepers.go b/x/pubkey/types/expected_keepers.go similarity index 100% rename from x/pkr/types/expected_keepers.go rename to x/pubkey/types/expected_keepers.go diff --git a/x/pkr/types/genesis.go b/x/pubkey/types/genesis.go similarity index 100% rename from x/pkr/types/genesis.go rename to x/pubkey/types/genesis.go diff --git a/x/pkr/types/genesis.pb.go b/x/pubkey/types/genesis.pb.go similarity index 83% rename from x/pkr/types/genesis.pb.go rename to x/pubkey/types/genesis.pb.go index 03bac1d0..4e354956 100644 --- a/x/pkr/types/genesis.pb.go +++ b/x/pubkey/types/genesis.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: sedachain/pkr/v1/genesis.proto +// source: sedachain/pubkey/v1/genesis.proto package types @@ -24,7 +24,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// GenesisState defines pkr module's genesis state. +// GenesisState defines pubkey module's genesis state. type GenesisState struct { ValidatorPubKeys []ValidatorPubKeys `protobuf:"bytes,1,rep,name=validator_pub_keys,json=validatorPubKeys,proto3" json:"validator_pub_keys"` } @@ -33,7 +33,7 @@ func (m *GenesisState) Reset() { *m = GenesisState{} } func (m *GenesisState) String() string { return proto.CompactTextString(m) } func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_0a702f1e4b392dc9, []int{0} + return fileDescriptor_a68b70401eeae88a, []int{0} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -70,7 +70,7 @@ func (m *GenesisState) GetValidatorPubKeys() []ValidatorPubKeys { } // ValidatorPubKeys defines a validator's list of registered public keys -// primarily used in the x/pkr genesis state. +// primarily used in the x/pubkey genesis state. type ValidatorPubKeys struct { ValidatorAddr string `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` IndexedPubKeys []IndexedPubKey `protobuf:"bytes,2,rep,name=indexed_pub_keys,json=indexedPubKeys,proto3" json:"indexed_pub_keys"` @@ -80,7 +80,7 @@ func (m *ValidatorPubKeys) Reset() { *m = ValidatorPubKeys{} } func (m *ValidatorPubKeys) String() string { return proto.CompactTextString(m) } func (*ValidatorPubKeys) ProtoMessage() {} func (*ValidatorPubKeys) Descriptor() ([]byte, []int) { - return fileDescriptor_0a702f1e4b392dc9, []int{1} + return fileDescriptor_a68b70401eeae88a, []int{1} } func (m *ValidatorPubKeys) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -124,34 +124,35 @@ func (m *ValidatorPubKeys) GetIndexedPubKeys() []IndexedPubKey { } func init() { - proto.RegisterType((*GenesisState)(nil), "sedachain.pkr.v1.GenesisState") - proto.RegisterType((*ValidatorPubKeys)(nil), "sedachain.pkr.v1.ValidatorPubKeys") + proto.RegisterType((*GenesisState)(nil), "sedachain.pubkey.v1.GenesisState") + proto.RegisterType((*ValidatorPubKeys)(nil), "sedachain.pubkey.v1.ValidatorPubKeys") } -func init() { proto.RegisterFile("sedachain/pkr/v1/genesis.proto", fileDescriptor_0a702f1e4b392dc9) } +func init() { proto.RegisterFile("sedachain/pubkey/v1/genesis.proto", fileDescriptor_a68b70401eeae88a) } -var fileDescriptor_0a702f1e4b392dc9 = []byte{ - // 320 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x4e, 0x4d, 0x49, - 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x2f, 0xc8, 0x2e, 0xd2, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, - 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0xcb, 0xeb, 0x15, - 0x64, 0x17, 0xe9, 0x95, 0x19, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x25, 0xf5, 0x41, 0x2c, - 0x88, 0x3a, 0x29, 0xc9, 0xe4, 0xfc, 0xe2, 0xdc, 0xfc, 0xe2, 0x78, 0x88, 0x04, 0x84, 0x03, 0x95, - 0x92, 0xc2, 0xb0, 0x02, 0x64, 0x12, 0x58, 0x4e, 0x29, 0x8d, 0x8b, 0xc7, 0x1d, 0x62, 0x5f, 0x70, - 0x49, 0x62, 0x49, 0xaa, 0x50, 0x18, 0x97, 0x50, 0x59, 0x62, 0x4e, 0x66, 0x4a, 0x62, 0x49, 0x7e, - 0x51, 0x7c, 0x41, 0x69, 0x52, 0x7c, 0x76, 0x6a, 0x65, 0xb1, 0x04, 0xa3, 0x02, 0xb3, 0x06, 0xb7, - 0x91, 0x92, 0x1e, 0xba, 0x5b, 0xf4, 0xc2, 0x60, 0x6a, 0x03, 0x4a, 0x93, 0xbc, 0x53, 0x2b, 0x8b, - 0x9d, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x12, 0x28, 0x43, 0x13, 0x57, 0x5a, 0xcb, 0xc8, 0x25, - 0x80, 0xae, 0x58, 0xc8, 0x83, 0x8b, 0x0f, 0x61, 0x59, 0x62, 0x4a, 0x4a, 0x91, 0x04, 0xa3, 0x02, - 0xa3, 0x06, 0xa7, 0x93, 0xe2, 0xa5, 0x2d, 0xba, 0xb2, 0x50, 0x2f, 0xc0, 0x35, 0x39, 0xa6, 0xa4, - 0x14, 0xa5, 0x16, 0x17, 0x07, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x07, 0xf1, 0x96, 0x21, 0x8b, 0x0b, - 0xf9, 0x73, 0x09, 0x64, 0xe6, 0xa5, 0xa4, 0x56, 0xa4, 0xa6, 0x20, 0x1c, 0xcd, 0x04, 0x76, 0xb4, - 0x3c, 0xa6, 0xa3, 0x3d, 0x21, 0x2a, 0x21, 0xae, 0x80, 0xba, 0x98, 0x2f, 0x13, 0x59, 0xb0, 0xd8, - 0xc9, 0xe3, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, - 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xf4, 0xd2, 0x33, 0x4b, - 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x46, 0x83, 0xc3, 0x31, 0x39, 0x3f, 0x07, - 0xcc, 0xd1, 0x85, 0x04, 0x73, 0x05, 0x38, 0xa0, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, - 0x0a, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x27, 0x1c, 0x69, 0x39, 0xe9, 0x01, 0x00, 0x00, +var fileDescriptor_a68b70401eeae88a = []byte{ + // 322 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2c, 0x4e, 0x4d, 0x49, + 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x2f, 0x28, 0x4d, 0xca, 0x4e, 0xad, 0xd4, 0x2f, 0x33, 0xd4, + 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, + 0x2b, 0xd1, 0x83, 0x28, 0xd1, 0x2b, 0x33, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xcb, 0xeb, + 0x83, 0x58, 0x10, 0xa5, 0x52, 0x92, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xf1, 0x10, 0x09, 0x08, + 0x07, 0x2a, 0xa5, 0x80, 0xcd, 0x22, 0xa8, 0x79, 0x60, 0x15, 0x4a, 0x99, 0x5c, 0x3c, 0xee, 0x10, + 0x8b, 0x83, 0x4b, 0x12, 0x4b, 0x52, 0x85, 0x22, 0xb9, 0x84, 0xca, 0x12, 0x73, 0x32, 0x53, 0x12, + 0x4b, 0xf2, 0x8b, 0xe2, 0x0b, 0x4a, 0x93, 0xe2, 0xb3, 0x53, 0x2b, 0x8b, 0x25, 0x18, 0x15, 0x98, + 0x35, 0xb8, 0x8d, 0x54, 0xf5, 0xb0, 0x38, 0x4a, 0x2f, 0x0c, 0xa6, 0x3c, 0xa0, 0x34, 0xc9, 0x3b, + 0xb5, 0xb2, 0xd8, 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x20, 0x81, 0x32, 0x34, 0x71, 0xa5, 0x0d, + 0x8c, 0x5c, 0x02, 0xe8, 0x8a, 0x85, 0x3c, 0xb8, 0xf8, 0x10, 0xf6, 0x25, 0xa6, 0xa4, 0x14, 0x49, + 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x3a, 0x29, 0x5e, 0xda, 0xa2, 0x2b, 0x0b, 0xf5, 0x0b, 0x5c, 0x93, + 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0x71, 0x70, 0x49, 0x51, 0x66, 0x5e, 0x7a, 0x10, 0x6f, 0x19, + 0xb2, 0xb8, 0x50, 0x10, 0x97, 0x40, 0x66, 0x5e, 0x4a, 0x6a, 0x45, 0x6a, 0x0a, 0xc2, 0xdd, 0x4c, + 0x60, 0x77, 0x2b, 0x61, 0x75, 0xb7, 0x27, 0x44, 0x31, 0xc4, 0x21, 0x50, 0x47, 0xf3, 0x65, 0x22, + 0x0b, 0x16, 0x3b, 0x79, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, + 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x61, + 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xc8, 0x74, 0x70, 0x68, 0x26, + 0xe7, 0xe7, 0x80, 0x39, 0xba, 0x90, 0x20, 0xaf, 0x80, 0x05, 0x7a, 0x49, 0x65, 0x41, 0x6a, 0x71, + 0x12, 0x1b, 0x58, 0x8d, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x95, 0x37, 0xd4, 0xb9, 0xfe, 0x01, + 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/pkr/types/keys.go b/x/pubkey/types/keys.go similarity index 83% rename from x/pkr/types/keys.go rename to x/pubkey/types/keys.go index b745cb58..bf1c278a 100644 --- a/x/pkr/types/keys.go +++ b/x/pubkey/types/keys.go @@ -3,7 +3,7 @@ package types import "cosmossdk.io/collections" const ( - ModuleName = "pkr" + ModuleName = "pubkey" StoreKey ) diff --git a/x/pkr/types/pkr.pb.go b/x/pubkey/types/pubkey.pb.go similarity index 68% rename from x/pkr/types/pkr.pb.go rename to x/pubkey/types/pubkey.pb.go index 62c7762f..50996d41 100644 --- a/x/pkr/types/pkr.pb.go +++ b/x/pubkey/types/pubkey.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: sedachain/pkr/v1/pkr.proto +// source: sedachain/pubkey/v1/pubkey.proto package types @@ -35,7 +35,7 @@ func (m *IndexedPubKey) Reset() { *m = IndexedPubKey{} } func (m *IndexedPubKey) String() string { return proto.CompactTextString(m) } func (*IndexedPubKey) ProtoMessage() {} func (*IndexedPubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_5be4d34ea5984f92, []int{0} + return fileDescriptor_a51ebcd05a6c14e0, []int{0} } func (m *IndexedPubKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -79,29 +79,30 @@ func (m *IndexedPubKey) GetPubKey() *types.Any { } func init() { - proto.RegisterType((*IndexedPubKey)(nil), "sedachain.pkr.v1.IndexedPubKey") + proto.RegisterType((*IndexedPubKey)(nil), "sedachain.pubkey.v1.IndexedPubKey") } -func init() { proto.RegisterFile("sedachain/pkr/v1/pkr.proto", fileDescriptor_5be4d34ea5984f92) } +func init() { proto.RegisterFile("sedachain/pubkey/v1/pubkey.proto", fileDescriptor_a51ebcd05a6c14e0) } -var fileDescriptor_5be4d34ea5984f92 = []byte{ - // 254 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2a, 0x4e, 0x4d, 0x49, - 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x2f, 0xc8, 0x2e, 0xd2, 0x2f, 0x33, 0x04, 0x51, 0x7a, 0x05, - 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x02, 0x70, 0x39, 0x3d, 0x90, 0x60, 0x99, 0xa1, 0x94, 0x48, 0x7a, - 0x7e, 0x7a, 0x3e, 0x58, 0x52, 0x1f, 0xc4, 0x82, 0xa8, 0x93, 0x92, 0x4c, 0xcf, 0xcf, 0x4f, 0xcf, - 0x49, 0xd5, 0x07, 0xf3, 0x92, 0x4a, 0xd3, 0xf4, 0x13, 0xf3, 0x2a, 0x61, 0x52, 0xc9, 0xf9, 0xc5, - 0xb9, 0xf9, 0xc5, 0xf1, 0x10, 0x3d, 0x10, 0x0e, 0x44, 0x4a, 0x29, 0x8f, 0x8b, 0xd7, 0x33, 0x2f, - 0x25, 0xb5, 0x22, 0x35, 0x25, 0xa0, 0x34, 0xc9, 0x3b, 0xb5, 0x52, 0x48, 0x84, 0x8b, 0x35, 0x13, - 0x24, 0x20, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x1b, 0x04, 0xe1, 0x08, 0xb9, 0x73, 0xb1, 0x17, 0x94, - 0x26, 0xc5, 0x67, 0xa7, 0x56, 0x4a, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x1b, 0x89, 0xe8, 0x41, 0xac, - 0xd3, 0x83, 0x59, 0xa7, 0xe7, 0x98, 0x57, 0xe9, 0x24, 0x71, 0x6a, 0x8b, 0xae, 0x08, 0xd4, 0xfc, - 0xe4, 0xa2, 0xca, 0x82, 0x92, 0x7c, 0x3d, 0x88, 0xb1, 0x41, 0x6c, 0x05, 0x60, 0xda, 0xc9, 0xe3, - 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, - 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xf4, 0xd2, 0x33, 0x4b, 0x32, 0x4a, - 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x5e, 0x06, 0x1b, 0x9c, 0x9c, 0x9f, 0x03, 0xe6, 0xe8, - 0x42, 0x02, 0xa7, 0x02, 0x1c, 0x3c, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x05, 0xc6, - 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc5, 0x00, 0xcd, 0x49, 0x3c, 0x01, 0x00, 0x00, +var fileDescriptor_a51ebcd05a6c14e0 = []byte{ + // 257 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x28, 0x4e, 0x4d, 0x49, + 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x2f, 0x28, 0x4d, 0xca, 0x4e, 0xad, 0xd4, 0x2f, 0x33, 0x84, + 0xb2, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x84, 0xe1, 0x2a, 0xf4, 0xa0, 0xe2, 0x65, 0x86, + 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x79, 0x7d, 0x10, 0x0b, 0xa2, 0x54, 0x4a, 0x32, 0x3d, + 0x3f, 0x3f, 0x3d, 0x27, 0x55, 0x1f, 0xcc, 0x4b, 0x2a, 0x4d, 0xd3, 0x4f, 0xcc, 0xab, 0x84, 0x49, + 0x25, 0xe7, 0x17, 0xe7, 0xe6, 0x17, 0xc7, 0x43, 0xf4, 0x40, 0x38, 0x10, 0x29, 0xa5, 0x3c, 0x2e, + 0x5e, 0xcf, 0xbc, 0x94, 0xd4, 0x8a, 0xd4, 0x94, 0x80, 0xd2, 0x24, 0xef, 0xd4, 0x4a, 0x21, 0x11, + 0x2e, 0xd6, 0x4c, 0x90, 0x80, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x6f, 0x10, 0x84, 0x23, 0xe4, 0xce, + 0xc5, 0x5e, 0x50, 0x9a, 0x14, 0x9f, 0x9d, 0x5a, 0x29, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, + 0xa2, 0x07, 0xb1, 0x4e, 0x0f, 0x66, 0x9d, 0x9e, 0x63, 0x5e, 0xa5, 0x93, 0xc4, 0xa9, 0x2d, 0xba, + 0x22, 0x50, 0xf3, 0x93, 0x8b, 0x2a, 0x0b, 0x4a, 0xf2, 0xf5, 0x20, 0xc6, 0x06, 0xb1, 0x15, 0x80, + 0x69, 0x27, 0xef, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, + 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4c, 0xcf, + 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, 0xf9, 0x1a, 0x6c, 0x70, 0x72, 0x7e, + 0x0e, 0x98, 0xa3, 0x0b, 0x09, 0xa5, 0x0a, 0x58, 0x38, 0x95, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, + 0x81, 0xd5, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x07, 0xf2, 0x6d, 0x74, 0x48, 0x01, 0x00, + 0x00, } func (m *IndexedPubKey) Marshal() (dAtA []byte, err error) { @@ -131,21 +132,21 @@ func (m *IndexedPubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintPkr(dAtA, i, uint64(size)) + i = encodeVarintPubkey(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } if m.Index != 0 { - i = encodeVarintPkr(dAtA, i, uint64(m.Index)) + i = encodeVarintPubkey(dAtA, i, uint64(m.Index)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func encodeVarintPkr(dAtA []byte, offset int, v uint64) int { - offset -= sovPkr(v) +func encodeVarintPubkey(dAtA []byte, offset int, v uint64) int { + offset -= sovPubkey(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -162,20 +163,20 @@ func (m *IndexedPubKey) Size() (n int) { var l int _ = l if m.Index != 0 { - n += 1 + sovPkr(uint64(m.Index)) + n += 1 + sovPubkey(uint64(m.Index)) } if m.PubKey != nil { l = m.PubKey.Size() - n += 1 + l + sovPkr(uint64(l)) + n += 1 + l + sovPubkey(uint64(l)) } return n } -func sovPkr(x uint64) (n int) { +func sovPubkey(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } -func sozPkr(x uint64) (n int) { - return sovPkr(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func sozPubkey(x uint64) (n int) { + return sovPubkey(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *IndexedPubKey) Unmarshal(dAtA []byte) error { l := len(dAtA) @@ -185,7 +186,7 @@ func (m *IndexedPubKey) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPkr + return ErrIntOverflowPubkey } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -213,7 +214,7 @@ func (m *IndexedPubKey) Unmarshal(dAtA []byte) error { m.Index = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPkr + return ErrIntOverflowPubkey } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -232,7 +233,7 @@ func (m *IndexedPubKey) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPkr + return ErrIntOverflowPubkey } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -245,11 +246,11 @@ func (m *IndexedPubKey) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthPkr + return ErrInvalidLengthPubkey } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthPkr + return ErrInvalidLengthPubkey } if postIndex > l { return io.ErrUnexpectedEOF @@ -263,12 +264,12 @@ func (m *IndexedPubKey) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipPkr(dAtA[iNdEx:]) + skippy, err := skipPubkey(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPkr + return ErrInvalidLengthPubkey } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -282,7 +283,7 @@ func (m *IndexedPubKey) Unmarshal(dAtA []byte) error { } return nil } -func skipPkr(dAtA []byte) (n int, err error) { +func skipPubkey(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 @@ -290,7 +291,7 @@ func skipPkr(dAtA []byte) (n int, err error) { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowPkr + return 0, ErrIntOverflowPubkey } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -307,7 +308,7 @@ func skipPkr(dAtA []byte) (n int, err error) { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowPkr + return 0, ErrIntOverflowPubkey } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -323,7 +324,7 @@ func skipPkr(dAtA []byte) (n int, err error) { var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowPkr + return 0, ErrIntOverflowPubkey } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -336,14 +337,14 @@ func skipPkr(dAtA []byte) (n int, err error) { } } if length < 0 { - return 0, ErrInvalidLengthPkr + return 0, ErrInvalidLengthPubkey } iNdEx += length case 3: depth++ case 4: if depth == 0 { - return 0, ErrUnexpectedEndOfGroupPkr + return 0, ErrUnexpectedEndOfGroupPubkey } depth-- case 5: @@ -352,7 +353,7 @@ func skipPkr(dAtA []byte) (n int, err error) { return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { - return 0, ErrInvalidLengthPkr + return 0, ErrInvalidLengthPubkey } if depth == 0 { return iNdEx, nil @@ -362,7 +363,7 @@ func skipPkr(dAtA []byte) (n int, err error) { } var ( - ErrInvalidLengthPkr = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPkr = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupPkr = fmt.Errorf("proto: unexpected end of group") + ErrInvalidLengthPubkey = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPubkey = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPubkey = fmt.Errorf("proto: unexpected end of group") ) diff --git a/x/pkr/types/query.pb.go b/x/pubkey/types/query.pb.go similarity index 83% rename from x/pkr/types/query.pb.go rename to x/pubkey/types/query.pb.go index f004726b..16687ace 100644 --- a/x/pkr/types/query.pb.go +++ b/x/pubkey/types/query.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: sedachain/pkr/v1/query.proto +// source: sedachain/pubkey/v1/query.proto package types @@ -39,7 +39,7 @@ func (m *QueryValidatorKeysRequest) Reset() { *m = QueryValidatorKeysReq func (m *QueryValidatorKeysRequest) String() string { return proto.CompactTextString(m) } func (*QueryValidatorKeysRequest) ProtoMessage() {} func (*QueryValidatorKeysRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b034a845bb2d91b6, []int{0} + return fileDescriptor_ab5fa3182b3fb474, []int{0} } func (m *QueryValidatorKeysRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -84,7 +84,7 @@ func (m *QueryValidatorKeysResponse) Reset() { *m = QueryValidatorKeysRe func (m *QueryValidatorKeysResponse) String() string { return proto.CompactTextString(m) } func (*QueryValidatorKeysResponse) ProtoMessage() {} func (*QueryValidatorKeysResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b034a845bb2d91b6, []int{1} + return fileDescriptor_ab5fa3182b3fb474, []int{1} } func (m *QueryValidatorKeysResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -121,38 +121,38 @@ func (m *QueryValidatorKeysResponse) GetValidatorPubKeys() ValidatorPubKeys { } func init() { - proto.RegisterType((*QueryValidatorKeysRequest)(nil), "sedachain.pkr.v1.QueryValidatorKeysRequest") - proto.RegisterType((*QueryValidatorKeysResponse)(nil), "sedachain.pkr.v1.QueryValidatorKeysResponse") -} - -func init() { proto.RegisterFile("sedachain/pkr/v1/query.proto", fileDescriptor_b034a845bb2d91b6) } - -var fileDescriptor_b034a845bb2d91b6 = []byte{ - // 372 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x29, 0x4e, 0x4d, 0x49, - 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x2f, 0xc8, 0x2e, 0xd2, 0x2f, 0x33, 0xd4, 0x2f, 0x2c, 0x4d, - 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0xcb, 0xea, 0x15, 0x64, 0x17, - 0xe9, 0x95, 0x19, 0x4a, 0xc9, 0xa4, 0xe7, 0xe7, 0xa7, 0xe7, 0xa4, 0xea, 0x27, 0x16, 0x64, 0xea, - 0x27, 0xe6, 0xe5, 0xe5, 0x97, 0x24, 0x96, 0x64, 0xe6, 0xe7, 0x15, 0x43, 0xd4, 0x4b, 0x89, 0xa4, - 0xe7, 0xa7, 0xe7, 0x83, 0x99, 0xfa, 0x20, 0x16, 0x54, 0x54, 0x32, 0x39, 0xbf, 0x38, 0x37, 0xbf, - 0x38, 0x1e, 0x22, 0x01, 0xe1, 0x40, 0xa5, 0xe4, 0x30, 0xac, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, - 0x84, 0xca, 0x2b, 0xa5, 0x72, 0x49, 0x06, 0x82, 0xdc, 0x13, 0x96, 0x98, 0x93, 0x99, 0x92, 0x58, - 0x92, 0x5f, 0xe4, 0x9d, 0x5a, 0x59, 0x1c, 0x94, 0x5a, 0x58, 0x9a, 0x5a, 0x5c, 0x22, 0xe4, 0xc1, - 0xc5, 0x57, 0x06, 0x13, 0x8f, 0x4f, 0x4c, 0x49, 0x29, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x74, - 0x52, 0xbc, 0xb4, 0x45, 0x57, 0x16, 0x6a, 0x0d, 0x5c, 0xa3, 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, - 0x71, 0x70, 0x49, 0x51, 0x66, 0x5e, 0x7a, 0x10, 0x6f, 0x19, 0xb2, 0xb8, 0x52, 0x09, 0x97, 0x14, - 0x36, 0x6b, 0x8a, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x85, 0xc2, 0xb8, 0x84, 0x10, 0xf6, 0x14, 0x94, - 0x26, 0xc5, 0x67, 0xa7, 0x56, 0x16, 0x83, 0xed, 0xe2, 0x36, 0x52, 0xd2, 0x43, 0x0f, 0x22, 0x84, - 0x95, 0x01, 0xa5, 0x49, 0x20, 0x73, 0x9c, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x12, 0x28, 0x43, - 0x13, 0x37, 0x5a, 0xcb, 0xc8, 0xc5, 0x0a, 0xb6, 0x56, 0x68, 0x31, 0x23, 0x17, 0x2f, 0x8a, 0xdd, - 0x42, 0xda, 0x98, 0xe6, 0xe2, 0x0c, 0x08, 0x29, 0x1d, 0xe2, 0x14, 0x43, 0xbc, 0xa3, 0x64, 0xde, - 0x74, 0xf9, 0xc9, 0x64, 0x26, 0x43, 0x21, 0x7d, 0x7d, 0x90, 0x2e, 0x5d, 0xa4, 0xd0, 0x87, 0x7b, - 0x12, 0xe4, 0x41, 0xfd, 0x6a, 0xd4, 0xc0, 0xad, 0x75, 0xf2, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, - 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, - 0xc6, 0x63, 0x39, 0x86, 0x28, 0xbd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, - 0xb0, 0xa1, 0xe0, 0xc8, 0x4b, 0xce, 0xcf, 0x41, 0xb6, 0xa1, 0x02, 0x6c, 0x47, 0x49, 0x65, 0x41, - 0x6a, 0x71, 0x12, 0x1b, 0x58, 0x81, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x46, 0x9d, 0xad, 0x80, - 0x7e, 0x02, 0x00, 0x00, + proto.RegisterType((*QueryValidatorKeysRequest)(nil), "sedachain.pubkey.v1.QueryValidatorKeysRequest") + proto.RegisterType((*QueryValidatorKeysResponse)(nil), "sedachain.pubkey.v1.QueryValidatorKeysResponse") +} + +func init() { proto.RegisterFile("sedachain/pubkey/v1/query.proto", fileDescriptor_ab5fa3182b3fb474) } + +var fileDescriptor_ab5fa3182b3fb474 = []byte{ + // 375 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2f, 0x4e, 0x4d, 0x49, + 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x2f, 0x28, 0x4d, 0xca, 0x4e, 0xad, 0xd4, 0x2f, 0x33, 0xd4, + 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0x2b, 0xd0, + 0x83, 0x28, 0xd0, 0x2b, 0x33, 0x94, 0x92, 0x49, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x4f, 0x2c, + 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0x86, 0x68, 0x91, + 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x33, 0xf5, 0x41, 0x2c, 0xa8, 0xa8, 0x64, 0x72, 0x7e, 0x71, + 0x6e, 0x7e, 0x71, 0x3c, 0x44, 0x02, 0xc2, 0x81, 0x4a, 0x29, 0x62, 0x73, 0x44, 0x7a, 0x6a, 0x5e, + 0x6a, 0x71, 0x26, 0x54, 0x89, 0x52, 0x2a, 0x97, 0x64, 0x20, 0xc8, 0x55, 0x61, 0x89, 0x39, 0x99, + 0x29, 0x89, 0x25, 0xf9, 0x45, 0xde, 0xa9, 0x95, 0xc5, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, + 0x42, 0x1e, 0x5c, 0x7c, 0x65, 0x30, 0xf1, 0xf8, 0xc4, 0x94, 0x94, 0x22, 0x09, 0x46, 0x05, 0x46, + 0x0d, 0x4e, 0x27, 0xc5, 0x4b, 0x5b, 0x74, 0x65, 0xa1, 0x36, 0xc1, 0x35, 0x3a, 0xa6, 0xa4, 0x14, + 0xa5, 0x16, 0x17, 0x07, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x07, 0xf1, 0x96, 0x21, 0x8b, 0x2b, 0x95, + 0x73, 0x49, 0x61, 0xb3, 0xa6, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, 0x28, 0x92, 0x4b, 0x08, 0x61, + 0x4f, 0x41, 0x69, 0x52, 0x7c, 0x76, 0x6a, 0x65, 0x31, 0xd8, 0x2e, 0x6e, 0x23, 0x55, 0x3d, 0x2c, + 0x01, 0x85, 0xb0, 0x35, 0xa0, 0x34, 0x09, 0x64, 0x94, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, + 0x02, 0x65, 0x68, 0xe2, 0x46, 0xdb, 0x18, 0xb9, 0x58, 0xc1, 0x36, 0x0b, 0xad, 0x61, 0xe4, 0xe2, + 0x45, 0xb1, 0x5e, 0x48, 0x0f, 0xab, 0xd1, 0x38, 0x83, 0x43, 0x4a, 0x9f, 0x68, 0xf5, 0x10, 0x7f, + 0x29, 0x59, 0x35, 0x5d, 0x7e, 0x32, 0x99, 0xc9, 0x44, 0xc8, 0x48, 0x1f, 0xa4, 0x51, 0x17, 0x35, + 0x26, 0xe0, 0x1e, 0x06, 0x79, 0x56, 0xbf, 0x1a, 0x35, 0xa0, 0x6b, 0x9d, 0xbc, 0x4f, 0x3c, 0x92, + 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, + 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x30, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, + 0x39, 0x3f, 0x17, 0x6c, 0x2e, 0x38, 0x22, 0x93, 0xf3, 0x73, 0x90, 0x2d, 0xa9, 0x80, 0x59, 0x53, + 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x56, 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x4a, + 0x35, 0xb0, 0x7e, 0x96, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -181,7 +181,7 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { func (c *queryClient) ValidatorKeys(ctx context.Context, in *QueryValidatorKeysRequest, opts ...grpc.CallOption) (*QueryValidatorKeysResponse, error) { out := new(QueryValidatorKeysResponse) - err := c.cc.Invoke(ctx, "/sedachain.pkr.v1.Query/ValidatorKeys", in, out, opts...) + err := c.cc.Invoke(ctx, "/sedachain.pubkey.v1.Query/ValidatorKeys", in, out, opts...) if err != nil { return nil, err } @@ -216,7 +216,7 @@ func _Query_ValidatorKeys_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/sedachain.pkr.v1.Query/ValidatorKeys", + FullMethod: "/sedachain.pubkey.v1.Query/ValidatorKeys", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).ValidatorKeys(ctx, req.(*QueryValidatorKeysRequest)) @@ -225,7 +225,7 @@ func _Query_ValidatorKeys_Handler(srv interface{}, ctx context.Context, dec func } var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "sedachain.pkr.v1.Query", + ServiceName: "sedachain.pubkey.v1.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { @@ -234,7 +234,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "sedachain/pkr/v1/query.proto", + Metadata: "sedachain/pubkey/v1/query.proto", } func (m *QueryValidatorKeysRequest) Marshal() (dAtA []byte, err error) { diff --git a/x/pkr/types/query.pb.gw.go b/x/pubkey/types/query.pb.gw.go similarity index 97% rename from x/pkr/types/query.pb.gw.go rename to x/pubkey/types/query.pb.gw.go index b5a369b1..b1834c49 100644 --- a/x/pkr/types/query.pb.gw.go +++ b/x/pubkey/types/query.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: sedachain/pkr/v1/query.proto +// source: sedachain/pubkey/v1/query.proto /* Package types is a reverse proxy. @@ -181,7 +181,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_ValidatorKeys_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"seda-chain", "pkr", "validator_keys", "validator_addr"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ValidatorKeys_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"seda-chain", "pubkey", "validator_keys", "validator_addr"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( diff --git a/x/pkr/types/tx.go b/x/pubkey/types/tx.go similarity index 61% rename from x/pkr/types/tx.go rename to x/pubkey/types/tx.go index 41fc45a7..0e36071a 100644 --- a/x/pkr/types/tx.go +++ b/x/pubkey/types/tx.go @@ -1,9 +1,12 @@ package types import ( + "sort" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) var ( @@ -13,11 +16,20 @@ var ( func (m *MsgAddKey) Validate() error { if m.ValidatorAddr == "" { - return ErrEmptyValue.Wrap("empty validator address") + return sdkerrors.ErrInvalidRequest.Wrap("empty validator address") } + + sort.Slice(m.IndexedPubKeys, func(i, j int) bool { + return m.IndexedPubKeys[i].Index < m.IndexedPubKeys[j].Index + }) for i, pair := range m.IndexedPubKeys { + if i > 0 { + if pair.Index == m.IndexedPubKeys[i-1].Index { + return sdkerrors.ErrInvalidRequest.Wrapf("duplicate index at %d", pair.Index) + } + } if pair.PubKey == nil { - return ErrEmptyValue.Wrapf("empty public key at index %d", i) + return sdkerrors.ErrInvalidRequest.Wrapf("empty public key at index %d", pair.Index) } } return nil diff --git a/x/pkr/types/tx.pb.go b/x/pubkey/types/tx.pb.go similarity index 82% rename from x/pkr/types/tx.pb.go rename to x/pubkey/types/tx.pb.go index 9bfb052d..3d0b05b0 100644 --- a/x/pkr/types/tx.pb.go +++ b/x/pubkey/types/tx.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: sedachain/pkr/v1/tx.proto +// source: sedachain/pubkey/v1/tx.proto package types @@ -41,7 +41,7 @@ func (m *MsgAddKey) Reset() { *m = MsgAddKey{} } func (m *MsgAddKey) String() string { return proto.CompactTextString(m) } func (*MsgAddKey) ProtoMessage() {} func (*MsgAddKey) Descriptor() ([]byte, []int) { - return fileDescriptor_39f67da0296e516c, []int{0} + return fileDescriptor_2cddc7f2809ea73c, []int{0} } func (m *MsgAddKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -92,7 +92,7 @@ func (m *MsgAddKeyResponse) Reset() { *m = MsgAddKeyResponse{} } func (m *MsgAddKeyResponse) String() string { return proto.CompactTextString(m) } func (*MsgAddKeyResponse) ProtoMessage() {} func (*MsgAddKeyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_39f67da0296e516c, []int{1} + return fileDescriptor_2cddc7f2809ea73c, []int{1} } func (m *MsgAddKeyResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -122,38 +122,38 @@ func (m *MsgAddKeyResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgAddKeyResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgAddKey)(nil), "sedachain.pkr.v1.MsgAddKey") - proto.RegisterType((*MsgAddKeyResponse)(nil), "sedachain.pkr.v1.MsgAddKeyResponse") -} - -func init() { proto.RegisterFile("sedachain/pkr/v1/tx.proto", fileDescriptor_39f67da0296e516c) } - -var fileDescriptor_39f67da0296e516c = []byte{ - // 370 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xb1, 0x4e, 0xc2, 0x40, - 0x1c, 0xc6, 0x5b, 0x51, 0x12, 0x6a, 0x24, 0x58, 0x4c, 0x84, 0x1a, 0x0b, 0xe2, 0x42, 0x48, 0xe8, - 0x05, 0xdc, 0xdc, 0x60, 0x42, 0x09, 0xd1, 0x60, 0x62, 0x8c, 0x4b, 0xd3, 0xf6, 0xce, 0xa3, 0x81, - 0xf6, 0x9a, 0x5e, 0xdb, 0xd0, 0xcd, 0xf8, 0x04, 0x3e, 0x0a, 0x83, 0x9b, 0x2f, 0xc0, 0x48, 0x9c, - 0x9c, 0x8c, 0x81, 0x81, 0xd7, 0x30, 0xbd, 0x16, 0x42, 0x20, 0x71, 0xeb, 0x77, 0xbf, 0xef, 0xff, - 0xff, 0xfe, 0xfd, 0x84, 0x22, 0x45, 0x50, 0x33, 0x06, 0x9a, 0x69, 0x03, 0x67, 0xe8, 0x82, 0xa0, - 0x01, 0xbc, 0xb1, 0xe2, 0xb8, 0xc4, 0x23, 0x62, 0x6e, 0x8d, 0x14, 0x67, 0xe8, 0x2a, 0x41, 0x43, - 0x3a, 0xc1, 0x04, 0x13, 0x06, 0x41, 0xf4, 0x15, 0xfb, 0xa4, 0x22, 0x26, 0x04, 0x8f, 0x10, 0x60, - 0x4a, 0xf7, 0x5f, 0x80, 0x66, 0x87, 0x2b, 0x64, 0x10, 0x6a, 0x11, 0xaa, 0xc6, 0x33, 0xb1, 0x48, - 0xd0, 0x69, 0xac, 0x80, 0x45, 0x71, 0x94, 0x6a, 0x51, 0x9c, 0x00, 0x69, 0xe7, 0xa2, 0x28, 0x9d, - 0xb1, 0xca, 0x27, 0x2f, 0x64, 0x7a, 0x14, 0xb7, 0x20, 0xec, 0xa2, 0x50, 0xec, 0x08, 0xd9, 0x40, - 0x1b, 0x99, 0x50, 0xf3, 0x88, 0xab, 0x6a, 0x10, 0xba, 0x05, 0xbe, 0xcc, 0x57, 0x33, 0xed, 0x8b, - 0xaf, 0x8f, 0xfa, 0x79, 0x12, 0xf6, 0xb8, 0x32, 0xb4, 0x20, 0x74, 0x11, 0xa5, 0x0f, 0x9e, 0x6b, - 0xda, 0xb8, 0x7f, 0x14, 0x6c, 0xbe, 0x8b, 0x77, 0x42, 0xce, 0xb4, 0x21, 0x1a, 0x23, 0xa8, 0x3a, - 0xbe, 0xae, 0x0e, 0x51, 0x48, 0x0b, 0x7b, 0xe5, 0x54, 0xf5, 0xb0, 0x59, 0x52, 0xb6, 0x5b, 0x50, - 0x6e, 0x62, 0xe7, 0xbd, 0xaf, 0x77, 0x51, 0xd8, 0xde, 0x9f, 0xfe, 0x94, 0xb8, 0x7e, 0xd6, 0xdc, - 0x7c, 0xa4, 0xd7, 0xf9, 0xb7, 0xe5, 0xa4, 0xb6, 0x75, 0x5d, 0x25, 0x2f, 0x1c, 0xaf, 0x8f, 0xef, - 0x23, 0xea, 0x10, 0x9b, 0xa2, 0xe6, 0x93, 0x90, 0xea, 0x51, 0x2c, 0xde, 0x0a, 0xe9, 0xe4, 0xaf, - 0xce, 0x76, 0x13, 0xd7, 0x53, 0xd2, 0xe5, 0x3f, 0x70, 0xb5, 0x52, 0x3a, 0x78, 0x5d, 0x4e, 0x6a, - 0x7c, 0xbb, 0x33, 0x9d, 0xcb, 0xfc, 0x6c, 0x2e, 0xf3, 0xbf, 0x73, 0x99, 0x7f, 0x5f, 0xc8, 0xdc, - 0x6c, 0x21, 0x73, 0xdf, 0x0b, 0x99, 0x7b, 0x56, 0xb0, 0xe9, 0x0d, 0x7c, 0x5d, 0x31, 0x88, 0x05, - 0xa2, 0x7d, 0xac, 0x5c, 0x83, 0x8c, 0x98, 0xa8, 0xc7, 0xdd, 0x8f, 0x59, 0xfb, 0x5e, 0xe8, 0x20, - 0xaa, 0xa7, 0x99, 0xe1, 0xea, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xc9, 0xc0, 0x89, 0xc6, 0x2d, 0x02, - 0x00, 0x00, + proto.RegisterType((*MsgAddKey)(nil), "sedachain.pubkey.v1.MsgAddKey") + proto.RegisterType((*MsgAddKeyResponse)(nil), "sedachain.pubkey.v1.MsgAddKeyResponse") +} + +func init() { proto.RegisterFile("sedachain/pubkey/v1/tx.proto", fileDescriptor_2cddc7f2809ea73c) } + +var fileDescriptor_2cddc7f2809ea73c = []byte{ + // 372 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xbf, 0x4e, 0xc2, 0x50, + 0x14, 0xc6, 0x5b, 0x51, 0x12, 0x6a, 0x24, 0x5a, 0x4c, 0xc4, 0x46, 0x2b, 0x32, 0x18, 0x42, 0x42, + 0x6f, 0xc0, 0xcd, 0x0d, 0x26, 0x0d, 0x21, 0x21, 0x35, 0x71, 0x70, 0xb0, 0x69, 0x7b, 0xaf, 0x97, + 0x06, 0xda, 0xdb, 0xf4, 0xb4, 0x0d, 0xdd, 0x8c, 0x4f, 0xe0, 0xa3, 0x30, 0x38, 0x3b, 0x33, 0x12, + 0x27, 0x27, 0x63, 0x60, 0xe0, 0x35, 0x0c, 0xfd, 0x43, 0x88, 0x21, 0x6e, 0xfd, 0xee, 0xef, 0x3b, + 0xe7, 0x7c, 0x3d, 0x47, 0x38, 0x03, 0x82, 0x75, 0x73, 0xa0, 0x5b, 0x0e, 0x72, 0x03, 0x63, 0x48, + 0x22, 0x14, 0x36, 0x91, 0x3f, 0x56, 0x5c, 0x8f, 0xf9, 0x4c, 0x2c, 0xad, 0xa9, 0x92, 0x50, 0x25, + 0x6c, 0x4a, 0xc7, 0x94, 0x51, 0x16, 0x73, 0xb4, 0xfa, 0x4a, 0xac, 0xd2, 0x29, 0x65, 0x8c, 0x8e, + 0x08, 0x8a, 0x95, 0x11, 0x3c, 0x23, 0xdd, 0x89, 0x32, 0x64, 0x32, 0xb0, 0x19, 0x68, 0x49, 0x4d, + 0x22, 0x52, 0x74, 0x92, 0x28, 0x64, 0x03, 0x5d, 0x0d, 0xb6, 0x81, 0xa6, 0xa0, 0xb2, 0x2d, 0x57, + 0x9a, 0x21, 0x76, 0x54, 0x3f, 0x78, 0xa1, 0xd0, 0x03, 0xda, 0xc6, 0xb8, 0x4b, 0x22, 0xf1, 0x56, + 0x28, 0x86, 0xfa, 0xc8, 0xc2, 0xba, 0xcf, 0x3c, 0x4d, 0xc7, 0xd8, 0x2b, 0xf3, 0x15, 0xbe, 0x56, + 0xe8, 0x5c, 0x7e, 0xbe, 0x37, 0xce, 0xd3, 0x91, 0x0f, 0x99, 0xa1, 0x8d, 0xb1, 0x47, 0x00, 0xee, + 0x7d, 0xcf, 0x72, 0xa8, 0x7a, 0x10, 0x6e, 0xbe, 0x8b, 0xaa, 0x70, 0x68, 0x39, 0x98, 0x8c, 0x09, + 0xd6, 0xdc, 0xc0, 0xd0, 0x86, 0x24, 0x82, 0xf2, 0x4e, 0x25, 0x57, 0xdb, 0x6f, 0x55, 0x95, 0x2d, + 0xeb, 0x50, 0xee, 0x12, 0x73, 0x3f, 0x30, 0xba, 0x24, 0xea, 0xec, 0x4e, 0xbf, 0x2f, 0x38, 0xb5, + 0x68, 0x6d, 0x3e, 0xc2, 0x4d, 0xe9, 0x75, 0x39, 0xa9, 0xff, 0x09, 0x58, 0x2d, 0x09, 0x47, 0xeb, + 0xfc, 0x2a, 0x01, 0x97, 0x39, 0x40, 0x5a, 0x4f, 0x42, 0xae, 0x07, 0x54, 0xec, 0x0b, 0xf9, 0xf4, + 0xc7, 0xe4, 0xad, 0x43, 0xd7, 0x85, 0xd2, 0xd5, 0xff, 0x3c, 0x6b, 0x2c, 0xed, 0xbd, 0x2c, 0x27, + 0x75, 0xbe, 0xd3, 0x9d, 0xce, 0x65, 0x7e, 0x36, 0x97, 0xf9, 0x9f, 0xb9, 0xcc, 0xbf, 0x2d, 0x64, + 0x6e, 0xb6, 0x90, 0xb9, 0xaf, 0x85, 0xcc, 0x3d, 0x36, 0xa9, 0xe5, 0x0f, 0x02, 0x43, 0x31, 0x99, + 0x8d, 0x56, 0x2d, 0xe3, 0x2d, 0x9b, 0x6c, 0x14, 0x8b, 0x46, 0x72, 0x8a, 0x71, 0x76, 0x0c, 0x3f, + 0x72, 0x09, 0x18, 0xf9, 0xd8, 0x73, 0xfd, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xb6, 0x89, 0x02, 0x42, + 0x45, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -182,7 +182,7 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { func (c *msgClient) AddKey(ctx context.Context, in *MsgAddKey, opts ...grpc.CallOption) (*MsgAddKeyResponse, error) { out := new(MsgAddKeyResponse) - err := c.cc.Invoke(ctx, "/sedachain.pkr.v1.Msg/AddKey", in, out, opts...) + err := c.cc.Invoke(ctx, "/sedachain.pubkey.v1.Msg/AddKey", in, out, opts...) if err != nil { return nil, err } @@ -217,7 +217,7 @@ func _Msg_AddKey_Handler(srv interface{}, ctx context.Context, dec func(interfac } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/sedachain.pkr.v1.Msg/AddKey", + FullMethod: "/sedachain.pubkey.v1.Msg/AddKey", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).AddKey(ctx, req.(*MsgAddKey)) @@ -226,7 +226,7 @@ func _Msg_AddKey_Handler(srv interface{}, ctx context.Context, dec func(interfac } var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "sedachain.pkr.v1.Msg", + ServiceName: "sedachain.pubkey.v1.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { @@ -235,7 +235,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "sedachain/pkr/v1/tx.proto", + Metadata: "sedachain/pubkey/v1/tx.proto", } func (m *MsgAddKey) Marshal() (dAtA []byte, err error) { diff --git a/x/randomness/client/cli/query.go b/x/randomness/client/cli/query.go index 477187a6..03c5e4ba 100644 --- a/x/randomness/client/cli/query.go +++ b/x/randomness/client/cli/query.go @@ -12,7 +12,7 @@ import ( ) // GetQueryCmd returns the CLI query commands for this module. -func GetQueryCmd(_ string) *cobra.Command { +func GetQueryCmd() *cobra.Command { cmd := &cobra.Command{ Use: types.ModuleName, Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), diff --git a/x/randomness/module.go b/x/randomness/module.go index 4b4d0288..a1305973 100644 --- a/x/randomness/module.go +++ b/x/randomness/module.go @@ -89,7 +89,7 @@ func (a AppModuleBasic) GetTxCmd() *cobra.Command { // GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) + return cli.GetQueryCmd() } // ---------------------------------------------------------------------------- diff --git a/x/wasm-storage/client/cli/query.go b/x/wasm-storage/client/cli/query.go index 66f76f01..9defc81b 100644 --- a/x/wasm-storage/client/cli/query.go +++ b/x/wasm-storage/client/cli/query.go @@ -12,7 +12,7 @@ import ( ) // GetQueryCmd returns the CLI query commands for this module -func GetQueryCmd(_ string) *cobra.Command { +func GetQueryCmd() *cobra.Command { cmd := &cobra.Command{ Use: types.ModuleName, Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), diff --git a/x/wasm-storage/module.go b/x/wasm-storage/module.go index d4d8d207..b4f37703 100644 --- a/x/wasm-storage/module.go +++ b/x/wasm-storage/module.go @@ -92,7 +92,7 @@ func (a AppModuleBasic) GetTxCmd() *cobra.Command { // GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) + return cli.GetQueryCmd() } // ----------------------------------------------------------------------------