Skip to content

Commit bebd143

Browse files
committed
Update version
1 parent 5438eaa commit bebd143

33 files changed

+2038
-585
lines changed

CHANGELOG.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@
22

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

5-
## Version: 0.50.23
5+
## Version: 0.51.0
66

77
### New
8+
- Merge to master
9+
- Fix build after rocksdb release 0.19
10+
- Async states storage
11+
- Fixed state and handle mismatch in ShardStatesKeeper::worker
12+
- - used try_get instead get
13+
- - decreased copying using VisitedCell
14+
- - to be continued...
15+
- ...while saving persistent state
816

917

1018
## Version: 0.50.23

Cargo.toml

+16-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
edition = '2021'
33
name = 'ton_node'
4-
version = '0.50.23'
4+
version = '0.51.0'
55
build = 'common/build/build.rs'
66

77

@@ -17,7 +17,7 @@ async-trait = '0.1.22'
1717
async-recursion = '0.3.2'
1818
base64 = '0.13'
1919
bitflags = '1.2.1'
20-
chrono = '0.4.10'
20+
chrono = '=0.4.19'
2121
clap = '2.33.1'
2222
colored = '1.9.3'
2323
crossbeam-channel = '0.4.2'
@@ -43,25 +43,25 @@ sha2 = '0.9'
4343
spin = '0.7.1'
4444
stream-cancel = '0.8.0'
4545
string-builder = '^0.2.0'
46-
adnl = { features = [ 'client', 'node', 'server' ], git = 'https://github.com/tonlabs/ton-labs-adnl', tag = '0.7.75' }
46+
adnl = { features = [ 'client', 'node', 'server' ], git = 'https://github.com/tonlabs/ton-labs-adnl', tag = '0.7.76' }
4747
catchain = { path = 'catchain' }
48-
dht = { git = 'https://github.com/tonlabs/ton-labs-dht', tag = '0.5.72' }
49-
ever-crypto = { git = 'https://github.com/tonlabs/ever-labs-crypto', tag = '0.1.29' }
48+
dht = { git = 'https://github.com/tonlabs/ton-labs-dht', tag = '0.5.73' }
49+
ever-crypto = { git = 'https://github.com/tonlabs/ever-labs-crypto', tag = '0.1.33' }
5050
lockfree = { git = 'https://github.com/tonlabs/lockfree.git' }
51-
overlay = { git = 'https://github.com/tonlabs/ton-labs-overlay', tag = '0.6.59' }
52-
rldp = { git = 'https://github.com/tonlabs/ton-labs-rldp', tag = '0.7.69' }
51+
overlay = { git = 'https://github.com/tonlabs/ton-labs-overlay', tag = '0.6.60' }
52+
rldp = { git = 'https://github.com/tonlabs/ton-labs-rldp', tag = '0.7.70' }
5353
rustracing = { optional = true, version = '0.4.0' }
5454
rustracing_jaeger = { optional = true, version = '0.4.1' }
5555
statsd = { optional = true, version = '0.14.0' }
5656
storage = { path = 'storage' }
5757
tokio = { features = [ 'rt-multi-thread' ], version = '1.5' }
58-
ton_abi = { git = 'https://github.com/tonlabs/ton-labs-abi.git', tag = '2.3.1' }
59-
ton_api = { git = 'https://github.com/tonlabs/ton-labs-tl', package = 'ton_api', tag = '0.2.129' }
60-
ton_block = { git = 'https://github.com/tonlabs/ton-labs-block', tag = '1.8.0' }
61-
ton_block_json = { git = 'https://github.com/tonlabs/ton-labs-block-json.git', tag = '0.7.24' }
62-
ton_executor = { git = 'https://github.com/tonlabs/ton-labs-executor', tag = '1.15.78' }
58+
ton_abi = { git = 'https://github.com/tonlabs/ton-labs-abi.git', tag = '2.3.5' }
59+
ton_api = { git = 'https://github.com/tonlabs/ton-labs-tl', package = 'ton_api', tag = '0.2.130' }
60+
ton_block = { git = 'https://github.com/tonlabs/ton-labs-block', tag = '1.8.1' }
61+
ton_block_json = { git = 'https://github.com/tonlabs/ton-labs-block-json.git', tag = '0.7.29' }
62+
ton_executor = { git = 'https://github.com/tonlabs/ton-labs-executor', tag = '1.15.84' }
6363
ton_types = { git = 'https://github.com/tonlabs/ton-labs-types', tag = '1.11.3' }
64-
ton_vm = { git = 'https://github.com/tonlabs/ton-labs-vm', tag = '1.8.40' }
64+
ton_vm = { git = 'https://github.com/tonlabs/ton-labs-vm', tag = '1.8.42' }
6565
validator_session = { path = 'validator-session' }
6666

