mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Merge branch 'testnet' into block-generation
This commit is contained in:
commit
f4fd3ff3be
246 changed files with 7895 additions and 5430 deletions
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include "common/errorlog.h"
|
||||
|
||||
#include "crypto/vm/cp0.h"
|
||||
#include "crypto/vm/vm.h"
|
||||
#include "crypto/fift/utils.h"
|
||||
|
||||
#include "td/utils/filesystem.h"
|
||||
|
@ -1423,6 +1423,7 @@ td::Status ValidatorEngine::load_global_config() {
|
|||
if (!session_logs_file_.empty()) {
|
||||
validator_options_.write().set_session_logs_file(session_logs_file_);
|
||||
}
|
||||
validator_options_.write().set_celldb_compress_depth(celldb_compress_depth_);
|
||||
|
||||
std::vector<ton::BlockIdExt> h;
|
||||
for (auto &x : conf.validator_->hardforks_) {
|
||||
|
@ -1680,6 +1681,12 @@ void ValidatorEngine::load_config(td::Promise<td::Unit> promise) {
|
|||
config_file_ = db_root_ + "/config.json";
|
||||
}
|
||||
auto conf_data_R = td::read_file(config_file_);
|
||||
if (conf_data_R.is_error()) {
|
||||
conf_data_R = td::read_file(temp_config_file());
|
||||
if (conf_data_R.is_ok()) {
|
||||
td::rename(temp_config_file(), config_file_).ensure();
|
||||
}
|
||||
}
|
||||
if (conf_data_R.is_error()) {
|
||||
auto P = td::PromiseCreator::lambda(
|
||||
[name = local_config_, new_name = config_file_, promise = std::move(promise)](td::Result<td::Unit> R) {
|
||||
|
@ -1728,12 +1735,15 @@ void ValidatorEngine::load_config(td::Promise<td::Unit> promise) {
|
|||
void ValidatorEngine::write_config(td::Promise<td::Unit> promise) {
|
||||
auto s = td::json_encode<std::string>(td::ToJson(*config_.tl().get()), true);
|
||||
|
||||
auto S = td::write_file(config_file_, s);
|
||||
if (S.is_ok()) {
|
||||
promise.set_value(td::Unit());
|
||||
} else {
|
||||
auto S = td::write_file(temp_config_file(), s);
|
||||
if (S.is_error()) {
|
||||
td::unlink(temp_config_file()).ignore();
|
||||
promise.set_error(std::move(S));
|
||||
return;
|
||||
}
|
||||
td::unlink(config_file_).ignore();
|
||||
TRY_STATUS_PROMISE(promise, td::rename(temp_config_file(), config_file_));
|
||||
promise.set_value(td::Unit());
|
||||
}
|
||||
|
||||
td::Promise<ton::PublicKey> ValidatorEngine::get_key_promise(td::MultiPromise::InitGuard &ig) {
|
||||
|
@ -3501,6 +3511,19 @@ void ValidatorEngine::run_control_query(ton::ton_api::engine_validator_getShardO
|
|||
promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::notready, "no such block")));
|
||||
return;
|
||||
}
|
||||
if (!dest) {
|
||||
td::actor::send_closure(
|
||||
manager, &ton::validator::ValidatorManagerInterface::get_out_msg_queue_size, handle->id(),
|
||||
[promise = std::move(promise)](td::Result<td::uint32> R) mutable {
|
||||
if (R.is_error()) {
|
||||
promise.set_value(create_control_query_error(R.move_as_error_prefix("failed to get queue size: ")));
|
||||
} else {
|
||||
promise.set_value(ton::create_serialize_tl_object<ton::ton_api::engine_validator_shardOutQueueSize>(
|
||||
R.move_as_ok()));
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
td::actor::send_closure(
|
||||
manager, &ton::validator::ValidatorManagerInterface::get_shard_state_from_db, handle,
|
||||
[=, promise = std::move(promise)](td::Result<td::Ref<ton::validator::ShardState>> R) mutable {
|
||||
|
@ -4060,6 +4083,15 @@ int main(int argc, char *argv[]) {
|
|||
acts.push_back([&x, at]() { td::actor::send_closure(x, &ValidatorEngine::schedule_shutdown, (double)at); });
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_checked_option('\0', "celldb-compress-depth",
|
||||
"optimize celldb by storing cells of depth X with whole subtrees (experimental, default: 0)",
|
||||
[&](td::Slice arg) {
|
||||
TRY_RESULT(value, td::to_integer_safe<td::uint32>(arg));
|
||||
acts.push_back([&x, value]() {
|
||||
td::actor::send_closure(x, &ValidatorEngine::set_celldb_compress_depth, value);
|
||||
});
|
||||
return td::Status::OK();
|
||||
});
|
||||
auto S = p.run(argc, argv);
|
||||
if (S.is_error()) {
|
||||
LOG(ERROR) << "failed to parse options: " << S.move_as_error();
|
||||
|
@ -4073,7 +4105,7 @@ int main(int argc, char *argv[]) {
|
|||
td::actor::Scheduler scheduler({threads});
|
||||
|
||||
scheduler.run_in_context([&] {
|
||||
CHECK(vm::init_op_cp0());
|
||||
vm::init_vm().ensure();
|
||||
x = td::actor::create_actor<ValidatorEngine>("validator-engine");
|
||||
for (auto &act : acts) {
|
||||
act();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue