Skip to content

Commit 0439613

Browse files
authored
Merge pull request #1543 from ton-blockchain/testnet
Merge developer branch
2 parents 2a68c86 + cf50b4b commit 0439613

File tree

184 files changed

+6850
-2221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+6850
-2221
lines changed

.github/workflows/docker-ubuntu-branch-image.yml

+15-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ jobs:
2020
submodules: 'recursive'
2121

2222
- name: Set up QEMU
23-
uses: docker/setup-qemu-action@v3
23+
uses: docker/setup-qemu-action@v3.5.0
2424

2525
- name: Set up Docker Buildx
26-
uses: docker/setup-buildx-action@v3
26+
uses: docker/[email protected]
27+
with:
28+
driver-opts: image=moby/buildkit:v0.11.0
2729

2830
- name: Login to GitHub Container Registry
2931
uses: docker/login-action@v3
@@ -32,6 +34,17 @@ jobs:
3234
username: ${{ github.repository_owner }}
3335
password: ${{ secrets.GITHUB_TOKEN }}
3436

37+
- name: Build and export to Docker
38+
uses: docker/build-push-action@v6
39+
with:
40+
load: true
41+
context: ./
42+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:test
43+
44+
- name: Test
45+
run: |
46+
docker run --rm -e "TEST=1" ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:test
47+
3548
- name: Get tag as branch name
3649
id: tag
3750
run: |

.github/workflows/docker-ubuntu-image.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
submodules: 'recursive'
2121

2222
- name: Set up QEMU
23-
uses: docker/setup-qemu-action@v3
24-
23+
uses: docker/setup-qemu-action@v3.5.0
24+
2525
- name: Set up Docker Buildx
26-
uses: docker/setup-buildx-action@v3
26+
uses: docker/setup-buildx-action@v3.10.0
2727

2828
- name: Login to GitHub Container Registry
2929
uses: docker/login-action@v3

Changelog.md

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## 2025.03 Update
2+
1. New extracurrency behavior introduced, check [GlobalVersions.md](./doc/GlobalVersions.md#version-10)
3+
2. Optmization of validation process, in particular CellStorageStat.
4+
3. Flag for speeding up broadcasts in various overlays.
5+
4. Fixes for static builds for emulator and tonlibjson
6+
5. Improving getstats output: adds
7+
* Liteserver queries count
8+
* Collated/validated blocks count, number of active sessions
9+
* Persistent state sizes
10+
* Initial sync progress
11+
6. Fixes in logging, TON Storage, external message checking, persistent state downloading, UB in tonlib
12+
13+
Besides the work of the core team, this update is based on the efforts of @Sild from StonFi(UB in tonlib).
14+
115
## 2025.02 Update
216
1. Series of improvement/fixes for `Config8.version >= 9`, check [GlobalVersions.md](./doc/GlobalVersions.md)
317
2. Fix for better discovery of updated nodes' (validators') IPs: retry dht queries

Dockerfile

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
FROM ubuntu:22.04 AS builder
2+
ARG DEBIAN_FRONTEND=noninteractive
23
RUN apt-get update && \
3-
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake clang openssl libssl-dev zlib1g-dev gperf wget git ninja-build libsodium-dev libmicrohttpd-dev liblz4-dev pkg-config autoconf automake libtool libjemalloc-dev lsb-release software-properties-common gnupg
4+
rm /var/lib/dpkg/info/libc-bin.* && \
5+
apt-get clean && \
6+
apt-get update && \
7+
apt install libc-bin && \
8+
apt-get install -y build-essential cmake clang openssl libssl-dev zlib1g-dev gperf wget git \
9+
ninja-build libsodium-dev libmicrohttpd-dev liblz4-dev pkg-config autoconf automake libtool \
10+
libjemalloc-dev lsb-release software-properties-common gnupg
411

512
RUN wget https://apt.llvm.org/llvm.sh && \
613
chmod +x llvm.sh && \
@@ -25,6 +32,7 @@ RUN mkdir build && \
2532
blockchain-explorer emulator tonlibjson http-proxy adnl-proxy
2633

2734
FROM ubuntu:22.04
35+
ARG DEBIAN_FRONTEND=noninteractive
2836
RUN apt-get update && \
2937
apt-get install -y wget curl libatomic1 openssl libsodium-dev libmicrohttpd-dev liblz4-dev libjemalloc-dev htop \
3038
net-tools netcat iptraf-ng jq tcpdump pv plzip && \

