From 4f45d36b77ef0b5a06d7f867809c2c8c2aefae8d Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Thu, 15 Sep 2022 12:48:28 +0530 Subject: [PATCH 01/16] add genesis account helper --- x/bank/types/add_genesis_account_helper.go | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 x/bank/types/add_genesis_account_helper.go diff --git a/x/bank/types/add_genesis_account_helper.go b/x/bank/types/add_genesis_account_helper.go new file mode 100644 index 000000000000..9c58744b8545 --- /dev/null +++ b/x/bank/types/add_genesis_account_helper.go @@ -0,0 +1,99 @@ +package types + +import ( + "encoding/json" + fmt "fmt" + + "github.com/cosmos/cosmos-sdk/server" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" +) + +func AddGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress) error { + serverCtx := server.NewDefaultContext() + config := serverCtx.Config + + config.SetRoot(path) + config.Moniker = moniker + + cfg := testutil.MakeTestEncodingConfig() + + coins, err := sdk.ParseCoinsNormalized(amountStr) + if err != nil { + return fmt.Errorf("failed to parse coins: %w", err) + } + + balances := Balance{Address: accAddr.String(), Coins: coins.Sort()} + genAccount := authtypes.NewBaseAccount(accAddr, nil, 0, 0) + + // if err := genAccount.Validate(); err != nil { + // return fmt.Errorf("failed to validate new genesis account: %w", err) + // } + + // TODO: Make the SDK make it far cleaner to add an account to GenesisState + genFile := config.GenesisFile() + appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) + if err != nil { + return fmt.Errorf("failed to unmarshal genesis state: %w", err) + } + + authGenState := authtypes.GetGenesisStateFromAppState(cfg.Codec, appState) + + accs, err := authtypes.UnpackAccounts(authGenState.Accounts) + if err != nil { + return fmt.Errorf("failed to get accounts from any: %w", err) + } + + bankGenState := GetGenesisStateFromAppState(cfg.Codec, appState) + if accs.Contains(accAddr) { + genesisB := GetGenesisStateFromAppState(cfg.Codec, appState) + for idx, acc := range genesisB.Balances { + if acc.Address != accAddr.String() { + continue + } + + updatedCoins := acc.Coins.Add(coins...) + bankGenState.Balances[idx] = Balance{Address: accAddr.String(), Coins: updatedCoins.Sort()} + break + } + } else { + // Add the new account to the set of genesis accounts and sanitize the accounts afterwards. + accs = append(accs, genAccount) + accs = authtypes.SanitizeGenesisAccounts(accs) + + genAccs, err := authtypes.PackAccounts(accs) + if err != nil { + return fmt.Errorf("failed to convert accounts into any's: %w", err) + } + authGenState.Accounts = genAccs + + authGenStateBz, err := cfg.Codec.MarshalJSON(&authGenState) + if err != nil { + return fmt.Errorf("failed to marshal auth genesis state: %w", err) + } + appState[authtypes.ModuleName] = authGenStateBz + + bankGenState.Balances = append(bankGenState.Balances, balances) + } + + bankGenState.Balances = SanitizeGenesisBalances(bankGenState.Balances) + + bankGenState.Supply = bankGenState.Supply.Add(balances.Coins...) + + bankGenStateBz, err := cfg.Codec.MarshalJSON(bankGenState) + if err != nil { + return fmt.Errorf("failed to marshal bank genesis state: %w", err) + } + appState[ModuleName] = bankGenStateBz + + appStateJSON, err := json.Marshal(appState) + if err != nil { + return fmt.Errorf("failed to marshal application genesis state: %w", err) + } + + genDoc.AppState = appStateJSON + return genutil.ExportGenesisFile(genDoc, genFile) +} From 4660787bad3a15c0772eab97a03a02d578d3c071 Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Thu, 15 Sep 2022 12:56:49 +0530 Subject: [PATCH 02/16] wip: clean up --- x/bank/types/add_genesis_account_helper.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/x/bank/types/add_genesis_account_helper.go b/x/bank/types/add_genesis_account_helper.go index 9c58744b8545..c14e92830f74 100644 --- a/x/bank/types/add_genesis_account_helper.go +++ b/x/bank/types/add_genesis_account_helper.go @@ -29,11 +29,10 @@ func AddGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress) balances := Balance{Address: accAddr.String(), Coins: coins.Sort()} genAccount := authtypes.NewBaseAccount(accAddr, nil, 0, 0) - // if err := genAccount.Validate(); err != nil { - // return fmt.Errorf("failed to validate new genesis account: %w", err) - // } + if err := genAccount.Validate(); err != nil { + return fmt.Errorf("failed to validate new genesis account: %w", err) + } - // TODO: Make the SDK make it far cleaner to add an account to GenesisState genFile := config.GenesisFile() appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) if err != nil { From fbadc23f6ec8f1bdb82edf746b095b5e964c0654 Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Thu, 15 Sep 2022 13:07:46 +0530 Subject: [PATCH 03/16] fix something --- .../add_genesis_account_helper.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) rename x/bank/{types => testutil}/add_genesis_account_helper.go (82%) diff --git a/x/bank/types/add_genesis_account_helper.go b/x/bank/testutil/add_genesis_account_helper.go similarity index 82% rename from x/bank/types/add_genesis_account_helper.go rename to x/bank/testutil/add_genesis_account_helper.go index c14e92830f74..ce0b285c1b6e 100644 --- a/x/bank/types/add_genesis_account_helper.go +++ b/x/bank/testutil/add_genesis_account_helper.go @@ -1,4 +1,4 @@ -package types +package testutil import ( "encoding/json" @@ -8,6 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module/testutil" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ) @@ -26,7 +27,7 @@ func AddGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress) return fmt.Errorf("failed to parse coins: %w", err) } - balances := Balance{Address: accAddr.String(), Coins: coins.Sort()} + balances := banktypes.Balance{Address: accAddr.String(), Coins: coins.Sort()} genAccount := authtypes.NewBaseAccount(accAddr, nil, 0, 0) if err := genAccount.Validate(); err != nil { @@ -46,16 +47,16 @@ func AddGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress) return fmt.Errorf("failed to get accounts from any: %w", err) } - bankGenState := GetGenesisStateFromAppState(cfg.Codec, appState) + bankGenState := banktypes.GetGenesisStateFromAppState(cfg.Codec, appState) if accs.Contains(accAddr) { - genesisB := GetGenesisStateFromAppState(cfg.Codec, appState) + genesisB := banktypes.GetGenesisStateFromAppState(cfg.Codec, appState) for idx, acc := range genesisB.Balances { if acc.Address != accAddr.String() { continue } updatedCoins := acc.Coins.Add(coins...) - bankGenState.Balances[idx] = Balance{Address: accAddr.String(), Coins: updatedCoins.Sort()} + bankGenState.Balances[idx] = banktypes.Balance{Address: accAddr.String(), Coins: updatedCoins.Sort()} break } } else { @@ -78,7 +79,7 @@ func AddGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress) bankGenState.Balances = append(bankGenState.Balances, balances) } - bankGenState.Balances = SanitizeGenesisBalances(bankGenState.Balances) + bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances) bankGenState.Supply = bankGenState.Supply.Add(balances.Coins...) @@ -86,7 +87,7 @@ func AddGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress) if err != nil { return fmt.Errorf("failed to marshal bank genesis state: %w", err) } - appState[ModuleName] = bankGenStateBz + appState[banktypes.ModuleName] = bankGenStateBz appStateJSON, err := json.Marshal(appState) if err != nil { From bda760edd04731d23a5be3cd8fa1a6c8a4cc11d9 Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Thu, 15 Sep 2022 14:47:41 +0530 Subject: [PATCH 04/16] wip: move add genesis account helper to auth module --- x/{bank/testutil => auth}/add_genesis_account_helper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename x/{bank/testutil => auth}/add_genesis_account_helper.go (99%) diff --git a/x/bank/testutil/add_genesis_account_helper.go b/x/auth/add_genesis_account_helper.go similarity index 99% rename from x/bank/testutil/add_genesis_account_helper.go rename to x/auth/add_genesis_account_helper.go index ce0b285c1b6e..43b6251ccf9c 100644 --- a/x/bank/testutil/add_genesis_account_helper.go +++ b/x/auth/add_genesis_account_helper.go @@ -1,4 +1,4 @@ -package testutil +package auth import ( "encoding/json" From 049c2088fbdca374468661028ba0bef71abf4d2a Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Thu, 15 Sep 2022 16:41:48 +0530 Subject: [PATCH 05/16] wip --- simapp/simd/cmd/genaccounts.go | 120 +----------------- .../add_genesis_account_helper.go | 55 ++++++-- 2 files changed, 50 insertions(+), 125 deletions(-) rename x/auth/{ => helpers}/add_genesis_account_helper.go (58%) diff --git a/simapp/simd/cmd/genaccounts.go b/simapp/simd/cmd/genaccounts.go index 862a061a4e20..2db46ae3aaad 100644 --- a/simapp/simd/cmd/genaccounts.go +++ b/simapp/simd/cmd/genaccounts.go @@ -2,8 +2,6 @@ package cmd import ( "bufio" - "encoding/json" - "errors" "fmt" "github.com/spf13/cobra" @@ -13,11 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + auth "github.com/cosmos/cosmos-sdk/x/auth/helpers" ) const ( @@ -72,119 +66,13 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa } } - coins, err := sdk.ParseCoinsNormalized(args[1]) - if err != nil { - return fmt.Errorf("failed to parse coins: %w", err) - } - + appendflag, _ := cmd.Flags().GetBool(flagAppendMode) vestingStart, _ := cmd.Flags().GetInt64(flagVestingStart) vestingEnd, _ := cmd.Flags().GetInt64(flagVestingEnd) vestingAmtStr, _ := cmd.Flags().GetString(flagVestingAmt) - vestingAmt, err := sdk.ParseCoinsNormalized(vestingAmtStr) - if err != nil { - return fmt.Errorf("failed to parse vesting amount: %w", err) - } - - // create concrete account type based on input parameters - var genAccount authtypes.GenesisAccount - - balances := banktypes.Balance{Address: addr.String(), Coins: coins.Sort()} - baseAccount := authtypes.NewBaseAccount(addr, nil, 0, 0) - - if !vestingAmt.IsZero() { - baseVestingAccount := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd) - - if (balances.Coins.IsZero() && !baseVestingAccount.OriginalVesting.IsZero()) || - baseVestingAccount.OriginalVesting.IsAnyGT(balances.Coins) { - return errors.New("vesting amount cannot be greater than total amount") - } - - switch { - case vestingStart != 0 && vestingEnd != 0: - genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart) - - case vestingEnd != 0: - genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount) - - default: - return errors.New("invalid vesting parameters; must supply start and end time or end time") - } - } else { - genAccount = baseAccount - } - - if err := genAccount.Validate(); err != nil { - return fmt.Errorf("failed to validate new genesis account: %w", err) - } - - genFile := config.GenesisFile() - appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) - if err != nil { - return fmt.Errorf("failed to unmarshal genesis state: %w", err) - } - - authGenState := authtypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) - - accs, err := authtypes.UnpackAccounts(authGenState.Accounts) - if err != nil { - return fmt.Errorf("failed to get accounts from any: %w", err) - } - - bankGenState := banktypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) - if accs.Contains(addr) { - appendflag, _ := cmd.Flags().GetBool(flagAppendMode) - if !appendflag { - return fmt.Errorf("cannot add account at existing address %s", addr) - } - - genesisB := banktypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) - for idx, acc := range genesisB.Balances { - if acc.Address != addr.String() { - continue - } - - updatedCoins := acc.Coins.Add(coins...) - bankGenState.Balances[idx] = banktypes.Balance{Address: addr.String(), Coins: updatedCoins.Sort()} - break - } - } else { - // Add the new account to the set of genesis accounts and sanitize the accounts afterwards. - accs = append(accs, genAccount) - accs = authtypes.SanitizeGenesisAccounts(accs) - - genAccs, err := authtypes.PackAccounts(accs) - if err != nil { - return fmt.Errorf("failed to convert accounts into any's: %w", err) - } - authGenState.Accounts = genAccs - - authGenStateBz, err := clientCtx.Codec.MarshalJSON(&authGenState) - if err != nil { - return fmt.Errorf("failed to marshal auth genesis state: %w", err) - } - appState[authtypes.ModuleName] = authGenStateBz - - bankGenState.Balances = append(bankGenState.Balances, balances) - } - - bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances) - - bankGenState.Supply = bankGenState.Supply.Add(balances.Coins...) - - bankGenStateBz, err := clientCtx.Codec.MarshalJSON(bankGenState) - if err != nil { - return fmt.Errorf("failed to marshal bank genesis state: %w", err) - } - appState[banktypes.ModuleName] = bankGenStateBz - - appStateJSON, err := json.Marshal(appState) - if err != nil { - return fmt.Errorf("failed to marshal application genesis state: %w", err) - } - - genDoc.AppState = appStateJSON - return genutil.ExportGenesisFile(genDoc, genFile) + err = auth.AddGenesisAccount(clientCtx.HomeDir, config.Moniker, args[1], addr, appendflag, vestingStart, vestingEnd, vestingAmtStr) + return err }, } diff --git a/x/auth/add_genesis_account_helper.go b/x/auth/helpers/add_genesis_account_helper.go similarity index 58% rename from x/auth/add_genesis_account_helper.go rename to x/auth/helpers/add_genesis_account_helper.go index 43b6251ccf9c..3463ed1deabf 100644 --- a/x/auth/add_genesis_account_helper.go +++ b/x/auth/helpers/add_genesis_account_helper.go @@ -1,34 +1,67 @@ -package auth +package helpers import ( "encoding/json" + "errors" fmt "fmt" "github.com/cosmos/cosmos-sdk/server" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ) -func AddGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress) error { +func AddGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress, appendAcct bool, vestingStart, vestingEnd int64, vestingAmtStr string) error { serverCtx := server.NewDefaultContext() config := serverCtx.Config config.SetRoot(path) config.Moniker = moniker - cfg := testutil.MakeTestEncodingConfig() + encCfg := testutil.MakeTestEncodingConfig(auth.AppModuleBasic{}) coins, err := sdk.ParseCoinsNormalized(amountStr) if err != nil { return fmt.Errorf("failed to parse coins: %w", err) } + vestingAmt, err := sdk.ParseCoinsNormalized(vestingAmtStr) + if err != nil { + return fmt.Errorf("failed to parse vesting amount: %w", err) + } + + // create concrete account type based on input parameters + var genAccount authtypes.GenesisAccount + balances := banktypes.Balance{Address: accAddr.String(), Coins: coins.Sort()} - genAccount := authtypes.NewBaseAccount(accAddr, nil, 0, 0) + baseAccount := authtypes.NewBaseAccount(accAddr, nil, 0, 0) + + if !vestingAmt.IsZero() { + baseVestingAccount := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd) + + if (balances.Coins.IsZero() && !baseVestingAccount.OriginalVesting.IsZero()) || + baseVestingAccount.OriginalVesting.IsAnyGT(balances.Coins) { + return errors.New("vesting amount cannot be greater than total amount") + } + + switch { + case vestingStart != 0 && vestingEnd != 0: + genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart) + + case vestingEnd != 0: + genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount) + + default: + return errors.New("invalid vesting parameters; must supply start and end time or end time") + } + } else { + genAccount = baseAccount + } if err := genAccount.Validate(); err != nil { return fmt.Errorf("failed to validate new genesis account: %w", err) @@ -40,16 +73,20 @@ func AddGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress) return fmt.Errorf("failed to unmarshal genesis state: %w", err) } - authGenState := authtypes.GetGenesisStateFromAppState(cfg.Codec, appState) + authGenState := authtypes.GetGenesisStateFromAppState(encCfg.Codec, appState) accs, err := authtypes.UnpackAccounts(authGenState.Accounts) if err != nil { return fmt.Errorf("failed to get accounts from any: %w", err) } - bankGenState := banktypes.GetGenesisStateFromAppState(cfg.Codec, appState) + bankGenState := banktypes.GetGenesisStateFromAppState(encCfg.Codec, appState) if accs.Contains(accAddr) { - genesisB := banktypes.GetGenesisStateFromAppState(cfg.Codec, appState) + if !appendAcct { + return fmt.Errorf(" Account %s already exists\nUse `append` flag to append account at existing address", accAddr) + } + + genesisB := banktypes.GetGenesisStateFromAppState(encCfg.Codec, appState) for idx, acc := range genesisB.Balances { if acc.Address != accAddr.String() { continue @@ -70,7 +107,7 @@ func AddGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress) } authGenState.Accounts = genAccs - authGenStateBz, err := cfg.Codec.MarshalJSON(&authGenState) + authGenStateBz, err := encCfg.Codec.MarshalJSON(&authGenState) if err != nil { return fmt.Errorf("failed to marshal auth genesis state: %w", err) } @@ -83,7 +120,7 @@ func AddGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress) bankGenState.Supply = bankGenState.Supply.Add(balances.Coins...) - bankGenStateBz, err := cfg.Codec.MarshalJSON(bankGenState) + bankGenStateBz, err := encCfg.Codec.MarshalJSON(bankGenState) if err != nil { return fmt.Errorf("failed to marshal bank genesis state: %w", err) } From 8373828d2853a0efe7a1b29480d4071327ba3f97 Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Thu, 15 Sep 2022 19:03:30 +0530 Subject: [PATCH 06/16] add inline doc for AddGenesisAccount func --- simapp/simd/cmd/genaccounts.go | 2 -- x/auth/helpers/add_genesis_account_helper.go | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/simapp/simd/cmd/genaccounts.go b/simapp/simd/cmd/genaccounts.go index 2db46ae3aaad..0e15b84c924b 100644 --- a/simapp/simd/cmd/genaccounts.go +++ b/simapp/simd/cmd/genaccounts.go @@ -37,8 +37,6 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa serverCtx := server.GetServerContextFromCmd(cmd) config := serverCtx.Config - config.SetRoot(clientCtx.HomeDir) - var kr keyring.Keyring addr, err := sdk.AccAddressFromBech32(args[0]) if err != nil { diff --git a/x/auth/helpers/add_genesis_account_helper.go b/x/auth/helpers/add_genesis_account_helper.go index 3463ed1deabf..890123c0ca13 100644 --- a/x/auth/helpers/add_genesis_account_helper.go +++ b/x/auth/helpers/add_genesis_account_helper.go @@ -16,6 +16,7 @@ import ( genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ) +// AddGenesisAccount adds a genesis account to genesis state. func AddGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress, appendAcct bool, vestingStart, vestingEnd int64, vestingAmtStr string) error { serverCtx := server.NewDefaultContext() config := serverCtx.Config From 268c94118f4fc1bd95714cd843ae9eee9c8cfc01 Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Thu, 15 Sep 2022 19:40:31 +0530 Subject: [PATCH 07/16] address review comments --- simapp/simd/cmd/genaccounts.go | 4 ++- x/auth/helpers/add_genesis_account_helper.go | 28 +++++++------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/simapp/simd/cmd/genaccounts.go b/simapp/simd/cmd/genaccounts.go index 0e15b84c924b..3ba8058f5b7f 100644 --- a/simapp/simd/cmd/genaccounts.go +++ b/simapp/simd/cmd/genaccounts.go @@ -37,6 +37,8 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa serverCtx := server.GetServerContextFromCmd(cmd) config := serverCtx.Config + config.SetRoot(clientCtx.HomeDir) + var kr keyring.Keyring addr, err := sdk.AccAddressFromBech32(args[0]) if err != nil { @@ -69,7 +71,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa vestingEnd, _ := cmd.Flags().GetInt64(flagVestingEnd) vestingAmtStr, _ := cmd.Flags().GetString(flagVestingAmt) - err = auth.AddGenesisAccount(clientCtx.HomeDir, config.Moniker, args[1], addr, appendflag, vestingStart, vestingEnd, vestingAmtStr) + err = auth.AddGenesisAccount(config, clientCtx, addr, args[1], appendflag, vestingStart, vestingEnd, vestingAmtStr) return err }, } diff --git a/x/auth/helpers/add_genesis_account_helper.go b/x/auth/helpers/add_genesis_account_helper.go index 890123c0ca13..d7c99f0bf4f5 100644 --- a/x/auth/helpers/add_genesis_account_helper.go +++ b/x/auth/helpers/add_genesis_account_helper.go @@ -5,10 +5,10 @@ import ( "errors" fmt "fmt" - "github.com/cosmos/cosmos-sdk/server" + tmcfg "github.com/tendermint/tendermint/config" + + "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module/testutil" - "github.com/cosmos/cosmos-sdk/x/auth" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -16,16 +16,8 @@ import ( genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ) -// AddGenesisAccount adds a genesis account to genesis state. -func AddGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress, appendAcct bool, vestingStart, vestingEnd int64, vestingAmtStr string) error { - serverCtx := server.NewDefaultContext() - config := serverCtx.Config - - config.SetRoot(path) - config.Moniker = moniker - - encCfg := testutil.MakeTestEncodingConfig(auth.AppModuleBasic{}) - +// AddGenesisAccount adds a genesis account to the genesis state. +func AddGenesisAccount(config *tmcfg.Config, clientCtx client.Context, accAddr sdk.AccAddress, amountStr string, appendAcct bool, vestingStart, vestingEnd int64, vestingAmtStr string) error { coins, err := sdk.ParseCoinsNormalized(amountStr) if err != nil { return fmt.Errorf("failed to parse coins: %w", err) @@ -74,20 +66,20 @@ func AddGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress, return fmt.Errorf("failed to unmarshal genesis state: %w", err) } - authGenState := authtypes.GetGenesisStateFromAppState(encCfg.Codec, appState) + authGenState := authtypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) accs, err := authtypes.UnpackAccounts(authGenState.Accounts) if err != nil { return fmt.Errorf("failed to get accounts from any: %w", err) } - bankGenState := banktypes.GetGenesisStateFromAppState(encCfg.Codec, appState) + bankGenState := banktypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) if accs.Contains(accAddr) { if !appendAcct { return fmt.Errorf(" Account %s already exists\nUse `append` flag to append account at existing address", accAddr) } - genesisB := banktypes.GetGenesisStateFromAppState(encCfg.Codec, appState) + genesisB := banktypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) for idx, acc := range genesisB.Balances { if acc.Address != accAddr.String() { continue @@ -108,7 +100,7 @@ func AddGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress, } authGenState.Accounts = genAccs - authGenStateBz, err := encCfg.Codec.MarshalJSON(&authGenState) + authGenStateBz, err := clientCtx.Codec.MarshalJSON(&authGenState) if err != nil { return fmt.Errorf("failed to marshal auth genesis state: %w", err) } @@ -121,7 +113,7 @@ func AddGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress, bankGenState.Supply = bankGenState.Supply.Add(balances.Coins...) - bankGenStateBz, err := encCfg.Codec.MarshalJSON(bankGenState) + bankGenStateBz, err := clientCtx.Codec.MarshalJSON(bankGenState) if err != nil { return fmt.Errorf("failed to marshal bank genesis state: %w", err) } From ae836163bfc9c66bf46be9bae514bbcd0580745c Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Thu, 15 Sep 2022 19:44:11 +0530 Subject: [PATCH 08/16] nit --- x/auth/helpers/add_genesis_account_helper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/auth/helpers/add_genesis_account_helper.go b/x/auth/helpers/add_genesis_account_helper.go index d7c99f0bf4f5..390ae8677e70 100644 --- a/x/auth/helpers/add_genesis_account_helper.go +++ b/x/auth/helpers/add_genesis_account_helper.go @@ -3,7 +3,7 @@ package helpers import ( "encoding/json" "errors" - fmt "fmt" + "fmt" tmcfg "github.com/tendermint/tendermint/config" From 1ef05524c2a739ab3bb8b8a3c17757f54e3db119 Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Tue, 20 Sep 2022 12:13:48 +0530 Subject: [PATCH 09/16] wip: use genesisFileUrl instead of config --- simapp/simd/cmd/genaccounts.go | 11 ++++++++-- x/auth/helpers/add_genesis_account_helper.go | 21 +++++++++----------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/simapp/simd/cmd/genaccounts.go b/simapp/simd/cmd/genaccounts.go index 3ba8058f5b7f..0bcaa0445702 100644 --- a/simapp/simd/cmd/genaccounts.go +++ b/simapp/simd/cmd/genaccounts.go @@ -3,6 +3,7 @@ package cmd import ( "bufio" "fmt" + "path/filepath" "github.com/spf13/cobra" @@ -33,6 +34,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa `, Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { + var genesisFileUrl string clientCtx := client.GetClientContextFromCmd(cmd) serverCtx := server.GetServerContextFromCmd(cmd) config := serverCtx.Config @@ -71,8 +73,13 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa vestingEnd, _ := cmd.Flags().GetInt64(flagVestingEnd) vestingAmtStr, _ := cmd.Flags().GetString(flagVestingAmt) - err = auth.AddGenesisAccount(config, clientCtx, addr, args[1], appendflag, vestingStart, vestingEnd, vestingAmtStr) - return err + if filepath.IsAbs(config.Genesis) { + genesisFileUrl = config.Genesis + } else { + genesisFileUrl = filepath.Join(config.RootDir, config.Genesis) + } + + return auth.AddGenesisAccount(genesisFileUrl, clientCtx.Codec, addr, args[1], appendflag, vestingStart, vestingEnd, vestingAmtStr) }, } diff --git a/x/auth/helpers/add_genesis_account_helper.go b/x/auth/helpers/add_genesis_account_helper.go index 390ae8677e70..3a6ccbe8a857 100644 --- a/x/auth/helpers/add_genesis_account_helper.go +++ b/x/auth/helpers/add_genesis_account_helper.go @@ -5,9 +5,7 @@ import ( "errors" "fmt" - tmcfg "github.com/tendermint/tendermint/config" - - "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" @@ -17,7 +15,7 @@ import ( ) // AddGenesisAccount adds a genesis account to the genesis state. -func AddGenesisAccount(config *tmcfg.Config, clientCtx client.Context, accAddr sdk.AccAddress, amountStr string, appendAcct bool, vestingStart, vestingEnd int64, vestingAmtStr string) error { +func AddGenesisAccount(genesisFileUrl string, cdc codec.Codec, accAddr sdk.AccAddress, amountStr string, appendAcct bool, vestingStart, vestingEnd int64, vestingAmtStr string) error { coins, err := sdk.ParseCoinsNormalized(amountStr) if err != nil { return fmt.Errorf("failed to parse coins: %w", err) @@ -60,26 +58,25 @@ func AddGenesisAccount(config *tmcfg.Config, clientCtx client.Context, accAddr s return fmt.Errorf("failed to validate new genesis account: %w", err) } - genFile := config.GenesisFile() - appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) + appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genesisFileUrl) if err != nil { return fmt.Errorf("failed to unmarshal genesis state: %w", err) } - authGenState := authtypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) + authGenState := authtypes.GetGenesisStateFromAppState(cdc, appState) accs, err := authtypes.UnpackAccounts(authGenState.Accounts) if err != nil { return fmt.Errorf("failed to get accounts from any: %w", err) } - bankGenState := banktypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) + bankGenState := banktypes.GetGenesisStateFromAppState(cdc, appState) if accs.Contains(accAddr) { if !appendAcct { return fmt.Errorf(" Account %s already exists\nUse `append` flag to append account at existing address", accAddr) } - genesisB := banktypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) + genesisB := banktypes.GetGenesisStateFromAppState(cdc, appState) for idx, acc := range genesisB.Balances { if acc.Address != accAddr.String() { continue @@ -100,7 +97,7 @@ func AddGenesisAccount(config *tmcfg.Config, clientCtx client.Context, accAddr s } authGenState.Accounts = genAccs - authGenStateBz, err := clientCtx.Codec.MarshalJSON(&authGenState) + authGenStateBz, err := cdc.MarshalJSON(&authGenState) if err != nil { return fmt.Errorf("failed to marshal auth genesis state: %w", err) } @@ -113,7 +110,7 @@ func AddGenesisAccount(config *tmcfg.Config, clientCtx client.Context, accAddr s bankGenState.Supply = bankGenState.Supply.Add(balances.Coins...) - bankGenStateBz, err := clientCtx.Codec.MarshalJSON(bankGenState) + bankGenStateBz, err := cdc.MarshalJSON(bankGenState) if err != nil { return fmt.Errorf("failed to marshal bank genesis state: %w", err) } @@ -125,5 +122,5 @@ func AddGenesisAccount(config *tmcfg.Config, clientCtx client.Context, accAddr s } genDoc.AppState = appStateJSON - return genutil.ExportGenesisFile(genDoc, genFile) + return genutil.ExportGenesisFile(genDoc, genesisFileUrl) } From 1de8641a44cd8c3ff004f5a02b2d2a3390d27d67 Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Tue, 20 Sep 2022 12:42:45 +0530 Subject: [PATCH 10/16] add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94b5d614193a..ee0720778c25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features +* [#13298](https://github.com/cosmos/cosmos-sdk/pull/13298) Add `AddGenesisAccount` helper func in x/auth module which helps adding accounts to genesis state. * (cli) [#13304](https://github.com/cosmos/cosmos-sdk/pull/13304) Add `tx gov draft-proposal` command for generating proposal JSONs. * (cli) [#13207](https://github.com/cosmos/cosmos-sdk/pull/13207) Reduce user's password prompts when calling keyring `List()` function * (x/authz) [#12648](https://github.com/cosmos/cosmos-sdk/pull/12648) Add an allow list, an optional list of addresses allowed to receive bank assets via authz MsgSend grant. From abfc581dc0a69c11619765c7b91d32b60ef9596d Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Tue, 20 Sep 2022 14:11:23 +0530 Subject: [PATCH 11/16] wip: nit --- simapp/simd/cmd/genaccounts.go | 2 +- x/auth/helpers/add_genesis_account_helper.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/simapp/simd/cmd/genaccounts.go b/simapp/simd/cmd/genaccounts.go index 0bcaa0445702..c24f237c1004 100644 --- a/simapp/simd/cmd/genaccounts.go +++ b/simapp/simd/cmd/genaccounts.go @@ -79,7 +79,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa genesisFileUrl = filepath.Join(config.RootDir, config.Genesis) } - return auth.AddGenesisAccount(genesisFileUrl, clientCtx.Codec, addr, args[1], appendflag, vestingStart, vestingEnd, vestingAmtStr) + return auth.AddGenesisAccount(clientCtx.Codec, genesisFileUrl, addr, args[1], appendflag, vestingStart, vestingEnd, vestingAmtStr) }, } diff --git a/x/auth/helpers/add_genesis_account_helper.go b/x/auth/helpers/add_genesis_account_helper.go index 3a6ccbe8a857..247f6825c114 100644 --- a/x/auth/helpers/add_genesis_account_helper.go +++ b/x/auth/helpers/add_genesis_account_helper.go @@ -15,7 +15,7 @@ import ( ) // AddGenesisAccount adds a genesis account to the genesis state. -func AddGenesisAccount(genesisFileUrl string, cdc codec.Codec, accAddr sdk.AccAddress, amountStr string, appendAcct bool, vestingStart, vestingEnd int64, vestingAmtStr string) error { +func AddGenesisAccount(cdc codec.Codec, genesisFileUrl string, accAddr sdk.AccAddress, amountStr string, appendAcct bool, vestingStart, vestingEnd int64, vestingAmtStr string) error { coins, err := sdk.ParseCoinsNormalized(amountStr) if err != nil { return fmt.Errorf("failed to parse coins: %w", err) From fcd4461089962d7f36019d3b4dc62acb8f0c6406 Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Wed, 21 Sep 2022 10:45:52 +0530 Subject: [PATCH 12/16] wip: apply suggestions --- .../helpers/{add_genesis_account_helper.go => genaccounts.go} | 4 ++++ 1 file changed, 4 insertions(+) rename x/auth/helpers/{add_genesis_account_helper.go => genaccounts.go} (90%) diff --git a/x/auth/helpers/add_genesis_account_helper.go b/x/auth/helpers/genaccounts.go similarity index 90% rename from x/auth/helpers/add_genesis_account_helper.go rename to x/auth/helpers/genaccounts.go index 247f6825c114..4358f95a40a1 100644 --- a/x/auth/helpers/add_genesis_account_helper.go +++ b/x/auth/helpers/genaccounts.go @@ -15,6 +15,10 @@ import ( ) // AddGenesisAccount adds a genesis account to the genesis state. +// Where `cdc` is client codec, `genesisFileUrl` is the path/url of current genesis file, `accAddr` is the address to be added to the genesis state, `amountStr` is the list of initial coins +// to be added for the account, `appendAcct` updates the account if already exists. `vestingStart, vestingEnd and vestingAmtStr` respectively are the schedule start time, end time (unix epoch) +// and coins to be appended to the account already in the genesis.json file. + func AddGenesisAccount(cdc codec.Codec, genesisFileUrl string, accAddr sdk.AccAddress, amountStr string, appendAcct bool, vestingStart, vestingEnd int64, vestingAmtStr string) error { coins, err := sdk.ParseCoinsNormalized(amountStr) if err != nil { From d86e4d02127e186f928d4dfcb600d8edc482b99f Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Wed, 21 Sep 2022 19:18:31 +0530 Subject: [PATCH 13/16] address review comments --- simapp/simd/cmd/genaccounts.go | 10 +--------- x/auth/helpers/genaccounts.go | 10 ++++++---- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/simapp/simd/cmd/genaccounts.go b/simapp/simd/cmd/genaccounts.go index c24f237c1004..d04f36d62d20 100644 --- a/simapp/simd/cmd/genaccounts.go +++ b/simapp/simd/cmd/genaccounts.go @@ -3,7 +3,6 @@ package cmd import ( "bufio" "fmt" - "path/filepath" "github.com/spf13/cobra" @@ -34,7 +33,6 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa `, Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { - var genesisFileUrl string clientCtx := client.GetClientContextFromCmd(cmd) serverCtx := server.GetServerContextFromCmd(cmd) config := serverCtx.Config @@ -73,13 +71,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa vestingEnd, _ := cmd.Flags().GetInt64(flagVestingEnd) vestingAmtStr, _ := cmd.Flags().GetString(flagVestingAmt) - if filepath.IsAbs(config.Genesis) { - genesisFileUrl = config.Genesis - } else { - genesisFileUrl = filepath.Join(config.RootDir, config.Genesis) - } - - return auth.AddGenesisAccount(clientCtx.Codec, genesisFileUrl, addr, args[1], appendflag, vestingStart, vestingEnd, vestingAmtStr) + return auth.AddGenesisAccount(clientCtx.Codec, addr, appendflag, config.GenesisFile(), args[1], vestingAmtStr, vestingStart, vestingEnd) }, } diff --git a/x/auth/helpers/genaccounts.go b/x/auth/helpers/genaccounts.go index 4358f95a40a1..e110aa34b8ce 100644 --- a/x/auth/helpers/genaccounts.go +++ b/x/auth/helpers/genaccounts.go @@ -15,11 +15,13 @@ import ( ) // AddGenesisAccount adds a genesis account to the genesis state. -// Where `cdc` is client codec, `genesisFileUrl` is the path/url of current genesis file, `accAddr` is the address to be added to the genesis state, `amountStr` is the list of initial coins -// to be added for the account, `appendAcct` updates the account if already exists. `vestingStart, vestingEnd and vestingAmtStr` respectively are the schedule start time, end time (unix epoch) +// Where `cdc` is client codec, `genesisFileUrl` is the path/url of current genesis file, +// `accAddr` is the address to be added to the genesis state, `amountStr` is the list of initial coins +// to be added for the account, `appendAcct` updates the account if already exists. +// `vestingStart, vestingEnd and vestingAmtStr` respectively are the schedule start time, end time (unix epoch) // and coins to be appended to the account already in the genesis.json file. - -func AddGenesisAccount(cdc codec.Codec, genesisFileUrl string, accAddr sdk.AccAddress, amountStr string, appendAcct bool, vestingStart, vestingEnd int64, vestingAmtStr string) error { +func AddGenesisAccount(cdc codec.Codec, accAddr sdk.AccAddress, appendAcct bool, + genesisFileUrl, amountStr, vestingAmtStr string, vestingStart, vestingEnd int64) error { coins, err := sdk.ParseCoinsNormalized(amountStr) if err != nil { return fmt.Errorf("failed to parse coins: %w", err) From 8d5937a9fa212a5e5979cdac05c71654ca8cd8f4 Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Wed, 21 Sep 2022 19:39:21 +0530 Subject: [PATCH 14/16] fix lint issue --- x/auth/helpers/genaccounts.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x/auth/helpers/genaccounts.go b/x/auth/helpers/genaccounts.go index e110aa34b8ce..5f305979eb66 100644 --- a/x/auth/helpers/genaccounts.go +++ b/x/auth/helpers/genaccounts.go @@ -21,7 +21,8 @@ import ( // `vestingStart, vestingEnd and vestingAmtStr` respectively are the schedule start time, end time (unix epoch) // and coins to be appended to the account already in the genesis.json file. func AddGenesisAccount(cdc codec.Codec, accAddr sdk.AccAddress, appendAcct bool, - genesisFileUrl, amountStr, vestingAmtStr string, vestingStart, vestingEnd int64) error { + genesisFileUrl, amountStr, vestingAmtStr string, vestingStart, vestingEnd int64, +) error { coins, err := sdk.ParseCoinsNormalized(amountStr) if err != nil { return fmt.Errorf("failed to parse coins: %w", err) From ca886bf29852496f2d39118533189dc6fbd5682c Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Wed, 21 Sep 2022 19:53:49 +0530 Subject: [PATCH 15/16] fix nit --- x/auth/helpers/genaccounts.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/x/auth/helpers/genaccounts.go b/x/auth/helpers/genaccounts.go index 5f305979eb66..00ee73c18e52 100644 --- a/x/auth/helpers/genaccounts.go +++ b/x/auth/helpers/genaccounts.go @@ -20,8 +20,12 @@ import ( // to be added for the account, `appendAcct` updates the account if already exists. // `vestingStart, vestingEnd and vestingAmtStr` respectively are the schedule start time, end time (unix epoch) // and coins to be appended to the account already in the genesis.json file. -func AddGenesisAccount(cdc codec.Codec, accAddr sdk.AccAddress, appendAcct bool, - genesisFileUrl, amountStr, vestingAmtStr string, vestingStart, vestingEnd int64, +func AddGenesisAccount( + cdc codec.Codec, + accAddr sdk.AccAddress, + appendAcct bool, + genesisFileUrl, amountStr, vestingAmtStr string, + vestingStart, vestingEnd int64, ) error { coins, err := sdk.ParseCoinsNormalized(amountStr) if err != nil { From 62d8a425787e2638d9b2a5e431b0ba45f9c09f22 Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Thu, 22 Sep 2022 15:28:24 +0530 Subject: [PATCH 16/16] fix changelog --- CHANGELOG.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16efc583c36e..8b1a2aa9d887 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,13 +39,9 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features -<<<<<<< HEAD * [#13298](https://github.com/cosmos/cosmos-sdk/pull/13298) Add `AddGenesisAccount` helper func in x/auth module which helps adding accounts to genesis state. -* (cli) [#13304](https://github.com/cosmos/cosmos-sdk/pull/13304) Add `tx gov draft-proposal` command for generating proposal JSONs. -======= * (cli) [#13353](https://github.com/cosmos/cosmos-sdk/pull/13353) Add `tx group draft-proposal` command for generating group proposal JSONs (skeleton). * (cli) [#13304](https://github.com/cosmos/cosmos-sdk/pull/13304) Add `tx gov draft-proposal` command for generating proposal JSONs (skeleton). ->>>>>>> c297caa6973adbf3ec067c6232e270c9b4b99f5c * (cli) [#13207](https://github.com/cosmos/cosmos-sdk/pull/13207) Reduce user's password prompts when calling keyring `List()` function * (x/authz) [#12648](https://github.com/cosmos/cosmos-sdk/pull/12648) Add an allow list, an optional list of addresses allowed to receive bank assets via authz MsgSend grant. * (sdk.Coins) [#12627](https://github.com/cosmos/cosmos-sdk/pull/12627) Make a Denoms method on sdk.Coins.