mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Experimental flags for speeding up broadcasts
This commit is contained in:
parent
04f2bc1360
commit
8a08bf67a2
19 changed files with 131 additions and 46 deletions
|
@ -526,10 +526,12 @@ void CatChainReceiverImpl::start_up() {
|
|||
for (td::uint32 i = 0; i < get_sources_cnt(); i++) {
|
||||
root_keys.emplace(get_source(i)->get_hash(), OVERLAY_MAX_ALLOWED_PACKET_SIZE);
|
||||
}
|
||||
td::actor::send_closure(overlay_manager_, &overlay::Overlays::create_private_overlay,
|
||||
overlay::OverlayOptions overlay_options;
|
||||
overlay_options.broadcast_speed_multiplier_ = opts_.broadcast_speed_multiplier;
|
||||
td::actor::send_closure(overlay_manager_, &overlay::Overlays::create_private_overlay_ex,
|
||||
get_source(local_idx_)->get_adnl_id(), overlay_full_id_.clone(), std::move(ids),
|
||||
make_callback(), overlay::OverlayPrivacyRules{0, 0, std::move(root_keys)},
|
||||
R"({ "type": "catchain" })");
|
||||
R"({ "type": "catchain" })", std::move(overlay_options));
|
||||
|
||||
CHECK(root_block_);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ void OverlayOutboundFecBroadcast::alarm() {
|
|||
fec_type_.size(), flags_, std::move(X.data), X.id, fec_type_, date_);
|
||||
}
|
||||
|
||||
alarm_timestamp() = td::Timestamp::in(0.010);
|
||||
alarm_timestamp() = td::Timestamp::in(delay_);
|
||||
|
||||
if (seqno_ >= to_send_) {
|
||||
stop();
|
||||
|
@ -46,8 +46,9 @@ void OverlayOutboundFecBroadcast::start_up() {
|
|||
|
||||
OverlayOutboundFecBroadcast::OverlayOutboundFecBroadcast(td::BufferSlice data, td::uint32 flags,
|
||||
td::actor::ActorId<OverlayImpl> overlay,
|
||||
PublicKeyHash local_id)
|
||||
PublicKeyHash local_id, double speed_multiplier)
|
||||
: flags_(flags) {
|
||||
delay_ /= speed_multiplier;
|
||||
CHECK(data.size() <= (1 << 27));
|
||||
local_id_ = local_id;
|
||||
overlay_ = std::move(overlay);
|
||||
|
@ -63,9 +64,10 @@ OverlayOutboundFecBroadcast::OverlayOutboundFecBroadcast(td::BufferSlice data, t
|
|||
}
|
||||
|
||||
td::actor::ActorId<OverlayOutboundFecBroadcast> OverlayOutboundFecBroadcast::create(
|
||||
td::BufferSlice data, td::uint32 flags, td::actor::ActorId<OverlayImpl> overlay, PublicKeyHash local_id) {
|
||||
return td::actor::create_actor<OverlayOutboundFecBroadcast>(td::actor::ActorOptions().with_name("bcast"),
|
||||
std::move(data), flags, overlay, local_id)
|
||||
td::BufferSlice data, td::uint32 flags, td::actor::ActorId<OverlayImpl> overlay, PublicKeyHash local_id,
|
||||
double speed_multiplier) {
|
||||
return td::actor::create_actor<OverlayOutboundFecBroadcast>(
|
||||
td::actor::ActorOptions().with_name("bcast"), std::move(data), flags, overlay, local_id, speed_multiplier)
|
||||
.release();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ class OverlayOutboundFecBroadcast : public td::actor::Actor {
|
|||
PublicKeyHash local_id_;
|
||||
Overlay::BroadcastDataHash data_hash_;
|
||||
td::uint32 flags_ = 0;
|
||||
double delay_ = 0.010;
|
||||
td::int32 date_;
|
||||
std::unique_ptr<td::fec::Encoder> encoder_;
|
||||
td::actor::ActorId<OverlayImpl> overlay_;
|
||||
|
@ -45,9 +46,9 @@ class OverlayOutboundFecBroadcast : public td::actor::Actor {
|
|||
public:
|
||||
static td::actor::ActorId<OverlayOutboundFecBroadcast> create(td::BufferSlice data, td::uint32 flags,
|
||||
td::actor::ActorId<OverlayImpl> overlay,
|
||||
PublicKeyHash local_id);
|
||||
PublicKeyHash local_id, double speed_multiplier = 1.0);
|
||||
OverlayOutboundFecBroadcast(td::BufferSlice data, td::uint32 flags, td::actor::ActorId<OverlayImpl> overlay,
|
||||
PublicKeyHash local_id);
|
||||
PublicKeyHash local_id, double speed_multiplier = 1.0);
|
||||
|
||||
void alarm() override;
|
||||
void start_up() override;
|
||||
|
|
|
@ -63,7 +63,7 @@ td::actor::ActorOwn<Overlay> Overlay::create_private(
|
|||
return td::actor::create_actor<OverlayImpl>(
|
||||
overlay_actor_name(overlay_id), keyring, adnl, manager, dht_node, local_id, std::move(overlay_id),
|
||||
OverlayType::FixedMemberList, std::move(nodes), std::vector<PublicKeyHash>(), OverlayMemberCertificate{},
|
||||
std::move(callback), std::move(rules), std::move(scope));
|
||||
std::move(callback), std::move(rules), std::move(scope), std::move(opts));
|
||||
}
|
||||
|
||||
td::actor::ActorOwn<Overlay> Overlay::create_semiprivate(
|
||||
|
@ -99,6 +99,7 @@ OverlayImpl::OverlayImpl(td::actor::ActorId<keyring::Keyring> keyring, td::actor
|
|||
overlay_id_ = id_full_.compute_short_id();
|
||||
frequent_dht_lookup_ = opts_.frequent_dht_lookup_;
|
||||
peer_list_.local_member_flags_ = opts_.local_overlay_member_flags_;
|
||||
opts_.broadcast_speed_multiplier_ = std::max(opts_.broadcast_speed_multiplier_, 1e-9);
|
||||
|
||||
VLOG(OVERLAY_INFO) << this << ": creating";
|
||||
|
||||
|
@ -490,7 +491,8 @@ void OverlayImpl::send_broadcast_fec(PublicKeyHash send_as, td::uint32 flags, td
|
|||
VLOG(OVERLAY_WARNING) << "broadcast source certificate is invalid";
|
||||
return;
|
||||
}
|
||||
OverlayOutboundFecBroadcast::create(std::move(data), flags, actor_id(this), send_as);
|
||||
OverlayOutboundFecBroadcast::create(std::move(data), flags, actor_id(this), send_as,
|
||||
opts_.broadcast_speed_multiplier_);
|
||||
}
|
||||
|
||||
void OverlayImpl::print(td::StringBuilder &sb) {
|
||||
|
|
|
@ -269,6 +269,7 @@ struct OverlayOptions {
|
|||
td::uint32 nodes_to_send_ = 4;
|
||||
td::uint32 propagate_broadcast_to_ = 5;
|
||||
td::uint32 default_permanent_members_flags_ = 0;
|
||||
double broadcast_speed_multiplier_ = 1.0;
|
||||
};
|
||||
|
||||
class Overlays : public td::actor::Actor {
|
||||
|
|
|
@ -493,6 +493,7 @@ struct CatChainOptions {
|
|||
td::uint64 max_block_height_coeff = 0;
|
||||
|
||||
bool debug_disable_db = false;
|
||||
double broadcast_speed_multiplier = 1.0;
|
||||
};
|
||||
|
||||
struct ValidatorSessionConfig {
|
||||
|
|
|
@ -1504,6 +1504,7 @@ td::Status ValidatorEngine::load_global_config() {
|
|||
}
|
||||
validator_options_.write().set_hardforks(std::move(h));
|
||||
validator_options_.write().set_fast_state_serializer_enabled(fast_state_serializer_enabled_);
|
||||
validator_options_.write().set_catchain_broadcast_speed_multiplier(broadcast_speed_multiplier_catchain_);
|
||||
|
||||
return td::Status::OK();
|
||||
}
|
||||
|
@ -2004,9 +2005,13 @@ void ValidatorEngine::start_full_node() {
|
|||
R.ensure();
|
||||
td::actor::send_closure(SelfId, &ValidatorEngine::started_full_node);
|
||||
});
|
||||
ton::validator::fullnode::FullNodeOptions full_node_options{
|
||||
.config_ = config_.full_node_config,
|
||||
.public_broadcast_speed_multiplier_ = broadcast_speed_multiplier_public_,
|
||||
.private_broadcast_speed_multiplier_ = broadcast_speed_multiplier_private_};
|
||||
full_node_ = ton::validator::fullnode::FullNode::create(
|
||||
short_id, ton::adnl::AdnlNodeIdShort{config_.full_node}, validator_options_->zero_block_id().file_hash,
|
||||
config_.full_node_config, keyring_.get(), adnl_.get(), rldp_.get(), rldp2_.get(),
|
||||
full_node_options, keyring_.get(), adnl_.get(), rldp_.get(), rldp2_.get(),
|
||||
default_dht_node_.is_zero() ? td::actor::ActorId<ton::dht::Dht>{} : dht_nodes_[default_dht_node_].get(),
|
||||
overlay_manager_.get(), validator_manager_.get(), full_node_client_.get(), db_root_, std::move(P));
|
||||
for (auto &v : config_.validators) {
|
||||
|
@ -4562,6 +4567,42 @@ int main(int argc, char *argv[]) {
|
|||
"disable persistent state serializer (similar to set-state-serializer-enabled 0 in validator console)", [&]() {
|
||||
acts.push_back([&x]() { td::actor::send_closure(x, &ValidatorEngine::set_state_serializer_disabled_flag); });
|
||||
});
|
||||
p.add_checked_option(
|
||||
'\0', "broadcast-speed-catchain",
|
||||
"multiplier for broadcast speed in catchain overlays (experimental, default is 1.0, which is ~300 KB/s)",
|
||||
[&](td::Slice s) -> td::Status {
|
||||
auto v = td::to_double(s);
|
||||
if (v <= 0.0) {
|
||||
return td::Status::Error("broadcast-speed-catchain should be positive");
|
||||
}
|
||||
acts.push_back(
|
||||
[&x, v]() { td::actor::send_closure(x, &ValidatorEngine::set_broadcast_speed_multiplier_catchain, v); });
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_checked_option(
|
||||
'\0', "broadcast-speed-public",
|
||||
"multiplier for broadcast speed in public shard overlays (experimental, default is 1.0, which is ~300 KB/s)",
|
||||
[&](td::Slice s) -> td::Status {
|
||||
auto v = td::to_double(s);
|
||||
if (v <= 0.0) {
|
||||
return td::Status::Error("broadcast-speed-public should be positive");
|
||||
}
|
||||
acts.push_back(
|
||||
[&x, v]() { td::actor::send_closure(x, &ValidatorEngine::set_broadcast_speed_multiplier_public, v); });
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_checked_option(
|
||||
'\0', "broadcast-speed-private",
|
||||
"multiplier for broadcast speed in private block overlays (experimental, default is 1.0, which is ~300 KB/s)",
|
||||
[&](td::Slice s) -> td::Status {
|
||||
auto v = td::to_double(s);
|
||||
if (v <= 0.0) {
|
||||
return td::Status::Error("broadcast-speed-private should be positive");
|
||||
}
|
||||
acts.push_back(
|
||||
[&x, v]() { td::actor::send_closure(x, &ValidatorEngine::set_broadcast_speed_multiplier_private, v); });
|
||||
return td::Status::OK();
|
||||
});
|
||||
auto S = p.run(argc, argv);
|
||||
if (S.is_error()) {
|
||||
LOG(ERROR) << "failed to parse options: " << S.move_as_error();
|
||||
|
|
|
@ -229,6 +229,9 @@ class ValidatorEngine : public td::actor::Actor {
|
|||
bool not_all_shards_ = false;
|
||||
std::vector<ton::ShardIdFull> add_shard_cmds_;
|
||||
bool state_serializer_disabled_flag_ = false;
|
||||
double broadcast_speed_multiplier_catchain_ = 1.0;
|
||||
double broadcast_speed_multiplier_public_ = 1.0;
|
||||
double broadcast_speed_multiplier_private_ = 1.0;
|
||||
|
||||
std::set<ton::CatchainSeqno> unsafe_catchains_;
|
||||
std::map<ton::BlockSeqno, std::pair<ton::CatchainSeqno, td::uint32>> unsafe_catchain_rotations_;
|
||||
|
@ -329,6 +332,15 @@ class ValidatorEngine : public td::actor::Actor {
|
|||
void set_state_serializer_disabled_flag() {
|
||||
state_serializer_disabled_flag_ = true;
|
||||
}
|
||||
void set_broadcast_speed_multiplier_catchain(double value) {
|
||||
broadcast_speed_multiplier_catchain_ = value;
|
||||
}
|
||||
void set_broadcast_speed_multiplier_public(double value) {
|
||||
broadcast_speed_multiplier_public_ = value;
|
||||
}
|
||||
void set_broadcast_speed_multiplier_private(double value) {
|
||||
broadcast_speed_multiplier_private_ = value;
|
||||
}
|
||||
|
||||
void start_up() override;
|
||||
ValidatorEngine() {
|
||||
|
|
|
@ -264,8 +264,11 @@ void FullNodePrivateBlockOverlay::init() {
|
|||
overlay::OverlayPrivacyRules rules{overlay::Overlays::max_fec_broadcast_size(),
|
||||
overlay::CertificateFlags::AllowFec | overlay::CertificateFlags::Trusted,
|
||||
{}};
|
||||
td::actor::send_closure(overlays_, &overlay::Overlays::create_private_overlay, local_id_, overlay_id_full_.clone(),
|
||||
nodes_, std::make_unique<Callback>(actor_id(this)), rules, R"({ "type": "private-blocks" })");
|
||||
overlay::OverlayOptions overlay_options;
|
||||
overlay_options.broadcast_speed_multiplier_ = opts_.private_broadcast_speed_multiplier_;
|
||||
td::actor::send_closure(overlays_, &overlay::Overlays::create_private_overlay_ex, local_id_, overlay_id_full_.clone(),
|
||||
nodes_, std::make_unique<Callback>(actor_id(this)), rules, R"({ "type": "private-blocks" })",
|
||||
overlay_options);
|
||||
|
||||
td::actor::send_closure(rldp_, &rldp::Rldp::add_id, local_id_);
|
||||
td::actor::send_closure(rldp2_, &rldp2::Rldp::add_id, local_id_);
|
||||
|
@ -366,7 +369,7 @@ void FullNodeCustomOverlay::receive_broadcast(PublicKeyHash src, td::BufferSlice
|
|||
}
|
||||
|
||||
void FullNodeCustomOverlay::send_external_message(td::BufferSlice data) {
|
||||
if (!inited_ || config_.ext_messages_broadcast_disabled_) {
|
||||
if (!inited_ || opts_.config_.ext_messages_broadcast_disabled_) {
|
||||
return;
|
||||
}
|
||||
VLOG(FULL_NODE_DEBUG) << "Sending external message to custom overlay \"" << name_ << "\"";
|
||||
|
@ -472,10 +475,13 @@ void FullNodeCustomOverlay::init() {
|
|||
authorized_keys[sender.pubkey_hash()] = overlay::Overlays::max_fec_broadcast_size();
|
||||
}
|
||||
overlay::OverlayPrivacyRules rules{overlay::Overlays::max_fec_broadcast_size(), 0, std::move(authorized_keys)};
|
||||
overlay::OverlayOptions overlay_options;
|
||||
overlay_options.broadcast_speed_multiplier_ = opts_.private_broadcast_speed_multiplier_;
|
||||
td::actor::send_closure(
|
||||
overlays_, &overlay::Overlays::create_private_overlay, local_id_, overlay_id_full_.clone(), nodes_,
|
||||
overlays_, &overlay::Overlays::create_private_overlay_ex, local_id_, overlay_id_full_.clone(), nodes_,
|
||||
std::make_unique<Callback>(actor_id(this)), rules,
|
||||
PSTRING() << R"({ "type": "custom-overlay", "name": ")" << td::format::Escaped{name_} << R"(" })");
|
||||
PSTRING() << R"({ "type": "custom-overlay", "name": ")" << td::format::Escaped{name_} << R"(" })",
|
||||
overlay_options);
|
||||
|
||||
td::actor::send_closure(rldp_, &rldp::Rldp::add_id, local_id_);
|
||||
td::actor::send_closure(rldp2_, &rldp2::Rldp::add_id, local_id_);
|
||||
|
|
|
@ -50,14 +50,14 @@ class FullNodePrivateBlockOverlay : public td::actor::Actor {
|
|||
void collect_validator_telemetry(std::string filename);
|
||||
|
||||
void set_config(FullNodeConfig config) {
|
||||
config_ = std::move(config);
|
||||
opts_.config_ = std::move(config);
|
||||
}
|
||||
|
||||
void start_up() override;
|
||||
void tear_down() override;
|
||||
|
||||
FullNodePrivateBlockOverlay(adnl::AdnlNodeIdShort local_id, std::vector<adnl::AdnlNodeIdShort> nodes,
|
||||
FileHash zero_state_file_hash, FullNodeConfig config,
|
||||
FileHash zero_state_file_hash, FullNodeOptions opts,
|
||||
td::actor::ActorId<keyring::Keyring> keyring, td::actor::ActorId<adnl::Adnl> adnl,
|
||||
td::actor::ActorId<rldp::Rldp> rldp, td::actor::ActorId<rldp2::Rldp> rldp2,
|
||||
td::actor::ActorId<overlay::Overlays> overlays,
|
||||
|
@ -66,7 +66,7 @@ class FullNodePrivateBlockOverlay : public td::actor::Actor {
|
|||
: local_id_(local_id)
|
||||
, nodes_(std::move(nodes))
|
||||
, zero_state_file_hash_(zero_state_file_hash)
|
||||
, config_(config)
|
||||
, opts_(opts)
|
||||
, keyring_(keyring)
|
||||
, adnl_(adnl)
|
||||
, rldp_(rldp)
|
||||
|
@ -80,7 +80,7 @@ class FullNodePrivateBlockOverlay : public td::actor::Actor {
|
|||
adnl::AdnlNodeIdShort local_id_;
|
||||
std::vector<adnl::AdnlNodeIdShort> nodes_;
|
||||
FileHash zero_state_file_hash_;
|
||||
FullNodeConfig config_;
|
||||
FullNodeOptions opts_;
|
||||
bool enable_compression_ = true;
|
||||
|
||||
td::actor::ActorId<keyring::Keyring> keyring_;
|
||||
|
@ -126,14 +126,14 @@ class FullNodeCustomOverlay : public td::actor::Actor {
|
|||
td::BufferSlice data);
|
||||
|
||||
void set_config(FullNodeConfig config) {
|
||||
config_ = std::move(config);
|
||||
opts_.config_ = std::move(config);
|
||||
}
|
||||
|
||||
void start_up() override;
|
||||
void tear_down() override;
|
||||
|
||||
FullNodeCustomOverlay(adnl::AdnlNodeIdShort local_id, CustomOverlayParams params, FileHash zero_state_file_hash,
|
||||
FullNodeConfig config, td::actor::ActorId<keyring::Keyring> keyring,
|
||||
FullNodeOptions opts, td::actor::ActorId<keyring::Keyring> keyring,
|
||||
td::actor::ActorId<adnl::Adnl> adnl, td::actor::ActorId<rldp::Rldp> rldp,
|
||||
td::actor::ActorId<rldp2::Rldp> rldp2, td::actor::ActorId<overlay::Overlays> overlays,
|
||||
td::actor::ActorId<ValidatorManagerInterface> validator_manager,
|
||||
|
@ -144,7 +144,7 @@ class FullNodeCustomOverlay : public td::actor::Actor {
|
|||
, msg_senders_(std::move(params.msg_senders_))
|
||||
, block_senders_(std::move(params.block_senders_))
|
||||
, zero_state_file_hash_(zero_state_file_hash)
|
||||
, config_(config)
|
||||
, opts_(opts)
|
||||
, keyring_(keyring)
|
||||
, adnl_(adnl)
|
||||
, rldp_(rldp)
|
||||
|
@ -161,7 +161,7 @@ class FullNodeCustomOverlay : public td::actor::Actor {
|
|||
std::map<adnl::AdnlNodeIdShort, int> msg_senders_;
|
||||
std::set<adnl::AdnlNodeIdShort> block_senders_;
|
||||
FileHash zero_state_file_hash_;
|
||||
FullNodeConfig config_;
|
||||
FullNodeOptions opts_;
|
||||
|
||||
td::actor::ActorId<keyring::Keyring> keyring_;
|
||||
td::actor::ActorId<adnl::Adnl> adnl_;
|
||||
|
|
|
@ -105,6 +105,7 @@ void FullNodeShardImpl::create_overlay() {
|
|||
};
|
||||
overlay::OverlayOptions opts;
|
||||
opts.announce_self_ = active_;
|
||||
opts.broadcast_speed_multiplier_ = opts_.public_broadcast_speed_multiplier_;
|
||||
td::actor::send_closure(overlays_, &overlay::Overlays::create_public_overlay_ex, adnl_id_, overlay_id_full_.clone(),
|
||||
std::make_unique<Callback>(actor_id(this)), rules_,
|
||||
PSTRING() << "{ \"type\": \"shard\", \"shard_id\": " << get_shard()
|
||||
|
@ -132,7 +133,7 @@ void FullNodeShardImpl::check_broadcast(PublicKeyHash src, td::BufferSlice broad
|
|||
if (!processed_ext_msg_broadcasts_.insert(hash).second) {
|
||||
return promise.set_error(td::Status::Error("duplicate external message broadcast"));
|
||||
}
|
||||
if (config_.ext_messages_broadcast_disabled_) {
|
||||
if (opts_.config_.ext_messages_broadcast_disabled_) {
|
||||
promise.set_error(td::Status::Error("rebroadcasting external messages is disabled"));
|
||||
promise = [manager = validator_manager_, message = q->message_->data_.clone()](td::Result<td::Unit> R) mutable {
|
||||
if (R.is_ok()) {
|
||||
|
@ -850,7 +851,7 @@ void FullNodeShardImpl::send_ihr_message(td::BufferSlice data) {
|
|||
}
|
||||
|
||||
void FullNodeShardImpl::send_external_message(td::BufferSlice data) {
|
||||
if (config_.ext_messages_broadcast_disabled_) {
|
||||
if (opts_.config_.ext_messages_broadcast_disabled_) {
|
||||
return;
|
||||
}
|
||||
if (!client_.empty()) {
|
||||
|
@ -1367,7 +1368,7 @@ void FullNodeShardImpl::get_stats_extra(td::Promise<std::string> promise) {
|
|||
}
|
||||
|
||||
FullNodeShardImpl::FullNodeShardImpl(ShardIdFull shard, PublicKeyHash local_id, adnl::AdnlNodeIdShort adnl_id,
|
||||
FileHash zero_state_file_hash, FullNodeConfig config,
|
||||
FileHash zero_state_file_hash, FullNodeOptions opts,
|
||||
td::actor::ActorId<keyring::Keyring> keyring, td::actor::ActorId<adnl::Adnl> adnl,
|
||||
td::actor::ActorId<rldp::Rldp> rldp, td::actor::ActorId<rldp2::Rldp> rldp2,
|
||||
td::actor::ActorId<overlay::Overlays> overlays,
|
||||
|
@ -1387,17 +1388,17 @@ FullNodeShardImpl::FullNodeShardImpl(ShardIdFull shard, PublicKeyHash local_id,
|
|||
, client_(client)
|
||||
, full_node_(full_node)
|
||||
, active_(active)
|
||||
, config_(config) {
|
||||
, opts_(opts) {
|
||||
}
|
||||
|
||||
td::actor::ActorOwn<FullNodeShard> FullNodeShard::create(
|
||||
ShardIdFull shard, PublicKeyHash local_id, adnl::AdnlNodeIdShort adnl_id, FileHash zero_state_file_hash,
|
||||
FullNodeConfig config, td::actor::ActorId<keyring::Keyring> keyring, td::actor::ActorId<adnl::Adnl> adnl,
|
||||
FullNodeOptions opts, td::actor::ActorId<keyring::Keyring> keyring, td::actor::ActorId<adnl::Adnl> adnl,
|
||||
td::actor::ActorId<rldp::Rldp> rldp, td::actor::ActorId<rldp2::Rldp> rldp2,
|
||||
td::actor::ActorId<overlay::Overlays> overlays, td::actor::ActorId<ValidatorManagerInterface> validator_manager,
|
||||
td::actor::ActorId<adnl::AdnlExtClient> client, td::actor::ActorId<FullNode> full_node, bool active) {
|
||||
return td::actor::create_actor<FullNodeShardImpl>(PSTRING() << "tonnode" << shard.to_str(), shard, local_id, adnl_id,
|
||||
zero_state_file_hash, config, keyring, adnl, rldp, rldp2, overlays,
|
||||
zero_state_file_hash, opts, keyring, adnl, rldp, rldp2, overlays,
|
||||
validator_manager, client, full_node, active);
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ class FullNodeShard : public td::actor::Actor {
|
|||
|
||||
static td::actor::ActorOwn<FullNodeShard> create(
|
||||
ShardIdFull shard, PublicKeyHash local_id, adnl::AdnlNodeIdShort adnl_id, FileHash zero_state_file_hash,
|
||||
FullNodeConfig config, td::actor::ActorId<keyring::Keyring> keyring, td::actor::ActorId<adnl::Adnl> adnl,
|
||||
FullNodeOptions opts, td::actor::ActorId<keyring::Keyring> keyring, td::actor::ActorId<adnl::Adnl> adnl,
|
||||
td::actor::ActorId<rldp::Rldp> rldp, td::actor::ActorId<rldp2::Rldp> rldp2,
|
||||
td::actor::ActorId<overlay::Overlays> overlays, td::actor::ActorId<ValidatorManagerInterface> validator_manager,
|
||||
td::actor::ActorId<adnl::AdnlExtClient> client, td::actor::ActorId<FullNode> full_node, bool active);
|
||||
|
|
|
@ -86,7 +86,7 @@ class FullNodeShardImpl : public FullNodeShard {
|
|||
void set_active(bool active) override;
|
||||
|
||||
void set_config(FullNodeConfig config) override {
|
||||
config_ = config;
|
||||
opts_.config_ = config;
|
||||
}
|
||||
|
||||
void try_get_next_block(td::Timestamp timestamp, td::Promise<ReceivedBlock> promise);
|
||||
|
@ -222,7 +222,7 @@ class FullNodeShardImpl : public FullNodeShard {
|
|||
}
|
||||
|
||||
FullNodeShardImpl(ShardIdFull shard, PublicKeyHash local_id, adnl::AdnlNodeIdShort adnl_id,
|
||||
FileHash zero_state_file_hash, FullNodeConfig config, td::actor::ActorId<keyring::Keyring> keyring,
|
||||
FileHash zero_state_file_hash, FullNodeOptions opts, td::actor::ActorId<keyring::Keyring> keyring,
|
||||
td::actor::ActorId<adnl::Adnl> adnl, td::actor::ActorId<rldp::Rldp> rldp,
|
||||
td::actor::ActorId<rldp2::Rldp> rldp2, td::actor::ActorId<overlay::Overlays> overlays,
|
||||
td::actor::ActorId<ValidatorManagerInterface> validator_manager,
|
||||
|
@ -269,7 +269,7 @@ class FullNodeShardImpl : public FullNodeShard {
|
|||
|
||||
bool active_;
|
||||
|
||||
FullNodeConfig config_;
|
||||
FullNodeOptions opts_;
|
||||
|
||||
std::set<td::Bits256> my_ext_msg_broadcasts_;
|
||||
std::set<td::Bits256> processed_ext_msg_broadcasts_;
|
||||
|
|
|
@ -139,7 +139,7 @@ void FullNodeImpl::update_adnl_id(adnl::AdnlNodeIdShort adnl_id, td::Promise<td:
|
|||
}
|
||||
|
||||
void FullNodeImpl::set_config(FullNodeConfig config) {
|
||||
config_ = config;
|
||||
opts_.config_ = config;
|
||||
for (auto& s : shards_) {
|
||||
if (!s.second.actor.empty()) {
|
||||
td::actor::send_closure(s.second.actor, &FullNodeShard::set_config, config);
|
||||
|
@ -256,7 +256,7 @@ void FullNodeImpl::on_new_masterchain_block(td::Ref<MasterchainState> state, std
|
|||
void FullNodeImpl::update_shard_actor(ShardIdFull shard, bool active) {
|
||||
ShardInfo &info = shards_[shard];
|
||||
if (info.actor.empty()) {
|
||||
info.actor = FullNodeShard::create(shard, local_id_, adnl_id_, zero_state_file_hash_, config_, keyring_, adnl_, rldp_,
|
||||
info.actor = FullNodeShard::create(shard, local_id_, adnl_id_, zero_state_file_hash_, opts_, keyring_, adnl_, rldp_,
|
||||
rldp2_, overlays_, validator_manager_, client_, actor_id(this), active);
|
||||
if (!all_validators_.empty()) {
|
||||
td::actor::send_closure(info.actor, &FullNodeShard::update_validators, all_validators_, sign_cert_by_);
|
||||
|
@ -717,7 +717,7 @@ void FullNodeImpl::create_private_block_overlay(PublicKeyHash key) {
|
|||
nodes.push_back(p.second);
|
||||
}
|
||||
private_block_overlays_[key] = td::actor::create_actor<FullNodePrivateBlockOverlay>(
|
||||
"BlocksPrivateOverlay", current_validators_[key], std::move(nodes), zero_state_file_hash_, config_, keyring_,
|
||||
"BlocksPrivateOverlay", current_validators_[key], std::move(nodes), zero_state_file_hash_, opts_, keyring_,
|
||||
adnl_, rldp_, rldp2_, overlays_, validator_manager_, actor_id(this));
|
||||
update_validator_telemetry_collector();
|
||||
}
|
||||
|
@ -735,7 +735,7 @@ void FullNodeImpl::update_custom_overlay(CustomOverlayInfo &overlay) {
|
|||
old_actors.erase(it);
|
||||
} else {
|
||||
overlay.actors_[local_id] = td::actor::create_actor<FullNodeCustomOverlay>(
|
||||
"CustomOverlay", local_id, params, zero_state_file_hash_, config_, keyring_, adnl_, rldp_, rldp2_,
|
||||
"CustomOverlay", local_id, params, zero_state_file_hash_, opts_, keyring_, adnl_, rldp_, rldp2_,
|
||||
overlays_, validator_manager_, actor_id(this));
|
||||
}
|
||||
}
|
||||
|
@ -794,7 +794,7 @@ void FullNodeImpl::send_block_candidate_broadcast_to_custom_overlays(const Block
|
|||
}
|
||||
|
||||
FullNodeImpl::FullNodeImpl(PublicKeyHash local_id, adnl::AdnlNodeIdShort adnl_id, FileHash zero_state_file_hash,
|
||||
FullNodeConfig config, td::actor::ActorId<keyring::Keyring> keyring,
|
||||
FullNodeOptions opts, td::actor::ActorId<keyring::Keyring> keyring,
|
||||
td::actor::ActorId<adnl::Adnl> adnl, td::actor::ActorId<rldp::Rldp> rldp,
|
||||
td::actor::ActorId<rldp2::Rldp> rldp2, td::actor::ActorId<dht::Dht> dht,
|
||||
td::actor::ActorId<overlay::Overlays> overlays,
|
||||
|
@ -814,16 +814,16 @@ FullNodeImpl::FullNodeImpl(PublicKeyHash local_id, adnl::AdnlNodeIdShort adnl_id
|
|||
, client_(client)
|
||||
, db_root_(db_root)
|
||||
, started_promise_(std::move(started_promise))
|
||||
, config_(config) {
|
||||
, opts_(opts) {
|
||||
}
|
||||
|
||||
td::actor::ActorOwn<FullNode> FullNode::create(
|
||||
ton::PublicKeyHash local_id, adnl::AdnlNodeIdShort adnl_id, FileHash zero_state_file_hash, FullNodeConfig config,
|
||||
ton::PublicKeyHash local_id, adnl::AdnlNodeIdShort adnl_id, FileHash zero_state_file_hash, FullNodeOptions opts,
|
||||
td::actor::ActorId<keyring::Keyring> keyring, td::actor::ActorId<adnl::Adnl> adnl,
|
||||
td::actor::ActorId<rldp::Rldp> rldp, td::actor::ActorId<rldp2::Rldp> rldp2, td::actor::ActorId<dht::Dht> dht,
|
||||
td::actor::ActorId<overlay::Overlays> overlays, td::actor::ActorId<ValidatorManagerInterface> validator_manager,
|
||||
td::actor::ActorId<adnl::AdnlExtClient> client, std::string db_root, td::Promise<td::Unit> started_promise) {
|
||||
return td::actor::create_actor<FullNodeImpl>("fullnode", local_id, adnl_id, zero_state_file_hash, config, keyring,
|
||||
return td::actor::create_actor<FullNodeImpl>("fullnode", local_id, adnl_id, zero_state_file_hash, opts, keyring,
|
||||
adnl, rldp, rldp2, dht, overlays, validator_manager, client, db_root,
|
||||
std::move(started_promise));
|
||||
}
|
||||
|
|
|
@ -55,6 +55,12 @@ struct FullNodeConfig {
|
|||
bool ext_messages_broadcast_disabled_ = false;
|
||||
};
|
||||
|
||||
struct FullNodeOptions {
|
||||
FullNodeConfig config_;
|
||||
double public_broadcast_speed_multiplier_ = 1.0;
|
||||
double private_broadcast_speed_multiplier_ = 1.0;
|
||||
};
|
||||
|
||||
struct CustomOverlayParams {
|
||||
std::string name_;
|
||||
std::vector<adnl::AdnlNodeIdShort> nodes_;
|
||||
|
@ -107,7 +113,7 @@ class FullNode : public td::actor::Actor {
|
|||
enum { broadcast_mode_public = 1, broadcast_mode_private_block = 2, broadcast_mode_custom = 4 };
|
||||
|
||||
static td::actor::ActorOwn<FullNode> create(
|
||||
ton::PublicKeyHash local_id, adnl::AdnlNodeIdShort adnl_id, FileHash zero_state_file_hash, FullNodeConfig config,
|
||||
ton::PublicKeyHash local_id, adnl::AdnlNodeIdShort adnl_id, FileHash zero_state_file_hash, FullNodeOptions opts,
|
||||
td::actor::ActorId<keyring::Keyring> keyring, td::actor::ActorId<adnl::Adnl> adnl,
|
||||
td::actor::ActorId<rldp::Rldp> rldp, td::actor::ActorId<rldp2::Rldp> rldp2, td::actor::ActorId<dht::Dht> dht,
|
||||
td::actor::ActorId<overlay::Overlays> overlays, td::actor::ActorId<ValidatorManagerInterface> validator_manager,
|
||||
|
|
|
@ -98,7 +98,7 @@ class FullNodeImpl : public FullNode {
|
|||
void start_up() override;
|
||||
|
||||
FullNodeImpl(PublicKeyHash local_id, adnl::AdnlNodeIdShort adnl_id, FileHash zero_state_file_hash,
|
||||
FullNodeConfig config, td::actor::ActorId<keyring::Keyring> keyring, td::actor::ActorId<adnl::Adnl> adnl,
|
||||
FullNodeOptions opts, td::actor::ActorId<keyring::Keyring> keyring, td::actor::ActorId<adnl::Adnl> adnl,
|
||||
td::actor::ActorId<rldp::Rldp> rldp, td::actor::ActorId<rldp2::Rldp> rldp2,
|
||||
td::actor::ActorId<dht::Dht> dht, td::actor::ActorId<overlay::Overlays> overlays,
|
||||
td::actor::ActorId<ValidatorManagerInterface> validator_manager,
|
||||
|
@ -141,7 +141,7 @@ class FullNodeImpl : public FullNode {
|
|||
std::set<PublicKeyHash> local_keys_;
|
||||
|
||||
td::Promise<td::Unit> started_promise_;
|
||||
FullNodeConfig config_;
|
||||
FullNodeOptions opts_;
|
||||
|
||||
std::map<PublicKeyHash, td::actor::ActorOwn<FullNodePrivateBlockOverlay>> private_block_overlays_;
|
||||
bool broadcast_block_candidates_in_public_overlay_ = false;
|
||||
|
|
|
@ -373,6 +373,7 @@ void ValidatorGroup::create_session() {
|
|||
}
|
||||
CHECK(found);
|
||||
|
||||
config_.catchain_opts.broadcast_speed_multiplier = opts_->get_catchain_broadcast_speed_multiplier();
|
||||
if (!config_.new_catchain_ids) {
|
||||
session_ = validatorsession::ValidatorSession::create(session_id_, config_, local_id_, std::move(vec),
|
||||
make_validator_session_callback(), keyring_, adnl_, rldp_,
|
||||
|
|
|
@ -154,6 +154,9 @@ struct ValidatorManagerOptionsImpl : public ValidatorManagerOptions {
|
|||
bool get_fast_state_serializer_enabled() const override {
|
||||
return fast_state_serializer_enabled_;
|
||||
}
|
||||
double get_catchain_broadcast_speed_multiplier() const override {
|
||||
return catchain_broadcast_speed_multipliers_;
|
||||
}
|
||||
|
||||
void set_zero_block_id(BlockIdExt block_id) override {
|
||||
zero_block_id_ = block_id;
|
||||
|
@ -249,6 +252,9 @@ struct ValidatorManagerOptionsImpl : public ValidatorManagerOptions {
|
|||
void set_fast_state_serializer_enabled(bool value) override {
|
||||
fast_state_serializer_enabled_ = value;
|
||||
}
|
||||
void set_catchain_broadcast_speed_multiplier(double value) override {
|
||||
catchain_broadcast_speed_multipliers_ = value;
|
||||
}
|
||||
|
||||
ValidatorManagerOptionsImpl *make_copy() const override {
|
||||
return new ValidatorManagerOptionsImpl(*this);
|
||||
|
@ -302,6 +308,7 @@ struct ValidatorManagerOptionsImpl : public ValidatorManagerOptions {
|
|||
bool state_serializer_enabled_ = true;
|
||||
td::Ref<CollatorOptions> collator_options_{true};
|
||||
bool fast_state_serializer_enabled_ = false;
|
||||
double catchain_broadcast_speed_multipliers_;
|
||||
};
|
||||
|
||||
} // namespace validator
|
||||
|
|
|
@ -116,6 +116,7 @@ struct ValidatorManagerOptions : public td::CntObject {
|
|||
virtual bool get_state_serializer_enabled() const = 0;
|
||||
virtual td::Ref<CollatorOptions> get_collator_options() const = 0;
|
||||
virtual bool get_fast_state_serializer_enabled() const = 0;
|
||||
virtual double get_catchain_broadcast_speed_multiplier() const = 0;
|
||||
|
||||
virtual void set_zero_block_id(BlockIdExt block_id) = 0;
|
||||
virtual void set_init_block_id(BlockIdExt block_id) = 0;
|
||||
|
@ -148,6 +149,7 @@ struct ValidatorManagerOptions : public td::CntObject {
|
|||
virtual void set_state_serializer_enabled(bool value) = 0;
|
||||
virtual void set_collator_options(td::Ref<CollatorOptions> value) = 0;
|
||||
virtual void set_fast_state_serializer_enabled(bool value) = 0;
|
||||
virtual void set_catchain_broadcast_speed_multiplier(double value) = 0;
|
||||
|
||||
static td::Ref<ValidatorManagerOptions> create(
|
||||
BlockIdExt zero_block_id, BlockIdExt init_block_id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue