Skip to content

Commit 137ad9e

Browse files
committed
Automatic project update
1 parent b7702c1 commit 137ad9e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+376
-915
lines changed

Cargo.toml

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

66
[workspace]
77
members = [ 'storage' ]
@@ -10,7 +10,6 @@ resolver = '2'
1010
[dependencies]
1111
async-trait = '0.1.22'
1212
base64 = '0.13'
13-
bincode = '1.2.1'
1413
bitflags = '1.2.1'
1514
chrono = '0.4.10'
1615
clap = '2.33.1'
@@ -37,22 +36,22 @@ sha2 = '0.9'
3736
spin = '0.7.1'
3837
stream-cancel = '0.8.0'
3938
string-builder = '^0.2.0'
40-
adnl = { features = [ 'client', 'node', 'server' ], git = 'https://github.com/tonlabs/ton-labs-adnl', tag = '0.7.63' }
39+
adnl = { features = [ 'client', 'node', 'server' ], git = 'https://github.com/tonlabs/ton-labs-adnl', tag = '0.7.64' }
4140
catchain = { path = 'catchain' }
42-
dht = { git = 'https://github.com/tonlabs/ton-labs-dht', tag = '0.5.60' }
41+
dht = { git = 'https://github.com/tonlabs/ton-labs-dht', tag = '0.5.61' }
4342
lockfree = { git = 'https://github.com/tonlabs/lockfree.git' }
44-
overlay = { git = 'https://github.com/tonlabs/ton-labs-overlay', tag = '0.6.48' }
45-
rldp = { git = 'https://github.com/tonlabs/ton-labs-rldp', tag = '0.7.59' }
43+
overlay = { git = 'https://github.com/tonlabs/ton-labs-overlay', tag = '0.6.49' }
44+
rldp = { git = 'https://github.com/tonlabs/ton-labs-rldp', tag = '0.7.60' }
4645
rustracing = { optional = true, version = '0.4.0' }
4746
rustracing_jaeger = { optional = true, version = '0.4.1' }
4847
statsd = { optional = true, version = '0.14.0' }
4948
storage = { path = 'storage' }
5049
tokio = { features = [ 'rt-multi-thread' ], version = '1.5' }
51-
ton_abi = { git = 'https://github.com/tonlabs/ton-labs-abi.git', tag = '2.1.6' }
52-
ton_api = { git = 'https://github.com/tonlabs/ton-labs-tl', package = 'ton_api', tag = '0.2.116' }
53-
ton_block = { git = 'https://github.com/tonlabs/ton-labs-block', tag = '1.7.35' }
54-
ton_block_json = { git = 'https://github.com/tonlabs/ton-labs-block-json.git', tag = '0.6.32' }
55-
ton_executor = { git = 'https://github.com/tonlabs/ton-labs-executor', tag = '1.15.45' }
50+
ton_abi = { git = 'https://github.com/tonlabs/ton-labs-abi.git', tag = '2.1.7' }
51+
ton_api = { git = 'https://github.com/tonlabs/ton-labs-tl', package = 'ton_api', tag = '0.2.117' }
52+
ton_block = { git = 'https://github.com/tonlabs/ton-labs-block', tag = '1.7.36' }
53+
ton_block_json = { git = 'https://github.com/tonlabs/ton-labs-block-json.git', tag = '0.6.33' }
54+
ton_executor = { git = 'https://github.com/tonlabs/ton-labs-executor', tag = '1.15.47' }
5655
ton_types = { git = 'https://github.com/tonlabs/ton-labs-types', tag = '1.10.12' }
5756
ton_vm = { git = 'https://github.com/tonlabs/ton-labs-vm', tag = '1.8.27' }
5857
validator_session = { path = 'validator-session' }
@@ -74,6 +73,9 @@ trace_alloc = [ ]
7473
trace_alloc_detail = [ 'trace_alloc' ]
7574
validator = [ 'async_collator', 'async_validator' ]
7675

76+
[profile]
77+
release = { debug = true }
78+
7779
[target.'cfg(unix)'.dependencies.rdkafka]
7880
optional = true
7981
version = '0.26.0'

