diff --git a/cmd/neofs-adm/internal/modules/morph/verified_domains.go b/cmd/neofs-adm/internal/modules/morph/verified_domains.go index 9f53cd480b3..a32a42e3dc9 100644 --- a/cmd/neofs-adm/internal/modules/morph/verified_domains.go +++ b/cmd/neofs-adm/internal/modules/morph/verified_domains.go @@ -16,6 +16,9 @@ import ( "github.com/spf13/viper" ) +// as described in NEP-18 Specification https://github.com/neo-project/proposals/pull/133 +const nnsNeoAddressTextRecordPrefix = "address=" + func verifiedNodesDomainAccessList(cmd *cobra.Command, _ []string) error { vpr := viper.GetViper() @@ -49,7 +52,13 @@ func verifiedNodesDomainAccessList(cmd *cobra.Command, _ []string) error { } for i := range records { - cmd.Println(records[i]) + neoAddr := strings.TrimPrefix(records[i], nnsNeoAddressTextRecordPrefix) + if len(neoAddr) == len(records[i]) { + cmd.Printf("%s (not a Neo address)\n", records[i]) + continue + } + + cmd.Println(neoAddr) } return nil @@ -85,9 +94,9 @@ func verifiedNodesDomainSetAccessList(cmd *cobra.Command, _ []string) error { if err != nil { return fmt.Errorf("address #%d is invalid: %w", i, err) } - } - additionalRecords = strNeoAddresses + additionalRecords = append(additionalRecords, nnsNeoAddressTextRecordPrefix+strNeoAddresses[i]) + } } else { additionalRecords = make([]string, len(strPublicKeys)) @@ -103,7 +112,7 @@ func verifiedNodesDomainSetAccessList(cmd *cobra.Command, _ []string) error { return fmt.Errorf("public key #%d is not a HEX-encoded public key: %w", i, err) } - additionalRecords[i] = address.Uint160ToString(pubKey.GetScriptHash()) + additionalRecords[i] = nnsNeoAddressTextRecordPrefix + address.Uint160ToString(pubKey.GetScriptHash()) } } diff --git a/docs/verified-node-domains.md b/docs/verified-node-domains.md index 01d69194225..447a20015a4 100644 --- a/docs/verified-node-domains.md +++ b/docs/verified-node-domains.md @@ -28,7 +28,7 @@ the network map. For each public key, a record is created - a structure with at least 3 fields: 1. `ByteString` with name of the corresponding domain 2. `Integer` that is `16` for TXT records (other record types are allowed but left unprocessed) -3. `ByteString` with Neo address of the storage node's public key +3. `ByteString` with `address=` value described in [NEP-18 Specification](https://github.com/neo-project/proposals/pull/133) ### Management diff --git a/pkg/innerring/processors/netmap/nodevalidation/privatedomains/validator.go b/pkg/innerring/processors/netmap/nodevalidation/privatedomains/validator.go index c8ab674f325..2e6ef926934 100644 --- a/pkg/innerring/processors/netmap/nodevalidation/privatedomains/validator.go +++ b/pkg/innerring/processors/netmap/nodevalidation/privatedomains/validator.go @@ -77,7 +77,8 @@ func (x *Validator) VerifyAndUpdate(info *netmap.NodeInfo) error { emit.CheckSig(buf.BinWriter, bNodeKey) nodeNeoAddress := address.Uint160ToString(hash.Hash160(buf.Bytes())) - err := x.nns.CheckDomainRecord(verifiedNodesDomain, nodeNeoAddress) + // record format is described in NEP-18 Specification https://github.com/neo-project/proposals/pull/133 + err := x.nns.CheckDomainRecord(verifiedNodesDomain, "address="+nodeNeoAddress) if err != nil { if errors.Is(err, ErrMissingDomainRecord) { return errAccessDenied diff --git a/pkg/innerring/processors/netmap/nodevalidation/privatedomains/validator_test.go b/pkg/innerring/processors/netmap/nodevalidation/privatedomains/validator_test.go index 74d7d5bcb89..a3d70b22042 100644 --- a/pkg/innerring/processors/netmap/nodevalidation/privatedomains/validator_test.go +++ b/pkg/innerring/processors/netmap/nodevalidation/privatedomains/validator_test.go @@ -75,8 +75,8 @@ func (x *testNNS) CheckDomainRecord(domainName string, record string) error { func TestValidator_VerifyAndUpdate(t *testing.T) { const verifiedDomain = "nodes.some-org.neofs" const hNodeKey = "02a70577a832b338772c8cd07e7eaf526cae8d9b025a51b41671de5a4363eafe07" - const nodeNeoAddress = "NZ1czz5gkEDamTg6Tiw6cxqp9Me1KLs8ae" - const anyOtherNeoAddress = "NfMvD6WmBiCr4erfEnFFLs7jdj4Y5CM7nN" + const nodeNeoAddress = "address=NZ1czz5gkEDamTg6Tiw6cxqp9Me1KLs8ae" + const anyOtherNeoAddress = "address=NfMvD6WmBiCr4erfEnFFLs7jdj4Y5CM7nN" bNodeKey, err := hex.DecodeString(hNodeKey) require.NoError(t, err)