Skip to content

Commit 21dc0a6

Browse files
committed
Use modern collator with aborting procedure
1 parent 16a2616 commit 21dc0a6

File tree

4 files changed

+85
-69
lines changed

4 files changed

+85
-69
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

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

5+
## Version 0.59.12
6+
7+
- Use modern collator with aborting procedure
8+
59
## Version 0.59.11
610

711
- Fix for broken shard merge

Cargo.toml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22
build = 'common/build/build.rs'
33
edition = '2021'
44
name = 'ever-node'
5-
version = '0.59.11'
5+
version = '0.59.12'
66

77
[workspace]
8-
members = [ 'storage' ]
8+
members = [
9+
'ever-vm-private',
10+
'ever-block-private',
11+
'ever-block-json-private',
12+
'ever-executor-private',
13+
'storage'
14+
]
915

1016
[[bin]]
1117
name = 'adnl_resolve'
@@ -133,3 +139,29 @@ features = [ 'cmake_build' ]
133139
optional = true
134140
version = '0.26.0'
135141

142+
[patch.'https://github.com/everx-labs/ever-block.git']
143+
ever_block = { path = 'ever-block-private' }
144+
145+
[patch.'ssh://git@github.com/everx-labs/ever-block-private.git']
146+
ever_block = { path = 'ever-block-private' }
147+
148+
[patch.'https://github.com/everx-labs/ever-executor.git']
149+
ever_executor = { path = 'ever-executor-private' }
150+
151+
[patch.'ssh://git@github.com/everx-labs/ever-vm-private.git']
152+
ever_vm = { path = 'ever-vm-private' }
153+
154+
[patch.'https://github.com/everx-labs/ever-vm.git']
155+
ever_vm = { path = 'ever-vm-private' }
156+
157+
[patch.'ssh://git@github.com/everx-labs/ever-block-json-private.git']
158+
ever_block_json = { path = 'ever-block-json-private' }
159+
160+
#[patch.'https://github.com/everx-labs/ever-block-json.git']
161+
#ever_block_json = { path = 'ever-block-json-private' }
162+
163+
#[patch.'ssh://git@github.com/everx-labs/ever-vm-private.git']
164+
#ever_vm = { git = 'https://github.com/everx-labs/ever-vm.git' }
165+
166+
#[patch.'https://github.com/everx-labs/ever-executor.git']
167+
#ever_executor = { path = 'ever-executor-private' }

src/tests/test_shard_blocks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use super::*;
1515
use crate::test_helper::gen_master_state;
1616
use crate::collator_test_bundle::{create_block_handle_storage, create_engine_allocated};
17-
#[cfg(all(feature = "telemetry", not(feature = "fast_finality")))]
17+
#[cfg(all(feature = "telemetry"))]
1818
use crate::collator_test_bundle::create_engine_telemetry;
1919
use std::{sync::{atomic::{AtomicU32, Ordering}, Arc}, collections::HashSet};
2020
use storage::{block_handle_db::{BlockHandle, BlockHandleStorage}, types::BlockMeta};

src/validator/collator.rs

Lines changed: 46 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -201,17 +201,6 @@ struct NewMessage {
201201
prefix: AccountIdPrefixFull,
202202
}
203203