catchain/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ metrics-runtime = '0.13.0'
1919
rand = '0.8'
2020
regex = '1.3.1'
2121
sha2 = '0.9'
22-
adnl = { features = [ 'node' ], git = 'https://github.com/tonlabs/ton-labs-adnl', tag = '0.7.63' }
23-
overlay = { git = 'https://github.com/tonlabs/ton-labs-overlay', tag = '0.6.48' }
24-
rldp = { git = 'https://github.com/tonlabs/ton-labs-rldp', tag = '0.7.59' }
22+
adnl = { features = [ 'node' ], git = 'https://github.com/tonlabs/ton-labs-adnl', tag = '0.7.64' }
23+
overlay = { git = 'https://github.com/tonlabs/ton-labs-overlay', tag = '0.6.49' }
24+
rldp = { git = 'https://github.com/tonlabs/ton-labs-rldp', tag = '0.7.60' }
2525
storage = { path = '../storage' }
2626
tokio = { features = [ 'rt-multi-thread' ], version = '1.5' }
27-
ton_api = { git = 'https://github.com/tonlabs/ton-labs-tl', package = 'ton_api', tag = '0.2.116' }
27+
ton_api = { git = 'https://github.com/tonlabs/ton-labs-tl', package = 'ton_api', tag = '0.2.117' }
2828
ton_types = { git = 'https://github.com/tonlabs/ton-labs-types', tag = '1.10.12' }
2929

3030
[dev-dependencies]

