From da65be6ee2985590975d39790d1c7bd2e8c2ad04 Mon Sep 17 00:00:00 2001 From: tolya-yanot <1449561+tolya-yanot@users.noreply.github.com> Date: Tue, 30 Aug 2022 03:30:00 +0300 Subject: [PATCH] Fix DNS resolve in liteclient and tonlib --- crypto/block/block.tlb | 2 +- crypto/smc-envelope/ManualDns.cpp | 6 +++++- lite-client/lite-client.cpp | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/crypto/block/block.tlb b/crypto/block/block.tlb index dae517d4..788d2f96 100644 --- a/crypto/block/block.tlb +++ b/crypto/block/block.tlb @@ -814,7 +814,7 @@ vmc_pushint$1111 value:int32 next:^VmCont = VmCont; // // DNS RECORDS // -_ (HashmapE 256 DNSRecord) = DNS_RecordSet; +_ (HashmapE 256 ^DNSRecord) = DNS_RecordSet; chunk_ref$_ {n:#} ref:^(TextChunks (n + 1)) = TextChunkRef (n + 1); chunk_ref_empty$_ = TextChunkRef 0; diff --git a/crypto/smc-envelope/ManualDns.cpp b/crypto/smc-envelope/ManualDns.cpp index 8f5097c0..42d379c2 100644 --- a/crypto/smc-envelope/ManualDns.cpp +++ b/crypto/smc-envelope/ManualDns.cpp @@ -433,8 +433,12 @@ td::Result> ManualDns::resolve_raw_or_throw(td: } else { if (category.is_zero()) { vm::Dictionary dict(std::move(data), 256); - dict.check_for_each([&](auto cs, td::ConstBitPtr key, int n) { + dict.check_for_each([&](td::Ref cs, td::ConstBitPtr key, int n) { CHECK(n == 256); + if (cs.is_null() || cs->size_ext() != 0x10000) { + return true; + } + cs = vm::load_cell_slice_ref(cs->prefetch_ref()); vec.push_back({name.str(), td::Bits256(key), cs}); return true; }); diff --git a/lite-client/lite-client.cpp b/lite-client/lite-client.cpp index aad3ae6e..ecaa97bc 100644 --- a/lite-client/lite-client.cpp +++ b/lite-client/lite-client.cpp @@ -1812,10 +1812,11 @@ void TestNode::dns_resolve_finish(ton::WorkchainId workchain, ton::StdSmcAddress if (!dict.check_for_each([this, &out](Ref cs, td::ConstBitPtr key, int n) { CHECK(n == 256); td::Bits256 x{key}; - /*if (cs.is_null() || cs->size_ext() != 0x10000) { + if (cs.is_null() || cs->size_ext() != 0x10000) { out << "category " << x << " : value is not a reference" << std::endl; return true; - }*/ + } + cs = vm::load_cell_slice_ref(cs->prefetch_ref()); std::ostringstream os; (void)show_dns_record(os, x, cs, true); out << "category " << x << " : " << os.str() << std::endl;