diff --git a/cmd/neofs-adm/internal/modules/morph/subnet.go b/cmd/neofs-adm/internal/modules/morph/subnet.go index 9430f39b77..4b036744a7 100644 --- a/cmd/neofs-adm/internal/modules/morph/subnet.go +++ b/cmd/neofs-adm/internal/modules/morph/subnet.go @@ -140,6 +140,9 @@ func initSubnetClientCheckNotary(c *morphsubnet.Client, key *keys.PrivateKey, ch return err } + // Error means group was not set in NNS, continue with Global scope in this case. + _ = cMorph.SetGroupSignerScope() + // read contract address contractAddr, err := cMorph.NNSContractAddress(client.NNSSubnetworkContractName) if err != nil { diff --git a/cmd/neofs-node/morph.go b/cmd/neofs-node/morph.go index 810e150170..cc1c83a4d5 100644 --- a/cmd/neofs-node/morph.go +++ b/cmd/neofs-node/morph.go @@ -51,6 +51,9 @@ func initMorphComponents(c *cfg) { client.WithMaxConnectionPerHost(morphconfig.MaxConnPerHost(c.appCfg)), ) if err == nil { + if err := cli.SetGroupSignerScope(); err != nil { + c.log.Info("failed to set group signer scope, continue with Global", zap.Error(err)) + } handler(cli) return diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 85fd92691d..24792458f7 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -364,6 +364,9 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error if err != nil { return nil, err } + if err := server.morphClient.SetGroupSignerScope(); err != nil { + morphChain.log.Info("failed to set group signer scope, continue with Global", zap.Error(err)) + } server.withoutMainNet = cfg.GetBool("without_mainnet") diff --git a/pkg/morph/client/nns.go b/pkg/morph/client/nns.go index 9a6017ce28..562f770021 100644 --- a/pkg/morph/client/nns.go +++ b/pkg/morph/client/nns.go @@ -6,6 +6,7 @@ import ( "strconv" nns "github.com/nspcc-dev/neo-go/examples/nft-nd-nns" + "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/rpc/client" "github.com/nspcc-dev/neo-go/pkg/smartcontract" @@ -175,8 +176,27 @@ func exists(c *client.Client, nnsHash util.Uint160, domain string) (bool, error) return !available, nil } -// ContractGroupKey returns public key designating NeoFS contract group. -func (c *Client) ContractGroupKey() (*keys.PublicKey, error) { +// SetGroupSignerScope makes the default signer scope include all NeoFS contracts. +// Should be called for side-chain client only. +func (c *Client) SetGroupSignerScope() error { + if c.multiClient != nil { + return c.multiClient.iterateClients(func(c *Client) error { + return wrapNeoFSError(c.SetGroupSignerScope()) + }) + } + + pub, err := c.contractGroupKey() + if err != nil { + return err + } + + c.signer.Scopes = transaction.CustomGroups + c.signer.AllowedGroups = []*keys.PublicKey{pub} + return nil +} + +// contractGroupKey returns public key designating NeoFS contract group. +func (c *Client) contractGroupKey() (*keys.PublicKey, error) { if c.groupKey != nil { return c.groupKey, nil }