From e4dcc4d6a9cd0c8c2b1fe116a0b3e88adff6b5da Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 5 Sep 2022 13:04:24 +0300 Subject: [PATCH] [#1749] neofs-adm: Register contract hashes in NNS in 2 formats NNS proposal describes string N3 address format, however we must also have hex-string for backwards compatibility. Signed-off-by: Evgenii Stratonikov --- cmd/neofs-adm/internal/modules/morph/initialize_deploy.go | 3 +++ cmd/neofs-adm/internal/modules/morph/initialize_nns.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go b/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go index 199b55aff..eb270b8f3 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go @@ -15,6 +15,7 @@ import ( "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/encoding/address" 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" @@ -276,6 +277,8 @@ func (c *initializeContext) updateContracts() error { emit.AppCall(w.BinWriter, nnsHash, "deleteRecords", callflag.All, domain, int64(nns.TXT)) emit.AppCall(w.BinWriter, nnsHash, "addRecord", callflag.All, domain, int64(nns.TXT), cs.Hash.StringLE()) + emit.AppCall(w.BinWriter, nnsHash, "addRecord", callflag.All, + domain, int64(nns.TXT), address.Uint160ToString(cs.Hash)) } c.Command.Printf("NNS: Set %s -> %s\n", domain, cs.Hash.StringLE()) } diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_nns.go b/cmd/neofs-adm/internal/modules/morph/initialize_nns.go index ad355ce3d..9e8a97cc8 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize_nns.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize_nns.go @@ -197,6 +197,8 @@ func (c *initializeContext) nnsRegisterDomain(nnsHash, expectedHash util.Uint160 emit.AppCall(w.BinWriter, nnsHash, "deleteRecords", callflag.All, domain, int64(nns.TXT)) emit.AppCall(w.BinWriter, nnsHash, "addRecord", callflag.All, domain, int64(nns.TXT), expectedHash.StringLE()) + emit.AppCall(w.BinWriter, nnsHash, "addRecord", callflag.All, + domain, int64(nns.TXT), address.Uint160ToString(expectedHash)) return c.sendCommitteeTx(w.Bytes(), -1, true) }