catchain/catchain-receiver.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -526,10 +526,12 @@ void CatChainReceiverImpl::start_up() {
526526
for (td::uint32 i = 0; i < get_sources_cnt(); i++) {
527527
root_keys.emplace(get_source(i)->get_hash(), OVERLAY_MAX_ALLOWED_PACKET_SIZE);
528528
}
529-
td::actor::send_closure(overlay_manager_, &overlay::Overlays::create_private_overlay,
529+
overlay::OverlayOptions overlay_options;
530+
overlay_options.broadcast_speed_multiplier_ = opts_.broadcast_speed_multiplier;
531+
td::actor::send_closure(overlay_manager_, &overlay::Overlays::create_private_overlay_ex,
530532
get_source(local_idx_)->get_adnl_id(), overlay_full_id_.clone(), std::move(ids),
531533
make_callback(), overlay::OverlayPrivacyRules{0, 0, std::move(root_keys)},
532-
R"({ "type": "catchain" })");
534+
R"({ "type": "catchain" })", std::move(overlay_options));
533535

534536
CHECK(root_block_);
535537

common/global-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
namespace ton {
2020

2121
// See doc/GlobalVersions.md
22-
const int SUPPORTED_VERSION = 9;
22+
constexpr int SUPPORTED_VERSION = 10;
2323

2424
}

crypto/block/block.cpp

+33-3
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ MsgProcessedUptoCollection::MsgProcessedUptoCollection(ton::ShardIdFull _owner,
360360
z.shard = key.get_uint(64);
361361
z.mc_seqno = (unsigned)((key + 64).get_uint(32));
362362
z.last_inmsg_lt = value.write().fetch_ulong(64);
363-
// std::cerr << "ProcessedUpto shard " << std::hex << z.shard << std::dec << std::endl;
364363
return value.write().fetch_bits_to(z.last_inmsg_hash) && z.shard && ton::shard_contains(owner.shard, z.shard);
365364
});
366365
}
@@ -862,8 +861,10 @@ td::Status ShardState::unpack_out_msg_queue_info(Ref<vm::Cell> out_msg_queue_inf
862861
out_msg_queue_ =
863862
std::make_unique<vm::AugmentedDictionary>(std::move(qinfo.out_queue), 352, block::tlb::aug_OutMsgQueue);
864863
if (verbosity >= 3 * 1) {
865-
LOG(DEBUG) << "unpacking ProcessedUpto of our previous block " << id_.to_str();
866-
block::gen::t_ProcessedInfo.print(std::cerr, qinfo.proc_info);
864+
FLOG(DEBUG) {
865+
sb << "unpacking ProcessedUpto of our previous block " << id_.to_str();
866+
block::gen::t_ProcessedInfo.print(sb, qinfo.proc_info);
867+
};
867868
}
868869
if (!block::gen::t_ProcessedInfo.validate_csr(1024, qinfo.proc_info)) {
869870
return td::Status::Error(
@@ -1349,6 +1350,35 @@ bool CurrencyCollection::clamp(const CurrencyCollection& other) {
13491350
return ok || invalidate();
13501351
}
13511352

1353+
bool CurrencyCollection::check_extra_currency_limit(td::uint32 max_currencies) const {
1354+
td::uint32 count = 0;
1355+
return vm::Dictionary{extra, 32}.check_for_each([&](td::Ref<vm::CellSlice>, td::ConstBitPtr, int) {
1356+
++count;
1357+
return count <= max_currencies;
1358+
});
1359+
}
1360+
1361+
bool CurrencyCollection::remove_zero_extra_currencies(Ref<vm::Cell>& root, td::uint32 max_currencies) {
1362+
td::uint32 count = 0;
1363+
vm::Dictionary dict{root, 32};
1364+
int res = dict.filter([&](const vm::CellSlice& cs, td::ConstBitPtr, int) -> int {
1365+
++count;
1366+
if (count > max_currencies) {
1367+
return -1;
1368+
}
1369+
td::RefInt256 val = tlb::t_VarUInteger_32.as_integer(cs);
1370+
if (val.is_null()) {
1371+
return -1;
1372+
}
1373+
return val->sgn() > 0;
1374+
});
1375+
if (res < 0) {
1376+
return false;
1377+
}
1378+
root = dict.get_root_cell();
1379+
return true;
1380+
}
1381+
13521382
bool CurrencyCollection::operator==(const CurrencyCollection& other) const {
13531383
return is_valid() && other.is_valid() && !td::cmp(grams, other.grams) &&
13541384
(extra.not_null() == other.extra.not_null()) &&

crypto/block/block.h

+2
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,8 @@ struct CurrencyCollection {
391391
CurrencyCollection operator-(CurrencyCollection&& other) const;
392392
CurrencyCollection operator-(td::RefInt256 other_grams) const;
393393
bool clamp(const CurrencyCollection& other);
394+
bool check_extra_currency_limit(td::uint32 max_currencies) const;
395+
static bool remove_zero_extra_currencies(Ref<vm::Cell>& root, td::uint32 max_currencies);
394396
bool store(vm::CellBuilder& cb) const;
395397
bool store_or_zero(vm::CellBuilder& cb) const;
396398
bool fetch(vm::CellSlice& cs);

crypto/block/block.tlb

+1-1
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ size_limits_config#01 max_msg_bits:uint32 max_msg_cells:uint32 max_library_cells
801801
max_ext_msg_size:uint32 max_ext_msg_depth:uint16 = SizeLimitsConfig;
802802
size_limits_config_v2#02 max_msg_bits:uint32 max_msg_cells:uint32 max_library_cells:uint32 max_vm_data_depth:uint16
803803
max_ext_msg_size:uint32 max_ext_msg_depth:uint16 max_acc_state_cells:uint32 max_acc_state_bits:uint32
804-
max_acc_public_libraries:uint32 defer_out_queue_size_limit:uint32 = SizeLimitsConfig;
804+
max_acc_public_libraries:uint32 defer_out_queue_size_limit:uint32 max_msg_extra_currencies:uint32 = SizeLimitsConfig;
805805
_ SizeLimitsConfig = ConfigParam 43;
806806

807807
// key is [ wc:int32 addr:uint256 ]

crypto/block/mc-config.cpp

+10-5
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,11 @@ td::Status ConfigInfo::unpack() {
163163
}
164164
gen::McStateExtra::Record extra_info;
165165
if (!tlb::unpack_cell(state_extra_root_, extra_info)) {
166-
vm::load_cell_slice(state_extra_root_).print_rec(std::cerr);
167-
block::gen::t_McStateExtra.print_ref(std::cerr, state_extra_root_);
166+
FLOG(WARNING) {
167+
sb << "state extra information is invalid: ";
168+
vm::load_cell_slice(state_extra_root_).print_rec(sb);
169+
block::gen::t_McStateExtra.print_ref(sb, state_extra_root_);
170+
};
168171
return td::Status::Error("state extra information is invalid");
169172
}
170173
gen::ValidatorInfo::Record validator_info;
@@ -1067,7 +1070,6 @@ Ref<McShardHash> ShardConfig::get_shard_hash(ton::ShardIdFull id, bool exact) co
10671070
ton::ShardIdFull true_id;
10681071
vm::CellSlice cs;
10691072
if (get_shard_hash_raw(cs, id, true_id, exact)) {
1070-
// block::gen::t_ShardDescr.print(std::cerr, vm::CellSlice{cs});
10711073
return McShardHash::unpack(cs, true_id);
10721074
} else {
10731075
return {};
@@ -1637,8 +1639,10 @@ bool ShardConfig::set_shard_info(ton::ShardIdFull shard, Ref<vm::Cell> value) {
16371639
if (!gen::t_BinTree_ShardDescr.validate_ref(1024, value)) {
16381640
LOG(ERROR) << "attempting to store an invalid (BinTree ShardDescr) at shard configuration position "
16391641
<< shard.to_str();
1640-
gen::t_BinTree_ShardDescr.print_ref(std::cerr, value);
1641-
vm::load_cell_slice(value).print_rec(std::cerr);
1642+
FLOG(WARNING) {
1643+
gen::t_BinTree_ShardDescr.print_ref(sb, value);
1644+
vm::load_cell_slice(value).print_rec(sb);
1645+
};
16421646
return false;
16431647
}
16441648
auto root = shard_hashes_dict_->lookup_ref(td::BitArray<32>{shard.workchain});
@@ -1956,6 +1960,7 @@ td::Result<SizeLimitsConfig> Config::do_get_size_limits_config(td::Ref<vm::CellS
19561960
limits.max_acc_state_cells = rec.max_acc_state_cells;
19571961
limits.max_acc_public_libraries = rec.max_acc_public_libraries;
19581962
limits.defer_out_queue_size_limit = rec.defer_out_queue_size_limit;
1963+
limits.max_msg_extra_currencies = rec.max_msg_extra_currencies;
19591964
};
19601965
gen::SizeLimitsConfig::Record_size_limits_config rec_v1;
19611966
gen::SizeLimitsConfig::Record_size_limits_config_v2 rec_v2;

crypto/block/mc-config.h

+1
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ struct SizeLimitsConfig {
397397
td::uint32 max_acc_state_bits = (1 << 16) * 1023;
398398
td::uint32 max_acc_public_libraries = 256;
399399
td::uint32 defer_out_queue_size_limit = 256;
400+
td::uint32 max_msg_extra_currencies = 2;
400401
};
401402

402403
struct CatchainValidatorsConfig {

crypto/block/output-queue-merger.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ bool OutputQueueMerger::add_root(int src, Ref<vm::Cell> outmsg_root) {
138138
if (outmsg_root.is_null()) {
139139
return true;
140140
}
141-
//block::gen::HashmapAug{352, block::gen::t_EnqueuedMsg, block::gen::t_uint64}.print_ref(std::cerr, outmsg_root);
142141
auto kv = std::make_unique<MsgKeyValue>(src, std::move(outmsg_root));
143142
if (kv->replace_by_prefix(common_pfx.cbits(), common_pfx_len)) {
144143
heap.push_back(std::move(kv));

0 commit comments

Comments
 (0)