From e8cbdda0b81c4637ecf5d3704a80950f9dc1fcab Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Wed, 15 Jan 2025 00:44:03 +0900 Subject: [PATCH 1/7] fix: lockup-account document --- x/accounts/README.md | 8 ++++---- x/accounts/defaults/lockup/TUTORIAL.md | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/x/accounts/README.md b/x/accounts/README.md index c560f18d1fc6..6a3f81b73fd6 100644 --- a/x/accounts/README.md +++ b/x/accounts/README.md @@ -545,12 +545,12 @@ For example, given the following `genesis.json` file: "init_account_msgs": [ { "sender": "account_creator_address", - "account_type": "lockup", + "account_type": "lockup_account_type", "message": { - "@type": "cosmos.accounts.defaults.lockup.MsgInitLockupAccount", + "@type": "/cosmos.accounts.defaults.lockup.v1.MsgInitLockupAccount", "owner": "some_owner", - "end_time": "..", - "start_time": ".." + "end_time": "2026-01-01T00:00:00Z", + "start_time": "2025-01-01T00:00:00Z" }, "funds": [ { diff --git a/x/accounts/defaults/lockup/TUTORIAL.md b/x/accounts/defaults/lockup/TUTORIAL.md index 507679daf549..861141afbf4b 100644 --- a/x/accounts/defaults/lockup/TUTORIAL.md +++ b/x/accounts/defaults/lockup/TUTORIAL.md @@ -104,7 +104,7 @@ Whereas `execute-msg-type-url` and `msgcontents` corresponds to lockup account ### Delegate -The execute message type url for this execution is `cosmos.accounts.defaults.lockup.MsgDelegate`. +The execute message type url for this execution is `cosmos.accounts.defaults.lockup.v1.MsgDelegate`. Example of json file: @@ -125,7 +125,7 @@ The `sender` field are the address of the owner of the lockup account. If the se ### Undelegate -The execute message type url for this execution is `cosmos.accounts.defaults.lockup.MsgUndelegate`. +The execute message type url for this execution is `cosmos.accounts.defaults.lockup.v1.MsgUndelegate`. Example of json file: @@ -146,7 +146,7 @@ The `sender` field are the address of the owner of the lockup account. If the se ### Withdraw reward -The execute message type url for this execution is `cosmos.accounts.defaults.lockup.MsgWithdrawReward`. +The execute message type url for this execution is `cosmos.accounts.defaults.lockup.v1.MsgWithdrawReward`. Example of json file: @@ -163,7 +163,7 @@ The `sender` field are the address of the owner of the lockup account. If the se ### Withdraw unlocked token -The execute message type url for this execution is `cosmos.accounts.defaults.lockup.MsgWithdraw`. +The execute message type url for this execution is `cosmos.accounts.defaults.lockup.v1.MsgWithdraw`. Example of json file: @@ -183,7 +183,7 @@ The `withdrawer` field are the address of the owner of the lockup account. If th ### Send coins -The execute message type url for this execution is `cosmos.accounts.defaults.lockup.MsgSend`. +The execute message type url for this execution is `cosmos.accounts.defaults.lockup.v1.MsgSend`. Example of json file: @@ -213,7 +213,7 @@ simd tx accounts query $querycontents ### Query account info -The query request type url for this query is `cosmos.accounts.defaults.lockup.QueryLockupAccountInfoRequest`. And query json file can be an empty object since `QueryLockupAccountInfoRequest` does not required an input. +The query request type url for this query is `cosmos.accounts.defaults.lockup.v1.QueryLockupAccountInfoRequest`. And query json file can be an empty object since `QueryLockupAccountInfoRequest` does not required an input. Account information including: @@ -235,7 +235,7 @@ Account information including: Note, can only be queried from a periodic lockup account ::: -The query request type url for this query is `cosmos.accounts.defaults.lockup.QueryLockingPeriodsRequest`. And query json file can be an empty object since `QueryLockingPeriodsRequest` does not required an input. +The query request type url for this query is `cosmos.accounts.defaults.lockup.v1.QueryLockingPeriodsRequest`. And query json file can be an empty object since `QueryLockingPeriodsRequest` does not required an input. Locking periods including: From 7f8158324a21d9035aceb004ca97fbded6fff0c8 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Wed, 15 Jan 2025 00:55:22 +0900 Subject: [PATCH 2/7] feat: add funds to account init cli --- x/accounts/cli/cli.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/x/accounts/cli/cli.go b/x/accounts/cli/cli.go index e1458acbb045..72d01fcefb4f 100644 --- a/x/accounts/cli/cli.go +++ b/x/accounts/cli/cli.go @@ -15,6 +15,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" ) func TxCmd(name string) *cobra.Command { @@ -41,9 +42,9 @@ func QueryCmd(name string) *cobra.Command { func GetTxInitCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "init ", + Use: "init [,...]", Short: "Initialize a new account", - Args: cobra.ExactArgs(2), + Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -69,10 +70,15 @@ func GetTxInitCmd() *cobra.Command { if err != nil { return err } + funds, err := sdk.ParseCoinsNormalized(args[2]) + if err != nil { + return err + } msg := v1.MsgInit{ Sender: sender, AccountType: args[0], Message: msgBytes, + Funds: funds, } isGenesis, err := cmd.Flags().GetBool("genesis") From 99e0cd64cfbe22d529022b0ab3613c7335672f19 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Wed, 15 Jan 2025 01:04:44 +0900 Subject: [PATCH 3/7] feat: register lockup-account execute Msg --- x/accounts/go.mod | 11 ++++++----- x/accounts/go.sum | 6 ++++++ x/accounts/module.go | 9 +++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/x/accounts/go.mod b/x/accounts/go.mod index 41fbb29b3cd4..1085f688b8c4 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/accounts -go 1.23.3 +go 1.23.4 require ( cosmossdk.io/api v0.8.1 @@ -8,7 +8,7 @@ require ( cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.1 cosmossdk.io/depinject v1.1.0 - cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 + cosmossdk.io/x/bank v0.0.0-20241218110910-47409028a73d cosmossdk.io/x/tx v1.0.0 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 @@ -40,8 +40,9 @@ require ( cosmossdk.io/log v1.5.0 // indirect cosmossdk.io/math v1.5.0 cosmossdk.io/schema v1.0.0 - cosmossdk.io/store v1.10.0-rc.1 // indirect - cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect + cosmossdk.io/store v1.10.0-rc.1.0.20241218084712-ca559989da43 // indirect + cosmossdk.io/x/accounts/defaults/lockup v0.2.0-rc.1 + cosmossdk.io/x/staking v0.0.0-20241218110910-47409028a73d // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -142,7 +143,7 @@ require ( github.com/zondax/ledger-go v0.14.3 // indirect gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect - go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect + go.etcd.io/bbolt v1.4.0-alpha.1 // indirect go.opencensus.io v0.24.0 // indirect go.uber.org/mock v0.5.0 // indirect go.uber.org/multierr v1.11.0 // indirect diff --git a/x/accounts/go.sum b/x/accounts/go.sum index 8e26d39795e6..8c518de137ed 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -24,6 +24,10 @@ cosmossdk.io/schema v1.0.0 h1:/diH4XJjpV1JQwuIozwr+A4uFuuwanFdnw2kKeiXwwQ= cosmossdk.io/schema v1.0.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= cosmossdk.io/store v1.10.0-rc.1 h1:/YVPJLre7lt/QDbl90k95TLt+IvafF1sHaU6WHd/rpc= cosmossdk.io/store v1.10.0-rc.1/go.mod h1:eZNgZKvZRlDUk8CE3LTDVMAcSM7zLOet2S8fByQkF3s= +cosmossdk.io/store v1.10.0-rc.1.0.20241218084712-ca559989da43 h1:glZ6MpmD+5AhwJYV4jzx+rn7cgUB2owHgk9o+93luz0= +cosmossdk.io/store v1.10.0-rc.1.0.20241218084712-ca559989da43/go.mod h1:XCWpgfueHSBY+B7Cf2Aq/CcsU+6XoFH+EmseCKglFrU= +cosmossdk.io/x/accounts/defaults/lockup v0.2.0-rc.1 h1:sA1DfJUgEH6Pkeub7Wt9jXxe7IVeXder/vIrr0F8qMY= +cosmossdk.io/x/accounts/defaults/lockup v0.2.0-rc.1/go.mod h1:izqe1W1exX452AlezXCQt1Hyd3nU2vLYLU/Cftx/Lx4= cosmossdk.io/x/tx v1.0.0 h1:pUUKRvHiMUZC/MnO8v747k1lUEA1DfAq0j0y0Mqrz/o= cosmossdk.io/x/tx v1.0.0/go.mod h1:AXYJ47btzkcWuT1OtA3M44dv1iiYbKomtopHEbQGgH4= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= @@ -480,6 +484,8 @@ gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAF gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 h1:qxen9oVGzDdIRP6ejyAJc760RwW4SnVDiTYTzwnXuxo= go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5/go.mod h1:eW0HG9/oHQhvRCvb1/pIXW4cOvtDqeQK+XSi3TnwaXY= +go.etcd.io/bbolt v1.4.0-alpha.1 h1:3yrqQzbRRPFPdOMWS/QQIVxVnzSkAZQYeWlZFv1kbj4= +go.etcd.io/bbolt v1.4.0-alpha.1/go.mod h1:S/Z/Nm3iuOnyO1W4XuFfPci51Gj6F1Hv0z8hisyYYOw= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= diff --git a/x/accounts/module.go b/x/accounts/module.go index 22c353d9ed8d..4b96c3003f27 100644 --- a/x/accounts/module.go +++ b/x/accounts/module.go @@ -13,8 +13,10 @@ import ( "cosmossdk.io/core/registry" "cosmossdk.io/schema" "cosmossdk.io/x/accounts/cli" + lockuptypes "cosmossdk.io/x/accounts/defaults/lockup/v1" v1 "cosmossdk.io/x/accounts/v1" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" "github.com/cosmos/cosmos-sdk/types/msgservice" ) @@ -51,6 +53,13 @@ func (AppModule) IsAppModule() {} func (am AppModule) Name() string { return ModuleName } func (AppModule) RegisterInterfaces(registrar registry.InterfaceRegistrar) { + registrar.RegisterImplementations((*sdk.Msg)(nil), + &lockuptypes.MsgDelegate{}, + &lockuptypes.MsgUndelegate{}, + &lockuptypes.MsgWithdrawReward{}, + &lockuptypes.MsgSend{}, + ) + msgservice.RegisterMsgServiceDesc(registrar, v1.MsgServiceDesc()) } From afd59ad04d639c8871aa8e5d32b5c89f84f43a07 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Thu, 16 Jan 2025 01:57:46 +0900 Subject: [PATCH 4/7] fix: account InitGenesis order --- simapp/v2/app_config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simapp/v2/app_config.go b/simapp/v2/app_config.go index 84ed2f8fb643..acea179f5691 100644 --- a/simapp/v2/app_config.go +++ b/simapp/v2/app_config.go @@ -151,12 +151,12 @@ var ( // NOTE: The genutils module must also occur after auth so that it can access the params from auth. InitGenesis: []string{ consensustypes.ModuleName, - accounts.ModuleName, authtypes.ModuleName, banktypes.ModuleName, // bankv2types.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, + accounts.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, From 3a58ced7b914bc5d373cb6a3292b1cc70ac54b02 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Wed, 22 Jan 2025 23:30:22 +0900 Subject: [PATCH 5/7] fix: revert --- x/accounts/go.mod | 9 ++++----- x/accounts/go.sum | 2 -- x/accounts/module.go | 8 -------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/x/accounts/go.mod b/x/accounts/go.mod index e749a491e0a9..47e1a8b7aec7 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/accounts -go 1.23.4 +go 1.23.3 require ( cosmossdk.io/api v0.8.2 @@ -39,9 +39,8 @@ require ( cosmossdk.io/log v1.5.0 // indirect cosmossdk.io/math v1.5.0 cosmossdk.io/schema v1.0.0 - cosmossdk.io/store v1.10.0-rc.1.0.20241218084712-ca559989da43 // indirect - cosmossdk.io/x/accounts/defaults/lockup v0.2.0-rc.1 - cosmossdk.io/x/staking v0.0.0-20241218110910-47409028a73d // indirect + cosmossdk.io/store v1.10.0-rc.1 // indirect + cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-20241218110910-47409028a73d // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -142,7 +141,7 @@ require ( github.com/zondax/ledger-go v0.14.3 // indirect gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect - go.etcd.io/bbolt v1.4.0-alpha.1 // indirect + go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect go.opencensus.io v0.24.0 // indirect go.uber.org/mock v0.5.0 // indirect go.uber.org/multierr v1.11.0 // indirect diff --git a/x/accounts/go.sum b/x/accounts/go.sum index db12ba126b98..0261730d7efd 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -477,8 +477,6 @@ gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAF gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 h1:qxen9oVGzDdIRP6ejyAJc760RwW4SnVDiTYTzwnXuxo= go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5/go.mod h1:eW0HG9/oHQhvRCvb1/pIXW4cOvtDqeQK+XSi3TnwaXY= -go.etcd.io/bbolt v1.4.0-alpha.1 h1:3yrqQzbRRPFPdOMWS/QQIVxVnzSkAZQYeWlZFv1kbj4= -go.etcd.io/bbolt v1.4.0-alpha.1/go.mod h1:S/Z/Nm3iuOnyO1W4XuFfPci51Gj6F1Hv0z8hisyYYOw= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= diff --git a/x/accounts/module.go b/x/accounts/module.go index 4b96c3003f27..ad019b3d2888 100644 --- a/x/accounts/module.go +++ b/x/accounts/module.go @@ -13,7 +13,6 @@ import ( "cosmossdk.io/core/registry" "cosmossdk.io/schema" "cosmossdk.io/x/accounts/cli" - lockuptypes "cosmossdk.io/x/accounts/defaults/lockup/v1" v1 "cosmossdk.io/x/accounts/v1" sdk "github.com/cosmos/cosmos-sdk/types" @@ -53,13 +52,6 @@ func (AppModule) IsAppModule() {} func (am AppModule) Name() string { return ModuleName } func (AppModule) RegisterInterfaces(registrar registry.InterfaceRegistrar) { - registrar.RegisterImplementations((*sdk.Msg)(nil), - &lockuptypes.MsgDelegate{}, - &lockuptypes.MsgUndelegate{}, - &lockuptypes.MsgWithdrawReward{}, - &lockuptypes.MsgSend{}, - ) - msgservice.RegisterMsgServiceDesc(registrar, v1.MsgServiceDesc()) } From 011668712e378ec66e26d8720f7310057bbda7cd Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Wed, 22 Jan 2025 23:31:14 +0900 Subject: [PATCH 6/7] fix: typo --- x/accounts/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/accounts/go.mod b/x/accounts/go.mod index 47e1a8b7aec7..16947f4815f2 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -40,7 +40,7 @@ require ( cosmossdk.io/math v1.5.0 cosmossdk.io/schema v1.0.0 cosmossdk.io/store v1.10.0-rc.1 // indirect - cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-20241218110910-47409028a73d // indirect + cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect From c1aa29acbbaf1cb0f730c61d6f7fe70c52f809ce Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Wed, 22 Jan 2025 23:31:41 +0900 Subject: [PATCH 7/7] revert: module --- x/accounts/module.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/accounts/module.go b/x/accounts/module.go index ad019b3d2888..22c353d9ed8d 100644 --- a/x/accounts/module.go +++ b/x/accounts/module.go @@ -15,7 +15,6 @@ import ( "cosmossdk.io/x/accounts/cli" v1 "cosmossdk.io/x/accounts/v1" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" "github.com/cosmos/cosmos-sdk/types/msgservice" )