mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
updated submodules, bugfixes
- added new fift/func code for validator complaint creation - bugfixes in validator - updates in tonlib - new versions of rocksdb/abseil - hardfork support
This commit is contained in:
parent
16a4566091
commit
9f008b129f
129 changed files with 8438 additions and 879 deletions
|
@ -20,6 +20,7 @@
|
|||
#include "validator/fabric.h"
|
||||
#include "ton/ton-io.hpp"
|
||||
#include "common/checksum.h"
|
||||
#include "common/delay.h"
|
||||
|
||||
namespace ton {
|
||||
|
||||
|
@ -95,8 +96,6 @@ void WaitBlockState::start() {
|
|||
});
|
||||
td::actor::send_closure(manager_, &ValidatorManager::try_get_static_file, handle_->id().file_hash, std::move(P));
|
||||
} else if (handle_->id().id.seqno == 0) {
|
||||
// do not try to download full chain
|
||||
// download state + proof_link only
|
||||
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result<td::BufferSlice> R) {
|
||||
if (R.is_error()) {
|
||||
td::actor::send_closure(SelfId, &WaitBlockState::failed_to_get_state_from_net,
|
||||
|
@ -107,21 +106,19 @@ void WaitBlockState::start() {
|
|||
});
|
||||
td::actor::send_closure(manager_, &ValidatorManager::send_get_zero_state_request, handle_->id(), priority_,
|
||||
std::move(P));
|
||||
} else if (block_.is_null()) {
|
||||
// download block and then prev state, not in reverse only
|
||||
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result<td::Ref<BlockData>> R) {
|
||||
} else if (!handle_->inited_prev() || (!handle_->inited_proof() && !handle_->inited_proof_link())) {
|
||||
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this), handle = handle_](td::Result<td::BufferSlice> R) {
|
||||
if (R.is_error()) {
|
||||
td::actor::send_closure(SelfId, &WaitBlockState::failed_to_get_block_data,
|
||||
R.move_as_error_prefix("block wait error: "));
|
||||
delay_action([SelfId]() { td::actor::send_closure(SelfId, &WaitBlockState::start); }, td::Timestamp::in(0.1));
|
||||
} else {
|
||||
td::actor::send_closure(SelfId, &WaitBlockState::got_block_data, R.move_as_ok());
|
||||
td::actor::send_closure(SelfId, &WaitBlockState::got_proof_link, R.move_as_ok());
|
||||
}
|
||||
});
|
||||
|
||||
td::actor::send_closure(manager_, &ValidatorManager::wait_block_data, handle_, priority_, timeout_, std::move(P));
|
||||
td::actor::send_closure(manager_, &ValidatorManager::send_get_block_proof_link_request, handle_->id(), priority_,
|
||||
std::move(P));
|
||||
} else if (prev_state_.is_null()) {
|
||||
CHECK(handle_->inited_proof() || handle_->inited_proof_link());
|
||||
CHECK(handle_->received());
|
||||
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result<td::Ref<ShardState>> R) {
|
||||
if (R.is_error()) {
|
||||
td::actor::send_closure(SelfId, &WaitBlockState::failed_to_get_prev_state,
|
||||
|
@ -133,6 +130,28 @@ void WaitBlockState::start() {
|
|||
|
||||
td::actor::send_closure(manager_, &ValidatorManager::wait_prev_block_state, handle_, priority_, timeout_,
|
||||
std::move(P));
|
||||
} else if (handle_->id().is_masterchain() && !handle_->inited_proof()) {
|
||||
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this), handle = handle_](td::Result<td::BufferSlice> R) {
|
||||
if (R.is_error()) {
|
||||
delay_action([SelfId]() { td::actor::send_closure(SelfId, &WaitBlockState::start); }, td::Timestamp::in(0.1));
|
||||
} else {
|
||||
td::actor::send_closure(SelfId, &WaitBlockState::got_proof, R.move_as_ok());
|
||||
}
|
||||
});
|
||||
|
||||
td::actor::send_closure(manager_, &ValidatorManager::send_get_block_proof_request, handle_->id(), priority_,
|
||||
std::move(P));
|
||||
} else if (block_.is_null()) {
|
||||
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result<td::Ref<BlockData>> R) {
|
||||
if (R.is_error()) {
|
||||
td::actor::send_closure(SelfId, &WaitBlockState::failed_to_get_block_data,
|
||||
R.move_as_error_prefix("block wait error: "));
|
||||
} else {
|
||||
td::actor::send_closure(SelfId, &WaitBlockState::got_block_data, R.move_as_ok());
|
||||
}
|
||||
});
|
||||
|
||||
td::actor::send_closure(manager_, &ValidatorManager::wait_block_data, handle_, priority_, timeout_, std::move(P));
|
||||
} else {
|
||||
apply();
|
||||
}
|
||||
|
@ -152,6 +171,39 @@ void WaitBlockState::got_prev_state(td::Ref<ShardState> state) {
|
|||
start();
|
||||
}
|
||||
|
||||
void WaitBlockState::got_proof_link(td::BufferSlice data) {
|
||||
auto R = create_proof_link(handle_->id(), std::move(data));
|
||||
if (R.is_error()) {
|
||||
LOG(INFO) << "received bad proof link: " << R.move_as_error();
|
||||
start();
|
||||
return;
|
||||
}
|
||||
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result<BlockHandle> R) {
|
||||
if (R.is_ok()) {
|
||||
auto h = R.move_as_ok();
|
||||
CHECK(h->inited_prev());
|
||||
td::actor::send_closure(SelfId, &WaitBlockState::start);
|
||||
} else {
|
||||
LOG(INFO) << "received bad proof link: " << R.move_as_error();
|
||||
td::actor::send_closure(SelfId, &WaitBlockState::start);
|
||||
}
|
||||
});
|
||||
run_check_proof_link_query(handle_->id(), R.move_as_ok(), manager_, timeout_, std::move(P));
|
||||
}
|
||||
|
||||
void WaitBlockState::got_proof(td::BufferSlice data) {
|
||||
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result<td::Unit> R) {
|
||||
if (R.is_ok()) {
|
||||
td::actor::send_closure(SelfId, &WaitBlockState::start);
|
||||
} else {
|
||||
LOG(INFO) << "received bad proof link: " << R.move_as_error();
|
||||
td::actor::send_closure(SelfId, &WaitBlockState::start);
|
||||
}
|
||||
});
|
||||
td::actor::send_closure(manager_, &ValidatorManager::validate_block_proof, handle_->id(), std::move(data),
|
||||
std::move(P));
|
||||
}
|
||||
|
||||
void WaitBlockState::failed_to_get_block_data(td::Status reason) {
|
||||
if (reason.code() == ErrorCode::notready) {
|
||||
start();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue