From e67850b088b30488cf4e314e1fcdc7adb88c7f45 Mon Sep 17 00:00:00 2001 From: foxytanuki Date: Wed, 31 Jan 2024 04:09:00 +0900 Subject: [PATCH 1/7] Update openapi.yml --- docs/static/openapi.yml | 60 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index d0458d44..917d2808 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -50989,6 +50989,7 @@ paths: - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET + - BITCOIN_DEFAULT_DEFAULT - ETHEREUM_MAINNET_MAINNET - ETHEREUM_TESTNET_GOERLI - ETHEREUM_TESTNET_SEPOLIA @@ -51006,15 +51007,19 @@ paths: - ARBITRUM_TESTNET_GOERLI - SHARDEUM_BETANET_SPHINX - ZETA_TESTNET_ATHENS + - EVM_DEFAULT_DEFAULT - APTOS_MAINNET_MAINNET - APTOS_TESTNET_TESTNET - SUI_MAINNET_MAINNET - SUI_TESTNET_TESTNET + - MOVE_DEFAULT_DEFAULT - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET + - SOLANA_DEFAULT_DEFAULT default: NO_NETWORK description: |- - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - BITCOIN_DEFAULT_DEFAULT: DEFAULT - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon @@ -51028,10 +51033,13 @@ paths: SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain ZETA_MAINNET_MAINNET = 20018; + - EVM_DEFAULT_DEFAULT: DEFAULT - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui + - MOVE_DEFAULT_DEFAULT: DEFAULT - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx + - SOLANA_DEFAULT_DEFAULT: DEFAULT title: 'Rule: CHAINNAME_ENVIRONMENT_NETWORK' value: type: string @@ -51238,6 +51246,7 @@ paths: - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET + - BITCOIN_DEFAULT_DEFAULT - ETHEREUM_MAINNET_MAINNET - ETHEREUM_TESTNET_GOERLI - ETHEREUM_TESTNET_SEPOLIA @@ -51255,15 +51264,19 @@ paths: - ARBITRUM_TESTNET_GOERLI - SHARDEUM_BETANET_SPHINX - ZETA_TESTNET_ATHENS + - EVM_DEFAULT_DEFAULT - APTOS_MAINNET_MAINNET - APTOS_TESTNET_TESTNET - SUI_MAINNET_MAINNET - SUI_TESTNET_TESTNET + - MOVE_DEFAULT_DEFAULT - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET + - SOLANA_DEFAULT_DEFAULT default: NO_NETWORK description: |- - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - BITCOIN_DEFAULT_DEFAULT: DEFAULT - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon @@ -51277,10 +51290,13 @@ paths: SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain ZETA_MAINNET_MAINNET = 20018; + - EVM_DEFAULT_DEFAULT: DEFAULT - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui + - MOVE_DEFAULT_DEFAULT: DEFAULT - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx + - SOLANA_DEFAULT_DEFAULT: DEFAULT title: 'Rule: CHAINNAME_ENVIRONMENT_NETWORK' value: type: string @@ -81357,6 +81373,8 @@ definitions: NOTE: The amount field is an Int which implements the custom method signatures required by gogoproto. + mycel.registry.MsgCancelTopLevelDomainProposalResponse: + type: object mycel.registry.MsgExtendTopLevelDomainExpirationDateResponse: type: object properties: @@ -81546,6 +81564,8 @@ definitions: method signatures required by gogoproto. + mycel.registry.MsgNewTopLevelDomainProposalResponse: + type: object mycel.registry.MsgRegisterSecondLevelDomainResponse: type: object mycel.registry.MsgRegisterTopLevelDomainResponse: @@ -82624,6 +82644,7 @@ definitions: - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET + - BITCOIN_DEFAULT_DEFAULT - ETHEREUM_MAINNET_MAINNET - ETHEREUM_TESTNET_GOERLI - ETHEREUM_TESTNET_SEPOLIA @@ -82641,15 +82662,19 @@ definitions: - ARBITRUM_TESTNET_GOERLI - SHARDEUM_BETANET_SPHINX - ZETA_TESTNET_ATHENS + - EVM_DEFAULT_DEFAULT - APTOS_MAINNET_MAINNET - APTOS_TESTNET_TESTNET - SUI_MAINNET_MAINNET - SUI_TESTNET_TESTNET + - MOVE_DEFAULT_DEFAULT - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET + - SOLANA_DEFAULT_DEFAULT default: NO_NETWORK description: |- - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - BITCOIN_DEFAULT_DEFAULT: DEFAULT - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon @@ -82663,10 +82688,13 @@ definitions: SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain ZETA_MAINNET_MAINNET = 20018; + - EVM_DEFAULT_DEFAULT: DEFAULT - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui + - MOVE_DEFAULT_DEFAULT: DEFAULT - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx + - SOLANA_DEFAULT_DEFAULT: DEFAULT title: 'Rule: CHAINNAME_ENVIRONMENT_NETWORK' mycel.registry.Record: type: object @@ -82699,6 +82727,7 @@ definitions: - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET + - BITCOIN_DEFAULT_DEFAULT - ETHEREUM_MAINNET_MAINNET - ETHEREUM_TESTNET_GOERLI - ETHEREUM_TESTNET_SEPOLIA @@ -82716,15 +82745,19 @@ definitions: - ARBITRUM_TESTNET_GOERLI - SHARDEUM_BETANET_SPHINX - ZETA_TESTNET_ATHENS + - EVM_DEFAULT_DEFAULT - APTOS_MAINNET_MAINNET - APTOS_TESTNET_TESTNET - SUI_MAINNET_MAINNET - SUI_TESTNET_TESTNET + - MOVE_DEFAULT_DEFAULT - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET + - SOLANA_DEFAULT_DEFAULT default: NO_NETWORK description: |- - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - BITCOIN_DEFAULT_DEFAULT: DEFAULT - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon @@ -82738,10 +82771,13 @@ definitions: SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain ZETA_MAINNET_MAINNET = 20018; + - EVM_DEFAULT_DEFAULT: DEFAULT - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui + - MOVE_DEFAULT_DEFAULT: DEFAULT - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx + - SOLANA_DEFAULT_DEFAULT: DEFAULT title: 'Rule: CHAINNAME_ENVIRONMENT_NETWORK' value: type: string @@ -82768,6 +82804,7 @@ definitions: - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET + - BITCOIN_DEFAULT_DEFAULT - ETHEREUM_MAINNET_MAINNET - ETHEREUM_TESTNET_GOERLI - ETHEREUM_TESTNET_SEPOLIA @@ -82785,15 +82822,19 @@ definitions: - ARBITRUM_TESTNET_GOERLI - SHARDEUM_BETANET_SPHINX - ZETA_TESTNET_ATHENS + - EVM_DEFAULT_DEFAULT - APTOS_MAINNET_MAINNET - APTOS_TESTNET_TESTNET - SUI_MAINNET_MAINNET - SUI_TESTNET_TESTNET + - MOVE_DEFAULT_DEFAULT - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET + - SOLANA_DEFAULT_DEFAULT default: NO_NETWORK description: |- - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - BITCOIN_DEFAULT_DEFAULT: DEFAULT - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon @@ -82807,10 +82848,13 @@ definitions: SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain ZETA_MAINNET_MAINNET = 20018; + - EVM_DEFAULT_DEFAULT: DEFAULT - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui + - MOVE_DEFAULT_DEFAULT: DEFAULT - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx + - SOLANA_DEFAULT_DEFAULT: DEFAULT title: 'Rule: CHAINNAME_ENVIRONMENT_NETWORK' value: type: string @@ -82853,6 +82897,7 @@ definitions: - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET + - BITCOIN_DEFAULT_DEFAULT - ETHEREUM_MAINNET_MAINNET - ETHEREUM_TESTNET_GOERLI - ETHEREUM_TESTNET_SEPOLIA @@ -82870,15 +82915,19 @@ definitions: - ARBITRUM_TESTNET_GOERLI - SHARDEUM_BETANET_SPHINX - ZETA_TESTNET_ATHENS + - EVM_DEFAULT_DEFAULT - APTOS_MAINNET_MAINNET - APTOS_TESTNET_TESTNET - SUI_MAINNET_MAINNET - SUI_TESTNET_TESTNET + - MOVE_DEFAULT_DEFAULT - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET + - SOLANA_DEFAULT_DEFAULT default: NO_NETWORK description: |- - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - BITCOIN_DEFAULT_DEFAULT: DEFAULT - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon @@ -82892,10 +82941,13 @@ definitions: SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain ZETA_MAINNET_MAINNET = 20018; + - EVM_DEFAULT_DEFAULT: DEFAULT - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui + - MOVE_DEFAULT_DEFAULT: DEFAULT - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx + - SOLANA_DEFAULT_DEFAULT: DEFAULT title: 'Rule: CHAINNAME_ENVIRONMENT_NETWORK' value: type: string @@ -82957,6 +83009,7 @@ definitions: - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET + - BITCOIN_DEFAULT_DEFAULT - ETHEREUM_MAINNET_MAINNET - ETHEREUM_TESTNET_GOERLI - ETHEREUM_TESTNET_SEPOLIA @@ -82974,15 +83027,19 @@ definitions: - ARBITRUM_TESTNET_GOERLI - SHARDEUM_BETANET_SPHINX - ZETA_TESTNET_ATHENS + - EVM_DEFAULT_DEFAULT - APTOS_MAINNET_MAINNET - APTOS_TESTNET_TESTNET - SUI_MAINNET_MAINNET - SUI_TESTNET_TESTNET + - MOVE_DEFAULT_DEFAULT - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET + - SOLANA_DEFAULT_DEFAULT default: NO_NETWORK description: |- - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - BITCOIN_DEFAULT_DEFAULT: DEFAULT - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon @@ -82996,10 +83053,13 @@ definitions: SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain ZETA_MAINNET_MAINNET = 20018; + - EVM_DEFAULT_DEFAULT: DEFAULT - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui + - MOVE_DEFAULT_DEFAULT: DEFAULT - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx + - SOLANA_DEFAULT_DEFAULT: DEFAULT title: 'Rule: CHAINNAME_ENVIRONMENT_NETWORK' value: type: string From 4933d51f906f6acee70ec4d010e24d859013dfec Mon Sep 17 00:00:00 2001 From: foxytanuki Date: Thu, 1 Feb 2024 12:52:45 +0900 Subject: [PATCH 2/7] Run `ignite s message submit-top-level-domain-proposal name registration-period-in-year --module registry` --- docs/static/openapi.yml | 6 +- proto/mycel/registry/tx.proto | 9 + x/registry/client/cli/tx.go | 1 + .../tx_submit_top_level_domain_proposal.go | 44 ++ ...server_submit_top_level_domain_proposal.go | 17 + x/registry/module_simulation.go | 15 + .../submit_top_level_domain_proposal.go | 29 + x/registry/types/codec.go | 4 + ...essage_submit_top_level_domain_proposal.go | 47 ++ ...e_submit_top_level_domain_proposal_test.go | 40 ++ x/registry/types/tx.pb.go | 536 ++++++++++++++++-- 11 files changed, 692 insertions(+), 56 deletions(-) create mode 100644 x/registry/client/cli/tx_submit_top_level_domain_proposal.go create mode 100644 x/registry/keeper/msg_server_submit_top_level_domain_proposal.go create mode 100644 x/registry/simulation/submit_top_level_domain_proposal.go create mode 100644 x/registry/types/message_submit_top_level_domain_proposal.go create mode 100644 x/registry/types/message_submit_top_level_domain_proposal_test.go diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 917d2808..2db6865a 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -81373,8 +81373,6 @@ definitions: NOTE: The amount field is an Int which implements the custom method signatures required by gogoproto. - mycel.registry.MsgCancelTopLevelDomainProposalResponse: - type: object mycel.registry.MsgExtendTopLevelDomainExpirationDateResponse: type: object properties: @@ -81564,8 +81562,6 @@ definitions: method signatures required by gogoproto. - mycel.registry.MsgNewTopLevelDomainProposalResponse: - type: object mycel.registry.MsgRegisterSecondLevelDomainResponse: type: object mycel.registry.MsgRegisterTopLevelDomainResponse: @@ -81757,6 +81753,8 @@ definitions: method signatures required by gogoproto. + mycel.registry.MsgSubmitTopLevelDomainProposalResponse: + type: object mycel.registry.MsgUpdateDnsRecordResponse: type: object mycel.registry.MsgUpdateTextRecordResponse: diff --git a/proto/mycel/registry/tx.proto b/proto/mycel/registry/tx.proto index 7a2ec14c..3791e2e3 100644 --- a/proto/mycel/registry/tx.proto +++ b/proto/mycel/registry/tx.proto @@ -18,6 +18,7 @@ service Msg { rpc ExtendTopLevelDomainExpirationDate (MsgExtendTopLevelDomainExpirationDate ) returns (MsgExtendTopLevelDomainExpirationDateResponse ); rpc UpdateTextRecord (MsgUpdateTextRecord ) returns (MsgUpdateTextRecordResponse ); rpc UpdateTopLevelDomainRegistrationPolicy (MsgUpdateTopLevelDomainRegistrationPolicy) returns (MsgUpdateTopLevelDomainRegistrationPolicyResponse); + rpc SubmitTopLevelDomainProposal (MsgSubmitTopLevelDomainProposal ) returns (MsgSubmitTopLevelDomainProposalResponse ); } message MsgUpdateWalletRecord { string creator = 1; @@ -97,3 +98,11 @@ message MsgUpdateTopLevelDomainRegistrationPolicy { message MsgUpdateTopLevelDomainRegistrationPolicyResponse {} +message MsgSubmitTopLevelDomainProposal { + string creator = 1; + string name = 2; + string registrationPeriodInYear = 3; +} + +message MsgSubmitTopLevelDomainProposalResponse {} + diff --git a/x/registry/client/cli/tx.go b/x/registry/client/cli/tx.go index 727d7dcd..062196b0 100644 --- a/x/registry/client/cli/tx.go +++ b/x/registry/client/cli/tx.go @@ -37,6 +37,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(CmdExtendTopLevelDomainExpirationDate()) cmd.AddCommand(CmdUpdateTextRecord()) cmd.AddCommand(CmdUpdateTopLevelDomainRegistrationPolicy()) + cmd.AddCommand(CmdSubmitTopLevelDomainProposal()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/registry/client/cli/tx_submit_top_level_domain_proposal.go b/x/registry/client/cli/tx_submit_top_level_domain_proposal.go new file mode 100644 index 00000000..08c9c8c6 --- /dev/null +++ b/x/registry/client/cli/tx_submit_top_level_domain_proposal.go @@ -0,0 +1,44 @@ +package cli + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/mycel-domain/mycel/x/registry/types" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdSubmitTopLevelDomainProposal() *cobra.Command { + cmd := &cobra.Command{ + Use: "submit-top-level-domain-proposal [name] [registration-period-in-year]", + Short: "Broadcast message submit-top-level-domain-proposal", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argName := args[0] + argRegistrationPeriodInYear := args[1] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgSubmitTopLevelDomainProposal( + clientCtx.GetFromAddress().String(), + argName, + argRegistrationPeriodInYear, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/registry/keeper/msg_server_submit_top_level_domain_proposal.go b/x/registry/keeper/msg_server_submit_top_level_domain_proposal.go new file mode 100644 index 00000000..c2669e8f --- /dev/null +++ b/x/registry/keeper/msg_server_submit_top_level_domain_proposal.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/mycel-domain/mycel/x/registry/types" +) + +func (k msgServer) SubmitTopLevelDomainProposal(goCtx context.Context, msg *types.MsgSubmitTopLevelDomainProposal) (*types.MsgSubmitTopLevelDomainProposalResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // TODO: Handling the message + _ = ctx + + return &types.MsgSubmitTopLevelDomainProposalResponse{}, nil +} diff --git a/x/registry/module_simulation.go b/x/registry/module_simulation.go index e609d9ff..ec11fdc9 100644 --- a/x/registry/module_simulation.go +++ b/x/registry/module_simulation.go @@ -52,6 +52,10 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgUpdateTopLevelDomainRegistrationPolicy int = 100 + opWeightMsgSubmitTopLevelDomainProposal = "op_weight_msg_submit_top_level_domain_proposal" + // TODO: Determine the simulation weight value + defaultWeightMsgSubmitTopLevelDomainProposal int = 100 + // this line is used by starport scaffolding # simapp/module/const ) @@ -157,6 +161,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp registrysimulation.SimulateMsgUpdateTopLevelDomainRegistrationPolicy(am.accountKeeper, am.bankKeeper, am.keeper), )) + var weightMsgSubmitTopLevelDomainProposal int + simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgSubmitTopLevelDomainProposal, &weightMsgSubmitTopLevelDomainProposal, nil, + func(_ *rand.Rand) { + weightMsgSubmitTopLevelDomainProposal = defaultWeightMsgSubmitTopLevelDomainProposal + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgSubmitTopLevelDomainProposal, + registrysimulation.SimulateMsgSubmitTopLevelDomainProposal(am.accountKeeper, am.bankKeeper, am.keeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations diff --git a/x/registry/simulation/submit_top_level_domain_proposal.go b/x/registry/simulation/submit_top_level_domain_proposal.go new file mode 100644 index 00000000..dc5019da --- /dev/null +++ b/x/registry/simulation/submit_top_level_domain_proposal.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/mycel-domain/mycel/x/registry/keeper" + "github.com/mycel-domain/mycel/x/registry/types" +) + +func SimulateMsgSubmitTopLevelDomainProposal( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgSubmitTopLevelDomainProposal{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the SubmitTopLevelDomainProposal simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "SubmitTopLevelDomainProposal simulation not implemented"), nil, nil + } +} diff --git a/x/registry/types/codec.go b/x/registry/types/codec.go index bf6d6381..c09f1f90 100644 --- a/x/registry/types/codec.go +++ b/x/registry/types/codec.go @@ -15,6 +15,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgExtendTopLevelDomainExpirationDate{}, "registry/ExtendTopLevelDomainExpirationDate", nil) cdc.RegisterConcrete(&MsgUpdateTextRecord{}, "registry/UpdateTextRecord", nil) cdc.RegisterConcrete(&MsgUpdateTopLevelDomainRegistrationPolicy{}, "registry/UpdateTopLevelDomainRegistrationPolicy", nil) + cdc.RegisterConcrete(&MsgSubmitTopLevelDomainProposal{}, "registry/SubmitTopLevelDomainProposal", nil) // this line is used by starport scaffolding # 2 } @@ -40,6 +41,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUpdateTopLevelDomainRegistrationPolicy{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgSubmitTopLevelDomainProposal{}, + ) // this line is used by starport scaffolding # 3 msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/registry/types/message_submit_top_level_domain_proposal.go b/x/registry/types/message_submit_top_level_domain_proposal.go new file mode 100644 index 00000000..35bbc021 --- /dev/null +++ b/x/registry/types/message_submit_top_level_domain_proposal.go @@ -0,0 +1,47 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const TypeMsgSubmitTopLevelDomainProposal = "submit_top_level_domain_proposal" + +var _ sdk.Msg = &MsgSubmitTopLevelDomainProposal{} + +func NewMsgSubmitTopLevelDomainProposal(creator string, name string, registrationPeriodInYear string) *MsgSubmitTopLevelDomainProposal { + return &MsgSubmitTopLevelDomainProposal{ + Creator: creator, + Name: name, + RegistrationPeriodInYear: registrationPeriodInYear, + } +} + +func (msg *MsgSubmitTopLevelDomainProposal) Route() string { + return RouterKey +} + +func (msg *MsgSubmitTopLevelDomainProposal) Type() string { + return TypeMsgSubmitTopLevelDomainProposal +} + +func (msg *MsgSubmitTopLevelDomainProposal) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgSubmitTopLevelDomainProposal) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgSubmitTopLevelDomainProposal) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + return nil +} diff --git a/x/registry/types/message_submit_top_level_domain_proposal_test.go b/x/registry/types/message_submit_top_level_domain_proposal_test.go new file mode 100644 index 00000000..29e1406b --- /dev/null +++ b/x/registry/types/message_submit_top_level_domain_proposal_test.go @@ -0,0 +1,40 @@ +package types + +import ( + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/mycel-domain/mycel/testutil/sample" + "github.com/stretchr/testify/require" +) + +func TestMsgSubmitTopLevelDomainProposal_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgSubmitTopLevelDomainProposal + err error + }{ + { + name: "invalid address", + msg: MsgSubmitTopLevelDomainProposal{ + Creator: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "valid address", + msg: MsgSubmitTopLevelDomainProposal{ + Creator: sample.AccAddress(), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/registry/types/tx.pb.go b/x/registry/types/tx.pb.go index edfc0bc4..0b40c027 100644 --- a/x/registry/types/tx.pb.go +++ b/x/registry/types/tx.pb.go @@ -898,6 +898,104 @@ func (m *MsgUpdateTopLevelDomainRegistrationPolicyResponse) XXX_DiscardUnknown() var xxx_messageInfo_MsgUpdateTopLevelDomainRegistrationPolicyResponse proto.InternalMessageInfo +type MsgSubmitTopLevelDomainProposal struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + RegistrationPeriodInYear string `protobuf:"bytes,3,opt,name=registrationPeriodInYear,proto3" json:"registrationPeriodInYear,omitempty"` +} + +func (m *MsgSubmitTopLevelDomainProposal) Reset() { *m = MsgSubmitTopLevelDomainProposal{} } +func (m *MsgSubmitTopLevelDomainProposal) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitTopLevelDomainProposal) ProtoMessage() {} +func (*MsgSubmitTopLevelDomainProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_7a4e7619dfc6612f, []int{16} +} +func (m *MsgSubmitTopLevelDomainProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitTopLevelDomainProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitTopLevelDomainProposal.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 *MsgSubmitTopLevelDomainProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitTopLevelDomainProposal.Merge(m, src) +} +func (m *MsgSubmitTopLevelDomainProposal) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitTopLevelDomainProposal) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitTopLevelDomainProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitTopLevelDomainProposal proto.InternalMessageInfo + +func (m *MsgSubmitTopLevelDomainProposal) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgSubmitTopLevelDomainProposal) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *MsgSubmitTopLevelDomainProposal) GetRegistrationPeriodInYear() string { + if m != nil { + return m.RegistrationPeriodInYear + } + return "" +} + +type MsgSubmitTopLevelDomainProposalResponse struct { +} + +func (m *MsgSubmitTopLevelDomainProposalResponse) Reset() { + *m = MsgSubmitTopLevelDomainProposalResponse{} +} +func (m *MsgSubmitTopLevelDomainProposalResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitTopLevelDomainProposalResponse) ProtoMessage() {} +func (*MsgSubmitTopLevelDomainProposalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7a4e7619dfc6612f, []int{17} +} +func (m *MsgSubmitTopLevelDomainProposalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitTopLevelDomainProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitTopLevelDomainProposalResponse.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 *MsgSubmitTopLevelDomainProposalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitTopLevelDomainProposalResponse.Merge(m, src) +} +func (m *MsgSubmitTopLevelDomainProposalResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitTopLevelDomainProposalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitTopLevelDomainProposalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitTopLevelDomainProposalResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgUpdateWalletRecord)(nil), "mycel.registry.MsgUpdateWalletRecord") proto.RegisterType((*MsgUpdateWalletRecordResponse)(nil), "mycel.registry.MsgUpdateWalletRecordResponse") @@ -915,63 +1013,68 @@ func init() { proto.RegisterType((*MsgUpdateTextRecordResponse)(nil), "mycel.registry.MsgUpdateTextRecordResponse") proto.RegisterType((*MsgUpdateTopLevelDomainRegistrationPolicy)(nil), "mycel.registry.MsgUpdateTopLevelDomainRegistrationPolicy") proto.RegisterType((*MsgUpdateTopLevelDomainRegistrationPolicyResponse)(nil), "mycel.registry.MsgUpdateTopLevelDomainRegistrationPolicyResponse") + proto.RegisterType((*MsgSubmitTopLevelDomainProposal)(nil), "mycel.registry.MsgSubmitTopLevelDomainProposal") + proto.RegisterType((*MsgSubmitTopLevelDomainProposalResponse)(nil), "mycel.registry.MsgSubmitTopLevelDomainProposalResponse") } func init() { proto.RegisterFile("mycel/registry/tx.proto", fileDescriptor_7a4e7619dfc6612f) } var fileDescriptor_7a4e7619dfc6612f = []byte{ - // 804 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4f, 0x4f, 0xd4, 0x40, - 0x14, 0xdf, 0x71, 0xf9, 0x13, 0x1f, 0x11, 0x48, 0xe5, 0x4f, 0xa9, 0x50, 0xa0, 0x02, 0x01, 0x74, - 0x5b, 0x77, 0xc1, 0x83, 0x26, 0x1e, 0x44, 0x20, 0x6a, 0xdc, 0xc4, 0x54, 0x0c, 0xd1, 0x0b, 0xe9, - 0xb6, 0xcf, 0x52, 0xd9, 0xed, 0x34, 0x6d, 0x59, 0x76, 0x4f, 0x1e, 0x8c, 0x07, 0xe3, 0xc5, 0x93, - 0x07, 0x3d, 0xc8, 0xc9, 0x83, 0xf1, 0x83, 0x70, 0xe4, 0xe8, 0x49, 0x0d, 0x7c, 0x05, 0x3f, 0x80, - 0xd9, 0x76, 0xb7, 0xec, 0x9f, 0x76, 0xb7, 0x4b, 0x38, 0x78, 0xea, 0xcc, 0xbc, 0xdf, 0x7b, 0xf3, - 0x7b, 0x9d, 0x37, 0xbf, 0x37, 0x30, 0x5e, 0x28, 0xab, 0x98, 0x97, 0x6c, 0xd4, 0x0d, 0xc7, 0xb5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0x40, 0xa0, 0x08, 0x63, 0x11, 0xbd, 0x60, 0xa9, 0x4d, 0xbc, 0x46, 0x28, 0x97, - 0x8e, 0x0d, 0x0d, 0xf6, 0x2d, 0xc3, 0x78, 0x94, 0xb2, 0x86, 0xfd, 0xbf, 0x08, 0x2c, 0x97, 0x89, - 0x8f, 0x0d, 0xb6, 0xfe, 0x4c, 0x40, 0x88, 0x21, 0x75, 0xb7, 0x43, 0x42, 0x77, 0x76, 0xe3, 0xee, - 0x9d, 0xcb, 0x2d, 0x20, 0xa7, 0xc1, 0x70, 0x8b, 0x92, 0x5c, 0x8f, 0x2c, 0xa8, 0x33, 0x10, 0x77, - 0x23, 0x06, 0x28, 0xd8, 0xe5, 0x1b, 0x81, 0x85, 0x98, 0x5a, 0x70, 0x27, 0x3a, 0x6e, 0x07, 0x57, - 0xee, 0xfe, 0xb9, 0x5d, 0x6b, 0x44, 0xd7, 0x1e, 0x1e, 0x9d, 0xf0, 0xe4, 0xf8, 0x84, 0x27, 0x7f, - 0x4e, 0x78, 0xf2, 0xf1, 0x94, 0x4f, 0x1c, 0x9f, 0xf2, 0x89, 0x9f, 0xa7, 0x7c, 0xe2, 0xa5, 0x58, - 0xd7, 0xee, 0xbc, 0x6d, 0x52, 0xfe, 0x63, 0xd9, 0x9f, 0x48, 0xa5, 0xba, 0xe7, 0x74, 0xa5, 0xf5, - 0xe5, 0xfa, 0xbc, 0x47, 0xf4, 0xca, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x48, 0xd9, 0xd6, 0x2e, - 0xcc, 0x0b, 0x00, 0x00, + // 857 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcf, 0x53, 0xf3, 0x44, + 0x18, 0xee, 0x5a, 0xbe, 0xef, 0x93, 0x97, 0x11, 0x98, 0xc8, 0x8f, 0x10, 0x21, 0x85, 0x08, 0x08, + 0x68, 0x13, 0x5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c, 0x0b, 0x0b, 0xf0, 0xdc, 0x37, + 0x02, 0xec, 0x31, 0x31, 0x1b, 0xae, 0xb6, 0x66, 0xc2, 0x0e, 0xcc, 0x5e, 0x75, 0xb0, 0x9e, 0x36, + 0x7c, 0x2c, 0x4e, 0x84, 0x88, 0xbe, 0x75, 0x61, 0x0e, 0x9e, 0xd5, 0x0c, 0xb7, 0x8a, 0xc5, 0x67, + 0x21, 0x20, 0x9a, 0x28, 0x39, 0x58, 0x89, 0x15, 0xa8, 0x63, 0xea, 0x13, 0x8f, 0x62, 0xe5, 0x27, + 0x04, 0x02, 0x47, 0x1c, 0x78, 0x74, 0xac, 0xfa, 0xd7, 0xe1, 0x15, 0xab, 0x4d, 0xd9, 0x21, 0xbe, + 0x7b, 0x31, 0x41, 0xf9, 0x32, 0x48, 0xfd, 0xba, 0xb8, 0xec, 0x1b, 0x04, 0xcb, 0x25, 0x6a, 0xeb, + 0xe1, 0x0b, 0xc2, 0xc1, 0x09, 0x36, 0x89, 0x67, 0x7d, 0xd6, 0x7c, 0x43, 0x07, 0xe1, 0x0b, 0x1a, + 0x53, 0x01, 0xef, 0x83, 0xd8, 0x3a, 0x03, 0x06, 0x73, 0x88, 0x77, 0x8c, 0x03, 0x87, 0x58, 0x9f, + 0x78, 0x5f, 0x60, 0x23, 0x08, 0x6b, 0x99, 0xd0, 0x13, 0xe3, 0xca, 0x26, 0xac, 0x0f, 0x52, 0xc8, + 0x4b, 0xf9, 0x0e, 0xc1, 0x52, 0x07, 0xf0, 0x94, 0xf8, 0x4f, 0xaf, 0x63, 0x90, 0xde, 0xec, 0x10, + 0xbd, 0x37, 0x08, 0xd6, 0x12, 0x75, 0xb4, 0xd5, 0x0a, 0x47, 0x30, 0xcd, 0xba, 0x22, 0xa1, 0xac, + 0xa9, 0xa2, 0xac, 0x76, 0x5f, 0x3c, 0xb5, 0x27, 0xbf, 0x27, 0x4b, 0xd8, 0x85, 0xec, 0x57, 0x38, + 0x12, 0x3f, 0x55, 0x5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24, 0x55, 0xfa, 0xf0, 0xc9, 0xa9, 0x5c, 0xe8, 0xf7, 0x08, 0x96, 0x07, 0x9a, 0x95, 0x16, 0xb3, + 0xc7, 0xa0, 0x04, 0xe9, 0xdd, 0x11, 0x13, 0xda, 0x52, 0xf6, 0x3f, 0xbe, 0xbd, 0x97, 0xd1, 0xdd, + 0xbd, 0x8c, 0xfe, 0xb9, 0x97, 0xd1, 0x8f, 0x0f, 0x72, 0xe6, 0xee, 0x41, 0xce, 0xfc, 0xf9, 0x20, + 0x67, 0xbe, 0x54, 0x3b, 0xfe, 0x32, 0x84, 0xe4, 0xf9, 0xe8, 0x83, 0x23, 0x9a, 0x68, 0xf5, 0x8e, + 0x4f, 0x92, 0xe6, 0xdf, 0x87, 0xf2, 0xf3, 0xf0, 0x43, 0x64, 0xf7, 0xbf, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x23, 0x5f, 0xcb, 0x2c, 0x10, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -994,6 +1097,7 @@ type MsgClient interface { ExtendTopLevelDomainExpirationDate(ctx context.Context, in *MsgExtendTopLevelDomainExpirationDate, opts ...grpc.CallOption) (*MsgExtendTopLevelDomainExpirationDateResponse, error) UpdateTextRecord(ctx context.Context, in *MsgUpdateTextRecord, opts ...grpc.CallOption) (*MsgUpdateTextRecordResponse, error) UpdateTopLevelDomainRegistrationPolicy(ctx context.Context, in *MsgUpdateTopLevelDomainRegistrationPolicy, opts ...grpc.CallOption) (*MsgUpdateTopLevelDomainRegistrationPolicyResponse, error) + SubmitTopLevelDomainProposal(ctx context.Context, in *MsgSubmitTopLevelDomainProposal, opts ...grpc.CallOption) (*MsgSubmitTopLevelDomainProposalResponse, error) } type msgClient struct { @@ -1076,6 +1180,15 @@ func (c *msgClient) UpdateTopLevelDomainRegistrationPolicy(ctx context.Context, return out, nil } +func (c *msgClient) SubmitTopLevelDomainProposal(ctx context.Context, in *MsgSubmitTopLevelDomainProposal, opts ...grpc.CallOption) (*MsgSubmitTopLevelDomainProposalResponse, error) { + out := new(MsgSubmitTopLevelDomainProposalResponse) + err := c.cc.Invoke(ctx, "/mycel.registry.Msg/SubmitTopLevelDomainProposal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { UpdateWalletRecord(context.Context, *MsgUpdateWalletRecord) (*MsgUpdateWalletRecordResponse, error) @@ -1086,6 +1199,7 @@ type MsgServer interface { ExtendTopLevelDomainExpirationDate(context.Context, *MsgExtendTopLevelDomainExpirationDate) (*MsgExtendTopLevelDomainExpirationDateResponse, error) UpdateTextRecord(context.Context, *MsgUpdateTextRecord) (*MsgUpdateTextRecordResponse, error) UpdateTopLevelDomainRegistrationPolicy(context.Context, *MsgUpdateTopLevelDomainRegistrationPolicy) (*MsgUpdateTopLevelDomainRegistrationPolicyResponse, error) + SubmitTopLevelDomainProposal(context.Context, *MsgSubmitTopLevelDomainProposal) (*MsgSubmitTopLevelDomainProposalResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1116,6 +1230,9 @@ func (*UnimplementedMsgServer) UpdateTextRecord(ctx context.Context, req *MsgUpd func (*UnimplementedMsgServer) UpdateTopLevelDomainRegistrationPolicy(ctx context.Context, req *MsgUpdateTopLevelDomainRegistrationPolicy) (*MsgUpdateTopLevelDomainRegistrationPolicyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateTopLevelDomainRegistrationPolicy not implemented") } +func (*UnimplementedMsgServer) SubmitTopLevelDomainProposal(ctx context.Context, req *MsgSubmitTopLevelDomainProposal) (*MsgSubmitTopLevelDomainProposalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitTopLevelDomainProposal not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1265,6 +1382,24 @@ func _Msg_UpdateTopLevelDomainRegistrationPolicy_Handler(srv interface{}, ctx co return interceptor(ctx, in, info, handler) } +func _Msg_SubmitTopLevelDomainProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSubmitTopLevelDomainProposal) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitTopLevelDomainProposal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mycel.registry.Msg/SubmitTopLevelDomainProposal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitTopLevelDomainProposal(ctx, req.(*MsgSubmitTopLevelDomainProposal)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "mycel.registry.Msg", HandlerType: (*MsgServer)(nil), @@ -1301,6 +1436,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateTopLevelDomainRegistrationPolicy", Handler: _Msg_UpdateTopLevelDomainRegistrationPolicy_Handler, }, + { + MethodName: "SubmitTopLevelDomainProposal", + Handler: _Msg_SubmitTopLevelDomainProposal_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "mycel/registry/tx.proto", @@ -1940,6 +2079,73 @@ func (m *MsgUpdateTopLevelDomainRegistrationPolicyResponse) MarshalToSizedBuffer return len(dAtA) - i, nil } +func (m *MsgSubmitTopLevelDomainProposal) 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 *MsgSubmitTopLevelDomainProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitTopLevelDomainProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RegistrationPeriodInYear) > 0 { + i -= len(m.RegistrationPeriodInYear) + copy(dAtA[i:], m.RegistrationPeriodInYear) + i = encodeVarintTx(dAtA, i, uint64(len(m.RegistrationPeriodInYear))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitTopLevelDomainProposalResponse) 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 *MsgSubmitTopLevelDomainProposalResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitTopLevelDomainProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -2234,6 +2440,36 @@ func (m *MsgUpdateTopLevelDomainRegistrationPolicyResponse) Size() (n int) { return n } +func (m *MsgSubmitTopLevelDomainProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RegistrationPeriodInYear) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitTopLevelDomainProposalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -4139,6 +4375,202 @@ func (m *MsgUpdateTopLevelDomainRegistrationPolicyResponse) Unmarshal(dAtA []byt } return nil } +func (m *MsgSubmitTopLevelDomainProposal) 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: MsgSubmitTopLevelDomainProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitTopLevelDomainProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegistrationPeriodInYear", 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.RegistrationPeriodInYear = 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 *MsgSubmitTopLevelDomainProposalResponse) 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: MsgSubmitTopLevelDomainProposalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitTopLevelDomainProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From 0c28fe0c68d1525601b0d238aaae39710d25d043 Mon Sep 17 00:00:00 2001 From: foxytanuki Date: Thu, 1 Feb 2024 13:48:25 +0900 Subject: [PATCH 3/7] Update CmdSubmitTopLevelDomainProposal() to broadcast gov proposal --- .../cli/tx_submit_top_level_domain_proposal.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/x/registry/client/cli/tx_submit_top_level_domain_proposal.go b/x/registry/client/cli/tx_submit_top_level_domain_proposal.go index 08c9c8c6..321f5d3c 100644 --- a/x/registry/client/cli/tx_submit_top_level_domain_proposal.go +++ b/x/registry/client/cli/tx_submit_top_level_domain_proposal.go @@ -1,11 +1,14 @@ package cli import ( + "fmt" "strconv" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/gov/client/cli" "github.com/mycel-domain/mycel/x/registry/types" "github.com/spf13/cobra" ) @@ -26,6 +29,11 @@ func CmdSubmitTopLevelDomainProposal() *cobra.Command { return err } + proposal, err := cli.ReadGovPropFlags(clientCtx, cmd.Flags()) + if err != nil { + return err + } + msg := types.NewMsgSubmitTopLevelDomainProposal( clientCtx.GetFromAddress().String(), argName, @@ -34,7 +42,12 @@ func CmdSubmitTopLevelDomainProposal() *cobra.Command { if err := msg.ValidateBasic(); err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + + if err := proposal.SetMsgs([]sdk.Msg{msg}); err != nil { + return fmt.Errorf("failed to create submit top-level-domain proposal message: %w", err) + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposal) }, } From 021a9dc4c54070a5523f56b45b467ea2ef60d595 Mon Sep 17 00:00:00 2001 From: foxytanuki Date: Thu, 1 Feb 2024 13:51:29 +0900 Subject: [PATCH 4/7] Fix type of registrationPeriodInYear in MsgSubmitTopLevelDomainProposal --- proto/mycel/registry/tx.proto | 2 +- .../tx_submit_top_level_domain_proposal.go | 6 +- ...essage_submit_top_level_domain_proposal.go | 2 +- x/registry/types/tx.pb.go | 148 ++++++++---------- 4 files changed, 73 insertions(+), 85 deletions(-) diff --git a/proto/mycel/registry/tx.proto b/proto/mycel/registry/tx.proto index 3791e2e3..3d217235 100644 --- a/proto/mycel/registry/tx.proto +++ b/proto/mycel/registry/tx.proto @@ -101,7 +101,7 @@ message MsgUpdateTopLevelDomainRegistrationPolicyResponse {} message MsgSubmitTopLevelDomainProposal { string creator = 1; string name = 2; - string registrationPeriodInYear = 3; + uint64 registrationPeriodInYear = 3; } message MsgSubmitTopLevelDomainProposalResponse {} diff --git a/x/registry/client/cli/tx_submit_top_level_domain_proposal.go b/x/registry/client/cli/tx_submit_top_level_domain_proposal.go index 321f5d3c..92eefefe 100644 --- a/x/registry/client/cli/tx_submit_top_level_domain_proposal.go +++ b/x/registry/client/cli/tx_submit_top_level_domain_proposal.go @@ -10,6 +10,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/client/cli" "github.com/mycel-domain/mycel/x/registry/types" + "github.com/spf13/cast" "github.com/spf13/cobra" ) @@ -22,7 +23,10 @@ func CmdSubmitTopLevelDomainProposal() *cobra.Command { Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { argName := args[0] - argRegistrationPeriodInYear := args[1] + argRegistrationPeriodInYear, err := cast.ToUint64E(args[1]) + if err != nil { + return err + } clientCtx, err := client.GetClientTxContext(cmd) if err != nil { diff --git a/x/registry/types/message_submit_top_level_domain_proposal.go b/x/registry/types/message_submit_top_level_domain_proposal.go index 35bbc021..2725639b 100644 --- a/x/registry/types/message_submit_top_level_domain_proposal.go +++ b/x/registry/types/message_submit_top_level_domain_proposal.go @@ -9,7 +9,7 @@ const TypeMsgSubmitTopLevelDomainProposal = "submit_top_level_domain_proposal" var _ sdk.Msg = &MsgSubmitTopLevelDomainProposal{} -func NewMsgSubmitTopLevelDomainProposal(creator string, name string, registrationPeriodInYear string) *MsgSubmitTopLevelDomainProposal { +func NewMsgSubmitTopLevelDomainProposal(creator string, name string, registrationPeriodInYear uint64) *MsgSubmitTopLevelDomainProposal { return &MsgSubmitTopLevelDomainProposal{ Creator: creator, Name: name, diff --git a/x/registry/types/tx.pb.go b/x/registry/types/tx.pb.go index 0b40c027..619f3dcd 100644 --- a/x/registry/types/tx.pb.go +++ b/x/registry/types/tx.pb.go @@ -901,7 +901,7 @@ var xxx_messageInfo_MsgUpdateTopLevelDomainRegistrationPolicyResponse proto.Inte type MsgSubmitTopLevelDomainProposal struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - RegistrationPeriodInYear string `protobuf:"bytes,3,opt,name=registrationPeriodInYear,proto3" json:"registrationPeriodInYear,omitempty"` + RegistrationPeriodInYear uint64 `protobuf:"varint,3,opt,name=registrationPeriodInYear,proto3" json:"registrationPeriodInYear,omitempty"` } func (m *MsgSubmitTopLevelDomainProposal) Reset() { *m = MsgSubmitTopLevelDomainProposal{} } @@ -951,11 +951,11 @@ func (m *MsgSubmitTopLevelDomainProposal) GetName() string { return "" } -func (m *MsgSubmitTopLevelDomainProposal) GetRegistrationPeriodInYear() string { +func (m *MsgSubmitTopLevelDomainProposal) GetRegistrationPeriodInYear() uint64 { if m != nil { return m.RegistrationPeriodInYear } - return "" + return 0 } type MsgSubmitTopLevelDomainProposalResponse struct { @@ -1020,61 +1020,61 @@ func init() { func init() { proto.RegisterFile("mycel/registry/tx.proto", fileDescriptor_7a4e7619dfc6612f) } var fileDescriptor_7a4e7619dfc6612f = []byte{ - // 857 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcf, 0x53, 0xf3, 0x44, - 0x18, 0xee, 0x5a, 0xbe, 0xef, 0x93, 0x97, 0x11, 0x98, 0xc8, 0x8f, 0x10, 0x21, 0x85, 0x08, 0x08, - 0x68, 0x13, 0x5b, 0x70, 0x1c, 0x9d, 0xf1, 0x20, 0x02, 0xa3, 0x8e, 0x9d, 0x61, 0x02, 0x0e, 0xa3, - 0x17, 0x26, 0x4d, 0xd6, 0x10, 0x49, 0xb3, 0x99, 0xec, 0xb6, 0xb4, 0x27, 0x0f, 0x8e, 0x33, 0x3a, - 0x5c, 0x3c, 0x79, 0xd0, 0x83, 0x9c, 0x3c, 0x38, 0xfe, 0x21, 0x1c, 0x39, 0x7a, 0x52, 0x07, 0xfe, - 0x10, 0x9d, 0x26, 0xed, 0xd2, 0x1f, 0x49, 0x9b, 0x32, 0x3d, 0x78, 0xea, 0xee, 0xbe, 0xcf, 0xfb, - 0xec, 0xf3, 0x26, 0xbb, 0xcf, 0xdb, 0xc0, 0x62, 0xa5, 0x61, 0x62, 0x57, 0x0b, 0xb0, 0xed, 0x50, - 0x16, 0x34, 0x34, 0x56, 0x57, 0xfd, 0x80, 0x30, 0x22, 0x4c, 0x87, 0x01, 0xb5, 0x1d, 0x90, 0x64, - 0x93, 0xd0, 0x0a, 0xa1, 0x5a, 0xd9, 0xa0, 0x58, 0xab, 0x15, 0xca, 0x98, 0x19, 0x05, 0xcd, 0x24, - 0x8e, 0x17, 0xe1, 0xa5, 0x39, 0x9b, 0xd8, 0x24, 0x1c, 0x6a, 0xcd, 0x51, 0x6b, 0x75, 0xa3, 0x97, - 0x9e, 0xf8, 0xe7, 0x2e, 0xae, 0x61, 0xf7, 0xdc, 0x22, 0x15, 0xa3, 0x9d, 0xac, 0xfc, 0x8a, 0x60, - 0xbe, 0x44, 0xed, 0xcf, 0x7d, 0xcb, 0x60, 0xf8, 0xcc, 0x70, 0x5d, 0xcc, 0x74, 0x6c, 0x92, 0xc0, - 0x12, 0x44, 0x78, 0x61, 0x06, 0xd8, 0x60, 0x24, 0x10, 0xd1, 0x2a, 0xda, 0x9a, 0xd4, 0xdb, 0x53, - 0x41, 0x80, 0x09, 0xcf, 0xa8, 0x60, 0xf1, 0xa5, 0x70, 0x39, 0x1c, 0x0b, 0x0b, 0xf0, 0xdc, 0x37, - 0x02, 0xec, 0x31, 0x31, 0x1b, 0xae, 0xb6, 0x66, 0xc2, 0x0e, 0xcc, 0x5e, 0x75, 0xb0, 0x9e, 0x36, - 0x7c, 0x2c, 0x4e, 0x84, 0x88, 0xbe, 0x75, 0x61, 0x0e, 0x9e, 0xd5, 0x0c, 0xb7, 0x8a, 0xc5, 0x67, - 0x21, 0x20, 0x9a, 0x28, 0x39, 0x58, 0x89, 0x15, 0xa8, 0x63, 0xea, 0x13, 0x8f, 0x62, 0xe5, 0x27, - 0x04, 0x02, 0x47, 0x1c, 0x78, 0x74, 0xac, 0xfa, 0xd7, 0xe1, 0x15, 0xab, 0x4d, 0xd9, 0x21, 0xbe, - 0x7b, 0x31, 0x41, 0xf9, 0x32, 0x48, 0xfd, 0xba, 0xb8, 0xec, 0x1b, 0x04, 0xcb, 0x25, 0x6a, 0xeb, - 0xe1, 0x0b, 0xc2, 0xc1, 0x09, 0x36, 0x89, 0x67, 0x7d, 0xd6, 0x7c, 0x43, 0x07, 0xe1, 0x0b, 0x1a, - 0x53, 0x01, 0xef, 0x83, 0xd8, 0x3a, 0x03, 0x06, 0x73, 0x88, 0x77, 0x8c, 0x03, 0x87, 0x58, 0x9f, - 0x78, 0x5f, 0x60, 0x23, 0x08, 0x6b, 0x99, 0xd0, 0x13, 0xe3, 0xca, 0x26, 0xac, 0x0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ee, 0xf9, 0x25, 0x60, 0xa5, - 0x62, 0x7a, 0x2c, 0xdf, 0xfa, 0x67, 0x04, 0x4a, 0x0a, 0x8f, 0x7e, 0x27, 0x86, 0x7a, 0x78, 0x9a, - 0xf4, 0xc1, 0x93, 0xd2, 0xb8, 0x38, 0x0b, 0x66, 0xfb, 0x2c, 0xf0, 0xf5, 0xc4, 0x03, 0xf5, 0x08, - 0x92, 0xde, 0x4c, 0x01, 0xe2, 0xbb, 0xfc, 0x86, 0x60, 0x33, 0xa5, 0x89, 0xbd, 0x97, 0xcc, 0x3b, - 0x24, 0x55, 0xfa, 0xf0, 0xc9, 0xa9, 0x5c, 0xe8, 0xf7, 0x08, 0x96, 0x07, 0x9a, 0x95, 0x16, 0xb3, - 0xc7, 0xa0, 0x04, 0xe9, 0xdd, 0x11, 0x13, 0xda, 0x52, 0xf6, 0x3f, 0xbe, 0xbd, 0x97, 0xd1, 0xdd, - 0xbd, 0x8c, 0xfe, 0xb9, 0x97, 0xd1, 0x8f, 0x0f, 0x72, 0xe6, 0xee, 0x41, 0xce, 0xfc, 0xf9, 0x20, - 0x67, 0xbe, 0x54, 0x3b, 0xfe, 0x32, 0x84, 0xe4, 0xf9, 0xe8, 0x83, 0x23, 0x9a, 0x68, 0xf5, 0x8e, - 0x4f, 0x92, 0xe6, 0xdf, 0x87, 0xf2, 0xf3, 0xf0, 0x43, 0x64, 0xf7, 0xbf, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x23, 0x5f, 0xcb, 0x2c, 0x10, 0x0d, 0x00, 0x00, + // 851 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcf, 0x4f, 0xc4, 0x44, + 0x14, 0xde, 0x71, 0xf9, 0xa1, 0x8f, 0x08, 0xa4, 0xf2, 0xa3, 0x54, 0xe8, 0x42, 0x05, 0x04, 0x74, + 0x5b, 0x77, 0xc1, 0x18, 0x4d,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4, + 0x54, 0x2e, 0xf4, 0x3b, 0x04, 0xcb, 0x03, 0xcd, 0x4a, 0x8b, 0xd9, 0x63, 0x50, 0x82, 0xf4, 0xce, + 0x88, 0x09, 0x6d, 0x29, 0xfb, 0x1f, 0xdd, 0xde, 0xcb, 0xe8, 0xee, 0x5e, 0x46, 0x7f, 0xdf, 0xcb, + 0xe8, 0x87, 0x07, 0x39, 0x73, 0xf7, 0x20, 0x67, 0xfe, 0x78, 0x90, 0x33, 0x5f, 0xa8, 0x1d, 0x7f, + 0x19, 0x42, 0xf2, 0x7c, 0xf4, 0xc1, 0x11, 0x4d, 0xb4, 0x7a, 0xc7, 0x27, 0x49, 0xf3, 0xef, 0x43, + 0x79, 0x22, 0xfc, 0x10, 0xd9, 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, 0x8f, 0xca, 0xf3, 0x21, 0x10, + 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2099,12 +2099,10 @@ func (m *MsgSubmitTopLevelDomainProposal) MarshalToSizedBuffer(dAtA []byte) (int _ = i var l int _ = l - if len(m.RegistrationPeriodInYear) > 0 { - i -= len(m.RegistrationPeriodInYear) - copy(dAtA[i:], m.RegistrationPeriodInYear) - i = encodeVarintTx(dAtA, i, uint64(len(m.RegistrationPeriodInYear))) + if m.RegistrationPeriodInYear != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.RegistrationPeriodInYear)) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x18 } if len(m.Name) > 0 { i -= len(m.Name) @@ -2454,9 +2452,8 @@ func (m *MsgSubmitTopLevelDomainProposal) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.RegistrationPeriodInYear) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.RegistrationPeriodInYear != 0 { + n += 1 + sovTx(uint64(m.RegistrationPeriodInYear)) } return n } @@ -4469,10 +4466,10 @@ func (m *MsgSubmitTopLevelDomainProposal) Unmarshal(dAtA []byte) error { m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RegistrationPeriodInYear", wireType) } - var stringLen uint64 + m.RegistrationPeriodInYear = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4482,24 +4479,11 @@ func (m *MsgSubmitTopLevelDomainProposal) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.RegistrationPeriodInYear |= 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.RegistrationPeriodInYear = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) From 0144fda7b139199324a543ed30a5a318a0fe5417 Mon Sep 17 00:00:00 2001 From: foxytanuki Date: Thu, 1 Feb 2024 13:56:27 +0900 Subject: [PATCH 5/7] Update MsgSubmitTopLevelDomainProposalResponse --- docs/static/openapi.yml | 187 +++++++++++++++++++++++++++ proto/mycel/registry/tx.proto | 5 +- x/registry/types/tx.pb.go | 230 ++++++++++++++++++++++++++-------- 3 files changed, 366 insertions(+), 56 deletions(-) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 2db6865a..390b7389 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -81755,6 +81755,193 @@ definitions: signatures required by gogoproto. mycel.registry.MsgSubmitTopLevelDomainProposalResponse: type: object + properties: + topLevelDomain: + type: object + properties: + name: + type: string + expirationDate: + type: string + format: date-time + subdomainConfig: + type: object + properties: + maxSubdomainRegistrations: + type: string + format: uint64 + subdomainRegistrationFees: + type: object + properties: + feeByLength: + type: array + items: + type: object + properties: + length: + type: integer + format: int64 + isRegistrable: + type: boolean + fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + feeByName: + type: array + items: + type: object + properties: + name: + type: string + isRegistrable: + type: boolean + fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + defaultFee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + isRegistrable: + type: boolean + registrableRole: + type: string + enum: + - NO_ROLE + - OWNER + - EDITOR + default: NO_ROLE + customExpirationDate: + type: boolean + registrationPolicy: + type: string + enum: + - PRIVATE + - PUBLIC + default: PRIVATE + subdomainCount: + type: string + format: uint64 + accessControl: + type: array + items: + type: object + properties: + address: + type: string + role: + type: string + enum: + - NO_ROLE + - OWNER + - EDITOR + default: NO_ROLE + totalWithdrawalAmount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + fee: + type: object + properties: + totalFee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + burnWeight: + type: string + feeToBurn: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + feeToTreasury: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. mycel.registry.MsgUpdateDnsRecordResponse: type: object mycel.registry.MsgUpdateTextRecordResponse: diff --git a/proto/mycel/registry/tx.proto b/proto/mycel/registry/tx.proto index 3d217235..9b94bcb7 100644 --- a/proto/mycel/registry/tx.proto +++ b/proto/mycel/registry/tx.proto @@ -104,5 +104,8 @@ message MsgSubmitTopLevelDomainProposal { uint64 registrationPeriodInYear = 3; } -message MsgSubmitTopLevelDomainProposalResponse {} +message MsgSubmitTopLevelDomainProposalResponse { + TopLevelDomain topLevelDomain = 1; + TopLevelDomainFee fee = 2; +} diff --git a/x/registry/types/tx.pb.go b/x/registry/types/tx.pb.go index 619f3dcd..c3b6fcdf 100644 --- a/x/registry/types/tx.pb.go +++ b/x/registry/types/tx.pb.go @@ -959,6 +959,8 @@ func (m *MsgSubmitTopLevelDomainProposal) GetRegistrationPeriodInYear() uint64 { } type MsgSubmitTopLevelDomainProposalResponse struct { + TopLevelDomain *TopLevelDomain `protobuf:"bytes,1,opt,name=topLevelDomain,proto3" json:"topLevelDomain,omitempty"` + Fee *TopLevelDomainFee `protobuf:"bytes,2,opt,name=fee,proto3" json:"fee,omitempty"` } func (m *MsgSubmitTopLevelDomainProposalResponse) Reset() { @@ -996,6 +998,20 @@ func (m *MsgSubmitTopLevelDomainProposalResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSubmitTopLevelDomainProposalResponse proto.InternalMessageInfo +func (m *MsgSubmitTopLevelDomainProposalResponse) GetTopLevelDomain() *TopLevelDomain { + if m != nil { + return m.TopLevelDomain + } + return nil +} + +func (m *MsgSubmitTopLevelDomainProposalResponse) GetFee() *TopLevelDomainFee { + if m != nil { + return m.Fee + } + return nil +} + func init() { proto.RegisterType((*MsgUpdateWalletRecord)(nil), "mycel.registry.MsgUpdateWalletRecord") proto.RegisterType((*MsgUpdateWalletRecordResponse)(nil), "mycel.registry.MsgUpdateWalletRecordResponse") @@ -1020,61 +1036,61 @@ func init() { func init() { proto.RegisterFile("mycel/registry/tx.proto", fileDescriptor_7a4e7619dfc6612f) } var fileDescriptor_7a4e7619dfc6612f = []byte{ - // 851 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8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 0x69, 0x5c, - 0x9c, 0x05, 0xb3, 0x7d, 0x16, 0xf8, 0x5a, 0xe2, 0x81, 0x7a, 0x04, 0x49, 0x6f, 0xa4, 0x00, 0xf1, - 0x5d, 0x7e, 0x45, 0xb0, 0x99, 0xd2, 0xc4, 0xde, 0x4d, 0xe6, 0x1d, 0x92, 0x2a, 0x7d, 0xf0, 0xe4, - 0x54, 0x2e, 0xf4, 0x3b, 0x04, 0xcb, 0x03, 0xcd, 0x4a, 0x8b, 0xd9, 0x63, 0x50, 0x82, 0xf4, 0xce, - 0x88, 0x09, 0x6d, 0x29, 0xfb, 0x1f, 0xdd, 0xde, 0xcb, 0xe8, 0xee, 0x5e, 0x46, 0x7f, 0xdf, 0xcb, - 0xe8, 0x87, 0x07, 0x39, 0x73, 0xf7, 0x20, 0x67, 0xfe, 0x78, 0x90, 0x33, 0x5f, 0xa8, 0x1d, 0x7f, - 0x19, 0x42, 0xf2, 0x7c, 0xf4, 0xc1, 0x11, 0x4d, 0xb4, 0x7a, 0xc7, 0x27, 0x49, 0xf3, 0xef, 0x43, - 0x79, 0x22, 0xfc, 0x10, 0xd9, 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, 0x8f, 0xca, 0xf3, 0x21, 0x10, - 0x0d, 0x00, 0x00, + // 854 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcf, 0x4f, 0xf4, 0x44, + 0x18, 0xde, 0x71, 0xf9, 0xbe, 0x4f, 0x5f, 0x22, 0x90, 0xca, 0x8f, 0x52, 0xa1, 0x0b, 0x15, 0x10, + 0xd0, 0x6d, 0xdd, 0x05, 0x63, 0x34, 0xf1, 0x20, 0x02, 0x51, 0xe3, 0x26, 0xa4, 0x60, 0x88, 0x5e, + 0x48, 0xb7, 0x1d, 0x4b, 0xa5, 0xdb, 0x69, 0x3a, 0xb3, 0xcb, 0xee, 0xc9, 0x83, 0x31, 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x51, 0xfb, 0xb0, 0x5a, 0xae, 0x38, 0xac, 0x3b, 0xeb, 0x20, 0x20, 0x3e, 0xa1, 0x86, + 0xfb, 0x3f, 0xba, 0xd7, 0x15, 0x82, 0x37, 0x87, 0xa8, 0x79, 0x12, 0x8b, 0xb3, 0xf8, 0xef, 0xcb, + 0x90, 0x2d, 0x51, 0x5b, 0xf8, 0x06, 0x84, 0x98, 0xff, 0x86, 0xd5, 0x5e, 0x96, 0xd8, 0xd3, 0x5b, + 0xca, 0xa7, 0x82, 0xf1, 0x82, 0x0d, 0x98, 0xec, 0x3d, 0xe0, 0x95, 0x44, 0x06, 0x8e, 0x91, 0x36, + 0x87, 0x63, 0xf8, 0x14, 0xdf, 0xc2, 0x7c, 0xf2, 0x61, 0xfc, 0x76, 0x0c, 0x51, 0x22, 0x5a, 0xda, + 0x1e, 0x05, 0xcd, 0x05, 0xd4, 0x60, 0x36, 0xe1, 0x08, 0xdd, 0x18, 0xc0, 0xd7, 0x0d, 0x95, 0x0a, + 0xa9, 0xa1, 0x7c, 0xde, 0x06, 0xcc, 0x25, 0x1d, 0x48, 0x71, 0xef, 0x2f, 0x01, 0x2b, 0x15, 0xd3, + 0x63, 0xf9, 0xd4, 0xbf, 0x20, 0x50, 0x52, 0x9c, 0x10, 0xef, 0xc6, 0x50, 0x0f, 0x4f, 0x93, 0x3e, + 0x7c, 0x50, 0x1a, 0x17, 0x67, 0xc1, 0x54, 0x9f, 0x01, 0xbf, 0x91, 0xb8, 0xa0, 0xee, 0x41, 0xd2, + 0x5b, 0x29, 0x40, 0x7c, 0x96, 0x2b, 0x04, 0x6b, 0x29, 0x2d, 0xf4, 0xfd, 0x64, 0xde, 0x21, 0xa9, + 0xd2, 0x47, 0x0f, 0x4e, 0xe5, 0x42, 0x7f, 0x40, 0xb0, 0x30, 0xd0, 0x2a, 0xb5, 0x98, 0x39, 0x06, + 0x25, 0x48, 0xef, 0x8d, 0x98, 0xd0, 0x96, 0xb2, 0xf3, 0xc9, 0xf5, 0xad, 0x8c, 0x6e, 0x6e, 0x65, + 0xf4, 0xcf, 0xad, 0x8c, 0x7e, 0xba, 0x93, 0x33, 0x37, 0x77, 0x72, 0xe6, 0xcf, 0x3b, 0x39, 0xf3, + 0x95, 0xda, 0xf1, 0xc3, 0x12, 0x92, 0xe7, 0xa3, 0xeb, 0x4e, 0xd4, 0xd1, 0xea, 0x1d, 0x17, 0xa2, + 0xe6, 0xcf, 0x4b, 0xf9, 0x79, 0x78, 0x0d, 0xda, 0xfa, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x39, 0x30, + 0xdf, 0xf5, 0x8e, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2141,6 +2157,30 @@ func (m *MsgSubmitTopLevelDomainProposalResponse) MarshalToSizedBuffer(dAtA []by _ = i var l int _ = l + if m.Fee != nil { + { + size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.TopLevelDomain != nil { + { + size, err := m.TopLevelDomain.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -2464,6 +2504,14 @@ func (m *MsgSubmitTopLevelDomainProposalResponse) Size() (n int) { } var l int _ = l + if m.TopLevelDomain != nil { + l = m.TopLevelDomain.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.Fee != nil { + l = m.Fee.Size() + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -4534,6 +4582,78 @@ func (m *MsgSubmitTopLevelDomainProposalResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MsgSubmitTopLevelDomainProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TopLevelDomain", 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.TopLevelDomain == nil { + m.TopLevelDomain = &TopLevelDomain{} + } + if err := m.TopLevelDomain.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fee", 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.Fee == nil { + m.Fee = &TopLevelDomainFee{} + } + if err := m.Fee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) From 2016ecedd5e0ff2f4ca687e4853a56849c458944 Mon Sep 17 00:00:00 2001 From: foxytanuki Date: Thu, 1 Feb 2024 13:57:18 +0900 Subject: [PATCH 6/7] Impl msg_server for submit_top_level_domain_proposal --- .../cli/tx_submit_top_level_domain_proposal.go | 4 ++++ ...g_server_submit_top_level_domain_proposal.go | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/x/registry/client/cli/tx_submit_top_level_domain_proposal.go b/x/registry/client/cli/tx_submit_top_level_domain_proposal.go index 92eefefe..70788437 100644 --- a/x/registry/client/cli/tx_submit_top_level_domain_proposal.go +++ b/x/registry/client/cli/tx_submit_top_level_domain_proposal.go @@ -4,6 +4,7 @@ import ( "fmt" "strconv" + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" @@ -27,6 +28,9 @@ func CmdSubmitTopLevelDomainProposal() *cobra.Command { if err != nil { return err } + if argRegistrationPeriodInYear < 1 || argRegistrationPeriodInYear > 4 { + return errorsmod.Wrapf(types.ErrTopLevelDomainInvalidRegistrationPeriod, "%d year(s)", argRegistrationPeriodInYear) + } clientCtx, err := client.GetClientTxContext(cmd) if err != nil { diff --git a/x/registry/keeper/msg_server_submit_top_level_domain_proposal.go b/x/registry/keeper/msg_server_submit_top_level_domain_proposal.go index c2669e8f..66d36fc8 100644 --- a/x/registry/keeper/msg_server_submit_top_level_domain_proposal.go +++ b/x/registry/keeper/msg_server_submit_top_level_domain_proposal.go @@ -3,6 +3,7 @@ package keeper import ( "context" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/mycel-domain/mycel/x/registry/types" ) @@ -10,8 +11,18 @@ import ( func (k msgServer) SubmitTopLevelDomainProposal(goCtx context.Context, msg *types.MsgSubmitTopLevelDomainProposal) (*types.MsgSubmitTopLevelDomainProposalResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // TODO: Handling the message - _ = ctx + // NOTE: Same as x/registry/keeper/msg_server_register_top_level_domain.go + if msg.RegistrationPeriodInYear < 1 || msg.RegistrationPeriodInYear > 4 { + return nil, errorsmod.Wrapf(types.ErrTopLevelDomainInvalidRegistrationPeriod, "%d year(s)", msg.RegistrationPeriodInYear) + } - return &types.MsgSubmitTopLevelDomainProposalResponse{}, nil + topLevelDomain, fee, err := k.Keeper.RegisterTopLevelDomain(ctx, msg.Creator, msg.Name, msg.RegistrationPeriodInYear) + if err != nil { + return nil, err + } + + return &types.MsgSubmitTopLevelDomainProposalResponse{ + TopLevelDomain: &topLevelDomain, + Fee: &fee, + }, nil } From 41043064b2e061b3d893fa8375bded477091c1aa Mon Sep 17 00:00:00 2001 From: foxytanuki Date: Thu, 1 Feb 2024 16:37:13 +0900 Subject: [PATCH 7/7] Update CmdSubmitTopLevelDomainProposal --- .../client/cli/tx_submit_top_level_domain_proposal.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/x/registry/client/cli/tx_submit_top_level_domain_proposal.go b/x/registry/client/cli/tx_submit_top_level_domain_proposal.go index 70788437..f54c9cee 100644 --- a/x/registry/client/cli/tx_submit_top_level_domain_proposal.go +++ b/x/registry/client/cli/tx_submit_top_level_domain_proposal.go @@ -9,6 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" "github.com/cosmos/cosmos-sdk/x/gov/client/cli" "github.com/mycel-domain/mycel/x/registry/types" "github.com/spf13/cast" @@ -19,7 +20,7 @@ var _ = strconv.Itoa(0) func CmdSubmitTopLevelDomainProposal() *cobra.Command { cmd := &cobra.Command{ - Use: "submit-top-level-domain-proposal [name] [registration-period-in-year]", + Use: "submit-top-level-domain-proposal [name] [registration-period-in-year] [flags]", Short: "Broadcast message submit-top-level-domain-proposal", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { @@ -43,7 +44,7 @@ func CmdSubmitTopLevelDomainProposal() *cobra.Command { } msg := types.NewMsgSubmitTopLevelDomainProposal( - clientCtx.GetFromAddress().String(), + sdk.AccAddress(address.Module("gov")).String(), argName, argRegistrationPeriodInYear, ) @@ -59,7 +60,10 @@ func CmdSubmitTopLevelDomainProposal() *cobra.Command { }, } + // add common proposal flags flags.AddTxFlagsToCmd(cmd) + cli.AddGovPropFlagsToCmd(cmd) + cmd.MarkFlagRequired(cli.FlagTitle) return cmd }