204-
impl NewMessage {
205-
fn new(lt_hash: (u64, UInt256), msg: CommonMessage, tr_cell: Cell, prefix: AccountIdPrefixFull) -> Self {
206-
Self {
207-
lt_hash,
208-
msg,
209-
tr_cell,
210-
prefix,
211-
}
212-
}
213-
}
214-
215204
impl Ord for NewMessage {
216205
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
217206
other.lt_hash.cmp(&self.lt_hash)
@@ -340,12 +329,12 @@ impl CollatorData {
340329
collated_block_descr: Arc<String>,
341330
) -> Result<Self> {
342331
let limits = Arc::new(config.raw_config().block_limits(is_masterchain)?);
343-
let opts = serde_opts_from_caps(&config);
332+
let serde_opts = serde_opts_from_caps(&config);
344333
let split_queues = !config.has_capability(GlobalCapabilities::CapNoSplitOutQueue);
345334
let ret = Self {
346-
in_msgs: InMsgDescr::with_serde_opts(opts),
335+
in_msgs: InMsgDescr::with_serde_opts(serde_opts),
347336
in_msgs_descr_history: Default::default(),
348-
out_msgs: OutMsgDescr::with_serde_opts(opts),
337+
out_msgs: OutMsgDescr::with_serde_opts(serde_opts),
349338
out_msgs_descr_history: Default::default(),
350339
accounts: ShardAccountBlocks::default(),
351340
out_msg_queue_info: OutMsgQueueInfoStuff::default(),
@@ -401,7 +390,7 @@ impl CollatorData {
401390
remove_count: 0,
402391
msg_queue_depth_sum: 0,
403392
before_split: false,
404-
serde_opts: opts,
393+
serde_opts,
405394
split_queues,
406395
collated_block_descr,
407396
};
@@ -510,9 +499,8 @@ impl CollatorData {
510499
self.add_in_msg_descr_to_history(src_msg_sync_key, in_msg)?;
511500
}
512501
let shard = self.out_msg_queue_info.shard().clone();
513-
let opts = self.serde_opts;
514502
transaction.out_msgs.iterate_slices(|slice| {
515-
let msg_cell: ChildCell<CommonMessage> = ChildCell::with_cell_and_opts(slice.reference(0)?, opts);
503+
let msg_cell: ChildCell<CommonMessage> = ChildCell::with_cell_and_opts(slice.reference(0)?, self.serde_opts);
516504
let msg_hash = msg_cell.hash();
517505
let common_msg = msg_cell.read_struct()?;
518506
let msg = common_msg.get_std()?;
@@ -521,13 +509,17 @@ impl CollatorData {
521509
// Add out message to state for counting time and it may be removed if used
522510
let use_hypercube = !self.config.has_capability(GlobalCapabilities::CapOffHypercube);
523511
let fwd_fee = *info.fwd_fee();
524-
let enq = MsgEnqueueStuff::new(common_msg.clone(), &shard, fwd_fee, use_hypercube, opts)?;
512+
let enq = MsgEnqueueStuff::new(common_msg.clone(), &shard, fwd_fee, use_hypercube, self.serde_opts)?;
525513
self.enqueue_count += 1;
526514
self.msg_queue_depth_sum += self.out_msg_queue_info.add_message(&enq)?;
527515
// Add to message block here for counting time later it may be replaced
528516
let out_msg = OutMsg::new(enq.envelope_cell(), tr_cell.clone());
529-
let new_msg = NewMessage::new((info.created_lt, msg_hash.clone()), common_msg, tr_cell.cell(), enq.next_prefix().clone());
530-
517+
let new_msg = NewMessage {
518+
lt_hash: (info.created_lt, msg_hash.clone()),
519+
msg: common_msg,
520+
tr_cell: tr_cell.cell(),
521+
prefix: enq.next_prefix().clone(),
522+
};
531523
self.add_out_queue_msg_with_history(src_msg_sync_key, enq)?;
532524

533525
// Add to message block here for counting time later it may be replaced
@@ -1150,6 +1142,7 @@ struct ExecutionManager {
11501142
min_lt: Arc<AtomicU64>,
11511143
// block random seed
11521144
seed_block: UInt256,
1145+
serde_opts: u8,
11531146

11541147
#[cfg(feature = "signature_with_id")]
11551148
// signature ID used in VM
@@ -1166,43 +1159,47 @@ struct ExecutionManager {
11661159

11671160
impl ExecutionManager {
11681161
pub fn new(
1169-
gen_utime: u32,
1170-
start_lt: u64,
1171-
seed_block: UInt256,
1172-
#[cfg(feature = "signature_with_id")]
1173-
signature_id: i32,
1174-
libraries: Libraries,
1175-
config: BlockchainConfig,
1176-
max_collate_threads: usize,
1177-
max_collate_msgs_queue_on_account: usize,
1178-
collated_block_descr: Arc<String>,
1179-
debug: bool,
1180-
f_check_finalize_parallel_timeout: Box<dyn Fn() -> (bool, u32) + Send>,
1162+
collator: &Collator,
1163+
collator_data: &CollatorData,
1164+
mc_data: &McData,
11811165
) -> Result<Self> {
1166+
let collated_block_descr = collator_data.collated_block_descr.clone();
11821167
log::trace!("{}: ExecutionManager::new", collated_block_descr);
11831168
let (wait_tr, receive_tr) = Wait::new();
1169+
// closure to check the finalize timeout for parallel transactions
1170+
let collation_started = collator.started.clone();
1171+
let finalize_parallel_timeout_ms = collator.finalize_parallel_timeout_ms;
1172+
let f_check_finalize_parallel_timeout = Box::new(move || (
1173+
collation_started.elapsed().as_millis() as u32 > finalize_parallel_timeout_ms,
1174+
finalize_parallel_timeout_ms,
1175+
));
1176+
let start_lt = collator_data.start_lt()?;
1177+
let max_collate_threads = collator.engine.collator_config().max_collate_threads as usize;
1178+
let max_collate_msgs_queue_on_account = collator.engine.collator_config().max_collate_msgs_queue_on_account as usize;
11841179
Ok(Self {
11851180
changed_accounts: HashMap::new(),
11861181
msgs_queue: Vec::new(),
11871182
accounts_processed_msgs: HashMap::new(),
1183+
// cancellation_token: collator.engine.collator_config() tokio_util::sync::CancellationToken::new(),
11881184
cancellation_token: tokio_util::sync::CancellationToken::new(),
11891185
f_check_finalize_parallel_timeout,
11901186
receive_tr,
11911187
wait_tr,
11921188
max_collate_threads,
11931189
parallel_msgs_counter: ParallelMsgsCounter::new(max_collate_threads, max_collate_msgs_queue_on_account),
1194-
libraries,
1195-
config,
1190+
libraries: mc_data.libraries()?.clone(),
1191+
config: collator_data.config.clone(),
11961192
start_lt,
1197-
gen_utime,
1198-
seed_block,
1193+
gen_utime: collator_data.gen_utime(),
1194+
seed_block: collator.rand_seed.clone(),
1195+
serde_opts: collator_data.serde_opts,
11991196
#[cfg(feature = "signature_with_id")]
1200-
signature_id,
1197+
signature_id: mc_data.state().state()?.global_id(), // Use network global ID as signature ID
12011198
max_lt: start_lt + 1,
12021199
min_lt: Arc::new(AtomicU64::new(start_lt + 1)),
12031200
total_trans_duration: Arc::new(AtomicU64::new(0)),
12041201
collated_block_descr,
1205-
debug,
1202+
debug: collator.debug,
12061203
#[cfg(test)]
12071204
test_msg_process_sleep: 0,
12081205
})
@@ -1313,7 +1310,7 @@ impl ExecutionManager {
13131310
account_addr,
13141311
shard_acc,
13151312
self.min_lt.load(Ordering::Relaxed),
1316-
serde_opts_from_caps(&self.config)
1313+
self.serde_opts
13171314
)?;
13181315

13191316
let debug = self.debug;
@@ -2151,27 +2148,10 @@ impl Collator {
21512148
// compute created / minted / recovered / from_prev_blk
21522149
self.update_value_flow(mc_data, &prev_data, collator_data)?;
21532150

2154-
// closure to check the finalize timeout for parallel transactions
2155-
let collation_started = self.started.clone();
2156-
let finalize_parallel_timeout_ms = self.finalize_parallel_timeout_ms;
2157-
let check_finilize_parallel_timeout_closure = move || (
2158-
collation_started.elapsed().as_millis() as u32 > finalize_parallel_timeout_ms,
2159-
finalize_parallel_timeout_ms,
2160-
);
2161-
21622151
let mut exec_manager = ExecutionManager::new(
2163-
collator_data.gen_utime(),
2164-
collator_data.start_lt()?,
2165-
self.rand_seed.clone(),
2166-
#[cfg(feature = "signature_with_id")]
2167-
mc_data.state().state()?.global_id(), // Use network global ID as signature ID
2168-
mc_data.libraries()?.clone(),
2169-
collator_data.config.clone(),
2170-
self.engine.collator_config().max_collate_threads as usize,
2171-
self.engine.collator_config().max_collate_msgs_queue_on_account as usize,
2172-
self.collated_block_descr.clone(),
2173-
self.debug,
2174-
Box::new(check_finilize_parallel_timeout_closure),
2152+
self,
2153+
collator_data,
2154+
mc_data,
21752155
)?;
21762156

21772157
#[cfg(test)]
@@ -4455,7 +4435,7 @@ impl Collator {
44554435
if !res {
44564436
fail!(
44574437
"cannot apply the after-split update for {} without a corresponding sibling update",
4458-
new_info.blk_id()
4438+
new_info.block_id()
44594439
);
44604440
}
44614441
if let Some(ancestor) = ancestor {
@@ -4656,12 +4636,12 @@ impl Collator {
46564636
self.started.elapsed().as_millis() as u32 > cutoff_timeout
46574637
}
46584638

4659-
fn check_finilize_parallel_timeout(&self) -> (bool, u32) {
4660-
(
4661-
self.started.elapsed().as_millis() as u32 > self.finalize_parallel_timeout_ms,
4662-
self.finalize_parallel_timeout_ms,
4663-
)
4664-
}
4639+
// fn check_finilize_parallel_timeout(&self) -> (bool, u32) {
4640+
// (
4641+
// self.started.elapsed().as_millis() as u32 > self.finalize_parallel_timeout_ms,
4642+
// self.finalize_parallel_timeout_ms,
4643+
// )
4644+
// }
46654645

46664646
fn get_remaining_cutoff_time_limit_nanos(&self) -> i128 {
46674647
let cutoff_timeout_nanos = self.engine.collator_config().cutoff_timeout_ms as i128 * 1_000_000;

0 commit comments

Comments
 (0)