2021-07-09 09:53:10 +00:00
|
|
|
package morph
|
|
|
|
|
|
|
|
import (
|
2021-07-19 11:04:19 +00:00
|
|
|
"errors"
|
|
|
|
"fmt"
|
2022-03-18 11:12:58 +00:00
|
|
|
"os"
|
2021-07-19 11:04:19 +00:00
|
|
|
|
2023-03-07 13:38:26 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/config"
|
2024-01-31 14:26:26 +00:00
|
|
|
morphUtil "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util"
|
2023-03-07 13:38:26 +00:00
|
|
|
morphClient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
2021-08-19 10:27:43 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
|
2022-02-02 14:19:27 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
2021-07-20 12:08:47 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
2021-07-19 11:04:19 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
2022-08-29 19:31:32 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/rpcclient/actor"
|
2023-10-24 10:06:30 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/rpcclient/management"
|
2021-07-19 11:04:19 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/wallet"
|
2021-07-09 09:53:10 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
)
|
|
|
|
|
2022-02-02 14:19:27 +00:00
|
|
|
type cache struct {
|
|
|
|
nnsCs *state.Contract
|
|
|
|
groupKey *keys.PublicKey
|
|
|
|
}
|
|
|
|
|
2021-07-19 11:04:19 +00:00
|
|
|
type initializeContext struct {
|
2024-01-31 14:26:26 +00:00
|
|
|
morphUtil.ClientContext
|
2022-02-02 14:19:27 +00:00
|
|
|
cache
|
2022-04-21 11:28:05 +00:00
|
|
|
// CommitteeAcc is used for retrieving the committee address and the verification script.
|
2021-07-19 11:04:19 +00:00
|
|
|
CommitteeAcc *wallet.Account
|
2022-04-21 11:28:05 +00:00
|
|
|
// ConsensusAcc is used for retrieving the committee address and the verification script.
|
2021-07-19 11:04:19 +00:00
|
|
|
ConsensusAcc *wallet.Account
|
|
|
|
Wallets []*wallet.Wallet
|
2022-04-21 11:28:05 +00:00
|
|
|
// ContractWallet is a wallet for providing the contract group signature.
|
2021-11-29 12:33:46 +00:00
|
|
|
ContractWallet *wallet.Wallet
|
2021-07-30 11:26:44 +00:00
|
|
|
// Accounts contains simple signature accounts in the same order as in Wallets.
|
|
|
|
Accounts []*wallet.Account
|
2021-07-21 10:09:59 +00:00
|
|
|
Contracts map[string]*contractState
|
2021-07-20 14:51:45 +00:00
|
|
|
Command *cobra.Command
|
2021-07-29 13:23:36 +00:00
|
|
|
ContractPath string
|
2024-02-03 17:17:12 +00:00
|
|
|
ContractURL string
|
2021-07-19 11:04:19 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 08:24:40 +00:00
|
|
|
func initializeSideChainCmd(cmd *cobra.Command, _ []string) error {
|
2021-07-20 14:51:45 +00:00
|
|
|
initCtx, err := newInitializeContext(cmd, viper.GetViper())
|
2021-07-19 11:04:19 +00:00
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("initialization error: %w", err)
|
|
|
|
}
|
2022-04-07 12:47:13 +00:00
|
|
|
defer initCtx.close()
|
2021-07-19 11:04:19 +00:00
|
|
|
|
|
|
|
// 1. Transfer funds to committee accounts.
|
|
|
|
cmd.Println("Stage 1: transfer GAS to alphabet nodes.")
|
|
|
|
if err := initCtx.transferFunds(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-07-20 12:08:47 +00:00
|
|
|
cmd.Println("Stage 2: set notary and alphabet nodes in designate contract.")
|
|
|
|
if err := initCtx.setNotaryAndAlphabetNodes(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-07-21 10:09:59 +00:00
|
|
|
// 3. Deploy NNS contract.
|
|
|
|
cmd.Println("Stage 3: deploy NNS contract.")
|
2021-11-29 10:15:03 +00:00
|
|
|
if err := initCtx.deployNNS(deployMethodName); err != nil {
|
2021-07-21 10:09:59 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// 4. Deploy NeoFS contracts.
|
|
|
|
cmd.Println("Stage 4: deploy NeoFS contracts.")
|
2021-12-27 10:26:22 +00:00
|
|
|
if err := initCtx.deployContracts(); err != nil {
|
2021-07-21 10:09:59 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-07-23 12:07:44 +00:00
|
|
|
cmd.Println("Stage 4.1: Transfer GAS to proxy contract.")
|
|
|
|
if err := initCtx.transferGASToProxy(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-07-22 07:57:11 +00:00
|
|
|
cmd.Println("Stage 5: register candidates.")
|
|
|
|
if err := initCtx.registerCandidates(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd.Println("Stage 6: transfer NEO to alphabet contracts.")
|
|
|
|
if err := initCtx.transferNEOToAlphabetContracts(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-07-19 11:04:19 +00:00
|
|
|
|
2021-07-22 09:52:44 +00:00
|
|
|
cmd.Println("Stage 7: set addresses in NNS.")
|
2023-04-26 08:31:41 +00:00
|
|
|
return initCtx.setNNS()
|
2021-07-09 09:53:10 +00:00
|
|
|
}
|
2021-07-19 11:04:19 +00:00
|
|
|
|
2022-04-07 12:47:13 +00:00
|
|
|
func (c *initializeContext) close() {
|
2024-01-31 14:26:26 +00:00
|
|
|
if local, ok := c.Client.(*morphUtil.LocalClient); ok {
|
|
|
|
err := local.Dump()
|
2022-04-07 12:47:13 +00:00
|
|
|
if err != nil {
|
|
|
|
c.Command.PrintErrf("Can't write dump: %v\n", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-20 14:51:45 +00:00
|
|
|
func newInitializeContext(cmd *cobra.Command, v *viper.Viper) (*initializeContext, error) {
|
2024-02-01 06:51:24 +00:00
|
|
|
walletDir := config.ResolveHomePath(viper.GetString(morphUtil.AlphabetWalletsFlag))
|
2024-01-31 14:26:26 +00:00
|
|
|
wallets, err := morphUtil.GetAlphabetWallets(v, walletDir)
|
2021-07-19 11:04:19 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2023-02-21 13:17:41 +00:00
|
|
|
needContracts := cmd.Name() == "update-contracts" || cmd.Name() == "init"
|
|
|
|
|
2022-08-15 15:27:23 +00:00
|
|
|
var w *wallet.Wallet
|
2023-03-23 06:18:44 +00:00
|
|
|
w, err = getWallet(cmd, v, needContracts, walletDir)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
2021-11-29 12:33:46 +00:00
|
|
|
}
|
|
|
|
|
2023-03-23 06:18:44 +00:00
|
|
|
c, err := createClient(cmd, v, wallets)
|
2021-07-19 11:04:19 +00:00
|
|
|
if err != nil {
|
2023-03-23 06:18:44 +00:00
|
|
|
return nil, err
|
2021-07-19 11:04:19 +00:00
|
|
|
}
|
|
|
|
|
2024-02-01 06:58:12 +00:00
|
|
|
committeeAcc, err := morphUtil.GetWalletAccount(wallets[0], morphUtil.CommitteeAccountName)
|
2021-07-19 11:04:19 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("can't find committee account: %w", err)
|
|
|
|
}
|
|
|
|
|
2024-01-31 14:26:26 +00:00
|
|
|
consensusAcc, err := morphUtil.GetWalletAccount(wallets[0], morphUtil.ConsensusAccountName)
|
2021-07-19 11:04:19 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("can't find consensus account: %w", err)
|
|
|
|
}
|
|
|
|
|
2023-03-23 06:18:44 +00:00
|
|
|
if err := validateInit(cmd); err != nil {
|
|
|
|
return nil, err
|
2021-08-06 11:28:07 +00:00
|
|
|
}
|
2021-10-25 13:19:56 +00:00
|
|
|
|
2023-04-26 08:24:40 +00:00
|
|
|
ctrPath, err := getContractsPath(cmd, needContracts)
|
2023-03-23 06:18:44 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
2021-07-29 13:23:36 +00:00
|
|
|
}
|
|
|
|
|
2024-02-03 17:17:12 +00:00
|
|
|
var ctrURL string
|
|
|
|
if needContracts {
|
|
|
|
ctrURL, _ = cmd.Flags().GetString(contractsURLFlag)
|
|
|
|
}
|
|
|
|
|
2022-11-23 14:44:03 +00:00
|
|
|
if err := checkNotaryEnabled(c); err != nil {
|
2021-11-30 11:57:58 +00:00
|
|
|
return nil, err
|
2021-08-19 10:27:43 +00:00
|
|
|
}
|
2021-07-29 13:35:57 +00:00
|
|
|
|
2023-03-23 06:18:44 +00:00
|
|
|
accounts, err := createWalletAccounts(wallets)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
2021-07-30 11:26:44 +00:00
|
|
|
}
|
|
|
|
|
2024-01-31 14:26:26 +00:00
|
|
|
cliCtx, err := morphUtil.DefaultClientContext(c, committeeAcc)
|
2022-09-05 12:45:38 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("client context: %w", err)
|
|
|
|
}
|
|
|
|
|
2021-07-19 11:04:19 +00:00
|
|
|
initCtx := &initializeContext{
|
2024-01-31 14:26:26 +00:00
|
|
|
ClientContext: *cliCtx,
|
2021-11-29 12:33:46 +00:00
|
|
|
ConsensusAcc: consensusAcc,
|
|
|
|
CommitteeAcc: committeeAcc,
|
|
|
|
ContractWallet: w,
|
|
|
|
Wallets: wallets,
|
|
|
|
Accounts: accounts,
|
|
|
|
Command: cmd,
|
|
|
|
Contracts: make(map[string]*contractState),
|
|
|
|
ContractPath: ctrPath,
|
2024-02-03 17:17:12 +00:00
|
|
|
ContractURL: ctrURL,
|
2021-07-19 11:04:19 +00:00
|
|
|
}
|
|
|
|
|
2021-10-25 13:19:56 +00:00
|
|
|
if needContracts {
|
|
|
|
err := initCtx.readContracts(fullContractList)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-19 11:04:19 +00:00
|
|
|
return initCtx, nil
|
|
|
|
}
|
|
|
|
|
2023-03-23 06:18:44 +00:00
|
|
|
func validateInit(cmd *cobra.Command) error {
|
|
|
|
if cmd.Name() != "init" {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
if viper.GetInt64(epochDurationInitFlag) <= 0 {
|
|
|
|
return fmt.Errorf("epoch duration must be positive")
|
|
|
|
}
|
|
|
|
|
|
|
|
if viper.GetInt64(maxObjectSizeInitFlag) <= 0 {
|
|
|
|
return fmt.Errorf("max object size must be positive")
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2024-01-31 14:26:26 +00:00
|
|
|
func createClient(cmd *cobra.Command, v *viper.Viper, wallets []*wallet.Wallet) (morphUtil.Client, error) {
|
|
|
|
var c morphUtil.Client
|
2023-03-23 06:18:44 +00:00
|
|
|
var err error
|
2023-07-10 08:03:02 +00:00
|
|
|
if ldf := cmd.Flags().Lookup(localDumpFlag); ldf != nil && ldf.Changed {
|
2024-01-31 14:26:26 +00:00
|
|
|
if cmd.Flags().Changed(morphUtil.EndpointFlag) {
|
|
|
|
return nil, fmt.Errorf("`%s` and `%s` flags are mutually exclusive", morphUtil.EndpointFlag, localDumpFlag)
|
2023-03-23 06:18:44 +00:00
|
|
|
}
|
2024-01-31 14:26:26 +00:00
|
|
|
c, err = morphUtil.NewLocalClient(cmd, v, wallets, ldf.Value.String())
|
2023-03-23 06:18:44 +00:00
|
|
|
} else {
|
2024-01-31 14:26:26 +00:00
|
|
|
c, err = morphUtil.GetN3Client(v)
|
2023-03-23 06:18:44 +00:00
|
|
|
}
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("can't create N3 client: %w", err)
|
|
|
|
}
|
|
|
|
return c, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func getWallet(cmd *cobra.Command, v *viper.Viper, needContracts bool, walletDir string) (*wallet.Wallet, error) {
|
|
|
|
if !needContracts {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
return openContractWallet(v, cmd, walletDir)
|
|
|
|
}
|
|
|
|
|
2023-04-26 08:24:40 +00:00
|
|
|
func getContractsPath(cmd *cobra.Command, needContracts bool) (string, error) {
|
2023-03-23 06:18:44 +00:00
|
|
|
if !needContracts {
|
|
|
|
return "", nil
|
|
|
|
}
|
|
|
|
|
|
|
|
ctrPath, err := cmd.Flags().GetString(contractsInitFlag)
|
|
|
|
if err != nil {
|
|
|
|
return "", fmt.Errorf("invalid contracts path: %w", err)
|
|
|
|
}
|
|
|
|
return ctrPath, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func createWalletAccounts(wallets []*wallet.Wallet) ([]*wallet.Account, error) {
|
|
|
|
accounts := make([]*wallet.Account, len(wallets))
|
|
|
|
for i, w := range wallets {
|
2024-02-01 06:58:12 +00:00
|
|
|
acc, err := morphUtil.GetWalletAccount(w, morphUtil.SingleAccountName)
|
2023-03-23 06:18:44 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("wallet %s is invalid (no single account): %w", w.Path(), err)
|
|
|
|
}
|
|
|
|
accounts[i] = acc
|
|
|
|
}
|
|
|
|
return accounts, nil
|
|
|
|
}
|
|
|
|
|
2021-07-19 11:04:19 +00:00
|
|
|
func (c *initializeContext) awaitTx() error {
|
2024-01-31 14:26:26 +00:00
|
|
|
return c.ClientContext.AwaitTx(c.Command)
|
2021-11-30 11:45:40 +00:00
|
|
|
}
|
|
|
|
|
2022-02-02 14:19:27 +00:00
|
|
|
func (c *initializeContext) nnsContractState() (*state.Contract, error) {
|
|
|
|
if c.nnsCs != nil {
|
|
|
|
return c.nnsCs, nil
|
|
|
|
}
|
|
|
|
|
2023-10-24 10:06:30 +00:00
|
|
|
r := management.NewReader(c.ReadOnlyInvoker)
|
|
|
|
cs, err := r.GetContractByID(1)
|
2022-02-02 14:19:27 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
c.nnsCs = cs
|
|
|
|
return cs, nil
|
|
|
|
}
|
|
|
|
|
2022-10-21 14:35:15 +00:00
|
|
|
func (c *initializeContext) getSigner(tryGroup bool, acc *wallet.Account) transaction.Signer {
|
2022-04-05 14:21:11 +00:00
|
|
|
if tryGroup && c.groupKey != nil {
|
2022-02-02 14:19:27 +00:00
|
|
|
return transaction.Signer{
|
2022-10-21 14:35:15 +00:00
|
|
|
Account: acc.Contract.ScriptHash(),
|
2022-02-02 14:19:27 +00:00
|
|
|
Scopes: transaction.CustomGroups,
|
|
|
|
AllowedGroups: keys.PublicKeys{c.groupKey},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
signer := transaction.Signer{
|
2022-10-21 14:35:15 +00:00
|
|
|
Account: acc.Contract.ScriptHash(),
|
2022-02-02 14:19:27 +00:00
|
|
|
Scopes: transaction.Global, // Scope is important, as we have nested call to container contract.
|
|
|
|
}
|
|
|
|
|
2022-04-05 14:21:11 +00:00
|
|
|
if !tryGroup {
|
|
|
|
return signer
|
|
|
|
}
|
|
|
|
|
2022-02-02 14:19:27 +00:00
|
|
|
nnsCs, err := c.nnsContractState()
|
|
|
|
if err != nil {
|
|
|
|
return signer
|
|
|
|
}
|
|
|
|
|
2022-09-05 12:45:38 +00:00
|
|
|
groupKey, err := nnsResolveKey(c.ReadOnlyInvoker, nnsCs.Hash, morphClient.NNSGroupKeyName)
|
2022-02-02 14:19:27 +00:00
|
|
|
if err == nil {
|
|
|
|
c.groupKey = groupKey
|
|
|
|
|
|
|
|
signer.Scopes = transaction.CustomGroups
|
|
|
|
signer.AllowedGroups = keys.PublicKeys{groupKey}
|
|
|
|
}
|
|
|
|
return signer
|
|
|
|
}
|
|
|
|
|
2022-10-24 12:07:39 +00:00
|
|
|
// sendCommitteeTx creates transaction from script, signs it by committee nodes and sends it to RPC.
|
2022-09-05 12:45:38 +00:00
|
|
|
// If tryGroup is false, global scope is used for the signer (useful when
|
|
|
|
// working with native contracts).
|
2022-08-29 19:31:32 +00:00
|
|
|
func (c *initializeContext) sendCommitteeTx(script []byte, tryGroup bool) error {
|
2022-10-21 14:35:15 +00:00
|
|
|
return c.sendMultiTx(script, tryGroup, false)
|
|
|
|
}
|
|
|
|
|
2022-10-24 12:07:39 +00:00
|
|
|
// sendConsensusTx creates transaction from script, signs it by alphabet nodes and sends it to RPC.
|
|
|
|
// Not that because this is used only after the contracts were initialized and deployed,
|
|
|
|
// we always try to have a group scope.
|
|
|
|
func (c *initializeContext) sendConsensusTx(script []byte) error {
|
|
|
|
return c.sendMultiTx(script, true, true)
|
|
|
|
}
|
|
|
|
|
2022-10-21 14:35:15 +00:00
|
|
|
func (c *initializeContext) sendMultiTx(script []byte, tryGroup bool, withConsensus bool) error {
|
2022-09-05 12:45:38 +00:00
|
|
|
var act *actor.Actor
|
|
|
|
var err error
|
|
|
|
|
2022-10-24 11:12:36 +00:00
|
|
|
withConsensus = withConsensus && !c.ConsensusAcc.Contract.ScriptHash().Equals(c.CommitteeAcc.ScriptHash())
|
2022-09-05 12:45:38 +00:00
|
|
|
if tryGroup {
|
2022-10-21 14:35:15 +00:00
|
|
|
// Even for consensus signatures we need the committee to pay.
|
|
|
|
signers := make([]actor.SignerAccount, 1, 2)
|
|
|
|
signers[0] = actor.SignerAccount{
|
|
|
|
Signer: c.getSigner(tryGroup, c.CommitteeAcc),
|
2022-09-05 12:45:38 +00:00
|
|
|
Account: c.CommitteeAcc,
|
2022-10-21 14:35:15 +00:00
|
|
|
}
|
|
|
|
if withConsensus {
|
|
|
|
signers = append(signers, actor.SignerAccount{
|
|
|
|
Signer: c.getSigner(tryGroup, c.ConsensusAcc),
|
|
|
|
Account: c.ConsensusAcc,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
act, err = actor.New(c.Client, signers)
|
2022-09-05 12:45:38 +00:00
|
|
|
} else {
|
2022-10-21 14:35:15 +00:00
|
|
|
if withConsensus {
|
|
|
|
panic("BUG: should never happen")
|
|
|
|
}
|
2022-09-05 12:45:38 +00:00
|
|
|
act, err = c.CommitteeAct, nil
|
2022-08-18 10:28:10 +00:00
|
|
|
}
|
|
|
|
if err != nil {
|
2022-08-29 19:31:32 +00:00
|
|
|
return fmt.Errorf("could not create actor: %w", err)
|
2022-08-18 10:28:10 +00:00
|
|
|
}
|
2021-07-20 12:08:47 +00:00
|
|
|
|
2022-09-05 12:45:38 +00:00
|
|
|
tx, err := act.MakeUnsignedRun(script, []transaction.Attribute{{Type: transaction.HighPriority}})
|
2022-04-07 08:10:35 +00:00
|
|
|
if err != nil {
|
2022-09-05 12:45:38 +00:00
|
|
|
return fmt.Errorf("could not perform test invocation: %w", err)
|
2022-04-07 08:10:35 +00:00
|
|
|
}
|
|
|
|
|
2024-02-01 06:58:12 +00:00
|
|
|
if err := c.multiSign(tx, morphUtil.CommitteeAccountName); err != nil {
|
2022-10-21 14:35:15 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
if withConsensus {
|
2024-01-31 14:26:26 +00:00
|
|
|
if err := c.multiSign(tx, morphUtil.ConsensusAccountName); err != nil {
|
2022-10-21 14:35:15 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-31 14:26:26 +00:00
|
|
|
return c.SendTx(tx, c.Command, false)
|
2021-07-19 11:04:19 +00:00
|
|
|
}
|
2021-11-30 11:57:58 +00:00
|
|
|
|
2024-01-31 14:26:26 +00:00
|
|
|
func checkNotaryEnabled(c morphUtil.Client) error {
|
2021-11-30 11:57:58 +00:00
|
|
|
ns, err := c.GetNativeContracts()
|
|
|
|
if err != nil {
|
2022-11-23 14:44:03 +00:00
|
|
|
return fmt.Errorf("can't get native contract hashes: %w", err)
|
2021-11-30 11:57:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
notaryEnabled := false
|
|
|
|
nativeHashes := make(map[string]util.Uint160, len(ns))
|
|
|
|
for i := range ns {
|
|
|
|
if ns[i].Manifest.Name == nativenames.Notary {
|
2023-12-06 08:57:04 +00:00
|
|
|
notaryEnabled = true
|
2021-11-30 11:57:58 +00:00
|
|
|
}
|
|
|
|
nativeHashes[ns[i].Manifest.Name] = ns[i].Hash
|
|
|
|
}
|
|
|
|
if !notaryEnabled {
|
2022-11-23 14:44:03 +00:00
|
|
|
return errors.New("notary contract must be enabled")
|
2021-11-30 11:57:58 +00:00
|
|
|
}
|
2022-11-23 14:44:03 +00:00
|
|
|
return nil
|
2021-11-30 11:57:58 +00:00
|
|
|
}
|