Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues with catchain forks #271

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to this project will be documented in this file.

## Version 0.60.14

- Deliver catchain fork info to node

## Version 0.60.13

- Tuning catchain performance

## Version 0.60.12

- Fixed possible zero division in cells db telemetry

## Version 0.60.11

- Decreased error severity for wrong REMP blocks enumeration
Expand Down
16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
build = 'common/build/build.rs'
edition = '2021'
name = 'ever-node'
version = '0.60.11'
version = '0.60.14'

[workspace]

Expand Down Expand Up @@ -85,16 +85,16 @@ string-builder = '0.2'
thiserror = '1.0'
tokio = { features = [ 'rt-multi-thread' ], version = '1.40' }
tokio-util = '0.7'
adnl = { features = [ 'client', 'node', 'server' ], git = 'https://github.com/everx-labs/ever-adnl.git', tag = '0.11.32' }
adnl = { features = [ 'client', 'node', 'server' ], git = 'https://github.com/everx-labs/ever-adnl.git', tag = '0.11.38' }
catchain = { path = 'catchain' }
ever_abi = { git = 'https://github.com/everx-labs/ever-abi.git', tag = '2.8.1' }
ever_block = { git = 'https://github.com/everx-labs/ever-block.git', tag = '1.11.20' }
ever_block_json = { git = 'https://github.com/everx-labs/ever-block-json.git', tag = '0.9.37' }
ever_executor = { git = 'https://github.com/everx-labs/ever-executor.git', tag = '1.18.22' }
ever_vm = { git = 'https://github.com/everx-labs/ever-vm.git', tag = '2.2.21' }
ever_abi = { git = 'https://github.com/everx-labs/ever-abi.git', tag = '2.8.5' }
ever_block = { git = 'https://github.com/everx-labs/ever-block.git', tag = '1.11.22' }
ever_block_json = { git = 'https://github.com/everx-labs/ever-block-json.git', tag = '0.9.41' }
ever_executor = { git = 'https://github.com/everx-labs/ever-executor.git', tag = '1.18.31' }
ever_vm = { git = 'https://github.com/everx-labs/ever-vm.git', tag = '2.2.26' }
lockfree = { git = 'https://github.com/everx-labs/lockfree.git' }
storage = { path = 'storage' }
ton_api = { git = 'https://github.com/everx-labs/ever-tl.git', package = 'ton_api', tag = '0.4.29' }
ton_api = { git = 'https://github.com/everx-labs/ever-tl.git', package = 'ton_api', tag = '0.4.32' }
validator_session = { path = 'validator-session' }

[dev-dependencies]
Expand Down
6 changes: 3 additions & 3 deletions catchain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ quanta = '0.11'
rand = '0.8'
regex = '1.10'
tokio = { features = [ 'rt-multi-thread' ], version = '1.40' }
adnl = { features = [ 'node' ], git = 'https://github.com/everx-labs/ever-adnl.git', tag = '0.11.32' }
ever_block = { git = 'https://github.com/everx-labs/ever-block.git', tag = '1.11.20' }
adnl = { features = [ 'node' ], git = 'https://github.com/everx-labs/ever-adnl.git', tag = '0.11.38' }
ever_block = { git = 'https://github.com/everx-labs/ever-block.git', tag = '1.11.22' }
storage = { path = '../storage' }
ton_api = { git = 'https://github.com/everx-labs/ever-tl.git', package = 'ton_api', tag = '0.4.29' }
ton_api = { git = 'https://github.com/everx-labs/ever-tl.git', package = 'ton_api', tag = '0.4.32' }

[dev-dependencies]
env_logger = '0.11'
Expand Down
4 changes: 3 additions & 1 deletion catchain/src/catchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1703,7 +1703,9 @@ impl CatchainProcessor {
log::trace!("Catchain forcing creation of a new block");
}