catchain/src/catchain.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1947,7 +1947,7 @@ impl CatchainProcessor {
19471947

19481948
//overlay creation
19491949

1950-
let sources_as_int256: Vec<::ton_api::ton::int256> = sources
1950+
let sources_as_int256: Vec<UInt256> = sources
19511951
.clone()
19521952
.into_iter()
19531953
.map(|key| public_key_hash_to_int256(&key))

catchain/src/received_block.rs

+13-7
Original file line numberDiff line numberDiff line change
@@ -853,9 +853,7 @@ impl ReceivedBlockImpl {
853853
bail!("Invalid source (first block) {}", block.src);
854854
}
855855

856-
if UInt256::from(block.data_hash.0) != *receiver.get_incarnation()
857-
|| block.signature.len() != 0
858-
{
856+
if (&block.data_hash != receiver.get_incarnation()) || (block.signature.len() != 0) {
859857
bail!("Invalid first block");
860858
}
861859
}
@@ -868,7 +866,7 @@ impl ReceivedBlockImpl {
868866
block: &ton::Block,
869867
payload: &BlockPayloadPtr,
870868
) -> Result<()> {
871-
if UInt256::from(block.incarnation.0) != *receiver.get_incarnation() {
869+
if &block.incarnation != receiver.get_incarnation() {
872870
bail!("Invalid session ID".to_string());
873871
}
874872

@@ -1059,7 +1057,11 @@ impl ReceivedBlockImpl {
10591057
body.incarnation = receiver.get_incarnation().clone();
10601058

10611059
if log_enabled!(log::Level::Debug) {
1062-
trace!("...create new block with payload: hash={:?}, source_id={}, height={}, data_hash={:?}, signature={:?}", body.hash, body.source_id, body.height, body.data_hash, body.signature);
1060+
trace!(
1061+
"...create new block with payload: \
1062+
hash={:?}, source_id={}, height={}, data_hash={:?}, signature={:?}",
1063+
body.hash, body.source_id, body.height, body.data_hash, body.signature
1064+
)
10631065
}
10641066

10651067
let new_block = ReceivedBlockImpl::wrap(&mut Rc::new(RefCell::new(body)));
@@ -1081,15 +1083,19 @@ impl ReceivedBlockImpl {
10811083
let mut body: ReceivedBlockImpl =
10821084
ReceivedBlockImpl::new(receiver.get_received_blocks_instance_counter());
10831085

1084-
body.data_hash = UInt256::from(block.data_hash.0);
1086+
body.data_hash = block.data_hash.clone();
10851087
body.signature = block.signature.clone();
10861088
body.hash = get_block_dependency_hash(block, receiver);
10871089
body.source_id = block.src as usize;
10881090
body.height = block.height as BlockHeight;
10891091
body.incarnation = receiver.get_incarnation().clone();
10901092

10911093
if log_enabled!(log::Level::Debug) {
1092-
trace!("...create new block dependency: hash={:?}, source_id={}, height={}, data_hash={:?}, signature={:?}", body.hash, body.source_id, body.height, body.data_hash, body.signature);
1094+
trace!(
1095+
"...create new block dependency: \
1096+
hash={:?}, source_id={}, height={}, data_hash={:?}, signature={:?}",
1097+
body.hash, body.source_id, body.height, body.data_hash, body.signature
1098+
)
10931099
}
10941100

10951101
let new_block = ReceivedBlockImpl::wrap(&mut Rc::new(RefCell::new(body)));

catchain/src/receiver.rs

+9-12
Original file line numberDiff line numberDiff line change
@@ -311,16 +311,14 @@ impl Receiver for ReceiverImpl {
311311
}
312312
}
313313

314-
if UInt256::from(block.incarnation.0) != self.incarnation {
314+
if block.incarnation != self.incarnation {
315315
let message = format!(
316316
"Block from source {} incarnation mismatch: expected {} but received {:?}",
317317
adnl_id,
318318
self.incarnation.to_hex_string(),
319-
UInt256::from(block.incarnation.0)
319+
block.incarnation
320320
);
321-
322321
warn!("{}", message);
323-
324322
return Err(err_msg(message));
325323
}
326324

@@ -967,7 +965,7 @@ impl ReceiverImpl {
967965

968966
fn get_block_id(&self, block: &ton::Block, payload: &RawBuffer) -> ton::BlockId {
969967
utils::get_block_id(
970-
&UInt256::from(block.incarnation.0),
968+
&block.incarnation,
971969
&self.get_source_public_key_hash(block.src as usize),
972970
block.height,
973971
payload,
@@ -979,9 +977,8 @@ impl ReceiverImpl {
979977
let source_hash = self.get_source_public_key_hash(dep.src as usize);
980978
let height = dep.height;
981979
let data_hash = dep.data_hash;
982-
983980
::ton_api::ton::catchain::block::id::Id {
984-
incarnation: incarnation.into(),
981+
incarnation: incarnation.clone(),
985982
src: public_key_hash_to_int256(source_hash),
986983
height,
987984
data_hash,
@@ -1365,7 +1362,7 @@ impl ReceiverImpl {
13651362

13661363
let _source = self.get_source(block.src as usize);
13671364

1368-
assert!(block.incarnation == self.incarnation.clone().into());
1365+
assert!(block.incarnation == self.incarnation);
13691366

13701367
if let Err(err) = self.validate_block_with_payload(&block, &payload) {
13711368
let message = format!(
@@ -1916,7 +1913,7 @@ impl ReceiverImpl {
19161913
trace!("Got GetBlockQuery: {:?}", query);
19171914

19181915
let block_hash = query.block;
1919-
let block_result = self.get_block_by_hash(&UInt256::from(block_hash.0));
1916+
let block_result = self.get_block_by_hash(&block_hash);
19201917

19211918
if let Some(block_ptr) = block_result {
19221919
let block = block_ptr.borrow();
@@ -1954,7 +1951,7 @@ impl ReceiverImpl {
19541951
let mut response_blocks_count = 0;
19551952

19561953
for block_hash in &query.blocks.0 {
1957-
if let Some(block_ptr) = self.get_block_by_hash(&UInt256::from(block_hash.0)) {
1954+
if let Some(block_ptr) = self.get_block_by_hash(&block_hash) {
19581955
let mut block = block_ptr.borrow_mut();
19591956

19601957
assert!(block.get_payload().data().len() > 0);
@@ -2006,7 +2003,7 @@ impl ReceiverImpl {
20062003

20072004
let mut response_blocks_count = 0;
20082005

2009-
if let Some(block) = self.get_block_by_hash(&UInt256::from(query.block.0)) {
2006+
if let Some(block) = self.get_block_by_hash(&query.block) {
20102007
//limit height by the requested block height
20112008

20122009
let block_height = block.borrow().get_height() as i64;
@@ -2025,7 +2022,7 @@ impl ReceiverImpl {
20252022

20262023
//terminate loop if the termination block has been found
20272024

2028-
if block_terminators.contains(&block.get_hash().into()) {
2025+
if block_terminators.contains(block.get_hash()) {
20292026
break;
20302027
}
20312028

catchain/src/utils.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,16 @@ pub fn get_hash_from_block_payload(data: &BlockPayloadPtr) -> BlockHash {
163163
UInt256::calc_file_hash(&data.data().0)
164164
}
165165

166-
pub fn int256_to_public_key_hash(public_key: &::ton_api::ton::int256) -> PublicKeyHash {
167-
adnl::common::KeyId::from_data(public_key.0)
166+
pub fn int256_to_public_key_hash(public_key: &UInt256) -> PublicKeyHash {
167+
adnl::common::KeyId::from_data(*public_key.as_slice())
168168
}
169169

170170
pub fn get_public_key_hash(public_key: &PublicKey) -> PublicKeyHash {
171171
public_key.id().clone()
172172
}
173173

174-
pub fn public_key_hash_to_int256(v: &PublicKeyHash) -> ::ton_api::ton::int256 {
175-
::ton_api::ton::int256(*v.data())
174+
pub fn public_key_hash_to_int256(v: &PublicKeyHash) -> UInt256 {
175+
UInt256::with_array(*v.data())
176176
}
177177

178178
pub fn get_overlay_id(first_block: &ton_api::ton::catchain::FirstBlock) -> Result<SessionId> {

commit_hash.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14109d623e0b34510e7d9c3c85cb9e1f22838854
1+
b740dde28492097794fcf7bb7f33397570847c54

deps_map.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"adnl":"2587e9f5b9622940de20c51ef49e8d316e168b26","dht":"6529fcd71524c434407aa7240a1c89b2203e7b73","overlay":"864ea30a7fee351e6225d971a4d8836e3fec74c9","rldp":"14c7858004c3c941b97523cc49c1d83f47665eee","ton-labs-abi":"a74609a928d17cd02985ced2fcaf93f50321c21e","ton-tl":"8a4777b6bc1065019a9b5c52ac2a740a48fd926c","ton-block":"447a265d0013336b3c506cad45558922aa67f9f6","ton-block-json":"0fba14f552e67b9144404503612dc159b49d7e6b","ton-executor":"979410555a2961ffb080a112f8ebb4db90e466de","ton-types":"164867fa842b1efd0eeb378e727a17677ae8a322","ton-vm":"95512b5a06fb90695bfefda4ba99f7b0bd2d35d0"}
1+
{"adnl":"a7dc836ea3ef176079c80dda16edc21af1c7e68f","dht":"241d9ffe8a25849de3c103a2813a3025852b1717","overlay":"0201a432755b8fd5db94579a549a59c38778277b","rldp":"7dbffd9d94556f552f8b1b0e140180b969fa7229","ton-labs-abi":"ec48e6f90fc0ad6b73ce5c2501807a94b38c056a","ton-tl":"44cb7e493735f425c1191e5df6239a4a6fd53d26","ton-block":"20dd6ecb7dec5163d7316fdacd9bb2876008a8c7","ton-block-json":"db40f4ae81a182125417fe839dece77d692f0309","ton-executor":"64f4e238d3d84df75e563104bdb40bae0eeddc85","ton-types":"164867fa842b1efd0eeb378e727a17677ae8a322","ton-vm":"95512b5a06fb90695bfefda4ba99f7b0bd2d35d0"}

src/block.rs

-43
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ impl BlockStuff {
9292

9393

9494
pub fn block(&self) -> &Block { &self.block }
95-
9695

9796
pub fn id(&self) -> &BlockIdExt { &self.id }
9897

@@ -260,48 +259,6 @@ impl BlockIdExtExtention for BlockIdExt {
260259
}
261260
}
262261

263-
pub fn convert_block_id_ext_api2blk(id: &ton_api::ton::ton_node::blockidext::BlockIdExt) -> Result<BlockIdExt> {
264-
Ok(
265-
BlockIdExt::with_params(
266-
ton_block::ShardIdent::with_tagged_prefix(id.workchain, id.shard as u64)?,
267-
id.seqno as u32,
268-
UInt256::from(&id.root_hash.0),
269-
UInt256::from(&id.file_hash.0),
270-
)
271-
)
272-
}
273-
274-
#[allow(dead_code)]
275-
pub fn convert_block_id_ext_blk2api(id: &BlockIdExt) -> ton_api::ton::ton_node::blockidext::BlockIdExt {
276-
ton_api::ton::ton_node::blockidext::BlockIdExt {
277-
workchain: id.shard_id.workchain_id(),
278-
shard: id.shard_id.shard_prefix_with_tag() as i64, // FIXME: why signed int???
279-
seqno: if id.seq_no <= std::i32::MAX as u32 {
280-
id.seq_no as i32
281-
} else {
282-
panic!("too big block seq_no") // FIXME: what to do?
283-
},
284-
root_hash: ton_api::ton::int256(id.root_hash.as_slice().to_owned()),
285-
file_hash: ton_api::ton::int256(id.file_hash.as_slice().to_owned()),
286-
}
287-
}
288-
289-
#[allow(dead_code)]
290-
pub fn convert_block_id_ext_blk_vec(vec: &Vec<BlockIdExt>) -> Vec<ton_api::ton::ton_node::blockidext::BlockIdExt> {
291-
vec.iter().fold(Vec::new(), |mut vec, item| {
292-
vec.push(convert_block_id_ext_blk2api(item));
293-
vec
294-
})
295-
}
296-
297-
#[allow(dead_code)]
298-
pub fn compare_block_ids(id: &BlockIdExt, id_api: &ton_api::ton::ton_node::blockidext::BlockIdExt) -> bool {
299-
id.shard_id.shard_prefix_with_tag() == id_api.shard as u64
300-
&& id.shard_id.workchain_id() == id_api.workchain
301-
&& id.root_hash.as_slice() == &id_api.root_hash.0
302-
&& id.file_hash.as_slice() == &id_api.file_hash.0
303-
}
304-
305262
// unpack_block_prev_blk_try in t-node
306263
pub fn construct_and_check_prev_stuff(
307264
block_root: &Cell,

src/block_proof.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use ton_block::{
1515
Block, BlockProof, BlockIdExt, Deserializable, MerkleProof, BlockInfo,
16-
ValidatorDescr, ValidatorSet, CatchainConfig, AccountIdPrefixFull, Serializable
16+
ValidatorDescr, ValidatorSet, CatchainConfig, Serializable
1717
};
1818
use ton_types::{
1919
Cell, Result, fail, error, HashmapType, deserialize_tree_of_cells, serialize_tree_of_cells,
@@ -183,8 +183,7 @@ impl BlockProofStuff {
183183
let zerostate = engine.load_mc_zero_state().await?;
184184
self.check_with_master_state_(&zerostate, &virt_block, &virt_block_info)?;
185185
} else {
186-
let mc_pfx = AccountIdPrefixFull::any_masterchain();
187-
let handle = engine.find_block_by_seq_no(&mc_pfx, prev_key_block_seqno).await
186+
let handle = engine.find_mc_block_by_seq_no(prev_key_block_seqno).await
188187
.map_err(|err|
189188
error!(
190189
"Couldn't find previous MC key block by seq_no = {}: {}",
@@ -193,8 +192,11 @@ impl BlockProofStuff {
193192
)
194193
)?;
195194
let prev_key_block_proof = engine.load_block_proof(&handle, false).await?;
196-
197-
self.check_with_prev_key_block_proof_(&prev_key_block_proof, &virt_block, &virt_block_info)?;
195+
self.check_with_prev_key_block_proof_(
196+
&prev_key_block_proof,
197+
&virt_block,
198+
&virt_block_info
199+
)?;
198200
}
199201

200202
log::trace!("Checked proof for block: {} TIME {}ms", self.id(), now.elapsed().as_millis());

0 commit comments

Comments
 (0)