6767
[target.'cfg(unix)'.dependencies.rdkafka]
@@ -74,7 +74,7 @@ optional = true
7474
version = '0.26.0'
7575

7676
[features]
77-
default = [ 'telemetry' ]
77+
default = [ 'telemetry', 'async_ss_storage' ]
7878
external_db = [ 'rdkafka' ]
7979
ci_run = [ 'storage/ci_run' ]
8080
export_key = [ 'catchain/export_key', 'ever-crypto/export_key' ]
@@ -89,4 +89,6 @@ telemetry = [
8989
]
9090
trace_alloc_detail = [ 'trace_alloc' ]
9191
trace_alloc = [ ]
92+
async_ss_storage = [ 'storage/ref_count_gc' ]
9293
workchains = [ ]
94+
gosh = [ 'ton_block/gosh', 'ton_vm/gosh' ]

catchain/Cargo.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ regex = '1.3.1'
2222
sha2 = '0.9'
2323
tokio = { features = [ 'rt-multi-thread' ], version = '1.5' }
2424

25-
adnl = { features = [ 'node' ], git = 'https://github.com/tonlabs/ton-labs-adnl', tag = '0.7.75' }
26-
ever-crypto = { git = 'https://github.com/tonlabs/ever-labs-crypto', tag = '0.1.29' }
27-
overlay = { git = 'https://github.com/tonlabs/ton-labs-overlay', tag = '0.6.59' }
28-
rldp = { git = 'https://github.com/tonlabs/ton-labs-rldp', tag = '0.7.69' }
25+
adnl = { features = [ 'node' ], git = 'https://github.com/tonlabs/ton-labs-adnl', tag = '0.7.76' }
26+
ever-crypto = { git = 'https://github.com/tonlabs/ever-labs-crypto', tag = '0.1.33' }
27+
overlay = { git = 'https://github.com/tonlabs/ton-labs-overlay', tag = '0.6.60' }
28+
rldp = { git = 'https://github.com/tonlabs/ton-labs-rldp', tag = '0.7.70' }
2929
storage = { path = '../storage' }
30-
ton_api = { git = 'https://github.com/tonlabs/ton-labs-tl', package = 'ton_api', tag = '0.2.129' }
30+
ton_api = { git = 'https://github.com/tonlabs/ton-labs-tl', package = 'ton_api', tag = '0.2.130' }
3131
ton_types = { git = 'https://github.com/tonlabs/ton-labs-types', tag = '1.11.3' }
3232

3333
[features]

commit_hash.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f44cd2c64fa4876d9f785f691c9ca1c7e076fd45
1+
ec1be35fc5e13e40875cd40297f69e5fb2a8150e

deps_map.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"adnl":"429fde6f0d5d0b0f445c4a7a8b32fd05de3f2daa","dht":"ae70dc4f635efb3d04ffe29ae361d6367bb8e0a4","ever-crypto":"4a9cefdfca1f20906c1c940cbca0af4b17e4b100","overlay":"9c6b0652d2b07b65a6245036cb4974175adeb46e","rldp":"fdec766db7f08c56665e360e04397055176f71a5","ton-labs-abi":"038e5c5ce85ca9a660780065a26e3520af5ad485","ton-tl":"99156ea96968bd86bc2d28814940253597fa2c2b","ton-block":"44683365a549ac28b1516b081621fa91c356d741","ton-block-json":"2f3766e2dcfad3aae8d3f190a66b47be7158f388","ton-executor":"aad4e507c4ec982aa57bc117691232147cecc79e","ton-types":"d04d4938a776665c7c276bff6bd860b0a6a1f45e","ton-vm":"8448a4627dd9d957cf4f187602582027b29c6b77"}
1+
{"adnl":"4c013a482f4dd593a1bdd8ba5fd31383c2fe2c66","dht":"56487cd8424062b375df096759b8310e699d7d2f","ever-crypto":"311b351a9af3b29d867fda7d29df69f7533156a1","overlay":"a44ea2faeef529258562ecc0e0deacd67c8130d6","rldp":"70613c5d7306fde3327a7921e31a41015f28fa5b","ton-labs-abi":"10d1790dc87a90cd51ad080deeddc93a85031513","ton-tl":"c5d4eea9ed50954c285dab82d08aab2cd42a23bc","ton-block":"e1210b6ed2560f58b5686c3e7ab41b20e885a987","ton-block-json":"77a01ebb92a978bbbd68b148fb37dd9c55f6fa01","ton-executor":"52f1ec58903834034cf070cfd1ebf59694d64b8e","ton-types":"d04d4938a776665c7c276bff6bd860b0a6a1f45e","ton-vm":"8cccb7ff36f8ce11712b59dc00d09da8f447540a"}

