139 implement mint address param (#174)

* add MintAddress to params.proto

* ignite scaffold message update-params params:Params --module dao

* add dao get and set params

* make dao.MsgUpdateParams.Params non-nullable

* use GetMintAddress in ante handler

* adjust dao e2e test suit for mint address param

* change msg creator to authority and set gov module as default in gov proposal

* fix staticcheck error

* remove depricated config param

* fix linter errors

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
Lorenz Herzberger 2023-11-15 10:46:01 +01:00 committed by GitHub
parent 1ca7faec60
commit 83d493dd94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 858 additions and 76 deletions

View File

@ -3,7 +3,6 @@ package ante
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/config"
daotypes "github.com/planetmint/planetmint-go/x/dao/types"
)
@ -22,9 +21,8 @@ func (cmad CheckMintAddressDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, sim
if sdk.MsgTypeURL(msg) == "/planetmintgo.dao.MsgMintToken" {
mintMsg, ok := msg.(*daotypes.MsgMintToken)
if ok {
cfg := config.GetConfig()
if mintMsg.Creator != cfg.MintAddress {
return ctx, errorsmod.Wrapf(daotypes.ErrInvalidMintAddress, "expected: %s; got: %s", cfg.MintAddress, mintMsg.Creator)
if mintMsg.Creator != cmad.dk.GetMintAddress(ctx) {
return ctx, errorsmod.Wrapf(daotypes.ErrInvalidMintAddress, "expected: %s; got: %s", cmad.dk.GetMintAddress(ctx), mintMsg.Creator)
}
_, found := cmad.dk.GetMintRequestByHash(ctx, mintMsg.GetMintRequest().GetLiquidTxHash())
if found {

View File

@ -36,4 +36,5 @@ type BankKeeper interface {
type DaoKeeper interface {
GetMintRequestByHash(ctx sdk.Context, hash string) (val daotypes.MintRequest, found bool)
GetMintAddress(ctx sdk.Context) (mintAddress string)
}

View File

@ -572,6 +572,7 @@ func New(
app.BankKeeper,
app.AccountKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
daoModule := daomodule.NewAppModule(appCodec, app.DaoKeeper, app.AccountKeeper, app.BankKeeper)

View File

@ -21,7 +21,6 @@ rpc-host = "{{ .PlmntConfig.RPCHost }}"
rpc-port = {{ .PlmntConfig.RPCPort }}
rpc-user = "{{ .PlmntConfig.RPCUser }}"
rpc-password = "{{ .PlmntConfig.RPCPassword }}"
mint-address = "{{ .PlmntConfig.MintAddress }}"
issuance-service-dir = "{{ .PlmntConfig.IssuanceServiceDir }}"
reissuance-asset = "{{ .PlmntConfig.ReissuanceAsset }}"
validator-address = "{{ .PlmntConfig.ValidatorAddress }}"
@ -40,7 +39,6 @@ type Config struct {
RPCUser string `mapstructure:"rpc-user" json:"rpc-user"`
RPCPassword string `mapstructure:"rpc-password" json:"rpc-password"`
IssuanceServiceDir string `mapstructure:"issuance-service-dir" json:"issuance-service-dir"`
MintAddress string `mapstructure:"mint-address" json:"mint-address"`
ReissuanceAsset string `mapstructure:"reissuance-asset" json:"reissuance-asset"`
ValidatorAddress string `mapstructure:"validator-address" json:"validator-address"`
}
@ -65,7 +63,6 @@ func DefaultConfig() *Config {
RPCUser: "user",
RPCPassword: "passwor",
IssuanceServiceDir: "/opt/issuer_service",
MintAddress: "default",
ReissuanceAsset: "asset-id-or-name",
ValidatorAddress: "plmnt1w5dww335zhh98pzv783hqre355ck3u4w4hjxcx",
}

View File

@ -46923,6 +46923,9 @@ paths:
params:
description: params holds all the parameters of this module.
type: object
properties:
mint_address:
type: string
description: >-
QueryParamsResponse is response type for the Query/Params RPC
method.
@ -75995,8 +75998,13 @@ definitions:
type: object
planetmintgo.dao.MsgReissueRDDLResultResponse:
type: object
planetmintgo.dao.MsgUpdateParamsResponse:
type: object
planetmintgo.dao.Params:
type: object
properties:
mint_address:
type: string
description: Params defines the parameters for the module.
planetmintgo.dao.QueryGetMintRequestsByHashResponse:
type: object
@ -76091,6 +76099,9 @@ definitions:
params:
description: params holds all the parameters of this module.
type: object
properties:
mint_address:
type: string
description: QueryParamsResponse is response type for the Query/Params RPC method.
planetmintgo.dao.Reissuance:
type: object

2
go.mod
View File

@ -10,6 +10,7 @@ require (
github.com/btcsuite/btcd/btcutil v1.1.2
github.com/cometbft/cometbft v0.37.2
github.com/cometbft/cometbft-db v0.7.0
github.com/cosmos/cosmos-proto v1.0.0-beta.2
github.com/cosmos/cosmos-sdk v0.47.5
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogoproto v1.4.10
@ -61,7 +62,6 @@ require (
github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect
github.com/confio/ics23/go v0.9.0 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v0.20.0 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect

View File

@ -9,4 +9,5 @@ option go_package = "github.com/planetmint/planetmint-go/x/dao/types";
message Params {
option (gogoproto.goproto_stringer) = false;
string mint_address = 1;
}

View File

@ -3,6 +3,11 @@ syntax = "proto3";
package planetmintgo.dao;
import "planetmintgo/dao/mint_request.proto";
import "planetmintgo/dao/params.proto";
import "amino/amino.proto";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
option go_package = "github.com/planetmint/planetmint-go/x/dao/types";
@ -11,6 +16,7 @@ service Msg {
rpc ReissueRDDLProposal (MsgReissueRDDLProposal) returns (MsgReissueRDDLProposalResponse);
rpc MintToken (MsgMintToken ) returns (MsgMintTokenResponse );
rpc ReissueRDDLResult (MsgReissueRDDLResult ) returns (MsgReissueRDDLResultResponse );
rpc UpdateParams (MsgUpdateParams ) returns (MsgUpdateParamsResponse );
}
message MsgReissueRDDLProposal {
string creator = 1;
@ -37,3 +43,16 @@ message MsgReissueRDDLResult {
message MsgReissueRDDLResultResponse {}
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address that controls the module (defaults to x/gov unless overwritten).
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// params defines the x/dao parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}
message MsgUpdateParamsResponse {}

View File

@ -1,8 +1,10 @@
package dao
import (
"bufio"
"encoding/json"
"fmt"
"os"
"github.com/planetmint/planetmint-go/config"
"github.com/planetmint/planetmint-go/testutil/network"
@ -10,6 +12,8 @@ import (
"cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
clitestutil "github.com/planetmint/planetmint-go/testutil/cli"
@ -21,6 +25,7 @@ import (
"github.com/stretchr/testify/suite"
daocli "github.com/planetmint/planetmint-go/x/dao/client/cli"
daotypes "github.com/planetmint/planetmint-go/x/dao/types"
)
var (
@ -88,6 +93,20 @@ func (s *E2ETestSuite) SetupSuite() {
s.cfg.GenesisState[banktypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&bankGenState)
s.cfg.MinGasPrices = fmt.Sprintf("0.000006%s", conf.FeeDenom)
// Setup MintAddress parameter in genesis state
// use sample.Mnemonic to make mint address deterministic for test
s.cfg.Mnemonics = []string{sample.Mnemonic}
// set MintAddress in GenesisState
var daoGenState daotypes.GenesisState
s.cfg.Codec.MustUnmarshalJSON(s.cfg.GenesisState[daotypes.ModuleName], &daoGenState)
valAddr, err := s.createValAccount(s.cfg)
s.Require().NoError(err)
daoGenState.Params.MintAddress = valAddr.String()
s.cfg.GenesisState[daotypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&daoGenState)
s.network = network.New(s.T(), s.cfg)
}
@ -144,13 +163,11 @@ func (s *E2ETestSuite) TestMintToken() {
conf := config.GetConfig()
val := s.network.Validators[0]
// val.Address.String()
mintRequest := sample.MintRequest(aliceAddr.String(), 1000, "hash")
mrJSON, err := json.Marshal(&mintRequest)
s.Require().NoError(err)
// send mint token request from non mint address
// send mint token request from mint address
args := []string{
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Moniker),
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("10%s", conf.FeeDenom)),
@ -163,26 +180,7 @@ func (s *E2ETestSuite) TestMintToken() {
txResponse, err := clitestutil.GetTxResponseFromOut(out)
s.Require().NoError(err)
s.Require().Equal(int(txResponse.Code), int(2))
// set mint address to val.address
conf.MintAddress = val.Address.String()
conf.SetPlanetmintConfig(conf)
// send mint token request from mint address
args = []string{
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Moniker),
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("10%s", conf.FeeDenom)),
"--yes",
string(mrJSON),
}
out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, daocli.CmdMintToken(), args)
s.Require().NoError(err)
txResponse, err = clitestutil.GetTxResponseFromOut(out)
s.Require().NoError(err)
s.Require().Equal(int(txResponse.Code), int(0))
s.Require().Equal(int(0), int(txResponse.Code))
s.Require().NoError(s.network.WaitForNextBlock())
rawLog, err := clitestutil.GetRawLogFromTxResponse(val, txResponse)
@ -197,4 +195,67 @@ func (s *E2ETestSuite) TestMintToken() {
assert.Contains(s.T(), out.String(), "plmnt")
assert.Contains(s.T(), out.String(), "11000")
s.Require().NoError(err)
// send mint token request from non mint address
kb := val.ClientCtx.Keyring
account, err := kb.NewAccount(sample.Name, sample.Mnemonic, keyring.DefaultBIP39Passphrase, sample.DefaultDerivationPath, hd.Secp256k1)
s.Require().NoError(err)
addr, _ := account.GetAddress()
// sending funds to account to initialize on chain
args = []string{
val.Moniker,
addr.String(),
sample.Amount,
"--yes",
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("10%s", conf.FeeDenom)),
}
_, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.NewSendTxCmd(), args)
s.Require().NoError(err)
s.Require().NoError(s.network.WaitForNextBlock())
args = []string{
fmt.Sprintf("--%s=%s", flags.FlagFrom, addr.String()),
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("10%s", conf.FeeDenom)),
"--yes",
string(mrJSON),
}
out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, daocli.CmdMintToken(), args)
s.Require().NoError(err)
txResponse, err = clitestutil.GetTxResponseFromOut(out)
s.Require().NoError(err)
s.Require().Equal(int(2), int(txResponse.Code))
}
func (s *E2ETestSuite) createValAccount(cfg network.Config) (address sdk.AccAddress, err error) {
buf := bufio.NewReader(os.Stdin)
kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, s.T().TempDir(), buf, cfg.Codec, cfg.KeyringOptions...)
if err != nil {
return nil, err
}
keyringAlgos, _ := kb.SupportedAlgorithms()
algo, err := keyring.NewSigningAlgoFromString(cfg.SigningAlgo, keyringAlgos)
if err != nil {
return nil, err
}
mnemonic := cfg.Mnemonics[0]
record, err := kb.NewAccount("node0", mnemonic, keyring.DefaultBIP39Passphrase, sdk.GetConfig().GetFullBIP44Path(), algo)
if err != nil {
return nil, err
}
addr, err := record.GetAddress()
if err != nil {
return nil, err
}
return addr, nil
}

View File

@ -11,6 +11,8 @@ import (
"github.com/cosmos/cosmos-sdk/store"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
typesparams "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/golang/mock/gomock"
"github.com/planetmint/planetmint-go/config"
@ -72,10 +74,14 @@ func DaoKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
paramsSubspace,
bk,
nil,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
// Initialize params
k.SetParams(ctx, types.DefaultParams())
err := k.SetParams(ctx, types.DefaultParams())
if err != nil {
panic(err)
}
return k, ctx
}

View File

@ -28,6 +28,7 @@ func GetTxCmd() *cobra.Command {
cmd.AddCommand(CmdReissueRDDLProposal())
cmd.AddCommand(CmdMintToken())
cmd.AddCommand(CmdReissueRDDLResult())
cmd.AddCommand(CmdUpdateParams())
// this line is used by starport scaffolding # 1
return cmd

View File

@ -0,0 +1,48 @@
package cli
import (
"strconv"
"encoding/json"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/planetmint/planetmint-go/x/dao/types"
"github.com/spf13/cobra"
)
var _ = strconv.Itoa(0)
func CmdUpdateParams() *cobra.Command {
cmd := &cobra.Command{
Use: "update-params [params]",
Short: "Broadcast message update-params",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
argParams := new(types.Params)
err = json.Unmarshal([]byte(args[0]), argParams)
if err != nil {
return err
}
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgUpdateParams(
clientCtx.GetFromAddress().String(),
*argParams,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}

View File

@ -9,7 +9,7 @@ import (
// InitGenesis initializes the module's state from a provided genesis state.
func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) {
// this line is used by starport scaffolding # genesis/module/init
k.SetParams(ctx, genState.Params)
_ = k.SetParams(ctx, genState.Params)
}
// ExportGenesis returns the module's exported genesis

View File

@ -28,6 +28,7 @@ type (
bankKeeper types.BankKeeper
accountKeeper types.AccountKeeper
authority string
}
)
@ -42,6 +43,7 @@ func NewKeeper(
bankKeeper types.BankKeeper,
accountKeeper types.AccountKeeper,
authority string,
) *Keeper {
// set KeyTable if it has not already been set
if !ps.HasKeyTable() {
@ -59,6 +61,7 @@ func NewKeeper(
bankKeeper: bankKeeper,
accountKeeper: accountKeeper,
authority: authority,
}
}

View File

@ -0,0 +1,24 @@
package keeper
import (
"context"
"cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/planetmint/planetmint-go/x/dao/types"
)
func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
if k.authority != msg.Authority {
return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority)
}
if err := k.SetParams(ctx, msg.Params); err != nil {
return nil, err
}
return &types.MsgUpdateParamsResponse{}, nil
}

View File

@ -6,11 +6,31 @@ import (
)
// GetParams get all parameters as types.Params
func (k Keeper) GetParams(_ sdk.Context) types.Params {
return types.NewParams()
func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
store := ctx.KVStore(k.storeKey)
bz := store.Get(types.KeyPrefix(types.ParamsKey))
if bz == nil {
return params
}
k.cdc.MustUnmarshal(bz, &params)
return params
}
// SetParams set the params
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramstore.SetParamSet(ctx, &params)
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error {
if err := params.Validate(); err != nil {
return err
}
store := ctx.KVStore(k.storeKey)
bz, err := k.cdc.Marshal(&params)
if err != nil {
return err
}
store.Set(types.KeyPrefix(types.ParamsKey), bz)
return nil
}
func (k Keeper) GetMintAddress(ctx sdk.Context) (mintAddress string) {
return k.GetParams(ctx).MintAddress
}

View File

@ -12,7 +12,7 @@ func TestGetParams(t *testing.T) {
k, ctx := testkeeper.DaoKeeper(t)
params := types.DefaultParams()
k.SetParams(ctx, params)
_ = k.SetParams(ctx, params)
require.EqualValues(t, params, k.GetParams(ctx))
}

View File

@ -13,7 +13,7 @@ func TestParamsQuery(t *testing.T) {
keeper, ctx := testkeeper.DaoKeeper(t)
wctx := sdk.WrapSDKContext(ctx)
params := types.DefaultParams()
keeper.SetParams(ctx, params)
_ = keeper.SetParams(ctx, params)
response, err := keeper.Params(wctx, &types.QueryParamsRequest{})
require.NoError(t, err)

View File

@ -32,6 +32,10 @@ const (
// TODO: Determine the simulation weight value
defaultWeightMsgReissueRDDLResult int = 100
opWeightMsgUpdateParams = "op_weight_msg_update_params"
// TODO: Determine the simulation weight value
defaultWeightMsgUpdateParams int = 100
// this line is used by starport scaffolding # simapp/module/const
)
@ -82,6 +86,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
daosimulation.SimulateMsgReissueRDDLResult(am.accountKeeper, am.bankKeeper, am.keeper),
))
var weightMsgUpdateParams int
simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUpdateParams, &weightMsgUpdateParams, nil,
func(_ *rand.Rand) {
weightMsgUpdateParams = defaultWeightMsgUpdateParams
},
)
operations = append(operations, simulation.NewWeightedOperation(
weightMsgUpdateParams,
daosimulation.SimulateMsgUpdateParams(am.accountKeeper, am.bankKeeper, am.keeper),
))
// this line is used by starport scaffolding # simapp/module/operation
return operations
@ -106,6 +121,14 @@ func (am AppModule) ProposalMsgs(_ module.SimulationState) []simtypes.WeightedPr
return nil
},
),
simulation.NewWeightedProposalMsg(
opWeightMsgUpdateParams,
defaultWeightMsgUpdateParams,
func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg {
daosimulation.SimulateMsgUpdateParams(am.accountKeeper, am.bankKeeper, am.keeper)
return nil
},
),
// this line is used by starport scaffolding # simapp/module/OpMsg
}
}

View File

@ -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/planetmint/planetmint-go/x/dao/keeper"
"github.com/planetmint/planetmint-go/x/dao/types"
)
func SimulateMsgUpdateParams(
_ types.AccountKeeper,
_ types.BankKeeper,
_ 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.MsgUpdateParams{
Authority: simAccount.Address.String(),
}
// TODO: Handling the UpdateParams simulation
return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UpdateParams simulation not implemented"), nil, nil
}
}

