Compare commits

...

7 commits

Author SHA1 Message Date
Evgenii Stratonikov
1231db87b5 do fix price trick
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
2022-08-18 11:27:15 +03:00
Evgenii Stratonikov
9a91ec4c5b m
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
2022-08-18 11:20:25 +03:00
Evgenii Stratonikov
bfabbb7968 renew neofs TLD
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
2022-08-17 19:22:28 +03:00
Evgenii Stratonikov
f9ff3adef2 neofs-adm: remove neofs contract
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
2022-08-17 19:01:31 +03:00
Evgenii Stratonikov
44bf2e8d06 neofs-adm: set hardcode nns hashes
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
2022-08-17 18:30:50 +03:00
Alex Vanin
bd3f43cdeb Disable things in notary disabled environment
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-08-17 18:30:49 +03:00
Alex Vanin
a01b05a09c Disable things in notary disabled environment
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-08-17 18:29:34 +03:00
7 changed files with 92 additions and 14 deletions

View file

@ -38,7 +38,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 {

View file

@ -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"
@ -414,16 +413,16 @@ func getNativeHashes(c 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
}

View file

@ -18,7 +18,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
io2 "github.com/nspcc-dev/neo-go/pkg/io"
"github.com/nspcc-dev/neo-go/pkg/rpcclient"
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/manifest"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/nef"
@ -70,7 +69,6 @@ var (
containerContract,
neofsIDContract,
netmapContract,
proxyContract,
reputationContract,
subnetContract,
}
@ -521,14 +519,14 @@ func getContractDeployParameters(cs *contractState, deployData []interface{}) []
func (c *initializeContext) getContractDeployData(ctrName string, keysParam []interface{}) []interface{} {
items := make([]interface{}, 1, 6)
items[0] = false // notaryDisabled is false
items[0] = true // notaryDisabled is false
switch ctrName {
case neofsContract:
items = append(items,
c.Contracts[processingContract].Hash,
keysParam,
smartcontract.Parameter{})
[]interface{}{})
case processingContract:
items = append(items, c.Contracts[neofsContract].Hash)
return items[1:] // no notary info
@ -588,7 +586,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)

View file

@ -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.")

View file

@ -135,6 +135,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)

View file

@ -188,6 +188,16 @@ var (
RunE: updateContracts,
}
hardcodeNNSCmd = &cobra.Command{
Use: "hardcode-nns",
Short: "FIX for mainnet update",
PreRun: func(cmd *cobra.Command, _ []string) {
_ = viper.BindPFlag(alphabetWalletsFlag, cmd.Flags().Lookup(alphabetWalletsFlag))
_ = viper.BindPFlag(endpointFlag, cmd.Flags().Lookup(endpointFlag))
},
RunE: hardcodeNNS,
}
dumpContainersCmd = &cobra.Command{
Use: "dump-containers",
Short: "Dump NeoFS containers to file",
@ -274,6 +284,10 @@ func init() {
dumpBalancesCmd.Flags().BoolP(dumpBalancesProxyFlag, "p", false, "dump balances of the proxy contract")
dumpBalancesCmd.Flags().Bool(dumpBalancesUseScriptHashFlag, false, "use script-hash format for addresses")
RootCmd.AddCommand(hardcodeNNSCmd)
hardcodeNNSCmd.Flags().String(alphabetWalletsFlag, "", "path to alphabet wallets dir")
hardcodeNNSCmd.Flags().StringP(endpointFlag, "r", "", "N3 RPC node endpoint")
RootCmd.AddCommand(updateContractsCmd)
updateContractsCmd.Flags().String(alphabetWalletsFlag, "", "path to alphabet wallets dir")
updateContractsCmd.Flags().StringP(endpointFlag, "r", "", "N3 RPC node endpoint")

View file

@ -3,6 +3,11 @@ package morph
import (
"fmt"
"github.com/nspcc-dev/neo-go/pkg/io"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neo-go/pkg/vm/emit"
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
@ -19,3 +24,63 @@ func updateContracts(cmd *cobra.Command, _ []string) error {
return wCtx.updateContracts()
}
func hardcodeNNS(cmd *cobra.Command, _ []string) error {
c, err := newInitializeContext(cmd, viper.GetViper())
if err != nil {
return fmt.Errorf("initialization error: %w", err)
}
nnsCs, err := c.Client.GetContractStateByID(1)
if err != nil {
panic(err)
}
/* FIX for mainnet, set hardcoded hashes. */
hashes := map[string]string{
//"neofs.neofs": "2cafa46838e8b564468ebd868dcafdd99dce6221",
"audit.neofs": "85fe181f4aa3cbdc94023d97c69001ece0730398",
"balance.neofs": "dc1ec98d9d0c5f9dfade16144defe08cffc5ca55",
"container.neofs": "1b6e68d299b570e1cb7e86eadfdc06aa2e8e0cc5",
"neofsid.neofs": "0a64ce753653cc97c0467e1334d9d3678ca8c682",
"netmap.neofs": "7c5bdb23e36cc7cce95bf42f3ab9e452c2501df1",
"reputation.neofs": "7ad824fd1eeb1565be2cee3889214b9aa605d2fc",
/* "az": */ getAlphabetNNSDomain(0): "2392438eb31100857c0f161c66791872b249aa13",
/* "buky": */ getAlphabetNNSDomain(1): "83ef4226d5d6519ca9c99a5de13b1b5ca223a6ad",
/* "vedi": */ getAlphabetNNSDomain(2): "6250927beaa9aa5a00171379dcb7187b0c91d17d",
/* "glagoli": */ getAlphabetNNSDomain(3): "1d6a2519ba41a139b2ced1bfd5013938271a7578",
/* "dobro": */ getAlphabetNNSDomain(4): "b65fc7a3c31cf57a90d7eb1c0e9909e4ca69133c",
/* "yest": */ getAlphabetNNSDomain(5): "f95b6ff8cd3b027c9911c18115518ad8c5d2f591",
/* "zhivete": */ getAlphabetNNSDomain(6): "5b17c579bf56884fd68af152432b3b5aee7aee76",
}
w := io.NewBufBinWriter()
emit.AppCall(w.BinWriter, nnsCs.Hash, "setPrice", callflag.All, 1)
for name, sh := range hashes {
h, err := util.Uint160DecodeStringLE(sh)
if err != nil {
return fmt.Errorf("invalid hash: %s", sh)
}
cs, err := c.Client.GetContractStateByHash(h)
if err != nil || cs.Hash != h {
return fmt.Errorf("contract %s should have hash %s, but: %w", name, sh, err)
}
c.Command.Printf("Domain %s will be registered again\n", name)
emit.AppCall(w.BinWriter, nnsCs.Hash, "register", callflag.All,
name, c.CommitteeAcc.Contract.ScriptHash(),
"ops@nspcc.ru", int64(3600), int64(600), int64(604800), int64(3600))
emit.Opcodes(w.BinWriter, opcode.ASSERT)
//emit.AppCall(w.BinWriter, nnsCs.Hash, "addRecord", callflag.All,
// name, int64(nns.TXT), h.StringLE())
//c.Command.Printf("NNS: Set %s -> %s\n", name, h.StringLE())
}
emit.AppCall(w.BinWriter, nnsCs.Hash, "setPrice", callflag.All, 10_0000_0000)
if w.Err != nil {
panic(w.Err)
}
if err := c.sendCommitteeTx(w.Bytes(), -1, false); err != nil {
return err
}
return c.awaitTx()
}