src/boot.rs

+10-110
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,18 @@ async fn download_block_and_state(
336336
};
337337
if !handle.has_state() {
338338
let state_update = block.block().read_state_update()?;
339-
log::info!(target: "boot", "download state {}", handle.id());
339+
log::info!(target: "boot", "downloading state {}...", handle.id());
340340
let (state, data) = engine.download_state(handle.id(), master_id, active_peers, attempts).await?;
341341
let state_hash = state.root_cell().repr_hash();
342342
if state_update.new_hash != state_hash {
343343
fail!("root_hash {} of downloaded state {} is wrong", state_hash.to_hex_string(), handle.id())
344344
}
345+
346+
let now = std::time::Instant::now();
347+
log::info!(target: "boot", "storing state {}...", handle.id());
345348
let state = engine.store_state(&handle, state, Some(&data)).await?;
349+
log::info!(target: "boot", "stored state {} TIME: {}s", handle.id(), now.elapsed().as_secs());
350+
346351
engine.process_full_state_in_ext_db(&state).await?;
347352
}
348353
engine.set_applied(&handle, master_id.seq_no()).await?;
@@ -373,6 +378,9 @@ pub async fn cold_boot(engine: Arc<dyn EngineOperations>) -> Result<BlockIdExt>
373378
Ok(handle.id().clone())
374379
}
375380

