[#73] nns: Allow 2-byte domain names

frostfs-node uses `.ns` domain, must be supported.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-01-25 16:20:33 +03:00
parent f2a82aa635
commit da8ec5b447
2 changed files with 11 additions and 1 deletions

View file

@ -52,7 +52,7 @@ const (
// maxDomainNameFragmentLength is the maximum length of the domain name fragment. // maxDomainNameFragmentLength is the maximum length of the domain name fragment.
maxDomainNameFragmentLength = 63 maxDomainNameFragmentLength = 63
// minDomainNameLength is minimum domain length. // minDomainNameLength is minimum domain length.
minDomainNameLength = 3 minDomainNameLength = 2
// maxDomainNameLength is maximum domain length. // maxDomainNameLength is maximum domain length.
maxDomainNameLength = 255 maxDomainNameLength = 255
// maxTXTRecordLength is the maximum length of the TXT domain record. // maxTXTRecordLength is the maximum length of the TXT domain record.

View file

@ -58,6 +58,16 @@ func TestNNSRegisterTLD(t *testing.T) {
"com", acc.ScriptHash(), "com", acc.ScriptHash(),
"email@frostfs.info", refresh, retry, expire, ttl) "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", c.Invoke(t, true, "register",
"com", c.CommitteeHash, "com", c.CommitteeHash,
"email@frostfs.info", refresh, retry, expire, ttl) "email@frostfs.info", refresh, retry, expire, ttl)