From 802192cfef65640f5de193270384d58a6ec1117d Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Fri, 2 Feb 2024 15:36:14 +0300 Subject: [PATCH] [#932] adm: Rename `util` to `helper` To avoid conflicts with `util` packages in other imports. Signed-off-by: Anton Nikiforov --- .../internal/modules/morph/ape/ape_util.go | 12 +++++----- .../internal/modules/morph/balance/balance.go | 18 +++++++------- .../internal/modules/morph/config/config.go | 14 +++++------ .../modules/morph/container/container.go | 18 +++++++------- .../internal/modules/morph/contract/deploy.go | 10 ++++---- .../modules/morph/contract/dump_hashes.go | 20 ++++++++-------- .../internal/modules/morph/contract/update.go | 24 +++++++++---------- .../modules/morph/frostfsid/frostfsid.go | 8 +++---- .../morph/frostfsid/frostfsid_util_test.go | 8 +++---- .../modules/morph/generate/generate.go | 10 ++++---- .../morph/{util => helper}/contract.go | 2 +- .../morph/{util => helper}/download.go | 2 +- .../morph/{util => helper}/frostfsid.go | 2 +- .../modules/morph/{util => helper}/group.go | 2 +- .../morph/{util => helper}/initialize.go | 2 +- .../morph/{util => helper}/initialize_ctx.go | 2 +- .../morph/{util => helper}/local_client.go | 2 +- .../morph/{util => helper}/n3client.go | 2 +- .../modules/morph/{util => helper}/netmap.go | 2 +- .../modules/morph/{util => helper}/util.go | 2 +- .../modules/morph/{util => helper}/wallet.go | 2 +- .../modules/morph/initialize/initialize.go | 6 ++--- .../morph/initialize/initialize_deploy.go | 16 ++++++------- .../morph/initialize/initialize_nns.go | 10 ++++---- .../morph/initialize/initialize_register.go | 14 +++++------ .../morph/initialize/initialize_roles.go | 8 +++---- .../morph/initialize/initialize_test.go | 16 ++++++------- .../morph/initialize/initialize_transfer.go | 10 ++++---- .../internal/modules/morph/netmap/epoch.go | 8 +++---- .../modules/morph/netmap/netmap_candidates.go | 6 ++--- .../internal/modules/morph/node/remove.go | 8 +++---- .../internal/modules/morph/notary/notary.go | 10 ++++---- .../internal/modules/morph/policy/policy.go | 6 ++--- .../internal/modules/morph/proxy/proxy.go | 6 ++--- 34 files changed, 144 insertions(+), 144 deletions(-) rename cmd/frostfs-adm/internal/modules/morph/{util => helper}/contract.go (99%) rename cmd/frostfs-adm/internal/modules/morph/{util => helper}/download.go (99%) rename cmd/frostfs-adm/internal/modules/morph/{util => helper}/frostfsid.go (98%) rename cmd/frostfs-adm/internal/modules/morph/{util => helper}/group.go (98%) rename cmd/frostfs-adm/internal/modules/morph/{util => helper}/initialize.go (99%) rename cmd/frostfs-adm/internal/modules/morph/{util => helper}/initialize_ctx.go (99%) rename cmd/frostfs-adm/internal/modules/morph/{util => helper}/local_client.go (99%) rename cmd/frostfs-adm/internal/modules/morph/{util => helper}/n3client.go (99%) rename cmd/frostfs-adm/internal/modules/morph/{util => helper}/netmap.go (99%) rename cmd/frostfs-adm/internal/modules/morph/{util => helper}/util.go (99%) rename cmd/frostfs-adm/internal/modules/morph/{util => helper}/wallet.go (99%) diff --git a/cmd/frostfs-adm/internal/modules/morph/ape/ape_util.go b/cmd/frostfs-adm/internal/modules/morph/ape/ape_util.go index 13392b1ce..bbbdf7805 100644 --- a/cmd/frostfs-adm/internal/modules/morph/ape/ape_util.go +++ b/cmd/frostfs-adm/internal/modules/morph/ape/ape_util.go @@ -8,7 +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/cmd/frostfs-adm/internal/modules/morph/helper" parseutil "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/modules/util" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" apechain "git.frostfs.info/TrueCloudLab/policy-engine/pkg/chain" @@ -80,17 +80,17 @@ func parseChain(cmd *cobra.Command) *apechain.Chain { func newPolicyContractInterface(cmd *cobra.Command) (*morph.ContractStorage, *actor.Actor) { v := viper.GetViper() - c, err := morphUtil.GetN3Client(v) + c, err := helper.GetN3Client(v) commonCmd.ExitOnErr(cmd, "unable to create NEO rpc client: %w", err) walletDir := config.ResolveHomePath(viper.GetString(commonflags.AlphabetWalletsFlag)) - wallets, err := morphUtil.GetAlphabetWallets(v, walletDir) + wallets, err := helper.GetAlphabetWallets(v, walletDir) commonCmd.ExitOnErr(cmd, "unable to get alphabet wallets: %w", err) - committeeAcc, err := morphUtil.GetWalletAccount(wallets[0], constants.CommitteeAccountName) + committeeAcc, err := helper.GetWalletAccount(wallets[0], constants.CommitteeAccountName) commonCmd.ExitOnErr(cmd, "can't find committee account: %w", err) - ac, err := morphUtil.NewActor(c, committeeAcc) + ac, err := helper.NewActor(c, committeeAcc) commonCmd.ExitOnErr(cmd, "can't create actor: %w", err) inv := &ac.Invoker @@ -99,7 +99,7 @@ func newPolicyContractInterface(cmd *cobra.Command) (*morph.ContractStorage, *ac nnsCs, err := r.GetContractByID(1) commonCmd.ExitOnErr(cmd, "can't get NNS contract state: %w", err) - ch, err = morphUtil.NNSResolveHash(inv, nnsCs.Hash, morphUtil.DomainOf(constants.PolicyContract)) + ch, err = helper.NNSResolveHash(inv, nnsCs.Hash, helper.DomainOf(constants.PolicyContract)) commonCmd.ExitOnErr(cmd, "unable to resolve policy contract hash: %w", err) return morph.NewContractStorage(ac, ch), ac diff --git a/cmd/frostfs-adm/internal/modules/morph/balance/balance.go b/cmd/frostfs-adm/internal/modules/morph/balance/balance.go index 019c62346..428fb98b9 100644 --- a/cmd/frostfs-adm/internal/modules/morph/balance/balance.go +++ b/cmd/frostfs-adm/internal/modules/morph/balance/balance.go @@ -8,7 +8,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-contract/nns" "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/cmd/frostfs-adm/internal/modules/morph/helper" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" "github.com/nspcc-dev/neo-go/pkg/core/native/noderoles" "github.com/nspcc-dev/neo-go/pkg/core/state" @@ -51,7 +51,7 @@ func dumpBalances(cmd *cobra.Command, _ []string) error { nmHash util.Uint160 ) - c, err := morphUtil.GetN3Client(viper.GetViper()) + c, err := helper.GetN3Client(viper.GetViper()) if err != nil { return err } @@ -65,7 +65,7 @@ func dumpBalances(cmd *cobra.Command, _ []string) error { return fmt.Errorf("can't get NNS contract info: %w", err) } - nmHash, err = morphUtil.NNSResolveHash(inv, nnsCs.Hash, morphUtil.DomainOf(constants.NetmapContract)) + nmHash, err = helper.NNSResolveHash(inv, nnsCs.Hash, helper.DomainOf(constants.NetmapContract)) if err != nil { return fmt.Errorf("can't get netmap contract hash: %w", err) } @@ -138,7 +138,7 @@ func printStorageNodeBalances(cmd *cobra.Command, inv *invoker.Invoker, nmHash u } func printProxyContractBalance(cmd *cobra.Command, inv *invoker.Invoker, nnsHash util.Uint160) error { - h, err := morphUtil.NNSResolveHash(inv, nnsHash, morphUtil.DomainOf(constants.ProxyContract)) + h, err := helper.NNSResolveHash(inv, nnsHash, helper.DomainOf(constants.ProxyContract)) if err != nil { return fmt.Errorf("can't get hash of the proxy contract: %w", err) } @@ -152,13 +152,13 @@ func printProxyContractBalance(cmd *cobra.Command, inv *invoker.Invoker, nnsHash return nil } -func printAlphabetContractBalances(cmd *cobra.Command, c morphUtil.Client, inv *invoker.Invoker, count int, nnsHash util.Uint160) error { +func printAlphabetContractBalances(cmd *cobra.Command, c helper.Client, inv *invoker.Invoker, count int, nnsHash util.Uint160) error { alphaList := make([]accBalancePair, count) w := io.NewBufBinWriter() for i := range alphaList { emit.AppCall(w.BinWriter, nnsHash, "resolve", callflag.ReadOnly, - morphUtil.GetAlphabetNNSDomain(i), + helper.GetAlphabetNNSDomain(i), int64(nns.TXT)) } if w.Err != nil { @@ -171,7 +171,7 @@ func printAlphabetContractBalances(cmd *cobra.Command, c morphUtil.Client, inv * } for i := range alphaList { - h, err := morphUtil.ParseNNSResolveResult(alphaRes.Stack[i]) + h, err := helper.ParseNNSResolveResult(alphaRes.Stack[i]) if err != nil { return fmt.Errorf("can't fetch the alphabet contract #%d hash: %w", i, err) } @@ -186,7 +186,7 @@ func printAlphabetContractBalances(cmd *cobra.Command, c morphUtil.Client, inv * return nil } -func fetchIRNodes(c morphUtil.Client, desigHash util.Uint160) ([]accBalancePair, error) { +func fetchIRNodes(c helper.Client, desigHash util.Uint160) ([]accBalancePair, error) { inv := invoker.New(c, nil) height, err := c.GetBlockCount() @@ -194,7 +194,7 @@ func fetchIRNodes(c morphUtil.Client, desigHash util.Uint160) ([]accBalancePair, return nil, fmt.Errorf("can't get block height: %w", err) } - arr, err := morphUtil.GetDesignatedByRole(inv, desigHash, noderoles.NeoFSAlphabet, height) + arr, err := helper.GetDesignatedByRole(inv, desigHash, noderoles.NeoFSAlphabet, height) if err != nil { return nil, errors.New("can't fetch list of IR nodes from the netmap contract") } diff --git a/cmd/frostfs-adm/internal/modules/morph/config/config.go b/cmd/frostfs-adm/internal/modules/morph/config/config.go index f1845c9ce..3414a8f7f 100644 --- a/cmd/frostfs-adm/internal/modules/morph/config/config.go +++ b/cmd/frostfs-adm/internal/modules/morph/config/config.go @@ -11,7 +11,7 @@ import ( "text/tabwriter" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/constants" - "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util" + "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/netmap" "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/rpcclient/invoker" @@ -26,7 +26,7 @@ import ( const forceConfigSet = "force" func dumpNetworkConfig(cmd *cobra.Command, _ []string) error { - c, err := util.GetN3Client(viper.GetViper()) + c, err := helper.GetN3Client(viper.GetViper()) if err != nil { return fmt.Errorf("can't create N3 client: %w", err) } @@ -39,7 +39,7 @@ func dumpNetworkConfig(cmd *cobra.Command, _ []string) error { return fmt.Errorf("can't get NNS contract info: %w", err) } - nmHash, err := util.NNSResolveHash(inv, cs.Hash, util.DomainOf(constants.NetmapContract)) + nmHash, err := helper.NNSResolveHash(inv, cs.Hash, helper.DomainOf(constants.NetmapContract)) if err != nil { return fmt.Errorf("can't get netmap contract hash: %w", err) } @@ -52,7 +52,7 @@ func dumpNetworkConfig(cmd *cobra.Command, _ []string) error { buf := bytes.NewBuffer(nil) tw := tabwriter.NewWriter(buf, 0, 2, 2, ' ', 0) - m, err := util.ParseConfigFromNetmapContract(arr) + m, err := helper.ParseConfigFromNetmapContract(arr) if err != nil { return err } @@ -67,7 +67,7 @@ func dumpNetworkConfig(cmd *cobra.Command, _ []string) error { _, _ = tw.Write([]byte(fmt.Sprintf("%s:\t%d (int)\n", k, n))) case netmap.HomomorphicHashingDisabledKey, netmap.MaintenanceModeAllowedConfig: if len(v) == 0 || len(v) > 1 { - return util.InvalidConfigValueErr(k) + return helper.InvalidConfigValueErr(k) } _, _ = tw.Write([]byte(fmt.Sprintf("%s:\t%t (bool)\n", k, v[0] == 1))) default: @@ -86,7 +86,7 @@ func SetConfigCmd(cmd *cobra.Command, args []string) error { return errors.New("empty config pairs") } - wCtx, err := util.NewInitializeContext(cmd, viper.GetViper()) + wCtx, err := helper.NewInitializeContext(cmd, viper.GetViper()) if err != nil { return fmt.Errorf("can't initialize context: %w", err) } @@ -97,7 +97,7 @@ func SetConfigCmd(cmd *cobra.Command, args []string) error { return fmt.Errorf("can't get NNS contract info: %w", err) } - nmHash, err := util.NNSResolveHash(wCtx.ReadOnlyInvoker, cs.Hash, util.DomainOf(constants.NetmapContract)) + nmHash, err := helper.NNSResolveHash(wCtx.ReadOnlyInvoker, cs.Hash, helper.DomainOf(constants.NetmapContract)) if err != nil { return fmt.Errorf("can't get netmap contract hash: %w", err) } diff --git a/cmd/frostfs-adm/internal/modules/morph/container/container.go b/cmd/frostfs-adm/internal/modules/morph/container/container.go index 6ba6a3168..690db2f4f 100644 --- a/cmd/frostfs-adm/internal/modules/morph/container/container.go +++ b/cmd/frostfs-adm/internal/modules/morph/container/container.go @@ -8,7 +8,7 @@ import ( "sort" "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/cmd/frostfs-adm/internal/modules/morph/helper" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" "github.com/nspcc-dev/neo-go/pkg/crypto/hash" "github.com/nspcc-dev/neo-go/pkg/io" @@ -37,7 +37,7 @@ func getContainerContractHash(cmd *cobra.Command, inv *invoker.Invoker) (util.Ui if err != nil { return util.Uint160{}, fmt.Errorf("can't get NNS contract state: %w", err) } - ch, err = morphUtil.NNSResolveHash(inv, nnsCs.Hash, morphUtil.DomainOf(constants.ContainerContract)) + ch, err = helper.NNSResolveHash(inv, nnsCs.Hash, helper.DomainOf(constants.ContainerContract)) if err != nil { return util.Uint160{}, err } @@ -75,7 +75,7 @@ func dumpContainers(cmd *cobra.Command, _ []string) error { return fmt.Errorf("invalid filename: %w", err) } - c, err := morphUtil.GetN3Client(viper.GetViper()) + c, err := helper.GetN3Client(viper.GetViper()) if err != nil { return fmt.Errorf("can't create N3 client: %w", err) } @@ -165,7 +165,7 @@ func dumpSingleContainer(bw *io.BufBinWriter, ch util.Uint160, inv *invoker.Invo } func listContainers(cmd *cobra.Command, _ []string) error { - c, err := morphUtil.GetN3Client(viper.GetViper()) + c, err := helper.GetN3Client(viper.GetViper()) if err != nil { return fmt.Errorf("can't create N3 client: %w", err) } @@ -194,7 +194,7 @@ func restoreContainers(cmd *cobra.Command, _ []string) error { return fmt.Errorf("invalid filename: %w", err) } - wCtx, err := morphUtil.NewInitializeContext(cmd, viper.GetViper()) + wCtx, err := helper.NewInitializeContext(cmd, viper.GetViper()) if err != nil { return err } @@ -223,7 +223,7 @@ func restoreContainers(cmd *cobra.Command, _ []string) error { return wCtx.AwaitTx() } -func restoreOrPutContainers(containers []Container, isOK func([]byte) bool, cmd *cobra.Command, wCtx *morphUtil.InitializeContext, ch util.Uint160) error { +func restoreOrPutContainers(containers []Container, isOK func([]byte) bool, cmd *cobra.Command, wCtx *helper.InitializeContext, ch util.Uint160) error { bw := io.NewBufBinWriter() for _, cnt := range containers { hv := hash.Sha256(cnt.Value) @@ -263,7 +263,7 @@ func putContainer(bw *io.BufBinWriter, ch util.Uint160, cnt Container) { } } -func isContainerRestored(cmd *cobra.Command, wCtx *morphUtil.InitializeContext, containerHash util.Uint160, bw *io.BufBinWriter, hashValue util.Uint256) (bool, error) { +func isContainerRestored(cmd *cobra.Command, wCtx *helper.InitializeContext, containerHash util.Uint160, bw *io.BufBinWriter, hashValue util.Uint256) (bool, error) { emit.AppCall(bw.BinWriter, containerHash, "get", callflag.All, hashValue.BytesBE()) res, err := wCtx.Client.InvokeScript(bw.Bytes(), nil) if err != nil { @@ -301,14 +301,14 @@ func parseContainers(filename string) ([]Container, error) { return containers, nil } -func fetchContainerContractHash(wCtx *morphUtil.InitializeContext) (util.Uint160, error) { +func fetchContainerContractHash(wCtx *helper.InitializeContext) (util.Uint160, error) { r := management.NewReader(wCtx.ReadOnlyInvoker) nnsCs, err := r.GetContractByID(1) if err != nil { return util.Uint160{}, fmt.Errorf("can't get NNS contract state: %w", err) } - ch, err := morphUtil.NNSResolveHash(wCtx.ReadOnlyInvoker, nnsCs.Hash, morphUtil.DomainOf(constants.ContainerContract)) + ch, err := helper.NNSResolveHash(wCtx.ReadOnlyInvoker, nnsCs.Hash, helper.DomainOf(constants.ContainerContract)) if err != nil { return util.Uint160{}, fmt.Errorf("can't fetch container contract hash: %w", err) } diff --git a/cmd/frostfs-adm/internal/modules/morph/contract/deploy.go b/cmd/frostfs-adm/internal/modules/morph/contract/deploy.go index e7c4255b5..9a92e8f19 100644 --- a/cmd/frostfs-adm/internal/modules/morph/contract/deploy.go +++ b/cmd/frostfs-adm/internal/modules/morph/contract/deploy.go @@ -9,7 +9,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-contract/nns" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/constants" - "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util" + "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper" "github.com/nspcc-dev/neo-go/cli/cmdargs" "github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/encoding/address" @@ -61,7 +61,7 @@ func init() { func deployContractCmd(cmd *cobra.Command, args []string) error { v := viper.GetViper() - c, err := util.NewInitializeContext(cmd, v) + c, err := helper.NewInitializeContext(cmd, v) if err != nil { return fmt.Errorf("initialization error: %w", err) } @@ -73,7 +73,7 @@ func deployContractCmd(cmd *cobra.Command, args []string) error { return err } - cs, err := util.ReadContract(ctrPath, ctrName) + cs, err := helper.ReadContract(ctrPath, ctrName) if err != nil { return err } @@ -90,7 +90,7 @@ func deployContractCmd(cmd *cobra.Command, args []string) error { domain := ctrName + "." + zone isUpdate, _ := cmd.Flags().GetBool(updateFlag) if isUpdate { - cs.Hash, err = util.NNSResolveHash(c.ReadOnlyInvoker, nnsCs.Hash, domain) + cs.Hash, err = helper.NNSResolveHash(c.ReadOnlyInvoker, nnsCs.Hash, domain) if err != nil { return fmt.Errorf("can't fetch contract hash from NNS: %w", err) } @@ -130,7 +130,7 @@ func deployContractCmd(cmd *cobra.Command, args []string) error { return c.AwaitTx() } -func registerNNS(nnsCs *state.Contract, c *util.InitializeContext, zone string, domain string, cs *util.ContractState, writer *io.BufBinWriter) error { +func registerNNS(nnsCs *state.Contract, c *helper.InitializeContext, zone string, domain string, cs *helper.ContractState, writer *io.BufBinWriter) error { bw := io.NewBufBinWriter() emit.Instruction(bw.BinWriter, opcode.INITSSLOT, []byte{1}) emit.AppCall(bw.BinWriter, nnsCs.Hash, "getPrice", callflag.All) diff --git a/cmd/frostfs-adm/internal/modules/morph/contract/dump_hashes.go b/cmd/frostfs-adm/internal/modules/morph/contract/dump_hashes.go index ae7264405..6e406be56 100644 --- a/cmd/frostfs-adm/internal/modules/morph/contract/dump_hashes.go +++ b/cmd/frostfs-adm/internal/modules/morph/contract/dump_hashes.go @@ -10,7 +10,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-contract/nns" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags" "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/cmd/frostfs-adm/internal/modules/morph/helper" morphClient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client" "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/rpcclient/invoker" @@ -36,7 +36,7 @@ type contractDumpInfo struct { } func dumpContractHashes(cmd *cobra.Command, _ []string) error { - c, err := morphUtil.GetN3Client(viper.GetViper()) + c, err := helper.GetN3Client(viper.GetViper()) if err != nil { return fmt.Errorf("can't create N3 client: %w", err) } @@ -56,7 +56,7 @@ func dumpContractHashes(cmd *cobra.Command, _ []string) error { irSize := 0 for ; irSize < lastGlagoliticLetter; irSize++ { - ok, err := morphUtil.NNSIsAvailable(c, cs.Hash, morphUtil.GetAlphabetNNSDomain(irSize)) + ok, err := helper.NNSIsAvailable(c, cs.Hash, helper.GetAlphabetNNSDomain(irSize)) if err != nil { return err } else if ok { @@ -70,7 +70,7 @@ func dumpContractHashes(cmd *cobra.Command, _ []string) error { bw.Reset() for i := 0; i < irSize; i++ { emit.AppCall(bw.BinWriter, cs.Hash, "resolve", callflag.ReadOnly, - morphUtil.GetAlphabetNNSDomain(i), + helper.GetAlphabetNNSDomain(i), int64(nns.TXT)) } @@ -81,7 +81,7 @@ func dumpContractHashes(cmd *cobra.Command, _ []string) error { for i := 0; i < irSize; i++ { info := contractDumpInfo{name: fmt.Sprintf("alphabet %d", i)} - if h, err := morphUtil.ParseNNSResolveResult(alphaRes.Stack[i]); err == nil { + if h, err := helper.ParseNNSResolveResult(alphaRes.Stack[i]); err == nil { info.hash = h } infos = append(infos, info) @@ -91,7 +91,7 @@ func dumpContractHashes(cmd *cobra.Command, _ []string) error { for _, ctrName := range constants.ContractList { bw.Reset() emit.AppCall(bw.BinWriter, cs.Hash, "resolve", callflag.ReadOnly, - morphUtil.DomainOf(ctrName), int64(nns.TXT)) + helper.DomainOf(ctrName), int64(nns.TXT)) res, err := c.InvokeScript(bw.Bytes(), nil) if err != nil { @@ -100,7 +100,7 @@ func dumpContractHashes(cmd *cobra.Command, _ []string) error { info := contractDumpInfo{name: ctrName} if len(res.Stack) != 0 { - if h, err := morphUtil.ParseNNSResolveResult(res.Stack[0]); err == nil { + if h, err := helper.ParseNNSResolveResult(res.Stack[0]); err == nil { info.hash = h } } @@ -113,7 +113,7 @@ func dumpContractHashes(cmd *cobra.Command, _ []string) error { return nil } -func dumpCustomZoneHashes(cmd *cobra.Command, nnsHash util.Uint160, zone string, c morphUtil.Client) error { +func dumpCustomZoneHashes(cmd *cobra.Command, nnsHash util.Uint160, zone string, c helper.Client) error { const nnsMaxTokens = 100 inv := invoker.New(c, nil) @@ -135,7 +135,7 @@ func dumpCustomZoneHashes(cmd *cobra.Command, nnsHash util.Uint160, zone string, return } - h, err := morphUtil.NNSResolveHash(inv, nnsHash, string(bs)) + h, err := helper.NNSResolveHash(inv, nnsHash, string(bs)) if err != nil { cmd.PrintErrf("Could not resolve name %s: %v\n", string(bs), err) return @@ -227,7 +227,7 @@ func printContractInfo(cmd *cobra.Command, infos []contractDumpInfo) { cmd.Print(buf.String()) } -func fillContractVersion(cmd *cobra.Command, c morphUtil.Client, infos []contractDumpInfo) { +func fillContractVersion(cmd *cobra.Command, c helper.Client, infos []contractDumpInfo) { bw := io.NewBufBinWriter() sub := io.NewBufBinWriter() for i := range infos { diff --git a/cmd/frostfs-adm/internal/modules/morph/contract/update.go b/cmd/frostfs-adm/internal/modules/morph/contract/update.go index 33e49fad8..109849aab 100644 --- a/cmd/frostfs-adm/internal/modules/morph/contract/update.go +++ b/cmd/frostfs-adm/internal/modules/morph/contract/update.go @@ -9,7 +9,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-contract/common" "git.frostfs.info/TrueCloudLab/frostfs-contract/nns" "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/cmd/frostfs-adm/internal/modules/morph/helper" morphClient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client" "github.com/nspcc-dev/neo-go/pkg/encoding/address" io2 "github.com/nspcc-dev/neo-go/pkg/io" @@ -25,19 +25,19 @@ import ( var errMissingNNSRecord = errors.New("missing NNS record") func updateContracts(cmd *cobra.Command, _ []string) error { - wCtx, err := morphUtil.NewInitializeContext(cmd, viper.GetViper()) + wCtx, err := helper.NewInitializeContext(cmd, viper.GetViper()) if err != nil { return fmt.Errorf("initialization error: %w", err) } - if err := morphUtil.DeployNNS(wCtx, constants.UpdateMethodName); err != nil { + if err := helper.DeployNNS(wCtx, constants.UpdateMethodName); err != nil { return err } return updateContractsInternal(wCtx) } -func updateContractsInternal(c *morphUtil.InitializeContext) error { +func updateContractsInternal(c *helper.InitializeContext) error { alphaCs := c.GetContract(constants.AlphabetContract) nnsCs, err := c.NNSContractState() @@ -90,14 +90,14 @@ func updateContractsInternal(c *morphUtil.InitializeContext) error { return c.AwaitTx() } -func deployAlphabetAccounts(c *morphUtil.InitializeContext, nnsHash neoUtil.Uint160, w *io2.BufBinWriter, alphaCs *morphUtil.ContractState) ([]any, error) { +func deployAlphabetAccounts(c *helper.InitializeContext, nnsHash neoUtil.Uint160, w *io2.BufBinWriter, alphaCs *helper.ContractState) ([]any, error) { var keysParam []any baseGroups := alphaCs.Manifest.Groups // alphabet contracts should be deployed by individual nodes to get different hashes. for i, acc := range c.Accounts { - ctrHash, err := morphUtil.NNSResolveHash(c.ReadOnlyInvoker, nnsHash, morphUtil.GetAlphabetNNSDomain(i)) + ctrHash, err := helper.NNSResolveHash(c.ReadOnlyInvoker, nnsHash, helper.GetAlphabetNNSDomain(i)) if err != nil { return nil, fmt.Errorf("can't resolve hash for contract update: %w", err) } @@ -108,7 +108,7 @@ func deployAlphabetAccounts(c *morphUtil.InitializeContext, nnsHash neoUtil.Uint emit.Array(w.BinWriter, params...) alphaCs.Manifest.Groups = baseGroups - err = morphUtil.AddManifestGroup(c.ContractWallet, ctrHash, alphaCs) + err = helper.AddManifestGroup(c.ContractWallet, ctrHash, alphaCs) if err != nil { return nil, fmt.Errorf("can't sign manifest group: %v", err) } @@ -129,7 +129,7 @@ func deployAlphabetAccounts(c *morphUtil.InitializeContext, nnsHash neoUtil.Uint return keysParam, nil } -func deployOrUpdateContracts(c *morphUtil.InitializeContext, w *io2.BufBinWriter, nnsHash neoUtil.Uint160, keysParam []any) error { +func deployOrUpdateContracts(c *helper.InitializeContext, w *io2.BufBinWriter, nnsHash neoUtil.Uint160, keysParam []any) error { emit.Instruction(w.BinWriter, opcode.INITSSLOT, []byte{1}) emit.AppCall(w.BinWriter, nnsHash, "getPrice", callflag.All) emit.Opcodes(w.BinWriter, opcode.STSFLD0) @@ -139,7 +139,7 @@ func deployOrUpdateContracts(c *morphUtil.InitializeContext, w *io2.BufBinWriter cs := c.GetContract(ctrName) method := constants.UpdateMethodName - ctrHash, err := morphUtil.NNSResolveHash(c.ReadOnlyInvoker, nnsHash, morphUtil.DomainOf(ctrName)) + ctrHash, err := helper.NNSResolveHash(c.ReadOnlyInvoker, nnsHash, helper.DomainOf(ctrName)) if err != nil { if errors.Is(err, errMissingNNSRecord) { // if contract not found we deploy it instead of update @@ -149,7 +149,7 @@ func deployOrUpdateContracts(c *morphUtil.InitializeContext, w *io2.BufBinWriter } } - err = morphUtil.AddManifestGroup(c.ContractWallet, ctrHash, cs) + err = helper.AddManifestGroup(c.ContractWallet, ctrHash, cs) if err != nil { return fmt.Errorf("can't sign manifest group: %v", err) } @@ -159,11 +159,11 @@ func deployOrUpdateContracts(c *morphUtil.InitializeContext, w *io2.BufBinWriter invokeHash = ctrHash } - args, err := morphUtil.GetContractDeployData(c, ctrName, keysParam, constants.UpdateMethodName) + args, err := helper.GetContractDeployData(c, ctrName, keysParam, constants.UpdateMethodName) if err != nil { return fmt.Errorf("%s: getting update params: %v", ctrName, err) } - params := morphUtil.GetContractDeployParameters(cs, args) + params := helper.GetContractDeployParameters(cs, args) res, err := c.CommitteeAct.MakeCall(invokeHash, method, params...) if err != nil { if method != constants.UpdateMethodName || !strings.Contains(err.Error(), common.ErrAlreadyUpdated) { diff --git a/cmd/frostfs-adm/internal/modules/morph/frostfsid/frostfsid.go b/cmd/frostfs-adm/internal/modules/morph/frostfsid/frostfsid.go index e5d246b4e..0c791d391 100644 --- a/cmd/frostfs-adm/internal/modules/morph/frostfsid/frostfsid.go +++ b/cmd/frostfs-adm/internal/modules/morph/frostfsid/frostfsid.go @@ -8,7 +8,7 @@ import ( frostfsidclient "git.frostfs.info/TrueCloudLab/frostfs-contract/frostfsid/client" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags" "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/cmd/frostfs-adm/internal/modules/morph/helper" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" "github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/encoding/address" @@ -418,11 +418,11 @@ type frostfsidClient struct { bw *io.BufBinWriter contractHash util.Uint160 roCli *frostfsidclient.Client // client can be used only for waiting tx, parsing and forming method params - wCtx *morphUtil.InitializeContext + wCtx *helper.InitializeContext } func newFrostfsIDClient(cmd *cobra.Command) (*frostfsidClient, error) { - wCtx, err := morphUtil.NewInitializeContext(cmd, viper.GetViper()) + wCtx, err := helper.NewInitializeContext(cmd, viper.GetViper()) if err != nil { return nil, fmt.Errorf("can't to initialize context: %w", err) } @@ -433,7 +433,7 @@ func newFrostfsIDClient(cmd *cobra.Command) (*frostfsidClient, error) { return nil, fmt.Errorf("can't get NNS contract info: %w", err) } - ffsidHash, err := morphUtil.NNSResolveHash(wCtx.ReadOnlyInvoker, cs.Hash, morphUtil.DomainOf(constants.FrostfsIDContract)) + ffsidHash, err := helper.NNSResolveHash(wCtx.ReadOnlyInvoker, cs.Hash, helper.DomainOf(constants.FrostfsIDContract)) if err != nil { return nil, fmt.Errorf("can't get proxy contract hash: %w", err) } diff --git a/cmd/frostfs-adm/internal/modules/morph/frostfsid/frostfsid_util_test.go b/cmd/frostfs-adm/internal/modules/morph/frostfsid/frostfsid_util_test.go index fa6d07bf2..cce859d2f 100644 --- a/cmd/frostfs-adm/internal/modules/morph/frostfsid/frostfsid_util_test.go +++ b/cmd/frostfs-adm/internal/modules/morph/frostfsid/frostfsid_util_test.go @@ -4,7 +4,7 @@ import ( "encoding/hex" "testing" - "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util" + "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper" "git.frostfs.info/TrueCloudLab/frostfs-node/internal/ape" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/encoding/address" @@ -31,7 +31,7 @@ func TestFrostfsIDConfig(t *testing.T) { v := viper.New() v.Set("frostfsid.admin", fmts[i]) - actual, found, err := util.GetFrostfsIDAdmin(v) + actual, found, err := helper.GetFrostfsIDAdmin(v) require.NoError(t, err) require.True(t, found) require.Equal(t, pks[i].GetScriptHash(), actual) @@ -41,14 +41,14 @@ func TestFrostfsIDConfig(t *testing.T) { v := viper.New() v.Set("frostfsid.admin", "abc") - _, found, err := util.GetFrostfsIDAdmin(v) + _, found, err := helper.GetFrostfsIDAdmin(v) require.Error(t, err) require.True(t, found) }) t.Run("missing key", func(t *testing.T) { v := viper.New() - _, found, err := util.GetFrostfsIDAdmin(v) + _, found, err := helper.GetFrostfsIDAdmin(v) require.NoError(t, err) require.False(t, found) }) diff --git a/cmd/frostfs-adm/internal/modules/morph/generate/generate.go b/cmd/frostfs-adm/internal/modules/morph/generate/generate.go index f032ee708..8ecc9f1b6 100644 --- a/cmd/frostfs-adm/internal/modules/morph/generate/generate.go +++ b/cmd/frostfs-adm/internal/modules/morph/generate/generate.go @@ -9,7 +9,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/cmd/frostfs-adm/internal/modules/morph/helper" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/encoding/address" @@ -36,7 +36,7 @@ func AlphabetCreds(cmd *cobra.Command, _ []string) error { return errors.New("size must be > 0") } if size > constants.MaxAlphabetNodes { - return morphUtil.ErrTooManyAlphabetNodes + return helper.ErrTooManyAlphabetNodes } v := viper.GetViper() @@ -46,7 +46,7 @@ func AlphabetCreds(cmd *cobra.Command, _ []string) error { return err } - _, err = morphUtil.InitializeContractWallet(v, walletDir) + _, err = helper.InitializeContractWallet(v, walletDir) if err != nil { return err } @@ -191,12 +191,12 @@ func refillGas(cmd *cobra.Command, gasFlag string, createWallet bool) (err error gasStr := viper.GetString(gasFlag) - gasAmount, err := morphUtil.ParseGASAmount(gasStr) + gasAmount, err := helper.ParseGASAmount(gasStr) if err != nil { return err } - wCtx, err := morphUtil.NewInitializeContext(cmd, viper.GetViper()) + wCtx, err := helper.NewInitializeContext(cmd, viper.GetViper()) if err != nil { return err } diff --git a/cmd/frostfs-adm/internal/modules/morph/util/contract.go b/cmd/frostfs-adm/internal/modules/morph/helper/contract.go similarity index 99% rename from cmd/frostfs-adm/internal/modules/morph/util/contract.go rename to cmd/frostfs-adm/internal/modules/morph/helper/contract.go index 8f3b20e83..a740f3f09 100644 --- a/cmd/frostfs-adm/internal/modules/morph/util/contract.go +++ b/cmd/frostfs-adm/internal/modules/morph/helper/contract.go @@ -1,4 +1,4 @@ -package util +package helper import ( "fmt" diff --git a/cmd/frostfs-adm/internal/modules/morph/util/download.go b/cmd/frostfs-adm/internal/modules/morph/helper/download.go similarity index 99% rename from cmd/frostfs-adm/internal/modules/morph/util/download.go rename to cmd/frostfs-adm/internal/modules/morph/helper/download.go index ff97a7f4a..08d427a46 100644 --- a/cmd/frostfs-adm/internal/modules/morph/util/download.go +++ b/cmd/frostfs-adm/internal/modules/morph/helper/download.go @@ -1,4 +1,4 @@ -package util +package helper import ( "context" diff --git a/cmd/frostfs-adm/internal/modules/morph/util/frostfsid.go b/cmd/frostfs-adm/internal/modules/morph/helper/frostfsid.go similarity index 98% rename from cmd/frostfs-adm/internal/modules/morph/util/frostfsid.go rename to cmd/frostfs-adm/internal/modules/morph/helper/frostfsid.go index 7aea1c492..f29042b82 100644 --- a/cmd/frostfs-adm/internal/modules/morph/util/frostfsid.go +++ b/cmd/frostfs-adm/internal/modules/morph/helper/frostfsid.go @@ -1,4 +1,4 @@ -package util +package helper import ( "fmt" diff --git a/cmd/frostfs-adm/internal/modules/morph/util/group.go b/cmd/frostfs-adm/internal/modules/morph/helper/group.go similarity index 98% rename from cmd/frostfs-adm/internal/modules/morph/util/group.go rename to cmd/frostfs-adm/internal/modules/morph/helper/group.go index a0306f3bc..10a164651 100644 --- a/cmd/frostfs-adm/internal/modules/morph/util/group.go +++ b/cmd/frostfs-adm/internal/modules/morph/helper/group.go @@ -1,4 +1,4 @@ -package util +package helper import ( "encoding/json" diff --git a/cmd/frostfs-adm/internal/modules/morph/util/initialize.go b/cmd/frostfs-adm/internal/modules/morph/helper/initialize.go similarity index 99% rename from cmd/frostfs-adm/internal/modules/morph/util/initialize.go rename to cmd/frostfs-adm/internal/modules/morph/helper/initialize.go index 2d676327d..00c2fae6d 100644 --- a/cmd/frostfs-adm/internal/modules/morph/util/initialize.go +++ b/cmd/frostfs-adm/internal/modules/morph/helper/initialize.go @@ -1,4 +1,4 @@ -package util +package helper import ( "errors" diff --git a/cmd/frostfs-adm/internal/modules/morph/util/initialize_ctx.go b/cmd/frostfs-adm/internal/modules/morph/helper/initialize_ctx.go similarity index 99% rename from cmd/frostfs-adm/internal/modules/morph/util/initialize_ctx.go rename to cmd/frostfs-adm/internal/modules/morph/helper/initialize_ctx.go index 907ba57fe..8269f19dc 100644 --- a/cmd/frostfs-adm/internal/modules/morph/util/initialize_ctx.go +++ b/cmd/frostfs-adm/internal/modules/morph/helper/initialize_ctx.go @@ -1,4 +1,4 @@ -package util +package helper import ( "encoding/hex" diff --git a/cmd/frostfs-adm/internal/modules/morph/util/local_client.go b/cmd/frostfs-adm/internal/modules/morph/helper/local_client.go similarity index 99% rename from cmd/frostfs-adm/internal/modules/morph/util/local_client.go rename to cmd/frostfs-adm/internal/modules/morph/helper/local_client.go index 35fb07cc4..d309e7e5b 100644 --- a/cmd/frostfs-adm/internal/modules/morph/util/local_client.go +++ b/cmd/frostfs-adm/internal/modules/morph/helper/local_client.go @@ -1,4 +1,4 @@ -package util +package helper import ( "crypto/elliptic" diff --git a/cmd/frostfs-adm/internal/modules/morph/util/n3client.go b/cmd/frostfs-adm/internal/modules/morph/helper/n3client.go similarity index 99% rename from cmd/frostfs-adm/internal/modules/morph/util/n3client.go rename to cmd/frostfs-adm/internal/modules/morph/helper/n3client.go index 56a96c410..84dd69c79 100644 --- a/cmd/frostfs-adm/internal/modules/morph/util/n3client.go +++ b/cmd/frostfs-adm/internal/modules/morph/helper/n3client.go @@ -1,4 +1,4 @@ -package util +package helper import ( "context" diff --git a/cmd/frostfs-adm/internal/modules/morph/util/netmap.go b/cmd/frostfs-adm/internal/modules/morph/helper/netmap.go similarity index 99% rename from cmd/frostfs-adm/internal/modules/morph/util/netmap.go rename to cmd/frostfs-adm/internal/modules/morph/helper/netmap.go index fbce8a0fa..732a5e11f 100644 --- a/cmd/frostfs-adm/internal/modules/morph/util/netmap.go +++ b/cmd/frostfs-adm/internal/modules/morph/helper/netmap.go @@ -1,4 +1,4 @@ -package util +package helper import ( "errors" diff --git a/cmd/frostfs-adm/internal/modules/morph/util/util.go b/cmd/frostfs-adm/internal/modules/morph/helper/util.go similarity index 99% rename from cmd/frostfs-adm/internal/modules/morph/util/util.go rename to cmd/frostfs-adm/internal/modules/morph/helper/util.go index d85fa698e..f0399ab37 100644 --- a/cmd/frostfs-adm/internal/modules/morph/util/util.go +++ b/cmd/frostfs-adm/internal/modules/morph/helper/util.go @@ -1,4 +1,4 @@ -package util +package helper import ( "archive/tar" diff --git a/cmd/frostfs-adm/internal/modules/morph/util/wallet.go b/cmd/frostfs-adm/internal/modules/morph/helper/wallet.go similarity index 99% rename from cmd/frostfs-adm/internal/modules/morph/util/wallet.go rename to cmd/frostfs-adm/internal/modules/morph/helper/wallet.go index ca722f241..bd01cd59e 100644 --- a/cmd/frostfs-adm/internal/modules/morph/util/wallet.go +++ b/cmd/frostfs-adm/internal/modules/morph/helper/wallet.go @@ -1,4 +1,4 @@ -package util +package helper import ( "fmt" diff --git a/cmd/frostfs-adm/internal/modules/morph/initialize/initialize.go b/cmd/frostfs-adm/internal/modules/morph/initialize/initialize.go index d3903e226..cdaf7d3bc 100644 --- a/cmd/frostfs-adm/internal/modules/morph/initialize/initialize.go +++ b/cmd/frostfs-adm/internal/modules/morph/initialize/initialize.go @@ -4,13 +4,13 @@ import ( "fmt" "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/cmd/frostfs-adm/internal/modules/morph/helper" "github.com/spf13/cobra" "github.com/spf13/viper" ) func initializeSideChainCmd(cmd *cobra.Command, _ []string) error { - initCtx, err := morphUtil.NewInitializeContext(cmd, viper.GetViper()) + initCtx, err := helper.NewInitializeContext(cmd, viper.GetViper()) if err != nil { return fmt.Errorf("initialization error: %w", err) } @@ -29,7 +29,7 @@ func initializeSideChainCmd(cmd *cobra.Command, _ []string) error { // 3. Deploy NNS contract. cmd.Println("Stage 3: deploy NNS contract.") - if err := morphUtil.DeployNNS(initCtx, constants.DeployMethodName); err != nil { + if err := helper.DeployNNS(initCtx, constants.DeployMethodName); err != nil { return err } diff --git a/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_deploy.go b/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_deploy.go index 417cab269..f40ea732c 100644 --- a/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_deploy.go +++ b/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_deploy.go @@ -4,13 +4,13 @@ import ( "fmt" "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/cmd/frostfs-adm/internal/modules/morph/helper" "github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/rpcclient/actor" "github.com/nspcc-dev/neo-go/pkg/rpcclient/management" ) -func deployContracts(c *morphUtil.InitializeContext) error { +func deployContracts(c *helper.InitializeContext) error { alphaCs := c.GetContract(constants.AlphabetContract) var keysParam []any @@ -26,13 +26,13 @@ func deployContracts(c *morphUtil.InitializeContext) error { } alphaCs.Manifest.Groups = baseGroups - err := morphUtil.AddManifestGroup(c.ContractWallet, ctrHash, alphaCs) + err := helper.AddManifestGroup(c.ContractWallet, ctrHash, alphaCs) if err != nil { return fmt.Errorf("can't sign manifest group: %v", err) } keysParam = append(keysParam, acc.PrivateKey().PublicKey().Bytes()) - params := morphUtil.GetContractDeployParameters(alphaCs, c.GetAlphabetDeployItems(i, len(c.Wallets))) + params := helper.GetContractDeployParameters(alphaCs, c.GetAlphabetDeployItems(i, len(c.Wallets))) act, err := actor.NewSimple(c.Client, acc) if err != nil { @@ -44,7 +44,7 @@ func deployContracts(c *morphUtil.InitializeContext) error { return fmt.Errorf("can't deploy alphabet #%d contract: %w", i, err) } - c.SentTxs = append(c.SentTxs, morphUtil.HashVUBPair{Hash: txHash, Vub: vub}) + c.SentTxs = append(c.SentTxs, helper.HashVUBPair{Hash: txHash, Vub: vub}) } for _, ctrName := range constants.ContractList { @@ -56,16 +56,16 @@ func deployContracts(c *morphUtil.InitializeContext) error { continue } - err := morphUtil.AddManifestGroup(c.ContractWallet, ctrHash, cs) + err := helper.AddManifestGroup(c.ContractWallet, ctrHash, cs) if err != nil { return fmt.Errorf("can't sign manifest group: %v", err) } - args, err := morphUtil.GetContractDeployData(c, ctrName, keysParam, constants.DeployMethodName) + args, err := helper.GetContractDeployData(c, ctrName, keysParam, constants.DeployMethodName) if err != nil { return fmt.Errorf("%s: getting deploy params: %v", ctrName, err) } - params := morphUtil.GetContractDeployParameters(cs, args) + params := helper.GetContractDeployParameters(cs, args) res, err := c.CommitteeAct.MakeCall(management.Hash, constants.DeployMethodName, params...) if err != nil { return fmt.Errorf("can't deploy %s contract: %w", ctrName, err) diff --git a/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_nns.go b/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_nns.go index c7c1d5b67..7a628d5a3 100644 --- a/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_nns.go +++ b/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_nns.go @@ -6,7 +6,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-contract/nns" "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/cmd/frostfs-adm/internal/modules/morph/helper" morphClient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client" "github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" @@ -19,7 +19,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/vm/opcode" ) -func setNNS(c *morphUtil.InitializeContext) error { +func setNNS(c *helper.InitializeContext) error { r := management.NewReader(c.ReadOnlyInvoker) nnsCs, err := r.GetContractByID(1) if err != nil { @@ -47,7 +47,7 @@ func setNNS(c *morphUtil.InitializeContext) error { for i, acc := range c.Accounts { alphaCs.Hash = state.CreateContractHash(acc.Contract.ScriptHash(), alphaCs.NEF.Checksum, alphaCs.Manifest.Name) - domain := morphUtil.GetAlphabetNNSDomain(i) + domain := helper.GetAlphabetNNSDomain(i) if err := nnsRegisterDomain(c, nnsCs.Hash, alphaCs.Hash, domain); err != nil { return err } @@ -74,7 +74,7 @@ func setNNS(c *morphUtil.InitializeContext) error { return c.AwaitTx() } -func updateNNSGroup(c *morphUtil.InitializeContext, nnsHash util.Uint160, pub *keys.PublicKey) error { +func updateNNSGroup(c *helper.InitializeContext, nnsHash util.Uint160, pub *keys.PublicKey) error { bw := io.NewBufBinWriter() keyAlreadyAdded, domainRegCodeEmitted, err := c.EmitUpdateNNSGroupScript(bw, nnsHash, pub) if keyAlreadyAdded || err != nil { @@ -115,7 +115,7 @@ func wrapRegisterScriptWithPrice(w *io.BufBinWriter, nnsHash util.Uint160, s []b } } -func nnsRegisterDomain(c *morphUtil.InitializeContext, nnsHash, expectedHash util.Uint160, domain string) error { +func nnsRegisterDomain(c *helper.InitializeContext, nnsHash, expectedHash util.Uint160, domain string) error { script, ok, err := c.NNSRegisterDomainScript(nnsHash, expectedHash, domain) if ok || err != nil { return err diff --git a/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_register.go b/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_register.go index d3a30485e..6a0a88016 100644 --- a/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_register.go +++ b/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_register.go @@ -6,7 +6,7 @@ import ( "math/big" "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/cmd/frostfs-adm/internal/modules/morph/helper" "github.com/nspcc-dev/neo-go/pkg/core/native" "github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/core/transaction" @@ -29,7 +29,7 @@ const ( registerBatchSize = transaction.MaxAttributes - 1 ) -func registerCandidateRange(c *morphUtil.InitializeContext, start, end int) error { +func registerCandidateRange(c *helper.InitializeContext, start, end int) error { regPrice, err := getCandidateRegisterPrice(c) if err != nil { return fmt.Errorf("can't fetch registration price: %w", err) @@ -83,7 +83,7 @@ func registerCandidateRange(c *morphUtil.InitializeContext, start, end int) erro return c.SendTx(tx, c.Command, true) } -func registerCandidates(c *morphUtil.InitializeContext) error { +func registerCandidates(c *helper.InitializeContext) error { cc, err := unwrap.Array(c.ReadOnlyInvoker.Call(neo.Hash, "getCandidates")) if err != nil { return fmt.Errorf("`getCandidates`: %w", err) @@ -116,7 +116,7 @@ func registerCandidates(c *morphUtil.InitializeContext) error { return nil } -func transferNEOToAlphabetContracts(c *morphUtil.InitializeContext) error { +func transferNEOToAlphabetContracts(c *helper.InitializeContext) error { neoHash := neo.Hash ok, err := transferNEOFinished(c, neoHash) @@ -142,7 +142,7 @@ func transferNEOToAlphabetContracts(c *morphUtil.InitializeContext) error { return c.AwaitTx() } -func transferNEOFinished(c *morphUtil.InitializeContext, neoHash util.Uint160) (bool, error) { +func transferNEOFinished(c *helper.InitializeContext, neoHash util.Uint160) (bool, error) { r := nep17.NewReader(c.ReadOnlyInvoker, neoHash) bal, err := r.BalanceOf(c.CommitteeAcc.Contract.ScriptHash()) return bal.Cmp(big.NewInt(native.NEOTotalSupply)) == -1, err @@ -150,7 +150,7 @@ func transferNEOFinished(c *morphUtil.InitializeContext, neoHash util.Uint160) ( var errGetPriceInvalid = errors.New("`getRegisterPrice`: invalid response") -func getCandidateRegisterPrice(c *morphUtil.InitializeContext) (int64, error) { +func getCandidateRegisterPrice(c *helper.InitializeContext) (int64, error) { switch c.Client.(type) { case *rpcclient.Client: inv := invoker.New(c.Client, nil) @@ -158,7 +158,7 @@ func getCandidateRegisterPrice(c *morphUtil.InitializeContext) (int64, error) { return reader.GetRegisterPrice() default: neoHash := neo.Hash - res, err := morphUtil.InvokeFunction(c.Client, neoHash, "getRegisterPrice", nil, nil) + res, err := helper.InvokeFunction(c.Client, neoHash, "getRegisterPrice", nil, nil) if err != nil { return 0, err } diff --git a/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_roles.go b/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_roles.go index d7f17ccfb..a6815ee13 100644 --- a/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_roles.go +++ b/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_roles.go @@ -1,7 +1,7 @@ package initialize import ( - "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util" + "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper" "github.com/nspcc-dev/neo-go/pkg/core/native/noderoles" "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/rpcclient/rolemgmt" @@ -9,7 +9,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/vm/emit" ) -func setNotaryAndAlphabetNodes(c *util.InitializeContext) error { +func setNotaryAndAlphabetNodes(c *helper.InitializeContext) error { if ok, err := setRolesFinished(c); ok || err != nil { if err == nil { c.Command.Println("Stage 2: already performed.") @@ -35,12 +35,12 @@ func setNotaryAndAlphabetNodes(c *util.InitializeContext) error { return c.AwaitTx() } -func setRolesFinished(c *util.InitializeContext) (bool, error) { +func setRolesFinished(c *helper.InitializeContext) (bool, error) { height, err := c.Client.GetBlockCount() if err != nil { return false, err } - pubs, err := util.GetDesignatedByRole(c.ReadOnlyInvoker, rolemgmt.Hash, noderoles.NeoFSAlphabet, height) + pubs, err := helper.GetDesignatedByRole(c.ReadOnlyInvoker, rolemgmt.Hash, noderoles.NeoFSAlphabet, height) return len(pubs) == len(c.Wallets), err } diff --git a/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_test.go b/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_test.go index 0114410c7..a05e995a7 100644 --- a/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_test.go +++ b/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_test.go @@ -13,10 +13,10 @@ import ( cmdConfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/config" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/constants" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/generate" + "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/netmap" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/node" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/policy" - "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/config" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" @@ -53,7 +53,7 @@ func TestInitialize(t *testing.T) { testInitialize(t, constants.MaxAlphabetNodes) }) t.Run("too many nodes", func(t *testing.T) { - require.ErrorIs(t, generateTestData(t, t.TempDir(), constants.MaxAlphabetNodes+1), util.ErrTooManyAlphabetNodes) + require.ErrorIs(t, generateTestData(t, t.TempDir(), constants.MaxAlphabetNodes+1), helper.ErrTooManyAlphabetNodes) }) } @@ -158,33 +158,33 @@ func TestNextPollInterval(t *testing.T) { var pollInterval time.Duration var iteration int - pollInterval, hasChanged := util.NextPollInterval(iteration, pollInterval) + pollInterval, hasChanged := helper.NextPollInterval(iteration, pollInterval) require.True(t, hasChanged) require.Equal(t, time.Second, pollInterval) iteration = 4 - pollInterval, hasChanged = util.NextPollInterval(iteration, pollInterval) + pollInterval, hasChanged = helper.NextPollInterval(iteration, pollInterval) require.False(t, hasChanged) require.Equal(t, time.Second, pollInterval) iteration = 5 - pollInterval, hasChanged = util.NextPollInterval(iteration, pollInterval) + pollInterval, hasChanged = helper.NextPollInterval(iteration, pollInterval) require.True(t, hasChanged) require.Equal(t, 2*time.Second, pollInterval) iteration = 10 - pollInterval, hasChanged = util.NextPollInterval(iteration, pollInterval) + pollInterval, hasChanged = helper.NextPollInterval(iteration, pollInterval) require.True(t, hasChanged) require.Equal(t, 4*time.Second, pollInterval) iteration = 20 pollInterval = 32 * time.Second - pollInterval, hasChanged = util.NextPollInterval(iteration, pollInterval) + pollInterval, hasChanged = helper.NextPollInterval(iteration, pollInterval) require.True(t, hasChanged) // from 32s to 16s require.Equal(t, 16*time.Second, pollInterval) pollInterval = 16 * time.Second - pollInterval, hasChanged = util.NextPollInterval(iteration, pollInterval) + pollInterval, hasChanged = helper.NextPollInterval(iteration, pollInterval) require.False(t, hasChanged) require.Equal(t, 16*time.Second, pollInterval) } diff --git a/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_transfer.go b/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_transfer.go index cad5f53c2..8bcd7eb58 100644 --- a/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_transfer.go +++ b/cmd/frostfs-adm/internal/modules/morph/initialize/initialize_transfer.go @@ -5,7 +5,7 @@ import ( "math/big" "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/cmd/frostfs-adm/internal/modules/morph/helper" "github.com/nspcc-dev/neo-go/pkg/core/native" "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/io" @@ -28,7 +28,7 @@ const ( initialProxyGASAmount = 50_000 * native.GASFactor ) -func transferFunds(c *morphUtil.InitializeContext) error { +func transferFunds(c *helper.InitializeContext) error { ok, err := transferFundsFinished(c) if ok || err != nil { if err == nil { @@ -75,7 +75,7 @@ func transferFunds(c *morphUtil.InitializeContext) error { return c.AwaitTx() } -func transferFundsFinished(c *morphUtil.InitializeContext) (bool, error) { +func transferFundsFinished(c *helper.InitializeContext) (bool, error) { acc := c.Accounts[0] r := nep17.NewReader(c.ReadOnlyInvoker, gas.Hash) @@ -83,7 +83,7 @@ func transferFundsFinished(c *morphUtil.InitializeContext) (bool, error) { return res.Cmp(big.NewInt(initialAlphabetGASAmount/2)) == 1, err } -func transferGASToProxy(c *morphUtil.InitializeContext) error { +func transferGASToProxy(c *helper.InitializeContext) error { proxyCs := c.GetContract(constants.ProxyContract) r := nep17.NewReader(c.ReadOnlyInvoker, gas.Hash) @@ -115,7 +115,7 @@ type transferTarget struct { Data any } -func createNEP17MultiTransferTx(c morphUtil.Client, acc *wallet.Account, recipients []transferTarget) (*transaction.Transaction, error) { +func createNEP17MultiTransferTx(c helper.Client, acc *wallet.Account, recipients []transferTarget) (*transaction.Transaction, error) { from := acc.Contract.ScriptHash() w := io.NewBufBinWriter() diff --git a/cmd/frostfs-adm/internal/modules/morph/netmap/epoch.go b/cmd/frostfs-adm/internal/modules/morph/netmap/epoch.go index 8e681cc3b..4fd671f2a 100644 --- a/cmd/frostfs-adm/internal/modules/morph/netmap/epoch.go +++ b/cmd/frostfs-adm/internal/modules/morph/netmap/epoch.go @@ -5,7 +5,7 @@ import ( "strings" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/constants" - "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util" + "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper" "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/rpcclient/management" "github.com/spf13/cobra" @@ -13,7 +13,7 @@ import ( ) func ForceNewEpochCmd(cmd *cobra.Command, _ []string) error { - wCtx, err := util.NewInitializeContext(cmd, viper.GetViper()) + wCtx, err := helper.NewInitializeContext(cmd, viper.GetViper()) if err != nil { return fmt.Errorf("can't to initialize context: %w", err) } @@ -24,13 +24,13 @@ func ForceNewEpochCmd(cmd *cobra.Command, _ []string) error { return fmt.Errorf("can't get NNS contract info: %w", err) } - nmHash, err := util.NNSResolveHash(wCtx.ReadOnlyInvoker, cs.Hash, util.DomainOf(constants.NetmapContract)) + nmHash, err := helper.NNSResolveHash(wCtx.ReadOnlyInvoker, cs.Hash, helper.DomainOf(constants.NetmapContract)) if err != nil { return fmt.Errorf("can't get netmap contract hash: %w", err) } bw := io.NewBufBinWriter() - if err := util.EmitNewEpochCall(bw, wCtx, nmHash); err != nil { + if err := helper.EmitNewEpochCall(bw, wCtx, nmHash); err != nil { return err } diff --git a/cmd/frostfs-adm/internal/modules/morph/netmap/netmap_candidates.go b/cmd/frostfs-adm/internal/modules/morph/netmap/netmap_candidates.go index d7ad601dd..e9404e910 100644 --- a/cmd/frostfs-adm/internal/modules/morph/netmap/netmap_candidates.go +++ b/cmd/frostfs-adm/internal/modules/morph/netmap/netmap_candidates.go @@ -3,7 +3,7 @@ package netmap import ( "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/constants" - "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util" + "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/netmap" "github.com/nspcc-dev/neo-go/pkg/rpcclient/invoker" @@ -13,7 +13,7 @@ import ( ) func listNetmapCandidatesNodes(cmd *cobra.Command, _ []string) { - c, err := util.GetN3Client(viper.GetViper()) + c, err := helper.GetN3Client(viper.GetViper()) commonCmd.ExitOnErr(cmd, "can't create N3 client: %w", err) inv := invoker.New(c, nil) @@ -22,7 +22,7 @@ func listNetmapCandidatesNodes(cmd *cobra.Command, _ []string) { cs, err := r.GetContractByID(1) commonCmd.ExitOnErr(cmd, "can't get NNS contract info: %w", err) - nmHash, err := util.NNSResolveHash(inv, cs.Hash, util.DomainOf(constants.NetmapContract)) + nmHash, err := helper.NNSResolveHash(inv, cs.Hash, helper.DomainOf(constants.NetmapContract)) commonCmd.ExitOnErr(cmd, "can't get netmap contract hash: %w", err) res, err := inv.Call(nmHash, "netmapCandidates") diff --git a/cmd/frostfs-adm/internal/modules/morph/node/remove.go b/cmd/frostfs-adm/internal/modules/morph/node/remove.go index e25cb6efb..0d14bc646 100644 --- a/cmd/frostfs-adm/internal/modules/morph/node/remove.go +++ b/cmd/frostfs-adm/internal/modules/morph/node/remove.go @@ -6,7 +6,7 @@ import ( netmapcontract "git.frostfs.info/TrueCloudLab/frostfs-contract/netmap" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/constants" - "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util" + "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/rpcclient/management" @@ -30,7 +30,7 @@ func RemoveNodesCmd(cmd *cobra.Command, args []string) error { } } - wCtx, err := util.NewInitializeContext(cmd, viper.GetViper()) + wCtx, err := helper.NewInitializeContext(cmd, viper.GetViper()) if err != nil { return fmt.Errorf("can't initialize context: %w", err) } @@ -42,7 +42,7 @@ func RemoveNodesCmd(cmd *cobra.Command, args []string) error { return fmt.Errorf("can't get NNS contract info: %w", err) } - nmHash, err := util.NNSResolveHash(wCtx.ReadOnlyInvoker, cs.Hash, util.DomainOf(constants.NetmapContract)) + nmHash, err := helper.NNSResolveHash(wCtx.ReadOnlyInvoker, cs.Hash, helper.DomainOf(constants.NetmapContract)) if err != nil { return fmt.Errorf("can't get netmap contract hash: %w", err) } @@ -53,7 +53,7 @@ func RemoveNodesCmd(cmd *cobra.Command, args []string) error { int64(netmapcontract.NodeStateOffline), nodeKeys[i].Bytes()) } - if err := util.EmitNewEpochCall(bw, wCtx, nmHash); err != nil { + if err := helper.EmitNewEpochCall(bw, wCtx, nmHash); err != nil { return err } diff --git a/cmd/frostfs-adm/internal/modules/morph/notary/notary.go b/cmd/frostfs-adm/internal/modules/morph/notary/notary.go index 3b1bb179f..6d65a8284 100644 --- a/cmd/frostfs-adm/internal/modules/morph/notary/notary.go +++ b/cmd/frostfs-adm/internal/modules/morph/notary/notary.go @@ -6,7 +6,7 @@ import ( "strconv" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags" - morphUtil "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util" + "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper" "github.com/nspcc-dev/neo-go/cli/input" "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" @@ -65,7 +65,7 @@ func depositNotary(cmd *cobra.Command, _ []string) error { if err != nil { return err } - gasAmount, err := morphUtil.ParseGASAmount(gasStr) + gasAmount, err := helper.ParseGASAmount(gasStr) if err != nil { return err } @@ -86,12 +86,12 @@ func depositNotary(cmd *cobra.Command, _ []string) error { } func transferGas(cmd *cobra.Command, acc *wallet.Account, accHash util.Uint160, gasAmount fixedn.Fixed8, till int64) error { - c, err := morphUtil.GetN3Client(viper.GetViper()) + c, err := helper.GetN3Client(viper.GetViper()) if err != nil { return err } - if err := morphUtil.CheckNotaryEnabled(c); err != nil { + if err := helper.CheckNotaryEnabled(c); err != nil { return err } @@ -123,7 +123,7 @@ func transferGas(cmd *cobra.Command, acc *wallet.Account, accHash util.Uint160, return fmt.Errorf("could not send tx: %w", err) } - return morphUtil.AwaitTx(cmd, c, []morphUtil.HashVUBPair{{Hash: txHash, Vub: vub}}) + return helper.AwaitTx(cmd, c, []helper.HashVUBPair{{Hash: txHash, Vub: vub}}) } func openWallet(cmd *cobra.Command) (*wallet.Wallet, error) { diff --git a/cmd/frostfs-adm/internal/modules/morph/policy/policy.go b/cmd/frostfs-adm/internal/modules/morph/policy/policy.go index 7f4a8d326..440e73a12 100644 --- a/cmd/frostfs-adm/internal/modules/morph/policy/policy.go +++ b/cmd/frostfs-adm/internal/modules/morph/policy/policy.go @@ -7,7 +7,7 @@ import ( "strings" "text/tabwriter" - "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util" + "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/rpcclient/invoker" @@ -25,7 +25,7 @@ const ( ) func SetPolicyCmd(cmd *cobra.Command, args []string) error { - wCtx, err := util.NewInitializeContext(cmd, viper.GetViper()) + wCtx, err := helper.NewInitializeContext(cmd, viper.GetViper()) if err != nil { return fmt.Errorf("can't to initialize context: %w", err) } @@ -59,7 +59,7 @@ func SetPolicyCmd(cmd *cobra.Command, args []string) error { } func dumpPolicyCmd(cmd *cobra.Command, _ []string) error { - c, err := util.GetN3Client(viper.GetViper()) + c, err := helper.GetN3Client(viper.GetViper()) commonCmd.ExitOnErr(cmd, "can't create N3 client:", err) inv := invoker.New(c, nil) diff --git a/cmd/frostfs-adm/internal/modules/morph/proxy/proxy.go b/cmd/frostfs-adm/internal/modules/morph/proxy/proxy.go index 2549958ef..7e173ac49 100644 --- a/cmd/frostfs-adm/internal/modules/morph/proxy/proxy.go +++ b/cmd/frostfs-adm/internal/modules/morph/proxy/proxy.go @@ -4,7 +4,7 @@ import ( "fmt" "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/cmd/frostfs-adm/internal/modules/morph/helper" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/nspcc-dev/neo-go/pkg/io" @@ -37,7 +37,7 @@ func removeProxyAccount(cmd *cobra.Command, _ []string) { } func processAccount(cmd *cobra.Command, addr util.Uint160, method string) error { - wCtx, err := morphUtil.NewInitializeContext(cmd, viper.GetViper()) + wCtx, err := helper.NewInitializeContext(cmd, viper.GetViper()) if err != nil { return fmt.Errorf("can't to initialize context: %w", err) } @@ -48,7 +48,7 @@ func processAccount(cmd *cobra.Command, addr util.Uint160, method string) error return fmt.Errorf("can't get NNS contract info: %w", err) } - proxyHash, err := morphUtil.NNSResolveHash(wCtx.ReadOnlyInvoker, cs.Hash, morphUtil.DomainOf(constants.ProxyContract)) + proxyHash, err := helper.NNSResolveHash(wCtx.ReadOnlyInvoker, cs.Hash, helper.DomainOf(constants.ProxyContract)) if err != nil { return fmt.Errorf("can't get proxy contract hash: %w", err) }