if self.active_process {
let is_requested_time_expired = SystemTime::now().duration_since(time).is_ok();

if self.active_process && is_requested_time_expired {
self.force_process = true;
} else {
self.set_next_block_generation_time(time);
Expand Down
26 changes: 16 additions & 10 deletions src/network/catchain_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use crate::network::node_network::NetworkContext;

use adnl::{
declare_counted, OverlayNode, PrivateOverlayShortId, RldpNode,
declare_counted, CatchainData, OverlayNode, PrivateOverlayShortId, RldpNode,
common::{
AdnlPeers, Answer, CountedObject, Counter, QueryAnswer, QueryResult,
Subscriber, TaggedByteSlice, TaggedTlObject, Wait
Expand Down Expand Up @@ -342,16 +342,22 @@ impl CatchainClient {
};
let message = receiver.wait_for_catchain(overlay_id).await;
match message {
Ok(Some((catchain_block_update, validator_session_block_update, source_id))) => {
log::trace!(target: Self::TARGET, "private overlay broadcast ValidatorSession_BlockUpdate (successed)");
let vs_block_update = validator_session_block_update.into_boxed();
let block_update = catchain_block_update.into_boxed();
Ok(Some((catchain_block_update, inner_update, source_id))) => {
log::trace!(
target: Self::TARGET,
"private overlay broadcast ValidatorSession_BlockUpdate (successed)"
);
if let Some(listener) = catchain_listener.upgrade() {
let mut data: catchain::RawBuffer = catchain::RawBuffer::default();
let mut serializer = ton_api::Serializer::new(&mut data);
serializer.write_boxed(&block_update)?;
serializer.write_boxed(&vs_block_update)?;
let data = catchain::CatchainFactory::create_block_payload(data);
let mut data: catchain::RawBuffer = catchain::RawBuffer::default();
let mut serializer = ton_api::Serializer::new(&mut data);
serializer.write_boxed(&catchain_block_update.into_boxed())?;
match inner_update {
CatchainData::Catchain(upd) =>
serializer.write_boxed(&upd.into_boxed())?,
CatchainData::ValidatorSession(upd) =>
serializer.write_boxed(&upd.into_boxed())?
};
let data = catchain::CatchainFactory::create_block_payload(data);
listener
.on_message(
source_id,
Expand Down
6 changes: 3 additions & 3 deletions storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ strum_macros = '0.18'
thiserror = '1.0'
tokio = { features = [ 'fs', 'rt-multi-thread' ], version = '1.5' }
tokio-util = '0.7'
adnl = { git = 'https://github.com/everx-labs/ever-adnl.git', tag = '0.11.32' }
ever_block = { git = 'https://github.com/everx-labs/ever-block.git', tag = '1.11.20' }
adnl = { git = 'https://github.com/everx-labs/ever-adnl.git', tag = '0.11.38' }
ever_block = { git = 'https://github.com/everx-labs/ever-block.git', tag = '1.11.22' }
lockfree = { git = 'https://github.com/everx-labs/lockfree.git' }
ton_api = { git = 'https://github.com/everx-labs/ever-tl.git', package = 'ton_api', tag = '0.4.29' }
ton_api = { git = 'https://github.com/everx-labs/ever-tl.git', package = 'ton_api', tag = '0.4.32' }

[build-dependencies]
cc = { features = [ 'parallel' ], version = '1.0.61' }
Expand Down
22 changes: 14 additions & 8 deletions storage/src/dynamic_boc_rc_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,14 @@ impl DynamicBocDb {
tx.blocking_send((key, value))?;
read += 1;
if read % 1_000_000 == 0 {
log::info!(
target: TARGET,
"Cells DB migration: read {} items, speed {} items/sec",
read, read / now.elapsed().as_secs()
);
let sec = now.elapsed().as_secs();
if sec != 0 {
log::info!(
target: TARGET,
"Cells DB migration: read {} items, speed {} items/sec",
read, read / sec
);
}
}
}

Expand Down Expand Up @@ -399,8 +402,10 @@ impl DynamicBocDb {
let now3 = Instant::now();
self.db.write(transaction)?;
#[cfg(feature = "telemetry")]
self.telemetry.boc_db_element_write_nanos.update(
now.elapsed().as_nanos() as u64 / (visited.len() as u64 + created as u64));
if !visited.is_empty() {
self.telemetry.boc_db_element_write_nanos.update(
now.elapsed().as_nanos() as u64 / (visited.len() as u64 + created as u64));
}

log::debug!(
target: TARGET,
Expand Down Expand Up @@ -522,7 +527,8 @@ impl DynamicBocDb {
self.db.write(transaction)?;

let updated = visited.len() - deleted;
#[cfg(feature = "telemetry")] {
#[cfg(feature = "telemetry")]
if !visited.is_empty() {
self.telemetry.deleted_cells_speed.update(deleted as u64);
self.telemetry.updated_cells_speed.update(updated as u64);
self.telemetry.boc_db_element_write_nanos.update(
Expand Down
6 changes: 3 additions & 3 deletions validator-session/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ metrics = '0.21'
num-derive = '0.4'
num-traits = '0.2'
rand = '0.8'
adnl = { git = 'https://github.com/everx-labs/ever-adnl.git', tag = '0.11.32' }
adnl = { git = 'https://github.com/everx-labs/ever-adnl.git', tag = '0.11.38' }
catchain = { path = '../catchain' }
ever_block = { git = 'https://github.com/everx-labs/ever-block.git', tag = '1.11.20' }
ever_block = { git = 'https://github.com/everx-labs/ever-block.git', tag = '1.11.22' }
storage = { path = '../storage' }
ton_api = { git = 'https://github.com/everx-labs/ever-tl.git', package = 'ton_api', tag = '0.4.29' }
ton_api = { git = 'https://github.com/everx-labs/ever-tl.git', package = 'ton_api', tag = '0.4.32' }

[dev-dependencies]
chrono = '0.4'
Expand Down
4 changes: 1 addition & 3 deletions validator-session/src/session_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,9 +687,7 @@ impl SessionProcessor for SessionProcessorImpl {
let block_processing_latency = get_elapsed_time(&block.get_creation_time());
let delivery_issue = block_processing_latency < BLOCK_PROCESSING_WARN_LATENCY;

if !delivery_issue {
force_batching_mode = true; //ask catchain to batch blocks in case of overloaded session incoming queues
}
force_batching_mode = true; //ask catchain to batch blocks in case of overloaded session incoming queues

let warn_elapsed = get_elapsed_time(&self.last_process_blocks_warn_dump_time);

Expand Down