Skip to content

Commit 33123cb

Browse files
committed
Update version
1 parent 5494f43 commit 33123cb

19 files changed

+292
-157
lines changed

CHANGELOG.md

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

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

5-
## Version: 0.50.5
5+
## Version: 0.50.13
66

77
### New
8-
- Merge to master
98

109

1110

Cargo.toml

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
edition = '2018'
33
name = 'ton_node'
4-
version = '0.50.5'
4+
version = '0.50.13'
55

66

77
[workspace]
@@ -20,7 +20,7 @@ chrono = '0.4.10'
2020
clap = '2.33.1'
2121
colored = '1.9.3'
2222
crossbeam-channel = '0.4.2'
23-
ctrlc = '3.2.1'
23+
ctrlc = { features = [ 'termination' ], version = '3.2.1' }
2424
dirs = '2.0.2'
2525
env_logger = '0.7.1'
2626
failure = '0.1'
@@ -42,25 +42,25 @@ sha2 = '0.9'
4242
spin = '0.7.1'
4343
stream-cancel = '0.8.0'
4444
string-builder = '^0.2.0'
45-
adnl = { features = [ 'client', 'node', 'server' ], git = 'https://github.com/tonlabs/ton-labs-adnl', tag = '0.7.67' }
45+
adnl = { features = [ 'client', 'node', 'server' ], git = 'https://github.com/tonlabs/ton-labs-adnl', tag = '0.7.69' }
4646
catchain = { path = 'catchain' }
47-
dht = { git = 'https://github.com/tonlabs/ton-labs-dht', tag = '0.5.62' }
48-
ever-crypto = { git = 'https://github.com/tonlabs/ever-labs-crypto', tag = '0.1.7' }
47+
dht = { git = 'https://github.com/tonlabs/ton-labs-dht', tag = '0.5.64' }
48+
ever-crypto = { git = 'https://github.com/tonlabs/ever-labs-crypto', tag = '0.1.15' }
4949
lockfree = { git = 'https://github.com/tonlabs/lockfree.git' }
50-
overlay = { git = 'https://github.com/tonlabs/ton-labs-overlay', tag = '0.6.50' }
51-
rldp = { git = 'https://github.com/tonlabs/ton-labs-rldp', tag = '0.7.61' }
50+
overlay = { git = 'https://github.com/tonlabs/ton-labs-overlay', tag = '0.6.52' }
51+
rldp = { git = 'https://github.com/tonlabs/ton-labs-rldp', tag = '0.7.63' }
5252
rustracing = { optional = true, version = '0.4.0' }
5353
rustracing_jaeger = { optional = true, version = '0.4.1' }
5454
statsd = { optional = true, version = '0.14.0' }
5555
storage = { path = 'storage' }
5656
tokio = { features = [ 'rt-multi-thread' ], version = '1.5' }
57-
ton_abi = { git = 'https://github.com/tonlabs/ton-labs-abi.git', tag = '2.1.14' }
58-
ton_api = { git = 'https://github.com/tonlabs/ton-labs-tl', package = 'ton_api', tag = '0.2.120' }
59-
ton_block = { git = 'https://github.com/tonlabs/ton-labs-block', tag = '1.7.39' }
60-
ton_block_json = { git = 'https://github.com/tonlabs/ton-labs-block-json.git', tag = '0.7.5' }
61-
ton_executor = { git = 'https://github.com/tonlabs/ton-labs-executor', tag = '1.15.57' }
62-
ton_types = { git = 'https://github.com/tonlabs/ton-labs-types', tag = '1.10.12' }
63-
ton_vm = { git = 'https://github.com/tonlabs/ton-labs-vm', tag = '1.8.32' }
57+
ton_abi = { git = 'https://github.com/tonlabs/ton-labs-abi.git', tag = '2.1.19' }
58+
ton_api = { git = 'https://github.com/tonlabs/ton-labs-tl', package = 'ton_api', tag = '0.2.122' }
59+
ton_block = { git = 'https://github.com/tonlabs/ton-labs-block', tag = '1.7.43' }
60+
ton_block_json = { git = 'https://github.com/tonlabs/ton-labs-block-json.git', tag = '0.7.10' }
61+
ton_executor = { git = 'https://github.com/tonlabs/ton-labs-executor', tag = '1.15.63' }
62+
ton_types = { git = 'https://github.com/tonlabs/ton-labs-types', tag = '1.10.14' }
63+
ton_vm = { git = 'https://github.com/tonlabs/ton-labs-vm', tag = '1.8.33' }
6464
validator_session = { path = 'validator-session' }
6565

