From da8ec5b44721110a05fb9bacef57d0b608f975c4 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 25 Jan 2024 16:20:33 +0300 Subject: [PATCH] [#73] nns: Allow 2-byte domain names frostfs-node uses `.ns` domain, must be supported. Signed-off-by: Evgenii Stratonikov --- nns/nns_contract.go | 2 +- tests/nns_test.go | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/nns/nns_contract.go b/nns/nns_contract.go index 202a03d..6ef39d1 100644 --- a/nns/nns_contract.go +++ b/nns/nns_contract.go @@ -52,7 +52,7 @@ const ( // maxDomainNameFragmentLength is the maximum length of the domain name fragment. maxDomainNameFragmentLength = 63 // minDomainNameLength is minimum domain length. - minDomainNameLength = 3 + minDomainNameLength = 2 // maxDomainNameLength is maximum domain length. maxDomainNameLength = 255 // maxTXTRecordLength is the maximum length of the TXT domain record. diff --git a/tests/nns_test.go b/tests/nns_test.go index 7ee43ae..6eeb3b6 100644 --- a/tests/nns_test.go +++ b/tests/nns_test.go @@ -58,6 +58,16 @@ func TestNNSRegisterTLD(t *testing.T) { "com", acc.ScriptHash(), "email@frostfs.info", refresh, retry, expire, ttl) + t.Run("size checks", func(t *testing.T) { + c.Invoke(t, true, "register", + "ns", c.CommitteeHash, + "email@frostfs.info", refresh, retry, expire, ttl) + + c.InvokeFail(t, "invalid domain name format", "register", + "x", c.CommitteeHash, + "email@frostfs.info", refresh, retry, expire, ttl) + }) + c.Invoke(t, true, "register", "com", c.CommitteeHash, "email@frostfs.info", refresh, retry, expire, ttl)