View File

@ -11,6 +11,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgReissueRDDLProposal{}, "dao/ReissueRDDLProposal", nil)
cdc.RegisterConcrete(&MsgMintToken{}, "dao/MintToken", nil)
cdc.RegisterConcrete(&MsgReissueRDDLResult{}, "dao/ReissueRDDLResult", nil)
cdc.RegisterConcrete(&MsgUpdateParams{}, "dao/UpdateParams", nil)
// this line is used by starport scaffolding # 2
}
@ -22,6 +23,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgReissueRDDLResult{},
)
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgUpdateParams{},
)
// this line is used by starport scaffolding # 3
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)

View File

@ -20,6 +20,8 @@ const (
MintRequestHashKey = "Dao/MintRequestHash"
ReissuanceBlockHeightKey = "Dao/ReissuanceBlockHeight"
ParamsKey = "Dao/Params"
)
func KeyPrefix(p string) []byte {

View File

@ -0,0 +1,47 @@
package types
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
const TypeMsgUpdateParams = "update_params"
var _ sdk.Msg = &MsgUpdateParams{}
func NewMsgUpdateParams(authority string, params Params) *MsgUpdateParams {
return &MsgUpdateParams{
Authority: authority,
Params: params,
}
}
func (msg *MsgUpdateParams) Route() string {
return RouterKey
}
func (msg *MsgUpdateParams) Type() string {
return TypeMsgUpdateParams
}
func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Authority)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgUpdateParams) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgUpdateParams) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Authority)
if err != nil {
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
return nil
}