6666
[target.'cfg(unix)'.dependencies.rdkafka]

catchain/Cargo.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ 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.67' }
26-
ever-crypto = { git = 'https://github.com/tonlabs/ever-labs-crypto', tag = '0.1.7' }
27-
overlay = { git = 'https://github.com/tonlabs/ton-labs-overlay', tag = '0.6.50' }
28-
rldp = { git = 'https://github.com/tonlabs/ton-labs-rldp', tag = '0.7.61' }
25+
adnl = { features = [ 'node' ], git = 'https://github.com/tonlabs/ton-labs-adnl', tag = '0.7.69' }
26+
ever-crypto = { git = 'https://github.com/tonlabs/ever-labs-crypto', tag = '0.1.15' }
27+
overlay = { git = 'https://github.com/tonlabs/ton-labs-overlay', tag = '0.6.52' }
28+
rldp = { git = 'https://github.com/tonlabs/ton-labs-rldp', tag = '0.7.63' }
2929
storage = { path = '../storage' }
30-
ton_api = { git = 'https://github.com/tonlabs/ton-labs-tl', package = 'ton_api', tag = '0.2.120' }
31-
ton_types = { git = 'https://github.com/tonlabs/ton-labs-types', tag = '1.10.12' }
30+
ton_api = { git = 'https://github.com/tonlabs/ton-labs-tl', package = 'ton_api', tag = '0.2.122' }
31+
ton_types = { git = 'https://github.com/tonlabs/ton-labs-types', tag = '1.10.14' }
3232

3333
[dev-dependencies]
3434
env_logger = '0.7.1'

commit_hash.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12ff888ba999182e5247a083831952292f414797
1+
74d8c1df70ef12cb2aca1355467e3bf5b6d59680

deps_map.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"adnl":"3713f1f77cfc0420e91b696574befe113d94914e","dht":"46d66350b7def07ecad5be08590fe9b84e0f59a4","ever-crypto":"04933eeea4a3e1988c1d6c788918be2599cbc1e5","overlay":"4b2108b0132455faf348c783bf4405586294b7a5","rldp":"4f8727510a0c497668e23478b095f1a07baad548","ton-labs-abi":"ed3f54ffeb646ba9fe86bd69cc19c9d62a752426","ton-tl":"a46df37d842301bc2d43549334022dfa20903760","ton-block":"e40e2ed3f39de5e40cbc5383f691b0a8d8c07de1","ton-block-json":"25cba771beb767d89973b225d3fbe263ce2cc254","ton-executor":"e5272a1b6b8059f666a740bc98b98e3a28a51f49","ton-types":"007da5416f1508fdd5fd23be8099a5e0f06f564e","ton-vm":"a3530fddcd4cb170cceace2bd545bf82a29081de"}
1+
{"adnl":"2ca9639487a98a9e8b80d1e04412469e3bb4d453","dht":"45fe2fe70b73aee68b9665789e0b6ac4318f689c","ever-crypto":"093c57010a10598842800ba0bb1bb65d6cb5e299","overlay":"79cb6d6c4a5a1fa72eefb35288ae4afe6003a6ce","rldp":"f9c0713f8681cb930b8c26cf44ac0b17158d2222","ton-labs-abi":"a5357f3dc7ba5badc913fc23de0cad98b18f6c80","ton-tl":"98fa531e72d567060d189ba22d65c009a413b491","ton-block":"07c6e4dfddd5de38e09344c41b94c2f316944701","ton-block-json":"9b82c63ffb93d99381f3a80d59101d0792fd3087","ton-executor":"e0226404255c65c483988e592a4aff5047883d35","ton-types":"bfb76ae3db7f793772dcdf74b7cd9f4bdf9d3b31","ton-vm":"ec071f932c63c9018841a7bd32d1c18ee787c9d1"}

src/engine.rs

