nns: Allow 2-byte domain names #73

Merged
fyrchik merged 1 commit from fyrchik/frostfs-contract:fix-nns into master 2024-01-25 16:13:05 +00:00
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)