381+
/*
382+
We don't need warm boot: restore db checks and restores db if need.
383+
376384
pub async fn warm_boot(
377385
engine: Arc<dyn EngineOperations>,
378386
block_id: Arc<BlockIdExt>
@@ -401,112 +409,4 @@ pub async fn warm_boot(
401409
}
402410
log::info!(target: "boot", "last key block id = {}", block_id);
403411
Ok(block_id)
404-
}
405-
406-
/*
407-
pub async fn cold_sync_stub(engine: Arc<Engine>) -> Result<BlockIdExt> {
408-
409-
log::info!("cold_sync_stub");
410-
411-
// For now we can't read key blocks chain, so start not from zerostate but from last key block
412-
413-
414-
let mc_overlay = engine.get_masterchain_overlay().await?;
415-
let shards_overlay = engine.get_full_node_overlay(0, SHARD_FULL).await?;
416-
417-
let init_mc_block_handle = engine.db().load_block_handle(engine.init_mc_block_id())?;
418-
419-
let ss = if !init_mc_block_handle.state_inited() {
420-
let ss = download_persistent_state(engine.init_mc_block_id(), engine.init_mc_block_id(), mc_overlay.deref()).await?;
421-
engine.db().store_shard_state_dynamic(&init_mc_block_handle, &ss)?;
422-
engine.process_full_state_in_ext_db(&ss).await?;
423-
ss
424-
} else {
425-
engine.load_state(&init_mc_block_handle).await?
426-
};
427-
428-
if init_mc_block_handle.id().seq_no() == 0 {
429-
engine.db().store_block_applied(init_mc_block_handle.id())?;
430-
431-
// load workchain zerostate
432-
433-
let custom = ss
434-
.shard_state()
435-
.read_custom()?
436-
.ok_or_else(|| error!("No custom field in zerostate"))?;
437-
let cp12 = custom.config.config(12)?.ok_or_else(|| error!("No config param 12 in zerostate"))?;
438-
439-
if let ConfigParamEnum::ConfigParam12(cp12) = cp12 {
440-
let wc = cp12.get(0)?.ok_or_else(|| error!("No description for base workchain"))?;
441-
442-
let zerostate_id = BlockIdExt {
443-
shard_id: ShardIdent::with_tagged_prefix(BASE_WORKCHAIN_ID, SHARD_FULL)?,
444-
seq_no: 0,
445-
root_hash: wc.zerostate_root_hash,
446-
file_hash: wc.zerostate_file_hash,
447-
};
448-
449-
let handle = engine.db().load_block_handle(&zerostate_id)?;
450-
451-
if !handle.applied() {
452-
let ss = download_persistent_state(&zerostate_id, engine.init_mc_block_id(), shards_overlay.deref()).await?;
453-
engine.db().store_shard_state_dynamic(&handle, &ss)?;
454-
engine.process_full_state_in_ext_db(&ss).await?;
455-
engine.db().store_block_applied(&zerostate_id)?;
456-
}
457-
458-
} else {
459-
fail!("Can't read config param 12")
460-
}
461-
} else {
462-
463-
// Load master block and state
464-
465-
let init_mc_block = if !init_mc_block_handle.data_inited() {
466-
467-
let (block, proof) = loop {
468-
if let Ok(Some((block, proof))) = mc_overlay.download_block_full(engine.init_mc_block_id(), 300).await {
469-
break (block, proof);
470-
}
471-
};
472-
engine.db().store_block_data(&init_mc_block_handle, &block)?;
473-
engine.db().store_block_proof(&init_mc_block_handle, &proof)?;
474-
engine.process_block_in_ext_db(&init_mc_block_handle, &block, Some(&proof), &ss).await?;
475-
engine.db().store_block_applied(engine.init_mc_block_id())?;
476-
block
477-
} else {
478-
engine.db().load_block_data(engine.init_mc_block_id())?
479-
};
480-
481-
// Load shards blocks and states
482-
483-
for (_shard_ident, block_id) in init_mc_block.shards_blocks()? {
484-
485-
let block_handle = engine.db().load_block_handle(&block_id)?;
486-
487-
let ss = if !block_handle.state_inited() {
488-
let ss = download_persistent_state(&block_id, engine.init_mc_block_id(), shards_overlay.deref()).await?;
489-
engine.db().store_shard_state_dynamic(&block_handle, &ss)?;
490-
engine.process_full_state_in_ext_db(&ss).await?;
491-
ss
492-
} else {
493-
engine.load_state(&block_handle).await?
494-
};
495-
496-
if !block_handle.data_inited() {
497-
let (block, proof) = loop {
498-
if let Ok(Some((block, proof))) = shards_overlay.download_block_full(&block_id, 30).await {
499-
break (block, proof);
500-
}
501-
};
502-
engine.db().store_block_data(&block_handle, &block)?;
503-
engine.db().store_block_proof(&block_handle, &proof)?;
504-
engine.process_block_in_ext_db(&block_handle, &block, None, &ss).await?;
505-
engine.db().store_block_applied(&block_id)?;
506-
}
507-
}
508-
}
509-
510-
Ok(engine.init_mc_block_id().clone())
511-
}
512-
*/
412+
}*/

src/collator_test_bundle.rs

+12-9
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,13 @@ impl CollatorTestBundle {
387387
&allocated
388388
)?
389389
} else {
390-
ShardStateStuff::deserialize(
390+
ShardStateStuff::deserialize_inmem(
391391
ss_id.clone(),
392-
&data,
392+
Arc::new(data),
393393
#[cfg(feature = "telemetry")]
394394
&telemetry,
395-
&allocated
395+
&allocated,
396+
&|| false
396397
)?
397398
};
398399
states.insert(ss_id.clone(), ss);
@@ -403,12 +404,13 @@ impl CollatorTestBundle {
403404
let data = read(&filename).map_err(|_| error!("cannot read file {}", filename))?;
404405
states.insert(
405406
index.id.clone(),
406-
ShardStateStuff::deserialize(
407+
ShardStateStuff::deserialize_inmem(
407408
index.id.clone(),
408-
&data,
409+
Arc::new(data),
409410
#[cfg(feature = "telemetry")]
410411
&telemetry,
411-
&allocated
412+
&allocated,
413+
&|| false
412414
)?
413415
);
414416
}
@@ -426,12 +428,13 @@ impl CollatorTestBundle {
426428
&allocated
427429
)?
428430
} else {
429-
ShardStateStuff::deserialize(
431+
ShardStateStuff::deserialize_inmem(
430432
oldest_mc_state_id.clone(),
431-
&data,
433+
Arc::new(data),
432434
#[cfg(feature = "telemetry")]
433435
&telemetry,
434-
&allocated
436+
&allocated,
437+
&|| false
435438
)?
436439
};
437440
let mut prev_state_root = oldest_mc_state.root_cell().clone();

0 commit comments

Comments
 (0)