+62-71
Original file line numberDiff line numberDiff line change
@@ -151,23 +151,24 @@ pub struct Engine {
151151
}
152152

153153
struct DownloadContext<'a, T> {
154+
engine: &'a Engine,
154155
client: Arc<dyn FullNodeOverlayClient>,
155-
db: &'a InternalDb,
156156
downloader: Arc<dyn Downloader<Item = T>>,
157157
id: &'a BlockIdExt,
158158
limit: Option<u32>,
159159
log_error_limit: u32,
160160
name: &'a str,
161161
timeout: Option<(u64, u64, u64)>, // (current, multiplier*10, max)
162-
#[cfg(feature = "telemetry")]
163-
full_node_telemetry: &'a FullNodeTelemetry,
164162
}
165163

166164
impl <T> DownloadContext<'_, T> {
167165

168166
async fn download(&mut self) -> Result<T> {
169167
let mut attempt = 1;
170168
loop {
169+
if self.engine.check_stop() {
170+
fail!("{} id: {}, stop flag was set", self.name, self.id);
171+
}
171172
match self.downloader.try_download(self).await {
172173
Err(e) => self.log(format!("{}", e).as_str(), attempt),
173174
Ok(ret) => break Ok(ret)
@@ -219,10 +220,10 @@ impl Downloader for BlockDownloader {
219220
&self,
220221
context: &DownloadContext<'_, Self::Item>,
221222
) -> Result<Self::Item> {
222-
if let Some(handle) = context.db.load_block_handle(context.id)? {
223+
if let Some(handle) = context.engine.db.load_block_handle(context.id)? {
223224
let mut is_link = false;
224225
if handle.has_data() && handle.has_proof_or_link(&mut is_link) {
225-
let block = match context.db.load_block_data(&handle).await {
226+
let block = match context.engine.db.load_block_data(&handle).await {
226227
Err(e) => if !handle.has_data() {
227228
None
228229
} else {
@@ -233,7 +234,7 @@ impl Downloader for BlockDownloader {
233234
let proof = if block.is_none() {
234235
None
235236
} else {
236-
match context.db.load_block_proof(&handle, is_link).await {
237+
match context.engine.db.load_block_proof(&handle, is_link).await {
237238
Err(e) => if is_link && !handle.has_proof_link() {
238239
None
239240
} else if !is_link && !handle.has_proof() {
@@ -252,11 +253,11 @@ impl Downloader for BlockDownloader {
252253
}
253254
}
254255
#[cfg(feature = "telemetry")]
255-
context.full_node_telemetry.new_downloading_block_attempt(context.id);
256+
context.engine.full_node_telemetry.new_downloading_block_attempt(context.id);
256257
let ret = context.client.download_block_full(context.id).await;
257258
#[cfg(feature = "telemetry")]
258259
if ret.is_ok() {
259-
context.full_node_telemetry.new_downloaded_block(context.id);
260+
context.engine.full_node_telemetry.new_downloaded_block(context.id);
260261
}
261262
ret
262263
}
@@ -274,10 +275,10 @@ impl Downloader for BlockProofDownloader {
274275
&self,
275276
context: &DownloadContext<'_, Self::Item>,
276277
) -> Result<Self::Item> {
277-
if let Some(handle) = context.db.load_block_handle(context.id)? {
278+
if let Some(handle) = context.engine.db.load_block_handle(context.id)? {
278279
let mut is_link = false;
279280
if handle.has_proof_or_link(&mut is_link) {
280-
return Ok(context.db.load_block_proof(&handle, is_link).await?);
281+
return Ok(context.engine.db.load_block_proof(&handle, is_link).await?);
281282
}
282283
}
283284
context.client.download_block_proof(
@@ -297,15 +298,15 @@ impl Downloader for NextBlockDownloader {
297298
&self,
298299
context: &DownloadContext<'_, Self::Item>,
299300
) -> Result<Self::Item> {
300-
if let Some(prev_handle) = context.db.load_block_handle(context.id)? {
301+
if let Some(prev_handle) = context.engine.db.load_block_handle(context.id)? {
301302
if prev_handle.has_next1() {
302-
let next_id = context.db.load_block_next1(context.id)?;
303-
if let Some(next_handle) = context.db.load_block_handle(&next_id)? {
303+
let next_id = context.engine.db.load_block_next1(context.id)?;
304+
if let Some(next_handle) = context.engine.db.load_block_handle(&next_id)? {
304305
let mut is_link = false;
305306
if next_handle.has_data() && next_handle.has_proof_or_link(&mut is_link) {
306307
return Ok((
307-
context.db.load_block_data(&next_handle).await?,
308-
context.db.load_block_proof(&next_handle, is_link).await?
308+
context.engine.db.load_block_data(&next_handle).await?,
309+
context.engine.db.load_block_proof(&next_handle, is_link).await?
309310
));
310311
}
311312
}
@@ -324,9 +325,9 @@ impl Downloader for ZeroStateDownloader {
324325
&self,
325326
context: &DownloadContext<'_, Self::Item>,
326327
) -> Result<Self::Item> {
327-
if let Some(handle) = context.db.load_block_handle(context.id)? {
328+
if let Some(handle) = context.engine.db.load_block_handle(context.id)? {
328329
if handle.has_state() {
329-
let zs = context.db.load_shard_state_dynamic(context.id)?;
330+
let zs = context.engine.db.load_shard_state_dynamic(context.id)?;
330331
let mut data = vec!();
331332
zs.write_to(&mut data)?;
332333
return Ok((zs, data));
@@ -1306,15 +1307,13 @@ impl Engine {
13061307
id.shard().workchain_id(),
13071308
id.shard().shard_prefix_with_tag()
13081309
).await?,
1309-
db: self.db.deref(),
1310+
engine: self,
13101311
downloader,
13111312
id,
13121313
limit,
13131314
log_error_limit,
13141315
name,
13151316
timeout,
1316-
#[cfg(feature = "telemetry")]
1317-
full_node_telemetry: self.full_node_telemetry(),
13181317
};
13191318
Ok(ret)
13201319
}
@@ -1546,78 +1545,70 @@ impl Engine {
15461545

15471546
async fn check_gc_for_archives(
15481547
engine: &Arc<Engine>,
1549-
curr_block_handle: &Arc<BlockHandle>,
1548+
last_keyblock: &Arc<BlockHandle>,
15501549
mc_state: &ShardStateStuff
15511550
) -> Result<()> {
1552-
let mut prev_pss_block = None;
1553-
let mut prev_prev_pss_block = None;
1554-
let mut handle = curr_block_handle.clone();
1555-
let mut check_date = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH)?;
1556-
1551+
let mut gc_max_date = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH)?;
15571552
match &engine.archives_life_time {
15581553
None => return Ok(()),
15591554
Some(life_time) => {
1560-
match check_date.checked_sub(Duration::from_secs((life_time * 3600) as u64)) {
1555+
match gc_max_date.checked_sub(Duration::from_secs((life_time * 3600) as u64)) {
15611556
Some(date) => {
15621557
log::info!("archive gc: checked date {}.", &date.as_secs());
1563-
check_date = date
1558+
gc_max_date = date
15641559
},
15651560
None => {
15661561
log::info!("archive gc: life_time in config is bad, actual checked date: {}",
1567-
&check_date.as_secs()
1562+
&gc_max_date.as_secs()
15681563
);
15691564
}
15701565
}
15711566
}
15721567
}
15731568

1569+
let mut visited_pss_blocks = 0;
1570+
let mut keyblock = last_keyblock.clone();
1571+
let prev_blocks = &mc_state.shard_state_extra()?.prev_blocks;
15741572
loop {
1575-
if handle.id().seq_no() == 0 {
1576-
return Ok(());
1577-
}
1578-
1579-
if let Some(prev_key_block_id) =
1580-
mc_state.shard_state_extra()?.prev_blocks.get_prev_key_block(handle.id().seq_no() - 1)? {
1581-
1582-
let block_id = BlockIdExt {
1583-
shard_id: ShardIdent::masterchain(),
1584-
seq_no: prev_key_block_id.seq_no,
1585-
root_hash: prev_key_block_id.root_hash,
1586-
file_hash: prev_key_block_id.file_hash
1587-
};
1588-
let prev_handle = engine.load_block_handle(&block_id)?.ok_or_else(
1589-
|| error!("Cannot load handle for PSS keeper prev key block {}", block_id)
1590-
)?;
1591-
if engine.is_persistent_state(curr_block_handle.gen_utime()?,
1592-
prev_handle.gen_utime()?, boot::PSS_PERIOD_BITS) {
1593-
prev_prev_pss_block = prev_pss_block;
1594-
prev_pss_block = Some(prev_handle.clone());
1595-
}
1596-
handle = prev_handle;
1597-
1598-
if let Some(pss_block) = &prev_prev_pss_block {
1599-
let gen_time = pss_block.gen_utime()? as u64;
1600-
let check_date = check_date.as_secs();
1601-
if gen_time < check_date {
1602-
log::info!(
1603-
"gc for archives: found block (gen time: {}, seq_no: {}), check date: {}",
1604-
&gen_time, pss_block.id().seq_no(), &check_date
1605-
);
1606-
break;
1573+
match prev_blocks.get_prev_key_block(keyblock.id().seq_no() - 1)? {
1574+
None => return Ok(()),
1575+
Some(prev_keyblock) => {
1576+
let prev_keyblock = BlockIdExt::from_ext_blk(prev_keyblock);
1577+
let prev_keyblock = engine.load_block_handle(&prev_keyblock)?.ok_or_else(
1578+
|| error!("Cannot load handle for PSS keeper prev key block {}", prev_keyblock)
1579+
)?;
1580+
if engine.is_persistent_state(
1581+
keyblock.gen_utime()?, prev_keyblock.gen_utime()?, boot::PSS_PERIOD_BITS
1582+
) {
1583+
visited_pss_blocks += 1;
1584+
1585+
// Due to boot process specific (pss period and key_block_utime_step combinations)
1586+
// we shouldn't delete last 4 pss blocks
1587+
// ....................pss_block....pss_block....pss_block....pss_block...
1588+
// visited_pss_blocks: 4 3 2 1
1589+
// ↑ we may delete blocks starting at least here (before 4th pss)
1590+
if visited_pss_blocks >= 4 {
1591+
let gen_time = keyblock.gen_utime()? as u64;
1592+
let gc_max_date = gc_max_date.as_secs();
1593+
if gen_time < gc_max_date {
1594+
log::info!(
1595+
"gc for archives: found block (gen time: {}, seq_no: {}), gc max date: {}",
1596+
&gen_time, keyblock.id().seq_no(), &gc_max_date
1597+
);
1598+
log::info!("start gc for archives..");
1599+
engine.db.archive_manager().gc(&keyblock.id()).await;
1600+
log::info!("finish gc for archives.");
1601+
return Ok(());
1602+
}
1603+
}
1604+
}
1605+
if prev_keyblock.id().seq_no() == 0 {
1606+
return Ok(());
16071607
}
1608+
keyblock = prev_keyblock;
16081609
}
1609-
} else {
1610-
return Ok(());
16111610
}
16121611
}
1613-
1614-
if let Some(gc_marked_block) = &prev_prev_pss_block {
1615-
log::info!("start gc for archives..");
1616-
engine.db.archive_manager().gc(&gc_marked_block.id()).await;
1617-
log::info!("finish gc for archives.");
1618-
}
1619-
1620-
Ok(())
16211612
}
16221613

16231614
fn check_finish_sync(self: Arc<Self>) {

src/external_db/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ pub fn create_external_db(config: ExternalDbConfig, front_workchain_ids: Vec<i32
5757
#[allow(dead_code)]
5858
#[cfg(feature = "external_db")]
5959
pub fn create_external_db(config: ExternalDbConfig, front_workchain_ids: Vec<i32>) -> Result<Arc<dyn ExternalDb>> {
60+
let max_account_bytes_size = match config.account_producer.big_messages_storage {
61+
Some(_) => None,
62+
None => Some(config.account_producer.message_max_size),
63+
};
6064
Ok(
6165
Arc::new(
6266
Processor::new(
@@ -69,6 +73,7 @@ pub fn create_external_db(config: ExternalDbConfig, front_workchain_ids: Vec<i32
6973
kafka_producer::KafkaProducer::new(config.chain_range_producer)?,
7074
config.bad_blocks_storage,
7175
front_workchain_ids,
76+
max_account_bytes_size,
7277
)
7378
)
7479
)

0 commit comments

Comments
 (0)