From 16fd3243abe62d90186d341813d106ee5bc8b406 Mon Sep 17 00:00:00 2001 From: Alexander Chuprov Date: Tue, 5 Nov 2024 13:56:18 +0300 Subject: [PATCH] [#99999] nns: Fix CM compatibility Signed-off-by: Alexander Chuprov --- nns/nns_contract.go | 3 +++ tests/nns_test.go | 1 + 2 files changed, 4 insertions(+) diff --git a/nns/nns_contract.go b/nns/nns_contract.go index 9df2d18..816f56c 100644 --- a/nns/nns_contract.go +++ b/nns/nns_contract.go @@ -239,6 +239,9 @@ func IsAvailable(name string) bool { ctx := storage.GetReadOnlyContext() l := len(fragments) if storage.Get(ctx, append([]byte{prefixRoot}, []byte(fragments[l-1])...)) == nil { + if l != 1 { + panic("panic should not happen") + } return true } diff --git a/tests/nns_test.go b/tests/nns_test.go index f19a448..51450bb 100644 --- a/tests/nns_test.go +++ b/tests/nns_test.go @@ -588,6 +588,7 @@ func TestNNSIsAvailable(t *testing.T) { c := newNNSInvoker(t, false) c.Invoke(t, true, "isAvailable", "com") + c.InvokeFail(t, "panic should not happen", "isAvailable", "aa.domain.zk") refresh, retry, expire, ttl := int64(101), int64(102), int64(103), int64(104) c.Invoke(t, true, "register",