[#932] adm: Move const to package constants

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
Anton Nikiforov 2024-02-02 15:26:57 +03:00
parent 814c411f4a
commit e2cee4cf09
29 changed files with 140 additions and 114 deletions

View file

@ -8,6 +8,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags"
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/config"
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/constants"
morphUtil "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
@ -34,7 +35,7 @@ func AlphabetCreds(cmd *cobra.Command, _ []string) error {
if size == 0 {
return errors.New("size must be > 0")
}
if size > morphUtil.MaxAlphabetNodes {
if size > constants.MaxAlphabetNodes {
return morphUtil.ErrTooManyAlphabetNodes
}
@ -82,7 +83,7 @@ func initializeWallets(v *viper.Viper, walletDir string, size int) ([]string, er
if err != nil {
return nil, fmt.Errorf("can't create wallet: %w", err)
}
if err := w.CreateAccount(morphUtil.SingleAccountName, password); err != nil {
if err := w.CreateAccount(constants.SingleAccountName, password); err != nil {
return nil, fmt.Errorf("can't create account: %w", err)
}
@ -101,10 +102,10 @@ func initializeWallets(v *viper.Viper, walletDir string, size int) ([]string, er
i := i
ps := pubs.Copy()
errG.Go(func() error {
if err := addMultisigAccount(wallets[i], majCount, morphUtil.CommitteeAccountName, passwords[i], ps); err != nil {
if err := addMultisigAccount(wallets[i], majCount, constants.CommitteeAccountName, passwords[i], ps); err != nil {
return fmt.Errorf("can't create committee account: %w", err)
}
if err := addMultisigAccount(wallets[i], bftCount, morphUtil.ConsensusAccountName, passwords[i], ps); err != nil {
if err := addMultisigAccount(wallets[i], bftCount, constants.ConsensusAccountName, passwords[i], ps); err != nil {
return fmt.Errorf("can't create consentus account: %w", err)
}
if err := wallets[i].SavePretty(); err != nil {
@ -177,7 +178,7 @@ func refillGas(cmd *cobra.Command, gasFlag string, createWallet bool) (err error
}
if label == "" {
label = morphUtil.SingleAccountName
label = constants.SingleAccountName
}
if err := w.CreateAccount(label, password); err != nil {