View File

@ -0,0 +1,34 @@
package types
import (
"testing"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/stretchr/testify/require"
)
func TestMsgUpdateParams_ValidateBasic(t *testing.T) {
tests := []struct {
name string
msg MsgUpdateParams
err error
}{
{
name: "invalid address",
msg: MsgUpdateParams{
Authority: "invalid_address",
},
err: sdkerrors.ErrInvalidAddress,
},
}
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)
})
}
}

View File

@ -13,13 +13,15 @@ func ParamKeyTable() paramtypes.KeyTable {
}
// NewParams creates a new Params instance
func NewParams() Params {
return Params{}
func NewParams(mintAddress string) Params {
return Params{
MintAddress: mintAddress,
}
}
// DefaultParams returns a default set of parameters
func DefaultParams() Params {
return NewParams()
return NewParams("plmnt1dyuhg8ldu3d6nvhrvzzemtc3893dys9v9lvdty")
}
// ParamSetPairs get the params.ParamSet

View File

@ -25,6 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Params defines the parameters for the module.
type Params struct {
MintAddress string `protobuf:"bytes,1,opt,name=mint_address,json=mintAddress,proto3" json:"mint_address,omitempty"`
}
func (m *Params) Reset() { *m = Params{} }
@ -59,6 +60,13 @@ func (m *Params) XXX_DiscardUnknown() {
var xxx_messageInfo_Params proto.InternalMessageInfo
func (m *Params) GetMintAddress() string {
if m != nil {
return m.MintAddress
}
return ""
}
func init() {
proto.RegisterType((*Params)(nil), "planetmintgo.dao.Params")
}
@ -66,17 +74,19 @@ func init() {
func init() { proto.RegisterFile("planetmintgo/dao/params.proto", fileDescriptor_a58575036b3ad531) }
var fileDescriptor_a58575036b3ad531 = []byte{
// 151 bytes of a gzipped FileDescriptorProto
// 178 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0xc8, 0x49, 0xcc,
0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0x4f, 0x49, 0xcc, 0xd7, 0x2f, 0x48, 0x2c,
0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x40, 0x96, 0xd6, 0x4b, 0x49,
0xcc, 0x97, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x4b, 0xea, 0x83, 0x58, 0x10, 0x75, 0x4a, 0x7c,
0x5c, 0x6c, 0x01, 0x60, 0x7d, 0x56, 0x2c, 0x33, 0x16, 0xc8, 0x33, 0x38, 0x79, 0x9e, 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, 0x7e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e,
0x72, 0x7e, 0xae, 0x3e, 0xc2, 0x70, 0x24, 0xa6, 0x6e, 0x7a, 0xbe, 0x7e, 0x05, 0xd8, 0x25, 0x25,
0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x1b, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x41,
0x65, 0x38, 0xbf, 0xaa, 0x00, 0x00, 0x00,
0xcc, 0x97, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x4b, 0xea, 0x83, 0x58, 0x10, 0x75, 0x4a, 0x86,
0x5c, 0x6c, 0x01, 0x60, 0x7d, 0x42, 0x8a, 0x5c, 0x3c, 0x20, 0xd5, 0xf1, 0x89, 0x29, 0x29, 0x45,
0xa9, 0xc5, 0xc5, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0xdc, 0x20, 0x31, 0x47, 0x88, 0x90,
0x15, 0xcb, 0x8c, 0x05, 0xf2, 0x0c, 0x4e, 0x9e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7,
0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c,
0xc7, 0x10, 0xa5, 0x9f, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x8f, 0xb0,
0x1f, 0x89, 0xa9, 0x9b, 0x9e, 0xaf, 0x5f, 0x01, 0x76, 0x6c, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12,
0x1b, 0xd8, 0x11, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x31, 0x13, 0x64, 0xcd, 0x00,
0x00, 0x00,
}
func (m *Params) Marshal() (dAtA []byte, err error) {
@ -99,6 +109,13 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.MintAddress) > 0 {
i -= len(m.MintAddress)
copy(dAtA[i:], m.MintAddress)
i = encodeVarintParams(dAtA, i, uint64(len(m.MintAddress)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
@ -119,6 +136,10 @@ func (m *Params) Size() (n int) {
}
var l int
_ = l
l = len(m.MintAddress)
if l > 0 {
n += 1 + l + sovParams(uint64(l))
}
return n
}
@ -157,6 +178,38 @@ func (m *Params) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MintAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MintAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipParams(dAtA[iNdEx:])

View File

@ -6,6 +6,10 @@ package types
import (
context "context"
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
_ "github.com/cosmos/cosmos-sdk/types/msgservice"
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/cosmos/gogoproto/grpc"
proto "github.com/cosmos/gogoproto/proto"
grpc "google.golang.org/grpc"
@ -323,6 +327,98 @@ func (m *MsgReissueRDDLResultResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgReissueRDDLResultResponse proto.InternalMessageInfo
type MsgUpdateParams struct {
// authority is the address that controls the module (defaults to x/gov unless overwritten).
Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
// params defines the x/dao parameters to update.
//
// NOTE: All parameters must be supplied.
Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
}
func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} }
func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateParams) ProtoMessage() {}
func (*MsgUpdateParams) Descriptor() ([]byte, []int) {
return fileDescriptor_7117c47dbc1828c7, []int{6}
}
func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateParams.Merge(m, src)
}
func (m *MsgUpdateParams) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateParams) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo
func (m *MsgUpdateParams) GetAuthority() string {
if m != nil {
return m.Authority
}
return ""
}
func (m *MsgUpdateParams) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
type MsgUpdateParamsResponse struct {
}
func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} }
func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateParamsResponse) ProtoMessage() {}
func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_7117c47dbc1828c7, []int{7}
}
func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src)
}
func (m *MsgUpdateParamsResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*MsgReissueRDDLProposal)(nil), "planetmintgo.dao.MsgReissueRDDLProposal")
proto.RegisterType((*MsgReissueRDDLProposalResponse)(nil), "planetmintgo.dao.MsgReissueRDDLProposalResponse")
@ -330,37 +426,50 @@ func init() {
proto.RegisterType((*MsgMintTokenResponse)(nil), "planetmintgo.dao.MsgMintTokenResponse")
proto.RegisterType((*MsgReissueRDDLResult)(nil), "planetmintgo.dao.MsgReissueRDDLResult")
proto.RegisterType((*MsgReissueRDDLResultResponse)(nil), "planetmintgo.dao.MsgReissueRDDLResultResponse")
proto.RegisterType((*MsgUpdateParams)(nil), "planetmintgo.dao.MsgUpdateParams")
proto.RegisterType((*MsgUpdateParamsResponse)(nil), "planetmintgo.dao.MsgUpdateParamsResponse")
}
func init() { proto.RegisterFile("planetmintgo/dao/tx.proto", fileDescriptor_7117c47dbc1828c7) }
var fileDescriptor_7117c47dbc1828c7 = []byte{
// 396 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x41, 0x6a, 0xe3, 0x30,
0x14, 0x86, 0x23, 0x27, 0xcc, 0x4c, 0x5e, 0x86, 0x61, 0x46, 0x33, 0x04, 0x8f, 0x99, 0x11, 0xc6,
0x85, 0x90, 0x4d, 0xed, 0x92, 0x1e, 0xa0, 0x50, 0xb2, 0x68, 0xa0, 0x86, 0xa2, 0x76, 0xd5, 0x4d,
0x71, 0x12, 0xe1, 0x98, 0x38, 0x96, 0x63, 0xc9, 0xe0, 0xee, 0x4a, 0x4f, 0xd0, 0xf3, 0xf4, 0x04,
0x5d, 0x66, 0xd9, 0x65, 0x49, 0x2e, 0x52, 0x62, 0xd7, 0x8e, 0x69, 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5, 0x27, 0x53, 0xc2, 0xd0, 0x90, 0xc9, 0x60, 0xfc, 0x96, 0x53, 0x5a, 0xef,
0x91, 0x14, 0x81, 0x7f, 0x55, 0x0c, 0x39, 0x64, 0xef, 0x51, 0x81, 0xba, 0x2d, 0x5c, 0x3c, 0x87,
0xdf, 0x55, 0x0f, 0xda, 0xad, 0xc8, 0xa1, 0x32, 0x78, 0xed, 0x68, 0x5f, 0x67, 0x3e, 0x1a, 0x5f,
0x42, 0x73, 0xf3, 0x3e, 0xa4, 0xb2, 0xbd, 0xd0, 0xb5, 0xce, 0x6e, 0xbd, 0x38, 0x74, 0x0a, 0xbf,
0xb6, 0x03, 0xef, 0x7c, 0xc4, 0x96, 0xf9, 0x34, 0x73, 0x3f, 0x5f, 0x3e, 0xec, 0x74, 0xf0, 0xb4,
0x24, 0x68, 0xb1, 0x24, 0xe8, 0x65, 0x49, 0xd0, 0xc3, 0x8a, 0xd4, 0x16, 0x2b, 0x52, 0x7b, 0x5e,
0x91, 0xda, 0xb5, 0xe5, 0x7a, 0x72, 0x12, 0x0f, 0xcd, 0x11, 0x9f, 0x59, 0x9b, 0x33, 0x4b, 0xe5,
0xa1, 0xcb, 0xad, 0x24, 0xfb, 0x8e, 0xb7, 0x21, 0x13, 0xc3, 0x2f, 0xe9, 0xdf, 0x3a, 0x7e, 0x0d,
0x00, 0x00, 0xff, 0xff, 0x29, 0x98, 0xe0, 0x51, 0xaf, 0x03, 0x00, 0x00,
// 564 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x41, 0x6b, 0x13, 0x41,
0x14, 0xce, 0x26, 0xa5, 0x9a, 0x97, 0x52, 0xed, 0x1a, 0xda, 0xcd, 0x62, 0xd7, 0x18, 0xa1, 0xc4,
0x42, 0x77, 0xb5, 0x82, 0x07, 0x3d, 0x88, 0xa1, 0x07, 0x0b, 0x2e, 0x94, 0xad, 0x5e, 0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 0xf4,
0xf2, 0x6c, 0x7b, 0x36, 0xac, 0x51, 0x83, 0x8d, 0x2b, 0xba, 0xa6, 0x9a, 0x77, 0xbf, 0x95, 0xa0,
0xe4, 0x72, 0xa2, 0x1f, 0xc3, 0xbd, 0x3c, 0x13, 0x36, 0x73, 0xde, 0x2e, 0xd7, 0x2c, 0xe6, 0x93,
0x45, 0x99, 0xd3, 0xd5, 0xfa, 0x21, 0x94, 0x67, 0x9e, 0xb2, 0x72, 0xdb, 0x53, 0xdc, 0xdc, 0xba,
0x1e, 0x4f, 0x87, 0xf6, 0x60, 0x6d, 0xde, 0x24, 0x5b, 0x37, 0x69, 0x53, 0x3c, 0xd3, 0x5e, 0x8c,
0x97, 0x2e, 0xfb, 0x08, 0x2b, 0xff, 0x3c, 0xf6, 0xc3, 0xdc, 0xfe, 0x2c, 0xc5, 0x7c, 0x7c, 0x23,
0x65, 0x3a, 0xbd, 0xb5, 0x7f, 0x3e, 0xb2, 0xb4, 0x8b, 0x91, 0xa5, 0xfd, 0x19, 0x59, 0xda, 0x97,
0xb1, 0x55, 0xb8, 0x18, 0x5b, 0x85, 0x5f, 0x63, 0xab, 0xf0, 0xc1, 0x21, 0x81, 0xe8, 0x0e, 0xda,
0x76, 0x87, 0x86, 0xce, 0x6c, 0x5c, 0x26, 0xdc, 0x21, 0xd4, 0x19, 0xaa, 0x8f, 0xe3, 0x49, 0x8c,
0x79, 0x7b, 0x59, 0x7e, 0x6d, 0x9e, 0xfd, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x46, 0xf6, 0xb0, 0xe5,
0x3d, 0x05, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -378,6 +487,7 @@ type MsgClient interface {
ReissueRDDLProposal(ctx context.Context, in *MsgReissueRDDLProposal, opts ...grpc.CallOption) (*MsgReissueRDDLProposalResponse, error)
MintToken(ctx context.Context, in *MsgMintToken, opts ...grpc.CallOption) (*MsgMintTokenResponse, error)
ReissueRDDLResult(ctx context.Context, in *MsgReissueRDDLResult, opts ...grpc.CallOption) (*MsgReissueRDDLResultResponse, error)
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}
type msgClient struct {
@ -415,11 +525,21 @@ func (c *msgClient) ReissueRDDLResult(ctx context.Context, in *MsgReissueRDDLRes
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, "/planetmintgo.dao.Msg/UpdateParams", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
ReissueRDDLProposal(context.Context, *MsgReissueRDDLProposal) (*MsgReissueRDDLProposalResponse, error)
MintToken(context.Context, *MsgMintToken) (*MsgMintTokenResponse, error)
ReissueRDDLResult(context.Context, *MsgReissueRDDLResult) (*MsgReissueRDDLResultResponse, error)
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@ -435,6 +555,9 @@ func (*UnimplementedMsgServer) MintToken(ctx context.Context, req *MsgMintToken)
func (*UnimplementedMsgServer) ReissueRDDLResult(ctx context.Context, req *MsgReissueRDDLResult) (*MsgReissueRDDLResultResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ReissueRDDLResult not implemented")
}
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
@ -494,6 +617,24 @@ func _Msg_ReissueRDDLResult_Handler(srv interface{}, ctx context.Context, dec fu
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/planetmintgo.dao.Msg/UpdateParams",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "planetmintgo.dao.Msg",
HandlerType: (*MsgServer)(nil),
@ -510,6 +651,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "ReissueRDDLResult",
Handler: _Msg_ReissueRDDLResult_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "planetmintgo/dao/tx.proto",
@ -724,6 +869,69 @@ func (m *MsgReissueRDDLResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, e
return len(dAtA) - i, nil
}
func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
if len(m.Authority) > 0 {
i -= len(m.Authority)
copy(dAtA[i:], m.Authority)
i = encodeVarintTx(dAtA, i, uint64(len(m.Authority)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateParamsResponse) 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
@ -827,6 +1035,30 @@ func (m *MsgReissueRDDLResultResponse) Size() (n int) {
return n
}
func (m *MsgUpdateParams) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Authority)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = m.Params.Size()
n += 1 + l + sovTx(uint64(l))
return n
}
func (m *MsgUpdateParamsResponse) 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
}
@ -1431,6 +1663,171 @@ func (m *MsgReissueRDDLResultResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Authority = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateParamsResponse: 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