Skip to content

Commit c8b90a7

Browse files
committed
Merge branch 'testnet' into archive-sync
2 parents 4c809de + 5c2461b commit c8b90a7

40 files changed

+449
-323
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
push:
66
branches:
77
- 'master'
8-
98
env:
109
REGISTRY: ghcr.io
1110
IMAGE_NAME: ${{ github.repository }}

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ endif()
7777

7878
if (WIN32)
7979
message("Add wingetopt")
80-
add_subdirectory(third-party/wingetopt EXCLUDE_FROM_ALL)
80+
function(wingetopt_scope)
81+
set(CMAKE_POLICY_VERSION_MINIMUM "3.10")
82+
add_subdirectory(third-party/wingetopt EXCLUDE_FROM_ALL)
83+
endfunction()
84+
wingetopt_scope()
8185
set(WINGETOPT_FOUND 1)
82-
message(STATUS "Use wingetopt")
8386
endif()
8487

8588
set(CRC32C_BUILD_TESTS OFF CACHE BOOL "Build CRC32C's unit tests")

adnl/adnl-ext-server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ td::Status AdnlInboundConnection::process_packet(td::BufferSlice data) {
3131
td::PromiseCreator::lambda([SelfId = actor_id(this), query_id = f->query_id_](td::Result<td::BufferSlice> R) {
3232
if (R.is_error()) {
3333
auto S = R.move_as_error();
34-
LOG(WARNING) << "failed ext query: " << S;
34+
LOG(INFO) << "failed ext query: " << S;
3535
} else {
3636
auto B = create_tl_object<ton_api::adnl_message_answer>(query_id, R.move_as_ok());
3737
td::actor::send_closure(SelfId, &AdnlInboundConnection::send, serialize_tl_object(B, true));

adnl/adnl-peer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,11 +598,11 @@ void AdnlPeerPairImpl::process_message(const adnlmessage::AdnlMessagePart &messa
598598
respond_with_nop();
599599
auto size = message.total_size();
600600
if (size > huge_packet_max_size()) {
601-
VLOG(ADNL_WARNING) << this << ": dropping too big huge message: size=" << size;
601+
VLOG(ADNL_INFO) << this << ": dropping too big huge message: size=" << size;
602602
return;
603603
}
604604
if (message.hash().is_zero()) {
605-
VLOG(ADNL_WARNING) << this << ": dropping huge message with zero hash";
605+
VLOG(ADNL_INFO) << this << ": dropping huge message with zero hash";
606606
return;
607607
}
608608
if (message.hash() != huge_message_hash_) {

assembly/native/build-macos-portable.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ git clone https://github.com/lz4/lz4.git ../3pp/lz4
5555
cd ../3pp/lz4
5656
lz4Path=`pwd`
5757
git checkout v1.9.4
58-
make -j$(nproc)
58+
make -j4
5959
test $? -eq 0 || { echo "Can't compile lz4"; exit 1; }
6060
cd ../../build
6161
# ./lib/liblz4.a
@@ -73,7 +73,7 @@ if [ ! -d "../3pp/libsodium" ]; then
7373
git checkout 1.0.18
7474
./autogen.sh
7575
./configure --with-pic --enable-static
76-
make -j$(nproc)
76+
make -j4
7777
test $? -eq 0 || { echo "Can't compile libsodium"; exit 1; }
7878
cd ../../build
7979
else
@@ -87,7 +87,7 @@ if [ ! -d "../3pp/openssl_3" ]; then
8787
opensslPath=`pwd`
8888
git checkout openssl-3.1.4
8989
./config
90-
make build_libs -j$(nproc)
90+
make build_libs -j4
9191
test $? -eq 0 || { echo "Can't compile openssl_3"; exit 1; }
9292
cd ../../build
9393
else
@@ -100,7 +100,7 @@ if [ ! -d "../3pp/zlib" ]; then
100100
cd ../3pp/zlib
101101
zlibPath=`pwd`
102102
./configure --static
103-
make -j$(nproc)
103+
make -j4
104104
test $? -eq 0 || { echo "Can't compile zlib"; exit 1; }
105105
cd ../../build
106106
else
@@ -116,7 +116,7 @@ if [ ! -d "../3pp/libmicrohttpd" ]; then
116116
cd libmicrohttpd-1.0.1
117117
libmicrohttpdPath=`pwd`
118118
./configure --enable-static --disable-tests --disable-benchmark --disable-shared --disable-https --with-pic
119-
make -j$(nproc)
119+
make -j4
120120
test $? -eq 0 || { echo "Can't compile libmicrohttpd"; exit 1; }
121121
cd ../../../build
122122
else

assembly/native/build-macos-shared.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ if [ ! -d "lz4" ]; then
5353
cd lz4
5454
lz4Path=`pwd`
5555
git checkout v1.9.4
56-
make -j$(nproc)
56+
make -j4
5757
test $? -eq 0 || { echo "Can't compile lz4"; exit 1; }
5858
cd ..
5959
else

crypto/test/test-db.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2991,10 +2991,13 @@ TEST(TonDb, LargeBocSerializer) {
29912991
td::unlink(path).ignore();
29922992
fd = td::FileFd::open(path, td::FileFd::Flags::Create | td::FileFd::Flags::Truncate | td::FileFd::Flags::Write)
29932993
.move_as_ok();
2994-
std_boc_serialize_to_file_large(dboc->get_cell_db_reader(), root->get_hash(), fd, 31);
2994+
boc_serialize_to_file_large(dboc->get_cell_db_reader(), root->get_hash(), fd, 31);
29952995
fd.close();
29962996
auto b = td::read_file_str(path).move_as_ok();
2997-
CHECK(a == b);
2997+
2998+
auto a_cell = vm::deserialize_boc(td::BufferSlice(a));
2999+
auto b_cell = vm::deserialize_boc(td::BufferSlice(b));
3000+
ASSERT_EQ(a_cell->get_hash(), b_cell->get_hash());
29983001
}
29993002

30003003
TEST(TonDb, DoNotMakeListsPrunned) {

crypto/vm/boc.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ td::Result<int> BagOfCells::import_cell(td::Ref<vm::Cell> cell, int depth) {
209209
return td::Status::Error("error while importing a cell into a bag of cells: cell is null");
210210
}
211211
if (logger_ptr_) {
212-
TRY_STATUS(logger_ptr_->on_cell_processed());
212+
TRY_STATUS(logger_ptr_->on_cells_processed(1));
213213
}
214214
auto it = cells.find(cell->get_hash());
215215
if (it != cells.end()) {
@@ -555,7 +555,7 @@ td::Result<std::size_t> BagOfCells::serialize_to_impl(WriterT& writer, int mode)
555555
}
556556
store_offset(fixed_offset);
557557
if (logger_ptr_) {
558-
TRY_STATUS(logger_ptr_->on_cell_processed());
558+
TRY_STATUS(logger_ptr_->on_cells_processed(1));
559559
}
560560
}
561561
if (logger_ptr_) {
@@ -588,7 +588,7 @@ td::Result<std::size_t> BagOfCells::serialize_to_impl(WriterT& writer, int mode)
588588
}
589589
// std::cerr << std::endl;
590590
if (logger_ptr_) {
591-
TRY_STATUS(logger_ptr_->on_cell_processed());
591+
TRY_STATUS(logger_ptr_->on_cells_processed(1));
592592
}
593593
}
594594
writer.chk();

crypto/vm/boc.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,22 +210,27 @@ class BagOfCellsLogger {
210210

211211
void start_stage(std::string stage) {
212212
log_speed_at_ = td::Timestamp::in(LOG_SPEED_PERIOD);
213+
last_speed_log_ = td::Timestamp::now();
213214
processed_cells_ = 0;
214215
timer_ = {};
215216
stage_ = std::move(stage);
216217
}
217218
void finish_stage(td::Slice desc) {
218219
LOG(ERROR) << "serializer: " << stage_ << " took " << timer_.elapsed() << "s, " << desc;
219220
}
220-
td::Status on_cell_processed() {
221-
++processed_cells_;
222-
if (processed_cells_ % 1000 == 0) {
221+
td::Status on_cells_processed(size_t count) {
222+
processed_cells_ += count;
223+
if (processed_cells_ / 1000 > last_token_check_) {
223224
TRY_STATUS(cancellation_token_.check());
225+
last_token_check_ = processed_cells_ / 1000;
224226
}
225227
if (log_speed_at_.is_in_past()) {
226-
log_speed_at_ += LOG_SPEED_PERIOD;
227-
LOG(WARNING) << "serializer: " << stage_ << " " << (double)processed_cells_ / LOG_SPEED_PERIOD << " cells/s";
228+
double period = td::Timestamp::now().at() - last_speed_log_.at();
229+
230+
LOG(WARNING) << "serializer: " << stage_ << " " << (double)processed_cells_ / period << " cells/s";
228231
processed_cells_ = 0;
232+
last_speed_log_ = td::Timestamp::now();
233+
log_speed_at_ = td::Timestamp::in(LOG_SPEED_PERIOD);
229234
}
230235
return td::Status::OK();
231236
}
@@ -236,6 +241,8 @@ class BagOfCellsLogger {
236241
td::CancellationToken cancellation_token_;
237242
td::Timestamp log_speed_at_;
238243
size_t processed_cells_ = 0;
244+
size_t last_token_check_ = 0;
245+
td::Timestamp last_speed_log_;
239246
static constexpr double LOG_SPEED_PERIOD = 120.0;
240247
};
241248
class BagOfCells {
@@ -390,7 +397,7 @@ td::Result<td::BufferSlice> std_boc_serialize_multi(std::vector<Ref<Cell>> root,
390397

391398
td::Status std_boc_serialize_to_file(Ref<Cell> root, td::FileFd& fd, int mode = 0,
392399
td::CancellationToken cancellation_token = {});
393-
td::Status std_boc_serialize_to_file_large(std::shared_ptr<CellDbReader> reader, Cell::Hash root_hash, td::FileFd& fd,
400+
td::Status boc_serialize_to_file_large(std::shared_ptr<CellDbReader> reader, Cell::Hash root_hash, td::FileFd& fd,
394401
int mode = 0, td::CancellationToken cancellation_token = {});
395402

396403
} // namespace vm

crypto/vm/db/CellStorage.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,28 @@ td::Result<CellLoader::LoadResult> CellLoader::load(td::Slice hash, bool need_da
194194
return res;
195195
}
196196

197+
td::Result<std::vector<CellLoader::LoadResult>> CellLoader::load_bulk(td::Span<td::Slice> hashes, bool need_data,
198+
ExtCellCreator &ext_cell_creator) {
199+
std::vector<std::string> values;
200+
TRY_RESULT(get_statuses, reader_->get_multi(hashes, &values));
201+
std::vector<LoadResult> res;
202+
res.reserve(hashes.size());
203+
for (size_t i = 0; i < hashes.size(); i++) {
204+
auto get_status = get_statuses[i];
205+
if (get_status != KeyValue::GetStatus::Ok) {
206+
DCHECK(get_status == KeyValue::GetStatus::NotFound);
207+
res.push_back(LoadResult{});
208+
continue;
209+
}
210+
TRY_RESULT(load_res, load(hashes[i], values[i], need_data, ext_cell_creator));
211+
if (on_load_callback_) {
212+
on_load_callback_(load_res);
213+
}
214+
res.push_back(std::move(load_res));
215+
}
216+
return res;
217+
}
218+
197219
td::Result<CellLoader::LoadResult> CellLoader::load(td::Slice hash, td::Slice value, bool need_data,
198220
ExtCellCreator &ext_cell_creator) {
199221
LoadResult res;

0 commit comments

Comments
 (0)