Skip to content

Commit 4b4e8d5

Browse files
committed
Automatic project update
1 parent f9e9a99 commit 4b4e8d5

17 files changed

+116
-123
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#
1616
[package]
1717
name = "ton_node"
18-
version = "0.47.73"
18+
version = "0.47.74"
1919
edition = "2018"
2020

2121
[workspace]

catchain/src/block_payload.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl fmt::Debug for BlockPayloadImpl {
4141
impl BlockPayloadImpl {
4242
pub(crate) fn create(data: RawBuffer) -> BlockPayloadPtr {
4343
Arc::new(Self {
44-
data: data,
44+
data,
4545
creation_time: SystemTime::now(),
4646
})
4747
}

catchain/src/received_block.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -454,12 +454,9 @@ impl ReceivedBlock for ReceivedBlockImpl {
454454
deps.push(dep.borrow().export_tl_dep());
455455
}
456456

457-
type TonBare = ::ton_api::ton::Bare;
458-
type TonDepVector = ::ton_api::ton::vector<TonBare, ton::BlockDep>;
459-
460457
let block_data = ton::BlockData {
461458
prev: self.get_prev().unwrap().borrow().export_tl_dep(),
462-
deps: TonDepVector::from(deps),
459+
deps: deps.into(),
463460
};
464461

465462
let block = ton::Block {

catchain/src/receiver.rs

+10-14
Original file line numberDiff line numberDiff line change
@@ -964,14 +964,12 @@ impl ReceiverImpl {
964964
let height = dep.height;
965965
let data_hash = dep.data_hash;
966966

967-
::ton_api::ton::catchain::block::Id::Catchain_Block_Id(Box::new(
968-
::ton_api::ton::catchain::block::id::Id {
969-
incarnation: incarnation.into(),
970-
src: public_key_hash_to_int256(source_hash),
971-
height: height,
972-
data_hash: data_hash,
973-
},
974-
))
967+
::ton_api::ton::catchain::block::id::Id {
968+
incarnation: incarnation.into(),
969+
src: public_key_hash_to_int256(source_hash),
970+
height,
971+
data_hash,
972+
}.into_boxed()
975973
}
976974

977975
fn add_received_block(&mut self, block: ReceivedBlockPtr) {
@@ -1542,7 +1540,7 @@ impl ReceiverImpl {
15421540
trace!("GetDifference response: {:?}", difference);
15431541
}
15441542
Difference::Catchain_DifferenceFork(difference_fork) => {
1545-
get_mut_impl(receiver).got_fork_proof(*difference_fork);
1543+
get_mut_impl(receiver).got_fork_proof(&difference_fork);
15461544
}
15471545
}
15481546
}
@@ -1896,15 +1894,13 @@ impl ReceiverImpl {
18961894
if block.get_height() != 0 && block.is_initialized() {
18971895
let response = ::ton_api::ton::catchain::blockresult::BlockResult {
18981896
block: block.export_tl(),
1899-
};
1900-
let response =
1901-
::ton_api::ton::catchain::BlockResult::Catchain_BlockResult(Box::new(response));
1897+
}.into_boxed();
19021898

19031899
return Ok((response, block.get_payload().clone()));
19041900
}
19051901
}
19061902

1907-
let response = ::ton_api::ton::catchain::BlockResult::Catchain_BlockNotFound {};
1903+
let response = ::ton_api::ton::catchain::BlockResult::Catchain_BlockNotFound;
19081904

19091905
return Ok((response, CatchainFactory::create_empty_block_payload()));
19101906
}
@@ -2039,7 +2035,7 @@ impl ReceiverImpl {
20392035
Forks management
20402036
*/
20412037

2042-
fn got_fork_proof(&mut self, fork_proof: ton::DifferenceFork) {
2038+
fn got_fork_proof(&mut self, fork_proof: &ton::DifferenceFork) {
20432039
if let Err(status) = self.validate_block_dependency(&fork_proof.left) {
20442040
warn!("Incorrect fork blame, left is invalid: {:?}", status);
20452041
return;

catchain/src/utils.rs

+12-16
Original file line numberDiff line numberDiff line change
@@ -179,25 +179,21 @@ pub fn get_block_id(
179179
}
180180

181181
pub fn get_block_dependency_id(block: &ton::BlockDep, receiver: &dyn Receiver) -> ton::BlockId {
182-
::ton_api::ton::catchain::block::Id::Catchain_Block_Id(Box::new(
183-
::ton_api::ton::catchain::block::id::Id {
184-
incarnation: receiver.get_incarnation().clone().into(),
185-
src: public_key_hash_to_int256(receiver.get_source_public_key_hash(block.src as usize)),
186-
height: block.height,
187-
data_hash: block.data_hash,
188-
},
189-
))
182+
::ton_api::ton::catchain::block::id::Id {
183+
incarnation: receiver.get_incarnation().clone().into(),
184+
src: public_key_hash_to_int256(receiver.get_source_public_key_hash(block.src as usize)),
185+
height: block.height,
186+
data_hash: block.data_hash,
187+
}.into_boxed()
190188
}
191189

192190
pub fn get_root_block_id(incarnation: &SessionId) -> ton::BlockId {
193-
::ton_api::ton::catchain::block::Id::Catchain_Block_Id(Box::new(
194-
::ton_api::ton::catchain::block::id::Id {
195-
incarnation: incarnation.clone().into(),
196-
src: incarnation.clone().into(),
197-
height: 0,
198-
data_hash: incarnation.clone().into(),
199-
},
200-
))
191+
::ton_api::ton::catchain::block::id::Id {
192+
incarnation: incarnation.clone().into(),
193+
src: incarnation.clone().into(),
194+
height: 0,
195+
data_hash: incarnation.clone().into(),
196+
}.into_boxed()
201197
}
202198

203199
pub fn get_block_id_hash(id: &ton::BlockId) -> BlockHash {

commit_hash.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8a3b7788863ce3e6287c37eb0af60998fa8dfe60
1+
5f541c79c9ab9633d822449d39745284b06ebd8f

src/engine.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -918,8 +918,8 @@ impl Engine {
918918
}
919919
match client.wait_broadcast().await {
920920
Err(e) => log::error!("Error while wait_broadcast for shard {}: {}", shard_ident, e),
921-
Ok((brodcast, src)) => {
922-
match brodcast {
921+
Ok((broadcast, src)) => {
922+
match broadcast {
923923
Broadcast::TonNode_BlockBroadcast(broadcast) => {
924924
self.clone().process_block_broadcast(broadcast, src);
925925
}
@@ -1005,7 +1005,7 @@ impl Engine {
10051005
Ok(())
10061006
}
10071007

1008-
fn process_block_broadcast(self: Arc<Self>, broadcast: Box<BlockBroadcast>, src: Arc<KeyId>) {
1008+
fn process_block_broadcast(self: Arc<Self>, broadcast: BlockBroadcast, src: Arc<KeyId>) {
10091009
// because of ALL blocks-broadcasts received in one task - spawn for each block
10101010
log::trace!("Processing block broadcast {}", broadcast.id);
10111011
let engine = self.clone() as Arc<dyn EngineOperations>;
@@ -1034,7 +1034,7 @@ impl Engine {
10341034
});
10351035
}
10361036

1037-
fn process_ext_msg_broadcast(&self, broadcast: Box<ExternalMessageBroadcast>, src: Arc<KeyId>) {
1037+
fn process_ext_msg_broadcast(&self, broadcast: ExternalMessageBroadcast, src: Arc<KeyId>) {
10381038
// just add to list
10391039
if !self.is_validator() {
10401040
log::trace!(
@@ -1063,7 +1063,7 @@ impl Engine {
10631063
}
10641064
}
10651065

1066-
fn process_new_shard_block_broadcast(self: Arc<Self>, broadcast: Box<NewShardBlockBroadcast>, src: Arc<KeyId>) {
1066+
fn process_new_shard_block_broadcast(self: Arc<Self>, broadcast: NewShardBlockBroadcast, src: Arc<KeyId>) {
10671067
let id = broadcast.block.block.clone();
10681068
if self.is_validator() {
10691069
log::trace!("Processing new shard block broadcast {} from {}", id, src);
@@ -1090,10 +1090,7 @@ impl Engine {
10901090
}
10911091
}
10921092

1093-
async fn process_new_shard_block(
1094-
self: Arc<Self>,
1095-
broadcast: Box<NewShardBlockBroadcast>
1096-
) -> Result<BlockIdExt> {
1093+
async fn process_new_shard_block(self: Arc<Self>, broadcast: NewShardBlockBroadcast) -> Result<BlockIdExt> {
10971094
let id: BlockIdExt = (&broadcast.block.block).try_into()?;
10981095
let cc_seqno = broadcast.block.cc_seqno as u32;
10991096
let data = broadcast.block.data.0;

src/internal_db/mod.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use storage::{
2121
};
2222
#[cfg(feature = "read_old_db")]
2323
use storage::block_db::BlockDb;
24-
use ton_api::ton::PublicKey;
2524
use ton_block::{Block, BlockIdExt, AccountIdPrefixFull, UnixTime32};
2625
use ton_types::{error, fail, Result, UInt256};
2726

@@ -410,7 +409,7 @@ impl InternalDb for InternalDbImpl {
410409
let handle = result.clone().as_non_updated().ok_or_else(
411410
|| error!("INTERNAL ERROR: block {} result mismatch in store_block_data {:?}", block.id(), result)
412411
)?;
413-
let entry_id = PackageEntryId::<_, UInt256, PublicKey>::Block(block.id());
412+
let entry_id = PackageEntryId::<_, UInt256, UInt256>::Block(block.id());
414413
if !handle.has_data() || !self.archive_manager.check_file(&handle, &entry_id) {
415414
let _lock = handle.block_file_lock().write().await;
416415
if !handle.has_data() || !self.archive_manager.check_file(&handle, &entry_id) {
@@ -440,7 +439,7 @@ impl InternalDb for InternalDbImpl {
440439
return Ok(raw_block.to_vec());
441440
}
442441
#[cfg(not(feature = "read_old_db"))] {
443-
let entry_id = PackageEntryId::<_, UInt256, PublicKey>::Block(handle.id());
442+
let entry_id = PackageEntryId::<_, UInt256, UInt256>::Block(handle.id());
444443
self.archive_manager.get_file(handle, &entry_id).await
445444
}
446445
}
@@ -498,15 +497,15 @@ impl InternalDb for InternalDbImpl {
498497
|| error!("INTERNAL ERROR: block {} result mismatch in store_block_proof", id)
499498
)?;
500499
if proof.is_link() {
501-
let entry_id = PackageEntryId::<_, UInt256, PublicKey>::ProofLink(id);
500+
let entry_id = PackageEntryId::<_, UInt256, UInt256>::ProofLink(id);
502501
if !handle.has_proof_link() ||
503502
!self.archive_manager.check_file(&handle, &entry_id)
504503
{
505504
let _lock = handle.proof_file_lock().write().await;
506505
if !handle.has_proof_link() ||
507506
!self.archive_manager.check_file(&handle, &entry_id)
508507
{
509-
let entry_id = PackageEntryId::<_, UInt256, PublicKey>::ProofLink(id);
508+
let entry_id = PackageEntryId::<_, UInt256, UInt256>::ProofLink(id);
510509
self.archive_manager.add_file(&entry_id, proof.data().to_vec()).await?;
511510
if handle.set_proof_link() {
512511
self.store_block_handle(&handle, callback)?;
@@ -515,15 +514,15 @@ impl InternalDb for InternalDbImpl {
515514
}
516515
}
517516
} else {
518-
let entry_id = PackageEntryId::<_, UInt256, PublicKey>::Proof(id);
517+
let entry_id = PackageEntryId::<_, UInt256, UInt256>::Proof(id);
519518
if !handle.has_proof() ||
520519
!self.archive_manager.check_file(&handle, &entry_id)
521520
{
522521
let _lock = handle.proof_file_lock().write().await;
523522
if !handle.has_proof() ||
524523
!self.archive_manager.check_file(&handle, &entry_id)
525524
{
526-
let entry_id = PackageEntryId::<_, UInt256, PublicKey>::Proof(id);
525+
let entry_id = PackageEntryId::<_, UInt256, UInt256>::Proof(id);
527526
self.archive_manager.add_file(&entry_id, proof.data().to_vec()).await?;
528527
if handle.set_proof() {
529528
self.store_block_handle(&handle, callback)?;
@@ -557,9 +556,9 @@ impl InternalDb for InternalDbImpl {
557556
async fn load_block_proof_raw(&self, handle: &BlockHandle, is_link: bool) -> Result<Vec<u8>> {
558557
log::trace!("load_block_proof_raw {} {}", if is_link {"link"} else {""}, handle.id());
559558
let (entry_id, inited) = if is_link {
560-
(PackageEntryId::<_, UInt256, PublicKey>::ProofLink(handle.id()), handle.has_proof_link())
559+
(PackageEntryId::<_, UInt256, UInt256>::ProofLink(handle.id()), handle.has_proof_link())
561560
} else {
562-
(PackageEntryId::<_, UInt256, PublicKey>::Proof(handle.id()), handle.has_proof())
561+
(PackageEntryId::<_, UInt256, UInt256>::Proof(handle.id()), handle.has_proof())
563562
};
564563
if !inited {
565564
fail!("This proof{} is not in the archive: {:?}", if is_link { "link" } else { "" }, handle);

src/network/full_node_service.rs

+7-11
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use adnl::common::{
99
use overlay::QueriesConsumer;
1010
use std::{sync::Arc, convert::TryInto, cmp::min, fmt::Debug};
1111
use ton_api::{
12-
AnyBoxedSerialize, BoxedSerialize, IntoBoxed,
12+
AnyBoxedSerialize, IntoBoxed,
1313
ton::{
1414
self, TLObject, Vector,
1515
rpc::ton_node::{
@@ -59,15 +59,11 @@ impl FullNodeOverlayService {
5959
) -> Result<TaggedObject<BlockDescription>> {
6060
let prev_id = (&query.prev_block).try_into()?;
6161
let answer = match self.engine.load_block_next1(&prev_id).await {
62-
Ok(id) => {
63-
BlockDescription::TonNode_BlockDescription(
64-
Box::new(
65-
ton_node::blockdescription::BlockDescription{
66-
id: id.into()
67-
}
68-
)
69-
)
70-
},
62+
Ok(id) => {
63+
ton_node::blockdescription::BlockDescription{
64+
id: id.into()
65+
}.into_boxed()
66+
}
7167
Err(_) => BlockDescription::TonNode_BlockDescriptionEmpty
7268
};
7369
#[cfg(feature = "telemetry")]
@@ -566,7 +562,7 @@ impl FullNodeOverlayService {
566562
) -> Result<std::result::Result<QueryResult, TLObject>>
567563
where
568564
Q: AnyBoxedSerialize + Debug,
569-
A: BoxedSerialize + Send + Sync + serde::Serialize + Debug + 'static,
565+
A: AnyBoxedSerialize,
570566
F: futures::Future<Output = Result<TaggedObject<A>>>,
571567
{
572568
Ok(

src/network/node_network.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ impl NodeNetwork {
671671
});
672672
}
673673

674-
pub fn process_connectivity_broadcast(self: Arc<Self>, broadcast: Box<ConnectivityCheckBroadcast>) {
674+
pub fn process_connectivity_broadcast(self: Arc<Self>, broadcast: ConnectivityCheckBroadcast) {
675675
if !self.connectivity_check_config.enabled {
676676
return;
677677
}

storage/src/archives/archive_manager.rs

+10-11
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use crate::{
88
};
99
use std::{borrow::Borrow, hash::Hash, io::ErrorKind, path::PathBuf, sync::Arc};
1010
use tokio::io::AsyncWriteExt;
11-
use ton_api::ton::PublicKey;
1211
use ton_block::BlockIdExt;
1312
use ton_types::{error, fail, Result, UInt256};
1413

@@ -46,7 +45,7 @@ impl ArchiveManager {
4645
where
4746
B: Borrow<BlockIdExt> + Hash,
4847
U256: Borrow<UInt256> + Hash,
49-
PK: Borrow<PublicKey> + Hash
48+
PK: Borrow<UInt256> + Hash
5049
{
5150
log::debug!(target: "storage", "Saving unapplied file: {}", entry_id);
5251

@@ -74,7 +73,7 @@ impl ArchiveManager {
7473
where
7574
B: Borrow<BlockIdExt> + Hash,
7675
U256: Borrow<UInt256> + Hash,
77-
PK: Borrow<PublicKey> + Hash
76+
PK: Borrow<UInt256> + Hash
7877
{
7978
if handle.is_archived() {
8079
true
@@ -91,7 +90,7 @@ impl ArchiveManager {
9190
where
9291
B: Borrow<BlockIdExt> + Hash,
9392
U256: Borrow<UInt256> + Hash,
94-
PK: Borrow<PublicKey> + Hash
93+
PK: Borrow<UInt256> + Hash
9594
{
9695

9796
if handle.is_archived() {
@@ -143,13 +142,13 @@ impl ArchiveManager {
143142
let _lock = handle.proof_file_lock().write().await;
144143
self.move_file_to_archives(
145144
handle,
146-
&PackageEntryId::<&BlockIdExt, &UInt256, &PublicKey>::Proof(handle.id())
145+
&PackageEntryId::<&BlockIdExt, &UInt256, &UInt256>::Proof(handle.id())
147146
).await?
148147
} else if prooflink_inited {
149148
let _lock = handle.proof_file_lock().write().await;
150149
self.move_file_to_archives(
151150
handle,
152-
&PackageEntryId::<&BlockIdExt, &UInt256, &PublicKey>::ProofLink(handle.id())
151+
&PackageEntryId::<&BlockIdExt, &UInt256, &UInt256>::ProofLink(handle.id())
153152
).await?
154153
} else {
155154
None
@@ -158,7 +157,7 @@ impl ArchiveManager {
158157
let _lock = handle.block_file_lock().write().await;
159158
self.move_file_to_archives(
160159
handle,
161-
&PackageEntryId::<&BlockIdExt, &UInt256, &PublicKey>::Block(handle.id())
160+
&PackageEntryId::<&BlockIdExt, &UInt256, &UInt256>::Block(handle.id())
162161
).await?
163162
} else {
164163
None
@@ -217,7 +216,7 @@ impl ArchiveManager {
217216
where
218217
B: Borrow<BlockIdExt> + Hash,
219218
U256: Borrow<UInt256> + Hash,
220-
PK: Borrow<PublicKey> + Hash
219+
PK: Borrow<UInt256> + Hash
221220
{
222221
let package_id = self.get_package_id(get_mc_seq_no(handle), is_key).await?;
223222
if let Some(ref fd) = self.get_file_desc(package_id, false).await? {
@@ -235,7 +234,7 @@ impl ArchiveManager {
235234
where
236235
B: Borrow<BlockIdExt> + Hash,
237236
U256: Borrow<UInt256> + Hash,
238-
PK: Borrow<PublicKey> + Hash
237+
PK: Borrow<UInt256> + Hash
239238
{
240239
log::debug!(target: "storage", "Moving entry to archive: {}", entry_id.filename_short());
241240
let (filename, data) = {
@@ -272,7 +271,7 @@ impl ArchiveManager {
272271
where
273272
B: Borrow<BlockIdExt> + Hash,
274273
U256: Borrow<UInt256> + Hash,
275-
PK: Borrow<PublicKey> + Hash
274+
PK: Borrow<UInt256> + Hash
276275
{
277276
let mc_seq_no = get_mc_seq_no(handle);
278277
let key_block = handle.is_key_block()?;
@@ -298,7 +297,7 @@ impl ArchiveManager {
298297
where
299298
B: Borrow<BlockIdExt> + Hash,
300299
U256: Borrow<UInt256> + Hash,
301-
PK: Borrow<PublicKey> + Hash
300+
PK: Borrow<UInt256> + Hash
302301
{
303302
let temp_filename = self.unapplied_dir.join(entry_id.filename_short());
304303
let data = tokio::fs::read(&temp_filename).await

0 commit comments

Comments
 (0)