From 6daf5cc4384995af7f3f793f5d70771d3620e323 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 27 Sep 2021 18:05:48 +0300 Subject: [PATCH] Disable things in notary disabled environment Signed-off-by: Alex Vanin --- cmd/neofs-adm/internal/modules/morph/balance.go | 2 +- .../internal/modules/morph/initialize.go | 15 +++++++-------- .../internal/modules/morph/initialize_deploy.go | 5 ++--- .../internal/modules/morph/initialize_roles.go | 1 + .../internal/modules/morph/initialize_transfer.go | 1 + 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cmd/neofs-adm/internal/modules/morph/balance.go b/cmd/neofs-adm/internal/modules/morph/balance.go index a674f5d0f..c081700b6 100644 --- a/cmd/neofs-adm/internal/modules/morph/balance.go +++ b/cmd/neofs-adm/internal/modules/morph/balance.go @@ -40,7 +40,7 @@ const ( // notaryEnabled signifies whether contracts were deployed in a notary-enabled environment. // The setting is here to simplify testing and building the command for testnet (notary currently disabled). // It will be removed eventually. - notaryEnabled = true + notaryEnabled = false ) func dumpBalances(cmd *cobra.Command, _ []string) error { diff --git a/cmd/neofs-adm/internal/modules/morph/initialize.go b/cmd/neofs-adm/internal/modules/morph/initialize.go index 132f40171..0d0e33236 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize.go @@ -7,7 +7,6 @@ import ( "path/filepath" "time" - "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" "github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" @@ -359,16 +358,16 @@ func getNativeHashes(c *client.Client) (map[string]util.Uint160, error) { return nil, fmt.Errorf("can't get native contract hashes: %w", err) } - notaryEnabled := false + //notaryEnabled := false nativeHashes := make(map[string]util.Uint160, len(ns)) for i := range ns { - if ns[i].Manifest.Name == nativenames.Notary { - notaryEnabled = len(ns[i].UpdateHistory) > 0 - } + //if ns[i].Manifest.Name == nativenames.Notary { + // notaryEnabled = len(ns[i].UpdateHistory) > 0 + //} nativeHashes[ns[i].Manifest.Name] = ns[i].Hash } - if !notaryEnabled { - return nil, errors.New("notary contract must be enabled") - } + //if !notaryEnabled { + // return nil, errors.New("notary contract must be enabled") + //} return nativeHashes, nil } diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go b/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go index 4473fe5e3..13710969f 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go @@ -69,7 +69,6 @@ var ( containerContract, neofsIDContract, netmapContract, - proxyContract, reputationContract, subnetContract, } @@ -523,7 +522,7 @@ func getContractDeployParameters(rawNef, rawManif []byte, deployData []smartcont func (c *initializeContext) getContractDeployData(ctrName string, keysParam []smartcontract.Parameter) []smartcontract.Parameter { items := make([]smartcontract.Parameter, 1, 6) - items[0] = newContractParameter(smartcontract.BoolType, false) // notaryDisabled is false + items[0] = newContractParameter(smartcontract.BoolType, true) // notaryDisabled is true switch ctrName { case neofsContract: @@ -612,7 +611,7 @@ func (c *initializeContext) getAlphabetDeployItems(i, n int) []interface{} { items := make([]interface{}, 6) items[0] = false items[1] = c.Contracts[netmapContract].Hash - items[2] = c.Contracts[proxyContract].Hash + items[2] = util.Uint160{} items[3] = innerring.GlagoliticLetter(i).String() items[4] = int64(i) items[5] = int64(n) diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_roles.go b/cmd/neofs-adm/internal/modules/morph/initialize_roles.go index 080bb173e..3ede71482 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize_roles.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize_roles.go @@ -9,6 +9,7 @@ import ( ) func (c *initializeContext) setNotaryAndAlphabetNodes() error { + return nil if ok, err := c.setRolesFinished(); ok || err != nil { if err == nil { c.Command.Println("Stage 2: already performed.") diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go b/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go index 982c9da97..efd225d76 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go @@ -130,6 +130,7 @@ func (c *initializeContext) multiSign(tx *transaction.Transaction, accType strin } func (c *initializeContext) transferGASToProxy() error { + return nil gasHash := c.nativeHash(nativenames.Gas) proxyCs := c.getContract(proxyContract)