Anton Nikiforov
802192cfef
All checks were successful
Vulncheck / Vulncheck (pull_request) Successful in 1m57s
DCO action / DCO (pull_request) Successful in 3m3s
Build / Build Components (1.21) (pull_request) Successful in 5m0s
Build / Build Components (1.20) (pull_request) Successful in 5m6s
Tests and linters / Tests (1.20) (pull_request) Successful in 7m1s
Tests and linters / Staticcheck (pull_request) Successful in 6m55s
Tests and linters / Lint (pull_request) Successful in 7m30s
Tests and linters / Tests (1.21) (pull_request) Successful in 7m53s
Tests and linters / Tests with -race (pull_request) Successful in 8m21s
To avoid conflicts with `util` packages in other imports. Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
59 lines
1.6 KiB
Go
59 lines
1.6 KiB
Go
package initialize
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"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/helper"
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
func initializeSideChainCmd(cmd *cobra.Command, _ []string) error {
|
|
initCtx, err := helper.NewInitializeContext(cmd, viper.GetViper())
|
|
if err != nil {
|
|
return fmt.Errorf("initialization error: %w", err)
|
|
}
|
|
defer initCtx.Close()
|
|
|
|
// 1. Transfer funds to committee accounts.
|
|
cmd.Println("Stage 1: transfer GAS to alphabet nodes.")
|
|
if err := transferFunds(initCtx); err != nil {
|
|
return err
|
|
}
|
|
|
|
cmd.Println("Stage 2: set notary and alphabet nodes in designate contract.")
|
|
if err := setNotaryAndAlphabetNodes(initCtx); err != nil {
|
|
return err
|
|
}
|
|
|
|
// 3. Deploy NNS contract.
|
|
cmd.Println("Stage 3: deploy NNS contract.")
|
|
if err := helper.DeployNNS(initCtx, constants.DeployMethodName); err != nil {
|
|
return err
|
|
}
|
|
|
|
// 4. Deploy NeoFS contracts.
|
|
cmd.Println("Stage 4: deploy NeoFS contracts.")
|
|
if err := deployContracts(initCtx); err != nil {
|
|
return err
|
|
}
|
|
|
|
cmd.Println("Stage 4.1: Transfer GAS to proxy contract.")
|
|
if err := transferGASToProxy(initCtx); err != nil {
|
|
return err
|
|
}
|
|
|
|
cmd.Println("Stage 5: register candidates.")
|
|
if err := registerCandidates(initCtx); err != nil {
|
|
return err
|
|
}
|
|
|
|
cmd.Println("Stage 6: transfer NEO to alphabet contracts.")
|
|
if err := transferNEOToAlphabetContracts(initCtx); err != nil {
|
|
return err
|
|
}
|
|
|
|
cmd.Println("Stage 7: set addresses in NNS.")
|
|
return setNNS(initCtx)
|
|
}
|