From c8c97b24bb4f5af7c8df078572d11ae3bd3bef9d Mon Sep 17 00:00:00 2001 From: ViacheslavB Date: Sat, 20 Apr 2024 22:31:38 +0300 Subject: [PATCH 1/3] Crates and repos renaming; repo ever_types merged into repo ever_block --- CHANGELOG.md | 9 + Cargo.toml | 31 +- README.md | 2 +- bin/adnl_ping.rs | 8 +- bin/adnl_resolve.rs | 8 +- bin/console.rs | 35 +- bin/dhtscan.rs | 8 +- bin/gendht.rs | 6 +- bin/keygen.rs | 6 +- bin/keyid.rs | 6 +- bin/print.rs | 53 +- bin/zerostate.rs | 25 +- catchain/Cargo.toml | 8 +- catchain/src/activity_node.rs | 4 +- catchain/src/block.rs | 4 +- catchain/src/block_payload.rs | 4 +- catchain/src/catchain.rs | 6 +- catchain/src/database.rs | 6 +- catchain/src/lib.rs | 8 +- catchain/src/log_player.rs | 6 +- catchain/src/profiling.rs | 4 +- catchain/src/received_block.rs | 6 +- catchain/src/receiver.rs | 6 +- catchain/src/receiver_source.rs | 4 +- catchain/src/utils.rs | 6 +- catchain/tests/test_catchain.rs | 4 +- catchain/tests/test_hash.rs | 4 +- catchain/tests/test_log_replay.rs | 4 +- catchain/tests/test_received_block.rs | 4 +- catchain/tests/test_receiver.rs | 4 +- catchain/tests/test_receiver_many_sources.rs | 4 +- catchain/tests/test_ton_structs.rs | 4 +- config.md | 1 - src/block.rs | 47 +- src/block_proof.rs | 19 +- src/boot.rs | 8 +- src/collator_test_bundle.rs | 53 +- src/config.rs | 12 +- src/engine.rs | 82 +- src/engine_operations.rs | 22 +- src/engine_traits.rs | 31 +- src/error.rs | 4 +- src/ext_messages.rs | 15 +- src/external_db/kafka_consumer.rs | 6 +- src/external_db/kafka_producer.rs | 8 +- src/external_db/mod.rs | 8 +- src/external_db/processor.rs | 82 +- src/external_db/stub_producer.rs | 6 +- src/external_db/tests/test.rs | 8 +- src/full_node/apply_block.rs | 8 +- src/full_node/counters.rs | 6 +- src/full_node/mod.rs | 4 +- src/full_node/remp_client.rs | 10 +- src/full_node/shard_client.rs | 12 +- src/full_node/state_helper.rs | 8 +- src/full_node/telemetry.rs | 8 +- src/internal_db/mod.rs | 8 +- src/internal_db/restore.rs | 4 +- src/internal_db/state_gc_resolver.rs | 8 +- src/internal_db/update.rs | 2 +- src/jaeger.rs | 8 +- src/lib.rs | 7 +- src/macros.rs | 4 +- src/main.rs | 39 +- src/network/catchain_client.rs | 6 +- src/network/control.rs | 18 +- src/network/full_node_client.rs | 8 +- src/network/full_node_service.rs | 8 +- src/network/mod.rs | 4 +- src/network/neighbours.rs | 6 +- src/network/node_network.rs | 6 +- src/network/remp.rs | 8 +- src/network/telemetry.rs | 4 +- src/network/tests/test_remp.rs | 4 +- src/network/tests/test_telemetry.rs | 4 +- src/rng/mod.rs | 4 +- src/rng/random.rs | 4 +- src/rng/tests/test_random.rs | 4 +- src/shard_blocks.rs | 8 +- src/shard_blocks_fast_finality.rs | 902 ------------------ src/shard_state.rs | 8 +- src/shard_states_keeper.rs | 4 +- src/sync.rs | 8 +- src/tests/test_block.rs | 23 +- src/tests/test_block_proof.rs | 4 +- src/tests/test_control.rs | 8 +- src/tests/test_engine.rs | 6 +- src/tests/test_ext_messages.rs | 63 +- src/tests/test_helper.rs | 41 +- src/tests/test_internal_db.rs | 8 +- src/tests/test_remp_client.rs | 4 +- src/tests/test_shard_blocks.rs | 8 +- src/tests/test_shard_state.rs | 10 +- src/tests/test_sync.rs | 4 +- src/tests/test_telemetry.rs | 6 +- src/types/accounts.rs | 8 +- src/types/awaiters_pool.rs | 6 +- src/types/limits.rs | 6 +- src/types/lockfree_cache.rs | 6 +- src/types/messages.rs | 10 +- src/types/mod.rs | 4 +- src/types/mpmc_channel.rs | 6 +- src/types/shard_blocks_observer.rs | 4 +- src/types/tests/test_awaiters_pool.rs | 6 +- src/types/tests/test_lockfree_cache.rs | 4 +- src/types/tests/test_messages.rs | 6 +- src/types/top_block_descr.rs | 24 +- src/validating_utils.rs | 6 +- src/validator/accept_block.rs | 23 +- src/validator/candidate_db.rs | 8 +- src/validator/catchain_overlay.rs | 2 +- src/validator/collator.rs | 48 +- src/validator/fabric.rs | 26 +- src/validator/log_parser.rs | 4 +- src/validator/message_cache.rs | 13 +- src/validator/mod.rs | 8 +- src/validator/mutex_wrapper.rs | 4 +- src/validator/out_msg_queue.rs | 22 +- src/validator/out_msg_queue_cleaner.rs | 17 +- src/validator/reliable_message_queue.rs | 8 +- src/validator/remp_block_parser.rs | 8 +- src/validator/remp_catchain.rs | 8 +- src/validator/remp_manager.rs | 8 +- src/validator/remp_service.rs | 15 +- src/validator/sessions_computing.rs | 17 +- src/validator/slashing.rs | 32 +- src/validator/telemetry.rs | 6 +- src/validator/tests/test_collator.rs | 10 +- src/validator/tests/test_log_parser.rs | 4 +- src/validator/tests/test_message_cache.rs | 8 +- src/validator/tests/test_out_msg_queue.rs | 12 +- src/validator/tests/test_rmq_messages.rs | 4 +- src/validator/tests/test_session_id.rs | 6 +- src/validator/tests/test_slashing.rs | 4 +- src/validator/tests/test_telemetry.rs | 6 +- src/validator/tests/test_validate_query.rs | 4 +- src/validator/tests/test_validator_utils.rs | 15 +- .../tests/test_workchains_fast_finality.rs | 3 - src/validator/validate_query.rs | 53 +- src/validator/validator_group.rs | 29 +- src/validator/validator_manager.rs | 43 +- src/validator/validator_session_listener.rs | 47 +- src/validator/validator_utils.rs | 24 +- src/validator/verification/block.rs | 6 +- src/validator/verification/mod.rs | 8 +- .../verification/multi_signature_bls.rs | 19 +- .../verification/multi_signature_unsafe.rs | 5 +- src/validator/verification/utils.rs | 11 +- .../verification/verification_manager.rs | 2 +- src/validator/verification/workchain.rs | 5 +- .../verification/workchain_overlay.rs | 2 +- src/validator/workchains_fast_finality.rs | 75 -- storage/Cargo.toml | 9 +- storage/benches/shardstate_db.rs | 8 +- storage/src/archives/archive_manager.rs | 8 +- storage/src/archives/archive_slice.rs | 8 +- storage/src/archives/file_maps.rs | 8 +- storage/src/archives/mod.rs | 4 +- storage/src/archives/package.rs | 6 +- storage/src/archives/package_entry.rs | 6 +- storage/src/archives/package_entry_id.rs | 8 +- storage/src/archives/package_entry_meta.rs | 4 +- storage/src/archives/package_entry_meta_db.rs | 4 +- storage/src/archives/package_id.rs | 6 +- storage/src/archives/package_index_db.rs | 6 +- storage/src/archives/package_info.rs | 6 +- storage/src/archives/package_offsets_db.rs | 8 +- storage/src/archives/package_status_db.rs | 6 +- storage/src/archives/package_status_key.rs | 4 +- .../archives/tests/test_archive_manager.rs | 8 +- .../src/archives/tests/test_archive_slice.rs | 8 +- storage/src/archives/tests/test_package.rs | 8 +- .../archives/tests/test_package_entry_id.rs | 8 +- storage/src/archives/tests/test_package_id.rs | 6 +- storage/src/block_db.rs | 6 +- storage/src/block_handle_db.rs | 8 +- storage/src/block_info_db.rs | 6 +- storage/src/catchain_persistent_db.rs | 6 +- storage/src/cell_db.rs | 6 +- storage/src/db/async_adapter.rs | 6 +- storage/src/db/filedb.rs | 6 +- storage/src/db/memorydb.rs | 6 +- storage/src/db/mod.rs | 4 +- storage/src/db/rocksdb.rs | 8 +- storage/src/db/tests/destroy_db.rs | 6 +- storage/src/db/tests/mod.rs | 6 +- storage/src/db/tests/test_filedb.rs | 6 +- storage/src/db/tests/test_memorydb.rs | 6 +- storage/src/db/tests/test_rocksdb.rs | 6 +- storage/src/db/traits/async_traits.rs | 6 +- storage/src/db/traits/db_key.rs | 6 +- storage/src/db/traits/mod.rs | 4 +- storage/src/db/traits/sync_traits.rs | 6 +- storage/src/dynamic_boc_rc_db.rs | 8 +- storage/src/error.rs | 6 +- storage/src/lib.rs | 4 +- storage/src/macros.rs | 30 +- storage/src/node_state_db.rs | 4 +- storage/src/shard_top_blocks_db.rs | 4 +- storage/src/shardstate_db_async.rs | 8 +- storage/src/status_db.rs | 6 +- storage/src/tests/mod.rs | 8 +- storage/src/tests/test_block_db.rs | 6 +- storage/src/tests/test_block_handle_db.rs | 8 +- .../src/tests/test_catchain_persistent_db.rs | 6 +- storage/src/tests/test_cell_db.rs | 6 +- storage/src/tests/test_dynamic_boc_db.rs | 6 +- storage/src/tests/test_dynamic_boc_rc_db.rs | 8 +- storage/src/tests/test_shardstate_db_async.rs | 8 +- storage/src/traits.rs | 8 +- storage/src/types/block_id.rs | 6 +- storage/src/types/block_meta.rs | 8 +- storage/src/types/db_slice.rs | 4 +- storage/src/types/mod.rs | 4 +- storage/src/types/shard_ident_key.rs | 8 +- storage/src/types/status_key.rs | 4 +- storage/src/types/storage_cell.rs | 6 +- storage/src/types/tests/mod.rs | 4 +- storage/src/types/tests/test_block_id.rs | 8 +- storage/src/types/tests/test_serialization.rs | 8 +- tests/test_run_net/log_cfg.yml | 6 +- tests/test_run_net/restart_nodes.sh | 8 +- tests/test_run_net/stop_network.sh | 4 +- tests/test_run_net/test_run_net.sh | 10 +- tests/test_run_net/test_run_net_ci_public.sh | 14 +- validator-session/Cargo.toml | 7 +- validator-session/src/block_candidate.rs | 4 +- validator-session/src/cache.rs | 4 +- validator-session/src/lib.rs | 8 +- validator-session/src/old_round.rs | 4 +- validator-session/src/round.rs | 4 +- validator-session/src/round_attempt.rs | 4 +- validator-session/src/sent_block.rs | 4 +- validator-session/src/session.rs | 6 +- validator-session/src/session_description.rs | 6 +- validator-session/src/session_processor.rs | 28 +- validator-session/src/session_state.rs | 4 +- validator-session/src/slashing.rs | 16 +- validator-session/src/task_queue.rs | 6 +- validator-session/src/utils.rs | 4 +- validator-session/src/vector.rs | 4 +- validator-session/src/vector_bool.rs | 4 +- validator-session/src/vote_candidate.rs | 4 +- validator-session/tests/test_fast_session.rs | 6 +- validator-session/tests/test_hash.rs | 8 +- 245 files changed, 1309 insertions(+), 2149 deletions(-) delete mode 100644 src/shard_blocks_fast_finality.rs delete mode 100644 src/validator/tests/test_workchains_fast_finality.rs delete mode 100644 src/validator/workchains_fast_finality.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f13993a..828e7b6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ All notable changes to this project will be documented in this file. +## Version 0.58.2 + +- Repo ever_types merged into repo ever_block + +## Version 0.58.0 + +- The crate was renamed from `ton_node` to `ever-node` +- Supported renaming of other crates + ## Version 0.57.0 - Shadow SMFT is prepared for first deployment diff --git a/Cargo.toml b/Cargo.toml index f1ffcff8..68979ebe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] build = 'common/build/build.rs' edition = '2021' -name = 'ton_node' -version = '0.57.0' +name = 'ever-node' +version = '0.58.2' [workspace] members = [ 'storage' ] @@ -86,17 +86,16 @@ stream-cancel = '0.8.0' string-builder = '^0.2.0' tokio = { features = [ 'rt-multi-thread' ], version = '1.5' } tokio-util = '0.7' -adnl = { features = [ 'client', 'node', 'server' ], git = 'https://github.com/tonlabs/ever-adnl.git', tag = '0.10.15' } +adnl = { features = [ 'client', 'node', 'server' ], git = 'https://github.com/everx-labs/ever-adnl.git', tag = '0.10.22' } catchain = { path = 'catchain' } -lockfree = { git = 'https://github.com/tonlabs/lockfree.git' } +ever_abi = { git = 'https://github.com/everx-labs/ever-abi.git', tag = '2.5.1' } +ever_block = { git = 'https://github.com/everx-labs/ever-block.git', tag = '1.10.0' } +ever_block_json = { git = 'https://github.com/everx-labs/ever-block-json.git', tag = '0.8.3' } +ever_executor = { git = 'https://github.com/everx-labs/ever-executor.git', tag = '1.17.3' } +ever_vm = { git = 'https://github.com/everx-labs/ever-vm.git', tag = '2.1.2' } +lockfree = { git = 'https://github.com/everx-labs/lockfree.git' } storage = { path = 'storage' } -ton_abi = { git = 'https://github.com/tonlabs/ever-abi.git', tag = '2.4.25' } -ton_api = { git = 'https://github.com/tonlabs/ever-tl.git', package = 'ton_api', tag = '0.3.72' } -ton_block = { git = 'https://github.com/tonlabs/ever-block.git', tag = '1.9.141' } -ton_block_json = { git = 'https://github.com/tonlabs/ever-block-json.git', tag = '0.7.231' } -ton_executor = { git = 'https://github.com/tonlabs/ever-executor.git', tag = '1.16.122' } -ton_types = { git = 'https://github.com/tonlabs/ever-types.git', tag = '2.0.39' } -ton_vm = { git = 'https://github.com/tonlabs/ever-vm.git', tag = '1.9.22' } +ton_api = { git = 'https://github.com/everx-labs/ever-tl.git', package = 'ton_api', tag = '0.3.77' } validator_session = { path = 'validator-session' } [dev-dependencies] @@ -108,20 +107,20 @@ pretty_assertions = '1.3' tokio = { features = [ 'macros' ], version = '1.5' } [features] -default = [ 'telemetry', 'ton_types/export_key' ] -export_key = [ 'catchain/export_key', 'ton_types/export_key' ] +default = [ 'telemetry', 'ever_block/export_key' ] +export_key = [ 'catchain/export_key', 'ever_block/export_key' ] external_db = [ 'rdkafka' ] fast_finality_extra = [ ] -gosh = [ 'ton_block/gosh', 'ton_vm/gosh' ] +gosh = [ 'ever_block/gosh', 'ever_vm/gosh' ] log_metrics = [ ] prometheus = [ 'metrics-exporter-prometheus', 'log_metrics' ] -signature_with_id = [ 'ton_block/signature_with_id', 'ton_vm/signature_with_id', 'ton_executor/signature_with_id' ] +signature_with_id = [ 'ever_block/signature_with_id', 'ever_vm/signature_with_id', 'ever_executor/signature_with_id' ] slashing = [ 'validator_session/slashing' ] statsd = [ 'metrics-exporter-statsd', 'log_metrics', 'dep:statsd' ] telemetry = [ 'adnl/telemetry', 'storage/telemetry' ] trace_alloc = [ ] trace_alloc_detail = [ 'trace_alloc' ] -verification = [ 'ton_types/export_key' ] +verification = [ 'ever_block/export_key' ] [profile] diff --git a/README.md b/README.md index cf70eaf6..f2313c5c 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ cargo test --release -- --nocapture --test-threads=1 To get help about command line arguments, run ``` -ton_node --help +ever-node --help ``` ## Everscale/Venom Console Usage diff --git a/bin/adnl_ping.rs b/bin/adnl_ping.rs index ea038b92..d7c54bea 100644 --- a/bin/adnl_ping.rs +++ b/bin/adnl_ping.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -20,8 +20,8 @@ use std::{convert::TryInto, env, fs::File, io::BufReader, sync::Arc}; use ton_api::ton::{TLObject, rpc::ton_node::GetCapabilities}; #[cfg(feature = "telemetry")] use ton_api::tag_from_boxed_type; -use ton_node::config::TonNodeGlobalConfigJson; -use ton_types::{error, fail, base64_decode, Ed25519KeyOption, Result}; +use ever_node::config::TonNodeGlobalConfigJson; +use ever_block::{error, fail, base64_decode, Ed25519KeyOption, Result}; include!("../common/src/test.rs"); diff --git a/bin/adnl_resolve.rs b/bin/adnl_resolve.rs index 5b23254c..120834a2 100644 --- a/bin/adnl_resolve.rs +++ b/bin/adnl_resolve.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2022 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,15 +7,15 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use adnl::node::{AdnlNode, AdnlNodeConfig}; use adnl::{DhtNode, DhtSearchPolicy}; use std::{convert::TryInto, env, fs::File, io::BufReader}; -use ton_node::config::TonNodeGlobalConfigJson; -use ton_types::{error, fail, base64_decode, KeyId, Result}; +use ever_node::config::TonNodeGlobalConfigJson; +use ever_block::{error, fail, base64_decode, KeyId, Result}; include!("../common/src/test.rs"); diff --git a/bin/console.rs b/bin/console.rs index 756de54b..d9f35da9 100644 --- a/bin/console.rs +++ b/bin/console.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,15 +7,21 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use adnl::{ common::TaggedTlObject, client::{AdnlClient, AdnlClientConfig, AdnlClientConfigJson} }; +use ever_abi::{Contract, Token, TokenValue, Uint}; +use ever_block::{ + error, fail, AccountStatus, base64_decode, base64_encode, BlockIdExt, BuilderData, + Deserializable, Ed25519KeyOption, Result, Serializable, ShardAccount, SliceData, + UInt256, write_boc +}; +use ever_block_json::parse_state; use std::{collections::HashMap, convert::TryInto, env, str::FromStr, time::Duration}; -use ton_abi::{Contract, Token, TokenValue, Uint}; use ton_api::{ serialize_boxed, ton::{ @@ -26,13 +32,6 @@ use ton_api::{ }; #[cfg(feature = "telemetry")] use ton_api::tag_from_bare_object; -use ton_block::{ - AccountStatus, Deserializable, BlockIdExt, Serializable, ShardAccount -}; -use ton_types::{ - error, fail, base64_decode, base64_encode, BuilderData, Ed25519KeyOption, Result, - SliceData, UInt256, write_boc -}; include!("../common/src/test.rs"); @@ -626,7 +625,7 @@ impl ControlClient { let body = BuilderData::with_raw(data, len)?; let body = body.into_cell()?; log::trace!("message body {}", body); - let data = ton_types::write_boc(&body)?; + let data = write_boc(&body)?; let path = params.next().map( |path| path.to_string()).unwrap_or("recover-query.boc".to_string() ); @@ -780,7 +779,7 @@ impl ControlClient { body }; log::trace!("message body {}", body); - let data = ton_types::write_boc(&body)?; + let data = write_boc(&body)?; let path = params.next().map( |path| path.to_string()).unwrap_or("validator-query.boc".to_string() ); @@ -808,7 +807,7 @@ impl ControlClient { let zerostate = serde_json::from_str::>(&zerostate) .map_err(|err| error!("Can't parse read zerostate json file: {}", err))?; - let zerostate = ton_block_json::parse_state(&zerostate) + let zerostate = parse_state(&zerostate) .map_err(|err| error!("Can't parse read zerostate json file: {}", err))?; let key = SliceData::load_builder(index.write_to_new_cell()?)?; @@ -941,12 +940,12 @@ mod test { use serde_json::json; use storage::block_handle_db::BlockHandle; use ton_api::deserialize_boxed; - use ton_block::{ + use ever_block::{ generate_test_account_by_init_code_hash, BlockLimits, ConfigParam0, ConfigParam34, ConfigParamEnum, McStateExtra, ParamLimits, ShardIdent, ShardStateUnsplit, ValidatorDescr, ValidatorSet }; - use ton_node::{ + use ever_node::{ collator_test_bundle::{create_engine_telemetry, create_engine_allocated}, config::TonNodeConfig, engine_traits::{EngineAlloc, EngineOperations}, internal_db::{InternalDbConfig, InternalDb, state_gc_resolver::AllowStateGcSmartResolver}, @@ -955,7 +954,7 @@ mod test { validator::validator_manager::ValidationStatus, shard_states_keeper::PinnedShardStateGuard, }; #[cfg(feature = "telemetry")] - use ton_node::engine_traits::EngineTelemetry; + use ever_node::engine_traits::EngineTelemetry; const CFG_DIR: &str = "./target"; const CFG_NODE_FILE: &str = "light_node.json"; @@ -987,7 +986,7 @@ mod test { &ShardAccount::with_params(&account, UInt256::default(), 0).unwrap() ).unwrap(); let cell = ss.serialize().unwrap(); - let bytes = ton_types::write_boc(&cell).unwrap(); + let bytes = write_boc(&cell).unwrap(); let shard_state_id = BlockIdExt::with_params( ShardIdent::full(0), 0, @@ -1025,7 +1024,7 @@ mod test { ss.write_custom(Some(&ms)).unwrap(); let cell = ss.serialize().unwrap(); - let bytes = ton_types::write_boc(&cell).unwrap(); + let bytes = write_boc(&cell).unwrap(); let master_state_id = BlockIdExt::with_params( ShardIdent::masterchain(), 0, diff --git a/bin/dhtscan.rs b/bin/dhtscan.rs index f4fac380..7db4aff3 100644 --- a/bin/dhtscan.rs +++ b/bin/dhtscan.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -15,8 +15,8 @@ use adnl::node::{AdnlNode, AdnlNodeConfig}; use adnl::DhtNode; use adnl::OverlayNode; use std::{collections::HashMap, env, fs::File, io::BufReader, ops::Deref, sync::Arc}; -use ton_node::config::TonNodeGlobalConfigJson; -use ton_types::{error, fail, base64_encode, KeyOption, Result}; +use ever_node::config::TonNodeGlobalConfigJson; +use ever_block::{error, fail, base64_encode, KeyOption, Result}; include!("../common/src/test.rs"); diff --git a/bin/gendht.rs b/bin/gendht.rs index 16702cd3..54df0c4b 100644 --- a/bin/gendht.rs +++ b/bin/gendht.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,14 +7,14 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use adnl::{adnl_node_test_key, adnl_node_test_config, node::{AdnlNode, AdnlNodeConfig}}; use adnl::DhtNode; use std::{env, ops::Deref, sync::Arc}; -use ton_types::{error, base64_encode, KeyOption, Result}; +use ever_block::{error, base64_encode, KeyOption, Result}; async fn gen(ip: &str, dht_key_enc: &str) -> Result<()> { let config = AdnlNodeConfig::from_json( diff --git a/bin/keygen.rs b/bin/keygen.rs index 4aedb088..85b27e2d 100644 --- a/bin/keygen.rs +++ b/bin/keygen.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,11 +7,11 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ -use ton_types::{base64_decode, base64_encode, Ed25519KeyOption, Result}; +use ever_block::{base64_decode, base64_encode, Ed25519KeyOption, Result}; fn gen() -> Result<()> { let (private, public) = Ed25519KeyOption::generate_with_json()?; diff --git a/bin/keyid.rs b/bin/keyid.rs index 83e5e37b..f0a12a4b 100644 --- a/bin/keyid.rs +++ b/bin/keyid.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,12 +7,12 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use std::{convert::TryInto, env}; -use ton_types::{error, fail, base64_decode, base64_encode, Ed25519KeyOption, Result}; +use ever_block::{error, fail, base64_decode, base64_encode, Ed25519KeyOption, Result}; fn compute(typ: &str, key: &str) -> Result<()> { let key_bin = base64_decode(key)?; diff --git a/bin/print.rs b/bin/print.rs index 09c86e90..bafeab83 100644 --- a/bin/print.rs +++ b/bin/print.rs @@ -7,37 +7,36 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ -use clap::{Arg, App}; -use serde_json::Map; -use ton_block::{ - BlockIdExt, Block, Deserializable, ShardStateUnsplit, McShardRecord, HashmapAugType +use ever_block::{ + error, BlockIdExt, Block, Deserializable, ShardStateUnsplit, McShardRecord, + HashmapAugType, Result }; -use ton_node::{ +use ever_block_json::{debug_block, debug_block_full, debug_state, debug_state_full}; +use ever_node::{ collator_test_bundle::create_engine_allocated, internal_db::{InternalDb, InternalDbConfig, LAST_APPLIED_MC_BLOCK} }; #[cfg(feature = "telemetry")] -use ton_node::collator_test_bundle::create_engine_telemetry; -use ton_types::{error, Result}; +use ever_node::collator_test_bundle::create_engine_telemetry; fn print_block(block: &Block, brief: bool) -> Result<()> { if brief { - println!("{}", ton_block_json::debug_block(block.clone())?); + println!("{}", debug_block(block.clone())?); } else { - println!("{}", ton_block_json::debug_block_full(block)?); + println!("{}", debug_block_full(block)?); } Ok(()) } fn print_state(state: &ShardStateUnsplit, brief: bool) -> Result<()> { if brief { - println!("{}", ton_block_json::debug_state(state.clone())?); + println!("{}", debug_state(state.clone())?); } else { - println!("{}", ton_block_json::debug_state_full(state.clone())?); + println!("{}", debug_state_full(state.clone())?); } Ok(()) } @@ -83,47 +82,55 @@ fn get_block_id(db: &InternalDb, id: &str) -> Result { #[tokio::main] async fn main() -> Result<()> { - let args = App::new(env!("CARGO_PKG_NAME")) + let args = clap::App::new(env!("CARGO_PKG_NAME")) .version(env!("CARGO_PKG_VERSION")) - .arg(Arg::with_name("PATH") + .arg(clap::Arg::with_name("PATH") .short("p") .long("path") .help("path to DB") .takes_value(true) .default_value("node_db") .number_of_values(1)) - .arg(Arg::with_name("BLOCK") + .arg(clap::Arg::with_name("BLOCK") .short("b") .long("block") .help("print block") .takes_value(true) .number_of_values(1)) - .arg(Arg::with_name("STATE") + .arg(clap::Arg::with_name("STATE") .short("s") .long("state") .help("print state") .takes_value(true) .number_of_values(1)) - .arg(Arg::with_name("SHARDS") + .arg(clap::Arg::with_name("SHARDS") .short("r") .long("shards") .help("shard ids from master with seqno") .takes_value(true) .number_of_values(1)) - .arg(Arg::with_name("LAST_ACCOUNTS") + .arg(clap::Arg::with_name("LAST_ACCOUNTS") .long("accounts") .takes_value(false) - .help("print all accounts from all shards of workchains and masterchain for last applied state")) - .arg(Arg::with_name("BOC") + .help( + "print all accounts from all shards of workchains and masterchain \ + for last applied state" + ) + ) + .arg(clap::Arg::with_name("BOC") .short("c") .long("boc") .help("print containtment of bag of cells") .takes_value(true) .number_of_values(1)) - .arg(Arg::with_name("BRIEF") + .arg(clap::Arg::with_name("BRIEF") .short("i") .long("brief") - .help("print brief info (block without messages and transactions, state without accounts) ")) + .help( + "print brief info \ + (block without messages and transactions, state without accounts)" + ) + ) .get_matches(); let brief = args.is_present("BRIEF"); @@ -184,7 +191,7 @@ async fn main() -> Result<()> { "balance": balance.grams.as_u128(), }); if !balance.other.is_empty() { - let mut other = Map::new(); + let mut other = serde_json::Map::new(); balance.other.iterate_with_keys(|k: u32, v| { other.insert(k.to_string(), v.value().to_string().into()); Ok(true) diff --git a/bin/zerostate.rs b/bin/zerostate.rs index 8f0c3e40..30142a49 100644 --- a/bin/zerostate.rs +++ b/bin/zerostate.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,21 +7,22 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use clap::{Arg, App}; use serde_json::{Map, Value}; -use ton_block::{ - ConfigParamEnum, ConfigParam12, - Deserializable, Serializable, ShardIdent, ShardStateUnsplit, StateInit, +use ever_block::{ + base64_encode, ConfigParamEnum, ConfigParam12, Deserializable, HashmapType, MASTERCHAIN_ID, + Result, Serializable, SHARD_FULL, ShardIdent, ShardStateUnsplit, StateInit, UInt256, + write_boc }; -use ton_types::{base64_encode, HashmapType, Result, UInt256, write_boc}; +use ever_block_json::parse_state; fn import_zerostate(json: &str) -> Result { let map = serde_json::from_str::>(&json)?; - let mut mc_zero_state = ton_block_json::parse_state(&map)?; + let mut mc_zero_state = parse_state(&map)?; let now = mc_zero_state.gen_time(); // let now = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_secs() as u32; // mc_zero_state.set_gen_time(now); @@ -29,7 +30,7 @@ fn import_zerostate(json: &str) -> Result { let mut workchains = extra.config.workchains()?; let mut wc_zero_state = vec![]; workchains.clone().iterate_with_keys(|workchain_id, mut descr| { - let shard = ShardIdent::with_tagged_prefix(workchain_id, ton_block::SHARD_FULL)?; + let shard = ShardIdent::with_tagged_prefix(workchain_id, SHARD_FULL)?; // generate empty shard state and set desired fields let mut state = ShardStateUnsplit::with_ident(shard); state.set_gen_time(now); @@ -38,7 +39,7 @@ fn import_zerostate(json: &str) -> Result { let cell = state.serialize()?; descr.zerostate_root_hash = cell.repr_hash(); - let bytes = ton_types::write_boc(&cell)?; + let bytes = write_boc(&cell)?; descr.zerostate_file_hash = UInt256::calc_file_hash(&bytes); workchains.set(&workchain_id, &descr)?; let name = format!("{:x}.boc", descr.zerostate_file_hash); @@ -51,8 +52,8 @@ fn import_zerostate(json: &str) -> Result { let cur_validators = extra.config.validator_set()?; let (_validators, hash_short) = cur_validators.calc_subset( &ccvc, - ton_block::SHARD_FULL, - ton_block::MASTERCHAIN_ID, + SHARD_FULL, + MASTERCHAIN_ID, 0, now.into() )?; @@ -98,7 +99,7 @@ fn write_zero_state(mc_zero_state: ShardStateUnsplit) -> Result<()> { println!("{}", json); // check correctness - // std::fs::write("new.json", ton_block_json::debug_state(mc_zero_state)?)?; + // std::fs::write("new.json", debug_state(mc_zero_state)?)?; Ok(()) } diff --git a/catchain/Cargo.toml b/catchain/Cargo.toml index 644cd5ad..9910f9df 100644 --- a/catchain/Cargo.toml +++ b/catchain/Cargo.toml @@ -19,10 +19,10 @@ quanta = '0.11.1' rand = '0.8' regex = '1.3.1' tokio = { features = [ 'rt-multi-thread' ], version = '1.5' } -adnl = { features = [ 'node' ], git = 'https://github.com/tonlabs/ever-adnl.git', tag = '0.10.15' } +adnl = { features = [ 'node' ], git = 'https://github.com/everx-labs/ever-adnl.git', tag = '0.10.22' } +ever_block = { git = 'https://github.com/everx-labs/ever-block.git', tag = '1.10.0' } storage = { path = '../storage' } -ton_api = { git = 'https://github.com/tonlabs/ever-tl.git', package = 'ton_api', tag = '0.3.72' } -ton_types = { git = 'https://github.com/tonlabs/ever-types.git', tag = '2.0.39' } +ton_api = { git = 'https://github.com/everx-labs/ever-tl.git', package = 'ton_api', tag = '0.3.77' } [dev-dependencies] chrono = '0.4.10' @@ -32,5 +32,5 @@ rocksdb = '0.21' [features] default = [ ] -export_key = [ 'ton_types/export_key' ] +export_key = [ 'ever_block/export_key' ] diff --git a/catchain/src/activity_node.rs b/catchain/src/activity_node.rs index 32299aa1..3940eb5d 100644 --- a/catchain/src/activity_node.rs +++ b/catchain/src/activity_node.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/catchain/src/block.rs b/catchain/src/block.rs index 44f24f8e..bb4ff131 100644 --- a/catchain/src/block.rs +++ b/catchain/src/block.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/catchain/src/block_payload.rs b/catchain/src/block_payload.rs index 75a4e04a..eefa523a 100644 --- a/catchain/src/block_payload.rs +++ b/catchain/src/block_payload.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/catchain/src/catchain.rs b/catchain/src/catchain.rs index e4ad7ed7..c711ba51 100644 --- a/catchain/src/catchain.rs +++ b/catchain/src/catchain.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -31,7 +31,7 @@ use std::{ time::{Duration, SystemTime, UNIX_EPOCH} }; use ton_api::IntoBoxed; -use ton_types::{error, Result, UInt256}; +use ever_block::{error, Result, UInt256}; /* Constants diff --git a/catchain/src/database.rs b/catchain/src/database.rs index aba015a7..7f0b01dc 100644 --- a/catchain/src/database.rs +++ b/catchain/src/database.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -18,7 +18,7 @@ use crate::{ use metrics::Recorder; use std::{path::Path, sync::{Arc, atomic::{AtomicBool, Ordering}}}; use storage::catchain_persistent_db::CatchainPersistentDb; -use ton_types::{fail, Result}; +use ever_block::{fail, Result}; /* Implementation details for Database diff --git a/catchain/src/lib.rs b/catchain/src/lib.rs index 07d46192..ebc29ec4 100644 --- a/catchain/src/lib.rs +++ b/catchain/src/lib.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -30,7 +30,7 @@ use std::{ any::Any, cell::RefCell, fmt, path::Path, rc::{Rc, Weak}, sync::Arc, time::SystemTime, }; -use ton_types::{KeyId, KeyOption, UInt256}; +use ever_block::{KeyId, KeyOption, UInt256}; /// Public key pub type PublicKey = Arc; @@ -42,7 +42,7 @@ pub type PublicKeyHash = Arc; pub type PrivateKey = Arc; /// Result for operations -pub type Result = ton_types::Result; +pub type Result = ever_block::Result; pub type DatabasePtr = Arc; diff --git a/catchain/src/log_player.rs b/catchain/src/log_player.rs index 00c95331..8fcecdc8 100644 --- a/catchain/src/log_player.rs +++ b/catchain/src/log_player.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -23,7 +23,7 @@ use std::{ cell::RefCell, collections::HashMap, fmt, fs::File, io::{BufRead, BufReader}, rc::Rc, sync::{Arc, atomic::{AtomicBool, Ordering}}, time::SystemTime }; -use ton_types::{fail, Result}; +use ever_block::{fail, Result}; /* Constants diff --git a/catchain/src/profiling.rs b/catchain/src/profiling.rs index 36014352..661b5a65 100644 --- a/catchain/src/profiling.rs +++ b/catchain/src/profiling.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/catchain/src/received_block.rs b/catchain/src/received_block.rs index 535ce2a1..c1c51d02 100644 --- a/catchain/src/received_block.rs +++ b/catchain/src/received_block.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -21,7 +21,7 @@ use std::{ cell::RefCell, cmp, collections::HashMap, fmt, rc::{Rc, Weak}, str::FromStr }; use ton_api::IntoBoxed; -use ton_types::{error, fail, Result, UInt256}; +use ever_block::{error, fail, Result, UInt256}; /* Constants diff --git a/catchain/src/receiver.rs b/catchain/src/receiver.rs index eb4811fa..8b26b863 100644 --- a/catchain/src/receiver.rs +++ b/catchain/src/receiver.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -28,7 +28,7 @@ use std::{ rc::Rc, time::{Duration, SystemTime} }; use ton_api::IntoBoxed; -use ton_types::{error, fail, base64_encode_url_safe, Ed25519KeyOption, Result}; +use ever_block::{error, fail, base64_encode_url_safe, Ed25519KeyOption, Result}; /* Constants diff --git a/catchain/src/receiver_source.rs b/catchain/src/receiver_source.rs index 942dd790..1d79225c 100644 --- a/catchain/src/receiver_source.rs +++ b/catchain/src/receiver_source.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/catchain/src/utils.rs b/catchain/src/utils.rs index ebc65ab8..9c0a44b0 100644 --- a/catchain/src/utils.rs +++ b/catchain/src/utils.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -19,7 +19,7 @@ use crate::{ }; use std::{collections::{BTreeMap, HashMap, HashSet}, convert::TryInto}; use ton_api::{deserialize_typed, IntoBoxed}; -use ton_types::{Ed25519KeyOption, KeyId, Result, UInt256}; +use ever_block::{Ed25519KeyOption, KeyId, Result, UInt256}; mod metrics; pub use self::metrics::MetricsHandle; diff --git a/catchain/tests/test_catchain.rs b/catchain/tests/test_catchain.rs index 31666be9..609231d9 100644 --- a/catchain/tests/test_catchain.rs +++ b/catchain/tests/test_catchain.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/catchain/tests/test_hash.rs b/catchain/tests/test_hash.rs index c90eec79..d6a7572d 100644 --- a/catchain/tests/test_hash.rs +++ b/catchain/tests/test_hash.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/catchain/tests/test_log_replay.rs b/catchain/tests/test_log_replay.rs index da73eacc..ab73be4d 100644 --- a/catchain/tests/test_log_replay.rs +++ b/catchain/tests/test_log_replay.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/catchain/tests/test_received_block.rs b/catchain/tests/test_received_block.rs index 4cfa0410..72f42a06 100644 --- a/catchain/tests/test_received_block.rs +++ b/catchain/tests/test_received_block.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/catchain/tests/test_receiver.rs b/catchain/tests/test_receiver.rs index 7e5ff244..64fffa7c 100644 --- a/catchain/tests/test_receiver.rs +++ b/catchain/tests/test_receiver.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/catchain/tests/test_receiver_many_sources.rs b/catchain/tests/test_receiver_many_sources.rs index 0fa3f7a8..992d9f89 100644 --- a/catchain/tests/test_receiver_many_sources.rs +++ b/catchain/tests/test_receiver_many_sources.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/catchain/tests/test_ton_structs.rs b/catchain/tests/test_ton_structs.rs index 80ef2bb9..ca606a56 100644 --- a/catchain/tests/test_ton_structs.rs +++ b/catchain/tests/test_ton_structs.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/config.md b/config.md index 5b9ed53b..0a960745 100644 --- a/config.md +++ b/config.md @@ -5,7 +5,6 @@ Root section allows to synchronize node by archives instead of single blocks. It may be useful in some conditions, for example, long ping to other nodes. - `remp` section ------------ diff --git a/src/block.rs b/src/block.rs index e7d48353..cbd9a234 100644 --- a/src/block.rs +++ b/src/block.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2022 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,27 +7,24 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ -use std::{cmp::max, sync::Arc}; -use std::io::Write; -use ton_block::{ - Block, BlockIdExt, BlkPrevInfo, Deserializable, ExtBlkRef, ShardDescr, ShardIdent, - ShardHashes, HashmapAugType, MerkleProof, Serializable, ConfigParams, OutQueueUpdate, -}; -use ton_types::{ - Cell, Result, types::UInt256, BocReader, error, fail, HashmapType, UsageTree, -}; - -#[cfg(test)] -use ton_block::{BlockInfo, BlkMasterInfo}; use crate::{ shard_state::ShardHashesStuff, validator::accept_block::visit_block_for_proof, }; +use ever_block::{ + error, fail, Block, BlockIdExt, BlkPrevInfo, BocReader, Cell, ConfigParams, Deserializable, + ExtBlkRef, HashmapAugType, HashmapType, MerkleProof, OutQueueUpdate, Result, Serializable, + ShardDescr, ShardIdent, ShardHashes, UInt256, UsageTree +}; +#[cfg(test)] +use ever_block::{BlockInfo, BlkMasterInfo, write_boc}; +use std::{cmp::max, io::Write, sync::Arc}; + #[cfg(test)] #[path = "tests/test_block.rs"] mod tests; @@ -86,7 +83,7 @@ impl BlockStuff { #[cfg(test)] pub fn from_block(block: Block) -> Result { let root = block.serialize()?; - let data = ton_types::write_boc(&root)?; + let data = write_boc(&root)?; let file_hash = UInt256::calc_file_hash(&data); let block_info = block.read_info()?; let id = BlockIdExt { @@ -360,20 +357,20 @@ impl BlockStuff { Ok(true) })?; Ok(shards) - } + } - pub fn get_config_params(&self) -> Result { - self.block()? - .read_extra()? - .read_custom()? - .ok_or_else(|| error!("Block {} doesn't contain `custom` field", self.id))? - .config_mut().take() - .ok_or_else(|| error!("Block {} doesn't contain `config` field", self.id)) - } + pub fn get_config_params(&self) -> Result { + self.block()? + .read_extra()? + .read_custom()? + .ok_or_else(|| error!("Block {} doesn't contain `custom` field", self.id))? + .config_mut().take() + .ok_or_else(|| error!("Block {} doesn't contain `config` field", self.id)) + } // Unused // pub fn read_cur_validator_set_and_cc_conf(&self) -> Result<(ValidatorSet, CatchainConfig)> { -// self.block()?.read_cur_validator_set_and_cc_conf() +// self.block()?.read_cur_validator_set_and_cc_conf() // } pub fn calculate_tr_count(&self) -> Result { diff --git a/src/block_proof.rs b/src/block_proof.rs index d36c483c..33cad601 100644 --- a/src/block_proof.rs +++ b/src/block_proof.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2022 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,15 +7,10 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ -use std::sync::Arc; - -use ton_block::{Block, BlockIdExt, BlockInfo, BlockProof, ConfigParams, Deserializable, MerkleProof, Serializable}; -use ton_types::{Cell, Result, fail, error, HashmapType, BocReader, write_boc}; - use crate::{ block::{BlockIdExtExtention, BlockStuff}, error::NodeError, @@ -26,6 +21,12 @@ use crate::{ }, }; +use ever_block::{ + error, fail, Block, BlockIdExt, BlockInfo, BlockProof, BocReader, Cell, ConfigParams, + Deserializable, HashmapType, MerkleProof, Result, Serializable, write_boc +}; +use std::sync::Arc; + #[cfg(test)] #[path = "tests/test_block_proof.rs"] mod tests; @@ -550,7 +551,7 @@ impl BlockProofStuff { } // Check signatures - let checked_data = ton_block::Block::build_data_for_sign( + let checked_data = Block::build_data_for_sign( &self.id.root_hash, &self.id.file_hash ); @@ -582,7 +583,7 @@ impl BlockProofStuff { Ok(()) } - fn process_given_state(&self, state: &ShardStateStuff, block_info: &ton_block::BlockInfo) + fn process_given_state(&self, state: &ShardStateStuff, block_info: &BlockInfo) -> Result { // Checks diff --git a/src/boot.rs b/src/boot.rs index bd15377b..cc757832 100644 --- a/src/boot.rs +++ b/src/boot.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -20,8 +20,8 @@ use std::collections::HashSet; use std::{ops::Deref, sync::Arc, time::Duration}; use std::path::Path; use storage::block_handle_db::BlockHandle; -use ton_block::{BlockIdExt, ShardIdent, SHARD_FULL}; -use ton_types::{error, fail, KeyId, Result}; +use ever_block::{BlockIdExt, ShardIdent, SHARD_FULL}; +use ever_block::{error, fail, KeyId, Result}; use crate::block::BlockStuff; use crate::validator::accept_block::create_new_proof_link; diff --git a/src/collator_test_bundle.rs b/src/collator_test_bundle.rs index 6d409812..83e9488f 100644 --- a/src/collator_test_bundle.rs +++ b/src/collator_test_bundle.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -36,13 +36,13 @@ use storage::{ }; #[cfg(feature = "telemetry")] use storage::StorageTelemetry; -use ton_block::{ +use ever_block::{ BlockIdExt, Message, ShardIdent, Serializable, MerkleUpdate, Deserializable, ValidatorBaseInfo, BlockSignaturesPure, BlockSignatures, HashmapAugType, TopBlockDescrSet, GlobalCapabilities, OutMsgQueue, }; -use ton_block::{ShardStateUnsplit, TopBlockDescr}; -use ton_types::{UInt256, fail, error, Result, CellType, read_boc, read_single_root_boc}; +use ever_block::{ShardStateUnsplit, TopBlockDescr}; +use ever_block::{UInt256, fail, error, Result, CellType, read_boc, read_single_root_boc}; use crate::engine_traits::RempDuplicateStatus; #[derive(serde::Deserialize, serde::Serialize)] @@ -57,7 +57,9 @@ struct CollatorTestBundleIndexJson { prev_blocks: Vec, created_by: String, rand_seed: String, + #[serde(skip_serializing)] now: u32, + now_ms: u64, fake: bool, contains_ethalon: bool, #[serde(default)] @@ -100,7 +102,7 @@ impl TryFrom for CollatorTestBundleIndex { prev_blocks, created_by: value.created_by.parse()?, rand_seed: Some(value.rand_seed.parse()?), - now: value.now, + now_ms: if value.now_ms == 0 { (value.now as u64) * 1000 } else { value.now_ms }, fake: value.fake, contains_ethalon: value.contains_ethalon, contains_candidate: value.contains_candidate, @@ -125,7 +127,8 @@ impl From<&CollatorTestBundleIndex> for CollatorTestBundleIndexJson { Some(rand_seed) => rand_seed.to_hex_string(), None => UInt256::default().to_hex_string(), }, - now: value.now, + now: (value.now_ms / 1000) as u32, + now_ms: value.now_ms, fake: value.fake, contains_ethalon: value.contains_ethalon, contains_candidate: value.contains_candidate, @@ -145,7 +148,7 @@ struct CollatorTestBundleIndex { prev_blocks: Vec, created_by: UInt256, rand_seed: Option, - now: u32, + now_ms: u64, fake: bool, contains_ethalon: bool, contains_candidate: bool, @@ -254,12 +257,12 @@ impl CollatorTestBundle { &allocated )?; - let mut now = mc_state.state()?.gen_time() + 1; + let mut now_ms = mc_state.state()?.gen_time_ms() + 1; let mut states = HashMap::new(); states.insert(last_mc_state.clone(), mc_state); for wc_zero_state_name in wc_zero_state_names { let (wc_state, wc_fh, wc_rh) = construct_from_file::(wc_zero_state_name)?; - now = std::cmp::max(now, wc_state.gen_time() + 1); + now_ms = now_ms.max(wc_state.gen_time_ms() + 1); let block_id = BlockIdExt::with_params(wc_state.shard().clone(), 0, wc_rh, wc_fh); let wc_state = ShardStateStuff::from_state( block_id.clone(), @@ -286,7 +289,7 @@ impl CollatorTestBundle { prev_blocks, created_by: UInt256::default(), rand_seed: None, - now, + now_ms, fake: true, contains_ethalon: false, contains_candidate: false, @@ -337,10 +340,10 @@ impl CollatorTestBundle { // uncomment this block, and change dst address then run test // add id (new filename of message) to external messages in index.json // std::fs::create_dir_all(format!("{}/external_messages", path)).ok(); - // let src = ton_block::MsgAddressExt::with_extern([0x77; 32].into())?; + // let src = ever_block::MsgAddressExt::with_extern([0x77; 32].into())?; // let dst = hex::decode("b1219502b825ef2345f49fc9065e485e7f478bddafa63039d00c63e494ab7090")?; - // let dst = ton_block::MsgAddressInt::with_standart(None, 0, dst.into())?; - // let h = ton_block::ExternalInboundMessageHeader::new(src, dst); + // let dst = ever_block::MsgAddressInt::with_standart(None, 0, dst.into())?; + // let h = ever_block::ExternalInboundMessageHeader::new(src, dst); // let msg = Message::with_ext_in_header(h); // let id = msg.serialize()?.repr_hash(); // let filename = format!("{}/external_messages/{:x}", path, id); @@ -606,7 +609,10 @@ impl CollatorTestBundle { // // external messages // - let external_messages = engine.get_external_messages_iterator(shard.clone(), 0).collect::>(); + let external_messages = engine.get_external_messages_iterator( + shard.clone(), + 0 + ).collect::>(); // // neighbors @@ -706,7 +712,7 @@ impl CollatorTestBundle { prev_blocks: prev_blocks_ids, created_by: UInt256::default(), rand_seed: None, - now: engine.now(), + now_ms: engine.now_ms(), fake: true, contains_ethalon: false, contains_candidate: false, @@ -771,7 +777,10 @@ impl CollatorTestBundle { // // external messages // - let external_messages = engine.get_external_messages_iterator(shard.clone(), 0).collect::>(); + let external_messages = engine.get_external_messages_iterator( + shard.clone(), + 0 + ).collect::>(); // // neighbors @@ -862,7 +871,7 @@ impl CollatorTestBundle { prev_blocks: prev_blocks_ids, created_by: candidate.created_by.clone(), rand_seed: None, - now: b.block()?.read_info()?.gen_utime().as_u32(), + now_ms: b.block()?.read_info()?.gen_utime_ms(), fake: true, contains_ethalon: false, contains_candidate: true, @@ -1071,7 +1080,7 @@ impl CollatorTestBundle { prev_blocks: prev_blocks_ids, created_by: extra.created_by().clone(), rand_seed: Some(extra.rand_seed().clone()), - now: info.gen_utime().as_u32(), + now_ms: info.gen_utime_ms(), fake: true, contains_ethalon: true, contains_candidate: false, @@ -1219,7 +1228,11 @@ impl CollatorTestBundle { impl EngineOperations for CollatorTestBundle { fn now(&self) -> u32 { - self.index.now + (self.index.now_ms / 1000) as u32 + } + + fn now_ms(&self) -> u64 { + self.index.now_ms } fn load_block_handle(&self, id: &BlockIdExt) -> Result>> { diff --git a/src/config.rs b/src/config.rs index d8ceaff7..54dc35cd 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -33,10 +33,10 @@ use ton_api::{ dht::node::Node as DhtNodeConfig, pub_::publickey::Ed25519 } }; -use ton_block::{BlockIdExt, ShardIdent}; +use ever_block::{BlockIdExt, ShardIdent}; #[cfg(feature="external_db")] -use ton_block::{BASE_WORKCHAIN_ID, MASTERCHAIN_ID}; -use ton_types::{ +use ever_block::{BASE_WORKCHAIN_ID, MASTERCHAIN_ID}; +use ever_block::{ error, fail, base64_decode, base64_encode, BlsKeyOption, Ed25519KeyOption, KeyId, KeyOption, KeyOptionJson, Result, UInt256 }; @@ -106,7 +106,7 @@ impl Default for CollatorConfig { finalize_empty_after_ms: 800, empty_collation_sleep_ms: 100, external_messages_timeout_percentage_points: 100, // 0.1 = 10% = 100ms - external_messages_maximum_queue_length: None, + external_messages_maximum_queue_length: Some(25600), } } } diff --git a/src/engine.rs b/src/engine.rs index 132fca80..95f0da9e 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,12 +7,16 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::{ block::{BlockStuff, BlockIdExtExtention}, block_proof::BlockProofStuff, boot, + config::{ + CollatorConfig, CollatorTestBundlesGeneralConfig, KafkaConsumerConfig, + TonNodeConfig, ValidatorManagerConfig + }, engine_traits::{ ExternalDb, EngineAlloc, EngineOperations, OverlayOperations, PrivateOverlayOperations, Server, @@ -56,7 +60,7 @@ use crate::internal_db::EXTERNAL_DB_BLOCK; #[cfg(feature = "slashing")] use crate::validator::{ slashing::{ValidatedBlockStat, ValidatedBlockStatNode}, - validator_utils::calc_subset_for_workchain, + validator_utils::calc_subset_for_workchain_standard, }; #[cfg(feature = "telemetry")] use crate::{ @@ -65,10 +69,18 @@ use crate::{ validator::telemetry::{CollatorValidatorTelemetry, RempCoreTelemetry}, }; +use adnl::QueriesConsumer; #[cfg(feature = "telemetry")] use adnl::telemetry::{Metric, MetricBuilder, TelemetryItem, TelemetryPrinter}; -use adnl::QueriesConsumer; use catchain::SessionId; +use ever_block::{ + error, fail, BASE_WORKCHAIN_ID, BlockIdExt, GlobalCapabilities, KeyId, MASTERCHAIN_ID, + OutMsgQueue, Result, SHARD_FULL, ShardIdent, UInt256 +}; +#[cfg(feature = "slashing")] +use ever_block::{CryptoSignaturePair, Deserializable, HashmapType}; +#[cfg(feature = "telemetry")] +use ever_block::Cell; use std::{ ops::Deref, sync::{Arc, atomic::{AtomicBool, AtomicU8, AtomicU32, Ordering, AtomicU64}}, time::{Duration, SystemTime}, collections::{HashMap, HashSet}, path::Path @@ -84,19 +96,6 @@ use ton_api::ton::ton_node::{ BlockBroadcast, QueueUpdateBroadcast, ExternalMessageBroadcast, NewShardBlockBroadcast } }; -use ton_block::{ - self, ShardIdent, BlockIdExt, MASTERCHAIN_ID, SHARD_FULL, BASE_WORKCHAIN_ID, GlobalCapabilities, - OutMsgQueue -}; -use ton_types::{error, fail, KeyId, Result, UInt256}; -#[cfg(feature = "slashing")] -use ton_types::HashmapType; -#[cfg(feature = "telemetry")] -use ton_types::Cell; -use crate::config::{ - CollatorConfig, CollatorTestBundlesGeneralConfig, KafkaConsumerConfig, - TonNodeConfig, ValidatorManagerConfig -}; #[cfg(feature = "slashing")] //maximum number of validated block stats entries in engine's queue @@ -176,7 +175,7 @@ pub struct Engine { tps_counter: TpsCounter, - pub out_queues_cache: std::sync::Mutex>, + pub out_queues_cache: std::sync::Mutex>, } struct DownloadContext<'a, T> { @@ -792,7 +791,9 @@ impl Engine { engine_telemetry.clone(), engine_allocated.clone() ), - external_messages: Arc::new(MessagesPool::new(now, external_messages_maximum_queue_length)), + external_messages: Arc::new( + MessagesPool::new(now, external_messages_maximum_queue_length) + ), servers: lockfree::queue::Queue::new(), remp_client, remp_service, @@ -932,7 +933,7 @@ impl Engine { pub fn shard_states_keeper(&self) -> Arc { self.shard_states_keeper.clone() } pub async fn get_masterchain_overlay(&self) -> Result> { - self.get_full_node_overlay(ton_block::MASTERCHAIN_ID, ton_block::SHARD_FULL).await + self.get_full_node_overlay(MASTERCHAIN_ID, SHARD_FULL).await } pub async fn get_full_node_overlay(&self, workchain: i32, shard: u64) -> Result> { @@ -1687,27 +1688,31 @@ impl Engine { } #[cfg(feature = "slashing")] - async fn process_validated_block_stats(&self, block_id: &BlockIdExt, signing_nodes: HashSet, created_by: &UInt256) -> Result<()> { + async fn process_validated_block_stats( + &self, + block_id: &BlockIdExt, + signing_nodes: HashSet, + created_by: &UInt256 + ) -> Result<()> { let last_mc_state = self.load_last_applied_mc_state().await?; - let (cur_validator_set, cc_config) = last_mc_state.read_cur_validator_set_and_cc_conf()?; + let (cur_validator_set, _) = + last_mc_state.state()?.read_cur_validator_set_and_cc_conf()?; let shard = block_id.shard(); let cc_seqno = if shard.is_masterchain() { last_mc_state.shard_state_extra()?.validator_info.catchain_seqno } else { last_mc_state.shards()?.calc_shard_cc_seqno(shard)? }; - let (validators, _hash_short) = calc_subset_for_workchain( + let validators = calc_subset_for_workchain_standard( &cur_validator_set, last_mc_state.config_params()?, - &cc_config, - shard.shard_prefix_with_tag(), - shard.workchain_id(), - cc_seqno, - Default::default())?; + &shard, + cc_seqno + )?; let mut nodes = Vec::new(); - for validator in &validators { + for validator in &validators.validators { let signed = signing_nodes.contains(&validator.compute_node_id_short()); let collated = &validator.public_key == created_by; let validated_block_stat_node = ValidatedBlockStatNode { @@ -1806,7 +1811,10 @@ impl Engine { let result = if remp { self.push_message_to_remp(broadcast.message.data).await } else { - self.external_messages().new_message_raw(&broadcast.message.data, self.now()) + self.external_messages().new_message_raw( + &broadcast.message.data, + self.now() + ).map(|_| ()) }; match result { Err(e) => { @@ -1819,8 +1827,13 @@ impl Engine { Ok(_) => { log::debug!( target: EXT_MESSAGES_TRACE_TARGET, - "Processed ext message broadcast {}bytes from {} (added into remp's queue)", - bytes_len, src + "Processed ext message broadcast {}bytes from {}{}", + bytes_len, src, + if remp { + " (added into remp's queue)" + } else { + "" + } ); } } @@ -1887,8 +1900,7 @@ impl Engine { let mut signing_nodes = HashSet::new(); if let Some(commit_signatures) = tbd.top_block_descr().signatures() { commit_signatures.pure_signatures.signatures().iterate_slices(|ref mut _key, ref mut slice| { - use ton_block::Deserializable; - let sign = ton_block::CryptoSignaturePair::construct_from(slice)?; + let sign = CryptoSignaturePair::construct_from(slice)?; signing_nodes.insert(sign.node_id_short.clone()); Ok(true) })?; @@ -2882,7 +2894,7 @@ pub fn init_prometheus_exporter() { .install().expect("Could not create PrometheusRecorder"); } -// TODO: move to ton_types crate +// TODO: move to ever_block crate pub fn now_duration() -> Duration { SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap_or_default() } diff --git a/src/engine_operations.rs b/src/engine_operations.rs index 72d887b6..7d37a0f9 100644 --- a/src/engine_operations.rs +++ b/src/engine_operations.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -56,13 +56,13 @@ use ton_api::{ broadcast::{BlockBroadcast, QueueUpdateBroadcast} }, IntoBoxed }; -use ton_block::{ +use ever_block::{ AccountIdPrefixFull, BlockIdExt, CellsFactory, GlobalCapabilities, Message, OutMsgQueue, ShardIdent, MASTERCHAIN_ID, SHARD_FULL }; #[cfg(feature="workchains")] -use ton_block::{BASE_WORKCHAIN_ID, INVALID_WORKCHAIN_ID}; -use ton_types::{error, fail, KeyId, KeyOption, Result, UInt256}; +use ever_block::{BASE_WORKCHAIN_ID, INVALID_WORKCHAIN_ID}; +use ever_block::{error, fail, KeyId, KeyOption, Result, UInt256}; use validator_session::{BlockHash, SessionId, ValidatorBlockCandidate}; #[async_trait::async_trait] @@ -957,7 +957,7 @@ impl EngineOperations for Engine { self.will_validate() } - fn new_external_message(&self, id: UInt256, message: Arc) -> Result<()> { + fn new_external_message(&self, id: &UInt256, message: Arc) -> Result<()> { if !self.is_validator() { return Ok(()); } @@ -969,7 +969,13 @@ impl EngineOperations for Engine { shard: ShardIdent, finish_time_ms: u64 ) -> Box, UInt256)> + Send + Sync> { - Box::new(self.external_messages().clone().iter(shard, self.now(), finish_time_ms)) + Box::new( + self.external_messages().clone().iter( + shard, + self.now(), + finish_time_ms + ) + ) } fn get_external_messages_len(&self) -> u32 { @@ -1285,7 +1291,7 @@ async fn redirect_external_message( message_data: &[u8] ) -> Result { let message = Arc::new(message); - engine.new_external_message(id.clone(), message.clone())?; + engine.new_external_message(&id, message.clone())?; if let Some(header) = message.ext_in_header() { let res = engine.broadcast_to_public_overlay( &AccountIdPrefixFull::checked_prefix(&header.dst)?, diff --git a/src/engine_traits.rs b/src/engine_traits.rs index cb143730..f0e38300 100644 --- a/src/engine_traits.rs +++ b/src/engine_traits.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,18 +7,18 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::{ - block::BlockStuff, - block_proof::BlockProofStuff, config::TonNodeConfig, internal_db::BlockResult, - engine::EngineFlags, + block::BlockStuff, block_proof::BlockProofStuff, + config::{CollatorConfig, CollatorTestBundlesGeneralConfig, TonNodeConfig}, + engine::{EngineFlags, now_duration}, internal_db::BlockResult, network::{control::ControlServer, full_node_client::FullNodeOverlayClient}, - shard_state::ShardStateStuff, + shard_state::ShardStateStuff, shard_states_keeper::PinnedShardStateGuard, types::top_block_descr::{TopBlockDescrStuff, TopBlockDescrId}, - validator::validator_manager::ValidationStatus, engine::now_duration, shard_states_keeper::PinnedShardStateGuard, + validator::validator_manager::ValidationStatus }; #[cfg(feature = "slashing")] use crate::validator::slashing::ValidatedBlockStat; @@ -38,6 +38,11 @@ use catchain::{ CatchainNode, CatchainOverlay, CatchainOverlayListenerPtr, CatchainOverlayLogReplayListenerPtr }; +use ever_block::{ + error, AccountId, AccountIdPrefixFull, BlockIdExt, CellsFactory, ConfigParams, + Deserializable, KeyId, KeyOption, MASTERCHAIN_ID, Message, OutMsgQueue, Result, + SHARD_FULL, ShardAccount, ShardIdent, UInt256 +}; use std::{collections::HashSet, sync::{Arc, atomic::AtomicU64}}; use storage::{StorageAlloc, block_handle_db::BlockHandle}; #[cfg(feature = "telemetry")] @@ -46,13 +51,7 @@ use ton_api::ton::ton_node::{ RempMessage, RempMessageStatus, RempReceipt, broadcast::{BlockBroadcast, QueueUpdateBroadcast}, }; -use ton_block::{ - AccountIdPrefixFull, BlockIdExt, CellsFactory, ConfigParams, Deserializable, Message, - OutMsgQueue, ShardAccount, ShardIdent, MASTERCHAIN_ID -}; -use ton_types::{error, AccountId, KeyId, KeyOption, Result, UInt256}; use validator_session::{BlockHash, SessionId, ValidatorBlockCandidate}; -use crate::config::{CollatorConfig, CollatorTestBundlesGeneralConfig}; #[cfg(feature = "telemetry")] pub struct EngineTelemetry { @@ -94,7 +93,7 @@ pub trait OverlayOperations : Sync + Send { local: bool, ) -> Result<()>; async fn get_masterchain_overlay(self: Arc) -> Result> { - let overlay_id = self.calc_overlay_id(ton_block::MASTERCHAIN_ID, ton_block::SHARD_FULL)?; + let overlay_id = self.calc_overlay_id(MASTERCHAIN_ID, SHARD_FULL)?; self.get_overlay(&overlay_id.0).await .ok_or_else(|| error!("INTERNAL ERROR: masterchain overlay was not found")) } @@ -603,7 +602,7 @@ pub trait EngineOperations : Sync + Send { } // External messages - fn new_external_message(&self, id: UInt256, message: Arc) -> Result<()> { + fn new_external_message(&self, id: &UInt256, message: Arc) -> Result<()> { unimplemented!() } fn get_external_messages(&self, shard: &ShardIdent) -> Result, UInt256)>> { @@ -964,7 +963,7 @@ pub enum RempDuplicateStatus { /// Message found in queue and already included into valid block /// Parameters: block id; message uid; included message id (may be different from original id, /// since messages with different ids may share the same uid) - Duplicate(ton_block::BlockIdExt, UInt256, UInt256) + Duplicate(BlockIdExt, UInt256, UInt256) } #[async_trait::async_trait] diff --git a/src/error.rs b/src/error.rs index e0d962b0..d13e601d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/ext_messages.rs b/src/ext_messages.rs index 3421afe1..4380e3dc 100644 --- a/src/ext_messages.rs +++ b/src/ext_messages.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -16,8 +16,8 @@ use adnl::common::{add_unbound_object_to_map, add_unbound_object_to_map_with_upd use lockfree::map::Map; use std::sync::{Arc, atomic::{AtomicU64, Ordering, AtomicU32}}; use ton_api::ton::ton_node::{RempMessageStatus, RempMessageLevel}; -use ton_block::{Deserializable, ShardIdent, Message, AccountIdPrefixFull, BlockIdExt}; -use ton_types::{Result, types::UInt256, fail, read_boc}; +use ever_block::{Deserializable, ShardIdent, Message, AccountIdPrefixFull, BlockIdExt}; +use ever_block::{Result, types::UInt256, fail, read_boc}; #[cfg(test)] #[path = "tests/test_ext_messages.rs"] @@ -179,17 +179,16 @@ impl MessagesPool { pub fn new_message_raw(&self, data: &[u8], now: u32) -> Result<()> { let (id, message) = create_ext_message(data)?; let message = Arc::new(message); - - self.new_message(id.clone(), message, now)?; + self.new_message(&id, message, now)?; Ok(()) } - pub fn new_message(&self, id: UInt256, message: Arc, now: u32) -> Result<()> { + pub fn new_message(&self, id: &UInt256, message: Arc, now: u32) -> Result<()> { let timestamp = self.min_timestamp.load(Ordering::Relaxed); if now < timestamp { fail!("now {} is less than minimum {} for {:x}", now, timestamp, id) } - if self.messages.get(&id).is_some() { + if self.messages.get(id).is_some() { return Ok(()); } for timestamp in self.min_timestamp.load(Ordering::Relaxed)..now.saturating_sub(MESSAGE_LIFETIME) { diff --git a/src/external_db/kafka_consumer.rs b/src/external_db/kafka_consumer.rs index 0d3d8c1e..74be7c20 100644 --- a/src/external_db/kafka_consumer.rs +++ b/src/external_db/kafka_consumer.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -19,7 +19,7 @@ use rdkafka::{consumer::Consumer, Message, message::BorrowedMessage}; use std::sync::Arc; use std::time; use stream_cancel::StreamExt as StreamCancelExt; -use ton_types::{Result, UInt256, fail, error}; +use ever_block::{Result, UInt256, fail, error}; pub struct KafkaConsumer { config: KafkaConsumerConfig, diff --git a/src/external_db/kafka_producer.rs b/src/external_db/kafka_producer.rs index ff82cc46..977b8fba 100644 --- a/src/external_db/kafka_producer.rs +++ b/src/external_db/kafka_producer.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -18,7 +18,7 @@ use crate::{ external_db::WriteData, }; use rdkafka::{message::OwnedHeaders, producer::Producer}; -use ton_types::{Result, fail}; +use ever_block::{Result, fail}; const EXTERNAL_MESSAGE_DATA_HEADER_KEY: &str = "external-message-ref"; @@ -164,7 +164,7 @@ impl KafkaProducer { let dir = message_path.parent().ok_or_else(|| NodeError::Other( format!("Could not find parent dir for big message path: {:?}", message_path) ))?; - let _ = std::fs::create_dir_all(dir.clone()); + let _ = std::fs::create_dir_all(dir); let result = std::fs::write(&message_path, &data); match &result { Ok(_) => log::warn!( diff --git a/src/external_db/mod.rs b/src/external_db/mod.rs index 1bd65088..82a7ccc9 100644 --- a/src/external_db/mod.rs +++ b/src/external_db/mod.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -17,8 +17,8 @@ use crate::{ }; use processor::Processor; use std::sync::Arc; -use ton_block::BlockIdExt; -use ton_types::{Result, error, fail}; +use ever_block::BlockIdExt; +use ever_block::{Result, error, fail}; mod processor; #[cfg(feature = "external_db")] diff --git a/src/external_db/processor.rs b/src/external_db/processor.rs index 3e9eb097..d3f2b1a1 100644 --- a/src/external_db/processor.rs +++ b/src/external_db/processor.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -16,28 +16,28 @@ use crate::{ error::NodeError, external_db::WriteData, shard_state::ShardStateStuff }; +use ever_block::{ + fail, Account, AccountBlock, AccountId, Block, BlockIdExt, BlockProcessingStatus, BlockProof, + BuilderData, Cell, DepthBalanceInfo, Deserializable, HashmapAugType, HashmapIterator, + HashmapType, Message, MessageProcessingStatus, MsgAddressInt, MsgAddrStd, Result, + Serializable, ShardAccount, SliceData, Transaction, TransactionProcessingStatus, UInt256, + write_boc +}; +use ever_block_json::{ + AccountSerializationSet, block_order, BlockSerializationSetFH, db_serialize_account, + db_serialize_block, db_serialize_block_proof, db_serialize_deleted_account, + db_serialize_message, db_serialize_remp_status, db_serialize_transaction, + DeletedAccountSerializationSet, MessageSerializationSet, TransactionSerializationSet, + u64_to_string +}; use std::{ collections::{hash_set::HashSet, BTreeMap, HashMap}, convert::TryInto, time::{SystemTime, UNIX_EPOCH}, sync::{Arc, atomic::{AtomicU64, Ordering}}, }; -use ton_block::{ - Account, AccountBlock, Block, BlockIdExt, - BlockProcessingStatus, BlockProof, Deserializable, - HashmapAugType, Message, MessageProcessingStatus, - Serializable, ShardAccount, Transaction, TransactionProcessingStatus, - MsgAddressInt, MsgAddrStd, DepthBalanceInfo, -}; -use ton_types::{ - write_boc, - types::UInt256, HashmapIterator, - AccountId, Cell, Result, SliceData, HashmapType, - fail, BuilderData, -}; use ton_api::ton::ton_node::RempReceipt; use serde::Serialize; -use serde_json::{Map, Value}; lazy_static::lazy_static!( static ref ACCOUNT_NONE_HASH: UInt256 = Account::default().serialize().unwrap().repr_hash(); @@ -179,7 +179,7 @@ impl Processor { block_id: UInt256, tr_chain_order: &str, block_root_for_proof: Option<&Cell>, - messages: &mut HashMap>, + messages: &mut HashMap> ) -> Result<()> { if let Some(message_cell) = transaction.in_msg_cell() { let message = Message::construct_from_cell(message_cell.clone())?; @@ -196,7 +196,7 @@ impl Processor { } else { messages.remove(&message_id) .unwrap_or_else(|| { - let mut doc = Map::with_capacity(2); + let mut doc = serde_json::Map::with_capacity(2); doc.insert("id".into(), message_id.as_hex_string().into()); doc }) @@ -204,7 +204,7 @@ impl Processor { doc.insert( "dst_chain_order".into(), - format!("{}{}", tr_chain_order, ton_block_json::u64_to_string(0)).into()); + format!("{}{}", tr_chain_order, u64_to_string(0)).into()); messages.insert(message_id, doc); }; @@ -225,7 +225,7 @@ impl Processor { // messages are ordered by created_lt doc.insert( "src_chain_order".into(), - format!("{}{}", tr_chain_order, ton_block_json::u64_to_string(index)).into()); + format!("{}{}", tr_chain_order, u64_to_string(index)).into()); index += 1; messages.insert(message_id, doc); @@ -241,13 +241,13 @@ impl Processor { block_root_for_proof: Option<&Cell>, block_id: UInt256, transaction_now: Option, - ) -> Result> { + ) -> Result> { let boc = write_boc(&message_cell)?; let proof = block_root_for_proof .map(|cell| write_boc(&message.prepare_proof(true, cell)?)) .transpose()?; - let set = ton_block_json::MessageSerializationSet { + let set = MessageSerializationSet { message, id: message_cell.repr_hash(), block_id: Some(block_id.clone()), @@ -257,7 +257,7 @@ impl Processor { proof, transaction_now, // affects ExtIn messages only }; - let doc = ton_block_json::db_serialize_message("id", &set)?; + let doc = db_serialize_message("id", &set)?; Ok(doc) } @@ -268,14 +268,14 @@ impl Processor { block_id: UInt256, workchain_id: i32, add_proof: bool, - ) -> Result> { + ) -> Result> { let boc = write_boc(&tr_cell).unwrap(); let proof = if add_proof { Some(write_boc(&transaction.prepare_proof(&block_root)?)?) } else { None }; - let set = ton_block_json::TransactionSerializationSet { + let set = TransactionSerializationSet { transaction, id: tr_cell.repr_hash(), status: TransactionProcessingStatus::Finalized, @@ -285,7 +285,7 @@ impl Processor { proof, ..Default::default() }; - let doc = ton_block_json::db_serialize_transaction("id", &set)?; + let doc = db_serialize_transaction("id", &set)?; Ok(doc) } @@ -326,7 +326,7 @@ impl Processor { Some(id) => id, None => fail!("Account without id in external db processor") }; - let set = ton_block_json::AccountSerializationSet { + let set = AccountSerializationSet { account, prev_code_hash, proof: None, @@ -336,7 +336,7 @@ impl Processor { }; let partition_key = Self::calc_account_partition_key(sharding_depth, account_id.clone())?; - let mut doc = ton_block_json::db_serialize_account("id", &set)?; + let mut doc = db_serialize_account("id", &set)?; if let Some(last_trans_chain_order) = last_trans_chain_order { doc.insert("last_trans_chain_order".to_owned(), last_trans_chain_order.into()); } @@ -356,19 +356,19 @@ impl Processor { last_trans_lt: Option, ) -> Result { let partition_key = Self::calc_account_partition_key(sharding_depth, account_id.clone())?; - let set = ton_block_json::DeletedAccountSerializationSet { + let set = DeletedAccountSerializationSet { account_id, workchain_id, prev_code_hash, ..Default::default() }; - let mut doc = ton_block_json::db_serialize_deleted_account("id", &set)?; + let mut doc = db_serialize_deleted_account("id", &set)?; if let Some(last_trans_chain_order) = last_trans_chain_order { doc.insert("last_trans_chain_order".to_owned(), last_trans_chain_order.into()); } if let Some(lt) = last_trans_lt { - doc.insert("last_trans_lt".to_owned(), ton_block_json::u64_to_string(lt).into()); + doc.insert("last_trans_lt".to_owned(), u64_to_string(lt).into()); } Ok(DbRecord::Account( doc["id"].to_string(), @@ -384,14 +384,14 @@ impl Processor { file_hash: &UInt256, block_order: String, ) -> Result { - let set = ton_block_json::BlockSerializationSetFH { + let set = BlockSerializationSetFH { block, id: &block_root.repr_hash(), status: BlockProcessingStatus::Finalized, boc, file_hash: Some(file_hash), }; - let mut doc = ton_block_json::db_serialize_block("id", set)?; + let mut doc = db_serialize_block("id", set)?; doc.insert("chain_order".to_owned(), block_order.into()); Ok(DbRecord::Block( doc["id"].to_string(), @@ -431,7 +431,7 @@ impl Processor { partition_key: Option, block_order: String, ) -> Result { - let mut doc = ton_block_json::db_serialize_block_proof("id", proof)?; + let mut doc = db_serialize_block_proof("id", proof)?; doc.insert("chain_order".to_owned(), block_order.into()); Ok(DbRecord::BlockProof( doc["id"].to_string(), @@ -457,7 +457,7 @@ impl Processor { block.id(), e); let root = std::path::Path::new(&self.bad_blocks_storage); let name = block.id().to_string(); - let _ = std::fs::create_dir_all(root.clone()); + let _ = std::fs::create_dir_all(root); match std::fs::write(root.join(std::path::Path::new(&name)), block.data()) { Ok(_) => log::error!( "Bad block {}, saved into {}", @@ -499,7 +499,7 @@ impl Processor { let block_root = block_stuff.root_cell().clone(); let block_extra = block.read_extra()?; let block_boc = if process_block || process_raw_block { Some(block_stuff.data().to_vec()) } else { None }; - let block_order = ton_block_json::block_order(&block, mc_seq_no)?; + let block_order = block_order(&block, mc_seq_no)?; let workchain_id = block.read_info()?.shard().workchain_id(); let shard_accounts = state.map(|s| s.state()?.read_accounts()).transpose()?; let accounts_sharding_depth = self.writers.write_account.sharding_depth(); @@ -525,7 +525,7 @@ impl Processor { // Accounts, transactions and messages if process_account || process_transaction || process_message { - // Prepare sorted ton_block transactions and addresses of changed accounts + // Prepare sorted ever_block transactions and addresses of changed accounts let mut changed_acc = HashSet::new(); let mut deleted_acc = HashSet::new(); let mut acc_last_trans_chain_order = HashMap::new(); @@ -559,14 +559,14 @@ impl Processor { log::trace!("TIME: preliminary prepare {} transactions {}ms; {}", tr_count, now.elapsed().as_millis(), block_id); - // Iterate ton_block transactions to: + // Iterate ever_block transactions to: // - prepare messages and transactions for external db // - prepare last_trans_chain_order for accounts let now = std::time::Instant::now(); let mut index = 0; let mut messages = Default::default(); for (_, (cell, transaction)) in transactions.into_iter() { - let tr_chain_order = format!("{}{}", block_order, ton_block_json::u64_to_string(index as u64)); + let tr_chain_order = format!("{}{}", block_order, u64_to_string(index as u64)); if process_message { Self::prepare_messages_from_transaction( @@ -913,7 +913,7 @@ impl ExternalDb for Processor { status: &RempReceipt, signature: &[u8] ) -> Result<()> { - //let value = ton_block_json::db_serialize_remp_status(status, signature)?; + //let value = db_serialize_remp_status(status, signature)?; // self.remp_statuses_sender.send(( // format!("{:x}", id), // format!("{:#}", serde_json::json!(value)) @@ -924,7 +924,7 @@ impl ExternalDb for Processor { let key = format!("{:x}", id); let val = format!("{:#}", - serde_json::json!(ton_block_json::db_serialize_remp_status(status, signature)?)); + serde_json::json!(db_serialize_remp_status(status, signature)?)); self.writers.write_remp_statuses.write_data(key, val, None, None).await?; Ok(()) } diff --git a/src/external_db/stub_producer.rs b/src/external_db/stub_producer.rs index 8b8d7401..8f2374f1 100644 --- a/src/external_db/stub_producer.rs +++ b/src/external_db/stub_producer.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,13 +7,13 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::external_db::WriteData; -use ton_types::Result; +use ever_block::Result; #[derive(Clone)] pub struct StubProducer { diff --git a/src/external_db/tests/test.rs b/src/external_db/tests/test.rs index 92d37328..92397dcc 100644 --- a/src/external_db/tests/test.rs +++ b/src/external_db/tests/test.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -20,8 +20,8 @@ use crate::collator_test_bundle::create_engine_telemetry; use super::*; use std::sync::atomic::{AtomicUsize, Ordering}; -use ton_block::{HashmapAugType, OutMsg, AccountBlock}; -use ton_types::HashmapType; +use ever_block::{HashmapAugType, OutMsg, AccountBlock}; +use ever_block::HashmapType; #[derive(Clone)] struct TestWriter { diff --git a/src/full_node/apply_block.rs b/src/full_node/apply_block.rs index 0130674e..4eff05f2 100644 --- a/src/full_node/apply_block.rs +++ b/src/full_node/apply_block.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -17,8 +17,8 @@ use crate::{ }; use std::{ops::Deref, sync::Arc}; use storage::block_handle_db::BlockHandle; -use ton_types::{error, fail, Result}; -use ton_block::{BlockIdExt, MerkleProof, Deserializable, Serializable}; +use ever_block::{error, fail, Result}; +use ever_block::{BlockIdExt, MerkleProof, Deserializable, Serializable}; pub const MAX_RECURSION_DEPTH: u32 = UNREGISTERED_CHAIN_MAX_LEN * 2; diff --git a/src/full_node/counters.rs b/src/full_node/counters.rs index 7893394a..3b8d16f8 100644 --- a/src/full_node/counters.rs +++ b/src/full_node/counters.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -16,7 +16,7 @@ use std::{ time::{SystemTime, UNIX_EPOCH}, sync::atomic::{AtomicU32, Ordering}, }; -use ton_types::{fail, Result}; +use ever_block::{fail, Result}; const CLEAR_STAT_INTERVAL_BLOCKS: u32 = 10_000; const MAX_TPS_PERIOD_SEC: u64 = 3600; diff --git a/src/full_node/mod.rs b/src/full_node/mod.rs index fd9e5e69..f8aef198 100644 --- a/src/full_node/mod.rs +++ b/src/full_node/mod.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/full_node/remp_client.rs b/src/full_node/remp_client.rs index bc1da532..65a61e86 100644 --- a/src/full_node/remp_client.rs +++ b/src/full_node/remp_client.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2023-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -37,14 +37,14 @@ use ton_api::{ IntoBoxed, ton::ton_node::{RempMessage, RempMessageLevel, RempMessageStatus, RempReceipt} }; -use ton_block::{ +use ever_block::{ Message, ShardIdent, FutureSplitMerge, ShardAccount, BlockIdExt, ValidatorDescr, MASTERCHAIN_ID, HashmapAugType }; -use ton_executor::{ +use ever_executor::{ BlockchainConfig, OrdinaryTransactionExecutor, TransactionExecutor, ExecuteParams, }; -use ton_types::{error, fail, AccountId, base64_encode, KeyId, Result, UInt256}; +use ever_block::{error, fail, AccountId, base64_encode, KeyId, Result, UInt256}; const HANGED_MESSAGE_TIMEOUT_MS: u64 = 20_000; const TIME_BEFORE_DIE_MS: u64 = 100_000; diff --git a/src/full_node/shard_client.rs b/src/full_node/shard_client.rs index 45339198..3d80ff8f 100644 --- a/src/full_node/shard_client.rs +++ b/src/full_node/shard_client.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -22,12 +22,12 @@ use crate::{ use crate::validator::validator_utils::calc_subset_for_workchain_standard; use std::{sync::Arc, mem::drop, time::Duration}; -use ton_block::{ +use ever_block::{ BlockIdExt, BlockSignaturesPure, CryptoSignaturePair, CryptoSignature, GlobalCapabilities, ProofChain, MerkleProof, Deserializable, Block, Serializable, BASE_WORKCHAIN_ID, }; -use ton_types::{Result, fail, error}; +use ever_block::{Result, fail, error}; use ton_api::ton::ton_node::broadcast::{BlockBroadcast, QueueUpdateBroadcast}; pub fn start_masterchain_client( @@ -698,11 +698,11 @@ fn validate_brodcast( ))); } - // extract signatures - build ton_block::BlockSignaturesPure + // extract signatures - build ever_block::BlockSignaturesPure let blk_pure_signatures = broadcast.extract_signatures()?; // Check signatures - let checked_data = ton_block::Block::build_data_for_sign( + let checked_data = ever_block::Block::build_data_for_sign( &block_id.root_hash, &block_id.file_hash ); diff --git a/src/full_node/state_helper.rs b/src/full_node/state_helper.rs index d4647393..9fd55066 100644 --- a/src/full_node/state_helper.rs +++ b/src/full_node/state_helper.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,15 +7,15 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::network::full_node_client::FullNodeOverlayClient; use std::{sync::Arc, collections::HashSet}; -use ton_block::BlockIdExt; -use ton_types::{error, fail, KeyId, Result}; +use ever_block::BlockIdExt; +use ever_block::{error, fail, KeyId, Result}; pub async fn download_persistent_state( id: &BlockIdExt, diff --git a/src/full_node/telemetry.rs b/src/full_node/telemetry.rs index 99d9ec6c..39f2b8b7 100644 --- a/src/full_node/telemetry.rs +++ b/src/full_node/telemetry.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -18,8 +18,8 @@ use std::{ cmp::{max, min}, collections::HashMap, }; -use ton_block::BlockIdExt; -use ton_types::UInt256; +use ever_block::BlockIdExt; +use ever_block::UInt256; const MAX_DOWNLOAD_BLOCK_ATTEMPTS: usize = 10; const TOP_BLOCK_BCAST_TTL_SEC: usize = 30; diff --git a/src/internal_db/mod.rs b/src/internal_db/mod.rs index 15c39c92..5d53faa1 100644 --- a/src/internal_db/mod.rs +++ b/src/internal_db/mod.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -35,8 +35,8 @@ use storage::{ use storage::shardstate_db_async::{self, AllowStateGcResolver, ShardStateDb}; #[cfg(feature = "telemetry")] use storage::StorageTelemetry; -use ton_block::{Block, BlockIdExt, INVALID_WORKCHAIN_ID, CellsFactory}; -use ton_types::{ +use ever_block::{Block, BlockIdExt, INVALID_WORKCHAIN_ID, CellsFactory}; +use ever_block::{ error, fail, Result, UInt256, Cell, BocWriterStack, MAX_SAFE_DEPTH, DoneCellsStorage, }; diff --git a/src/internal_db/restore.rs b/src/internal_db/restore.rs index bf2b932a..a3a3116f 100644 --- a/src/internal_db/restore.rs +++ b/src/internal_db/restore.rs @@ -6,8 +6,8 @@ use crate::{ }, shard_state::ShardStateStuff, }; -use ton_block::{BlockIdExt, MASTERCHAIN_ID}; -use ton_types::{error, fail, Result, Cell}; +use ever_block::{BlockIdExt, MASTERCHAIN_ID}; +use ever_block::{error, fail, Result, Cell}; use storage::{ traits::Serializable, dynamic_boc_rc_db::BROKEN_CELL_BEACON_FILE, shardstate_db_async::SsNotificationCallback, diff --git a/src/internal_db/state_gc_resolver.rs b/src/internal_db/state_gc_resolver.rs index 3055c627..4eaea6f2 100644 --- a/src/internal_db/state_gc_resolver.rs +++ b/src/internal_db/state_gc_resolver.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,13 +7,13 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use storage::shardstate_db_async::AllowStateGcResolver; -use ton_block::{BlockIdExt, ShardIdent}; -use ton_types::{Result, fail}; +use ever_block::{BlockIdExt, ShardIdent}; +use ever_block::{Result, fail}; use adnl::common::add_unbound_object_to_map_with_update; use crate::engine_traits::EngineOperations; use std::{ diff --git a/src/internal_db/update.rs b/src/internal_db/update.rs index 22223ae5..20163d1b 100644 --- a/src/internal_db/update.rs +++ b/src/internal_db/update.rs @@ -3,7 +3,7 @@ use crate::internal_db::{ restore::check_db }; use std::sync::atomic::AtomicBool; -use ton_types::{Result, fail}; +use ever_block::{Result, fail}; pub async fn update( mut db: InternalDb, diff --git a/src/jaeger.rs b/src/jaeger.rs index 48c428c3..cf421539 100644 --- a/src/jaeger.rs +++ b/src/jaeger.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -18,8 +18,8 @@ use rustracing_jaeger::{ use std::net::ToSocketAddrs; use std::{collections::HashMap, env, sync::Mutex}; -use ton_types::fail; -use ton_types::types::*; +use ever_block::fail; +use ever_block::types::*; #[allow(dead_code)] enum LogKind { diff --git a/src/lib.rs b/src/lib.rs index 7750060c..b8a5b330 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -20,7 +20,6 @@ pub mod error; pub mod engine; pub mod engine_traits; pub mod engine_operations; -pub mod ext_messages; pub mod full_node; pub mod internal_db; pub mod macros; @@ -33,6 +32,8 @@ pub mod validating_utils; pub mod validator; pub mod shard_states_keeper; +pub mod ext_messages; + mod shard_blocks; include!("../common/src/info.rs"); diff --git a/src/macros.rs b/src/macros.rs index f843bc93..b60cc152 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/main.rs b/src/main.rs index 1cd7fad6..a7446b5c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -20,7 +20,6 @@ mod engine; mod engine_traits; mod engine_operations; mod error; -mod ext_messages; #[cfg(feature = "external_db")] mod external_db; mod full_node; @@ -35,6 +34,8 @@ mod validating_utils; mod validator; mod shard_states_keeper; +mod ext_messages; + mod shard_blocks; #[cfg(feature = "tracing")] @@ -66,9 +67,7 @@ use std::{ use std::{ fs::File, io::Write, mem::{self, MaybeUninit}, sync::atomic::{AtomicIsize, AtomicUsize} }; -#[cfg(feature = "external_db")] -use ton_types::error; -use ton_types::Result; +use ever_block::Result; #[cfg(test)] #[path = "tests/test_helper.rs"] @@ -281,31 +280,29 @@ fn get_version() -> String { fn get_build_info() -> String { let mut info = String::new(); info += &format!( - "TON Node, version {}\n\ + "EVER Node, version {}\n\ Rust: {}\n\ TON NODE git commit: {}\n\ ADNL git commit: {}\n\ - TON_BLOCK git commit: {}\n\ - TON_BLOCK_JSON git commit: {}\n\ - TON_EXECUTOR git commit: {}\n\ + EVER_BLOCK git commit: {}\n\ + EVER_BLOCK_JSON git commit: {}\n\ + EVER_EXECUTOR git commit: {}\n\ TON_TL git commit: {}\n\ - TON_TYPES git commit: {}\n\ - TON_VM git commit: {}\n", + EVER_VM git commit: {}\n", std::option_env!("CARGO_PKG_VERSION").unwrap_or(NOT_SET_LABEL), std::option_env!("BUILD_RUST_VERSION").unwrap_or(NOT_SET_LABEL), std::option_env!("BUILD_GIT_COMMIT").unwrap_or(NOT_SET_LABEL), adnl::build_commit().unwrap_or(NOT_SET_LABEL), - ton_block::build_commit().unwrap_or(NOT_SET_LABEL), - ton_block_json::build_commit().unwrap_or(NOT_SET_LABEL), - ton_executor::build_commit().unwrap_or(NOT_SET_LABEL), + ever_block::build_commit().unwrap_or(NOT_SET_LABEL), + ever_block_json::build_commit().unwrap_or(NOT_SET_LABEL), + ever_executor::build_commit().unwrap_or(NOT_SET_LABEL), ton_api::build_commit().unwrap_or(NOT_SET_LABEL), - ton_types::build_commit().unwrap_or(NOT_SET_LABEL), - ton_vm::build_commit().unwrap_or(NOT_SET_LABEL), + ever_vm::build_commit().unwrap_or(NOT_SET_LABEL), ); #[cfg(feature = "slashing")] { info += &format!( - "TON_ABI git commit: {}\n", - ton_abi::build_commit().unwrap_or(NOT_SET_LABEL) + "EVER_ABI git commit: {}\n", + ever_abi::build_commit().unwrap_or(NOT_SET_LABEL) ); } info @@ -316,7 +313,9 @@ fn start_external_db(config: &TonNodeConfig) -> Result>> let control_id = config.control_server()?.map(|config| *config.server_id()); Ok(vec!( external_db::create_external_db( - config.external_db_config().ok_or_else(|| error!("Can't load external database config!"))?, + config.external_db_config().ok_or_else( + || ever_block::error!("Can't load external database config!") + )?, config.front_workchain_ids(), control_id, )? diff --git a/src/network/catchain_client.rs b/src/network/catchain_client.rs index 52abd1a0..a73dbc39 100644 --- a/src/network/catchain_client.rs +++ b/src/network/catchain_client.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -38,7 +38,7 @@ use ton_api::{ }; #[cfg(feature = "telemetry")] use ton_api::tag_from_boxed_object; -use ton_types::{error, fail, KeyId, KeyOption, Result}; +use ever_block::{error, fail, KeyId, KeyOption, Result}; declare_counted!( pub struct CatchainClient { diff --git a/src/network/control.rs b/src/network/control.rs index fefff6fd..23bdf761 100644 --- a/src/network/control.rs +++ b/src/network/control.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -47,12 +47,12 @@ use ton_api::{ } } }; -use ton_block::{ - BlockIdExt, MsgAddressInt, Serializable, ShardIdent, MASTERCHAIN_ID, MerkleProof, - ShardAccount +use ever_block::{ + error, fail, AccountId, BlockIdExt, BlsKeyOption, Ed25519KeyOption, KeyId, MASTERCHAIN_ID, + MerkleProof, MsgAddressInt, read_single_root_boc, Result, Serializable, ShardIdent, + ShardAccount, UInt256 }; -use ton_block_json::serialize_config_param; -use ton_types::{error, fail, KeyId, read_single_root_boc, Result, UInt256, AccountId}; +use ever_block_json::serialize_config_param; pub struct ControlServer { adnl: AdnlServer @@ -638,7 +638,7 @@ impl ControlQuerySubscriber { }; let query = match query.downcast::() { Ok(_params) => return QueryResult::consume( - self.process_generate_keypair(ton_types::Ed25519KeyOption::KEY_TYPE).await?, + self.process_generate_keypair(Ed25519KeyOption::KEY_TYPE).await?, #[cfg(feature = "telemetry")] None ), @@ -646,7 +646,7 @@ impl ControlQuerySubscriber { }; let query = match query.downcast::() { Ok(_params) => return QueryResult::consume( - self.process_generate_keypair(ton_types::BlsKeyOption::KEY_TYPE).await?, + self.process_generate_keypair(BlsKeyOption::KEY_TYPE).await?, #[cfg(feature = "telemetry")] None ), diff --git a/src/network/full_node_client.rs b/src/network/full_node_client.rs index 91222345..1c63d664 100644 --- a/src/network/full_node_client.rs +++ b/src/network/full_node_client.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -59,8 +59,8 @@ use ton_api::{ }; #[cfg(feature = "telemetry")] use ton_api::{tag_from_boxed_type, tag_from_bare_type}; -use ton_block::BlockIdExt; -use ton_types::{error, fail, KeyId, Result}; +use ever_block::BlockIdExt; +use ever_block::{error, fail, KeyId, Result}; #[async_trait::async_trait] pub trait FullNodeOverlayClient : Sync + Send { diff --git a/src/network/full_node_service.rs b/src/network/full_node_service.rs index 3187e140..5498bf01 100644 --- a/src/network/full_node_service.rs +++ b/src/network/full_node_service.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -44,8 +44,8 @@ use ton_api::{ } } }; -use ton_block::BlockIdExt; -use ton_types::{fail, Result}; +use ever_block::BlockIdExt; +use ever_block::{fail, Result}; // max part size for partially transmitted data like archives and states const PART_MAX_SIZE: usize = 1 << 21; diff --git a/src/network/mod.rs b/src/network/mod.rs index 8910ddbc..a6c43ad1 100644 --- a/src/network/mod.rs +++ b/src/network/mod.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/network/neighbours.rs b/src/network/neighbours.rs index c9455463..9f638a68 100644 --- a/src/network/neighbours.rs +++ b/src/network/neighbours.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -25,7 +25,7 @@ use std::{ use ton_api::ton::{TLObject, rpc::ton_node::GetCapabilities, ton_node::Capabilities}; #[cfg(feature = "telemetry")] use ton_api::tag_from_boxed_type; -use ton_types::{error, fail, KeyId, KeyOption, Result}; +use ever_block::{error, fail, KeyId, KeyOption, Result}; #[derive(Debug)] pub struct Neighbour { diff --git a/src/network/node_network.rs b/src/network/node_network.rs index 7d953873..8355ad36 100644 --- a/src/network/node_network.rs +++ b/src/network/node_network.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -49,7 +49,7 @@ use std::{ sync::{Arc, atomic::{AtomicI32, AtomicU64, AtomicBool, Ordering}}, time::{Duration, SystemTime} }; -use ton_types::{error, fail, KeyId, KeyOption, Result, UInt256}; +use ever_block::{error, fail, KeyId, KeyOption, Result, UInt256}; use ton_api::{ IntoBoxed, serialize_boxed, ton::ton_node::broadcast::ConnectivityCheckBroadcast }; diff --git a/src/network/remp.rs b/src/network/remp.rs index 72d2ba63..e2c6fa94 100644 --- a/src/network/remp.rs +++ b/src/network/remp.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -29,8 +29,8 @@ use ton_api::{ #[cfg(feature = "telemetry")] use ton_api::tag_from_boxed_type; -use ton_block::BlockIdExt; -use ton_types::{error, fail, KeyId, Result, UInt256}; +use ever_block::BlockIdExt; +use ever_block::{error, fail, KeyId, Result, UInt256}; #[async_trait::async_trait] pub trait RempMessagesSubscriber: Sync + Send { diff --git a/src/network/telemetry.rs b/src/network/telemetry.rs index d6f624c1..233493da 100644 --- a/src/network/telemetry.rs +++ b/src/network/telemetry.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/network/tests/test_remp.rs b/src/network/tests/test_remp.rs index 583bb046..175b0c45 100644 --- a/src/network/tests/test_remp.rs +++ b/src/network/tests/test_remp.rs @@ -12,7 +12,7 @@ use ton_api::{ IntoBoxed, ton::ton_node::{RempReceipt, RempCombinedReceipt, RempMessageStatus}, }; -use ton_types::{fail, KeyId, Result, UInt256}; +use ever_block::{fail, KeyId, Result, UInt256}; const KEY_TAG: usize = 0; @@ -96,7 +96,7 @@ async fn test_remp_client_compact_protocol() -> Result<()> { status: RempMessageStatus::TonNode_RempRejected( ton_api::ton::ton_node::rempmessagestatus::RempRejected { level: 2.try_into()?, - block_id: ton_block::BlockIdExt::default(), + block_id: ever_block::BlockIdExt::default(), error: "Error test".to_owned(), } ), diff --git a/src/network/tests/test_telemetry.rs b/src/network/tests/test_telemetry.rs index 624e4a8b..52d35e54 100644 --- a/src/network/tests/test_telemetry.rs +++ b/src/network/tests/test_telemetry.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/rng/mod.rs b/src/rng/mod.rs index d72142f0..f9375e04 100644 --- a/src/rng/mod.rs +++ b/src/rng/mod.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/rng/random.rs b/src/rng/random.rs index 73a733a4..3bea021c 100644 --- a/src/rng/random.rs +++ b/src/rng/random.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/rng/tests/test_random.rs b/src/rng/tests/test_random.rs index 07488eaf..353317ed 100644 --- a/src/rng/tests/test_random.rs +++ b/src/rng/tests/test_random.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/shard_blocks.rs b/src/shard_blocks.rs index f4f48c09..00ae4f6b 100644 --- a/src/shard_blocks.rs +++ b/src/shard_blocks.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -24,8 +24,8 @@ use adnl::{ Counter } }; -use ton_block::{BlockIdExt, TopBlockDescr, Deserializable, BlockSignatures}; -use ton_types::{fail, Result}; +use ever_block::{BlockIdExt, TopBlockDescr, Deserializable, BlockSignatures}; +use ever_block::{fail, Result}; use std::{ sync::{Arc, atomic::{AtomicU32, Ordering}}, time::Duration, diff --git a/src/shard_blocks_fast_finality.rs b/src/shard_blocks_fast_finality.rs deleted file mode 100644 index d6b5afc0..00000000 --- a/src/shard_blocks_fast_finality.rs +++ /dev/null @@ -1,902 +0,0 @@ -/* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. -* -* Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use -* this file except in compliance with the License. -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and -* limitations under the License. -*/ - -use crate::{ - engine::Engine, engine_traits::{EngineAlloc, EngineOperations}, shard_state::ShardStateStuff, - types::top_block_descr::{ - Mode as TbdMode, TopBlockDescrStuff, TopBlockDescrGroup, TopBlockDescrId - } -}; -#[cfg(feature = "telemetry")] -use crate::engine_traits::EngineTelemetry; - -use adnl::{declare_counted, common::{CountedObject, Counter}}; -use rand::Rng; -use std::{ - collections::{hash_map::{self, HashMap}, BTreeMap}, ops::Deref, - sync::{Arc, atomic::{AtomicU32, Ordering}}, time::{Duration, Instant} -}; -use ton_block::{ - BlockIdExt, TopBlockDescr, Deserializable, BlockSignatures, ShardIdent, CollatorRange -}; -use ton_types::{fail, Result}; - -pub enum StoreAction { - Save(TopBlockDescrId, Arc), - Remove(TopBlockDescrId) -} - -pub enum ShardBlockProcessingResult { - Duplication, - MightBeAdded(Arc) -} - -declare_counted!( - struct ShardBlocksPoolItem { - top_block: Arc, - /// Flag used for async retain. Should not be used outside of `update_shard_blocks` - is_valid: bool - } -); - -impl std::fmt::Debug for ShardBlocksPoolItem { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("ShardBlocksPoolItem") - .field("top_block_id", self.top_block.proof_for()) - .field("is_own", &self.top_block.is_own()) - .field("ref_shard_blocks", self.top_block.ref_shard_blocks()) - .finish() - } -} - -pub struct ShardBlocksPool { - last_mc_seq_no: AtomicU32, - shard_blocks: tokio::sync::RwLock>, - storage_sender: Option>, - is_fake: bool, -} - -struct ShardBlocksPoolItems { - items: BTreeMap, - /// Flag used for async retain. Should not be used outside of `update_shard_blocks` - is_valid: bool, -} - -impl Default for ShardBlocksPoolItems { - fn default() -> Self { - Self { - items: Default::default(), - is_valid: true, - } - } -} - -impl ShardBlocksPool { - - pub fn new( - shard_blocks: HashMap, - last_mc_seqno: u32, - is_fake: bool, - #[cfg(feature = "telemetry")] - telemetry: &Arc, - allocated: &Arc - ) -> Result<(Self, tokio::sync::mpsc::UnboundedReceiver)> { - let mut tsbs = HashMap::::new(); - for (key, val) in shard_blocks { - let seqno = val.proof_for().seq_no; - let item = ShardBlocksPoolItem { - top_block: Arc::new(val), - is_valid: true, - counter: allocated.top_blocks.clone().into(), - }; - - match tsbs.entry(key.group) { - hash_map::Entry::Occupied(mut entry) => { - entry.get_mut().items.insert(seqno, item); - } - hash_map::Entry::Vacant(entry) => { - entry.insert(ShardBlocksPoolItems { - items: [(seqno, item)].into(), - is_valid: true, - }); - } - }; - - #[cfg(feature = "telemetry")] - telemetry.top_blocks.update(allocated.top_blocks.load(Ordering::Relaxed)); - } - - let (sender, receiver) = tokio::sync::mpsc::unbounded_channel(); - let ret = ShardBlocksPool { - last_mc_seq_no: AtomicU32::new(last_mc_seqno), - shard_blocks: tokio::sync::RwLock::new(tsbs), - storage_sender: Some(sender.clone()), - is_fake, - }; - Ok((ret, receiver)) - } - - pub async fn process_shard_block_raw( - &self, - id: &BlockIdExt, - cc_seqno: u32, - data: Vec, - own: bool, - check_only: bool, - engine: &dyn EngineOperations, - ) -> Result { - let factory = || { - let tbd = if self.is_fake { - TopBlockDescr::with_id_and_signatures(id.clone(), BlockSignatures::default()) - } else { - TopBlockDescr::construct_from_bytes(&data)? - }; - Ok(Arc::new(TopBlockDescrStuff::new(tbd, &id, self.is_fake, own)?)) - }; - self.process_shard_block(id, cc_seqno, factory, check_only, engine).await - } - - pub async fn process_shard_block( - &self, - id: &BlockIdExt, - cc_seqno: u32, - mut factory: impl FnMut() -> Result>, - check_only: bool, - engine: &dyn EngineOperations, - ) -> Result { - let tbds_id = TopBlockDescrGroup::new(id.shard().clone(), cc_seqno).with_seqno(id.seq_no); - - log::trace!("process_shard_block cc_seqno: {} id: {}", cc_seqno, id); - - // TODO: do more work for broadcasts VS aquire mutex twise - let tbds = factory()?; - if !self.is_fake { - tbds.validate(&engine.load_last_applied_mc_state().await?)?; - } - - let mut shard_blocks = self.shard_blocks.write().await; - - // check for duplication - if let Some(prev) = shard_blocks.get(&tbds_id.group) { - if let Some(existing) = prev.items.get(&id.seq_no) { - log::trace!("process_shard_block duplication cc_seqno: {} id: {} prev: {}", - cc_seqno, id, existing.top_block.proof_for()); - return Ok(ShardBlockProcessingResult::Duplication); - } - } - - if check_only { - log::trace!("process_shard_block check only id: {}", id); - } else { - let counter = &engine.engine_allocated().top_blocks; - - shard_blocks - .entry(tbds_id.group.clone()) - .or_default() - .items - .insert(id.seq_no, ShardBlocksPoolItem { - top_block: tbds.clone(), - is_valid: true, - counter: counter.clone().into(), - }); - - #[cfg(feature = "telemetry")] - engine.engine_telemetry().top_blocks.update( - counter.load(Ordering::Relaxed) - ); - - log::trace!("process_shard_block added cc_seqno: {} id: {}", cc_seqno, id); - } - - drop(shard_blocks); - - self.send_to_storage(StoreAction::Save(tbds_id.clone(), tbds.clone())); - Ok(ShardBlockProcessingResult::MightBeAdded(tbds)) - } - - pub async fn get_shard_blocks( - &self, - last_mc_state: &Arc, - engine: &dyn EngineOperations, - only_own: bool, - mut actual_last_mc_seqno: Option<&mut u32>, - ) -> Result>> { - let last_mc_seq_no = last_mc_state.block_id().seq_no; - - let mut check_mc_seqno_updated = || { - let mc_seqno = self.last_mc_seq_no.load(Ordering::Acquire); - if let Some(actual_last_mc_seqno) = actual_last_mc_seqno.as_mut() { - **actual_last_mc_seqno = mc_seqno; - } - - if last_mc_seq_no != mc_seqno { - log::debug!( - "get_shard_blocks: Given last_mc_seq_no {} is not actual {}", - last_mc_seq_no, mc_seqno - ); - fail!("Given last_mc_seq_no {} is not actual {}", last_mc_seq_no, mc_seqno); - } - - Result::Ok(()) - }; - - check_mc_seqno_updated()?; - - // Read shards from state - let (shards_info, ctx) = prepare_resolver_ctx(last_mc_state)?; - - let shard_blocks = self.shard_blocks.read().await; - let now = Instant::now(); - - let mut returned_list = string_builder::Builder::default(); - - let mut blocks = Vec::new(); - if only_own { - for shard in shards_info.shards.keys() { - // Compute the required shard group - let Some((group, info)) = shards_info.get_group_and_info(shard) else { - continue; - }; - - // Add all own broadcasts from this group - if let Some(group) = shard_blocks.get(&group) { - for ShardBlocksPoolItem { top_block, .. } in group.items.values() { - let seqno = top_block.proof_for().seq_no(); - if top_block.is_own() && seqno >= info.min_seqno { - blocks.push(top_block.clone()); - returned_list.append(format!("\n{shard} {seqno}")); - } - } - } - } - } else { - // NOTE: include `StreamExt` locally to prevent some possible collisions with `next` - use futures::StreamExt; - - let mut futures = futures::stream::FuturesUnordered::new(); - - // Start resolving shards in parallel - for shard in shards_info.shards.keys() { - // Return only the latest valid top block description - futures.push(ctx.resolve_shard_blocks(shard, engine, &shards_info, &shard_blocks)); - } - - // Collect resolver results into a blocks list (in any order) - while let Some(res) = futures.next().await { - if let Some(tbds) = res { - let shard = tbds.proof_for().shard(); - let seqno = tbds.proof_for().seq_no(); - returned_list.append(format!("\n{shard} {seqno}")); - blocks.push(tbds); - } - } - } - - drop(shard_blocks); - - const TIME_THRESHOLD: Duration = Duration::from_millis(1); - if now.elapsed() > TIME_THRESHOLD { - log::warn!( - "get_shard_blocks lock took longer than expected: {}ms / 1ms", - now.elapsed().as_millis(), - ); - } - - if !only_own { - check_mc_seqno_updated()? - } - - log::trace!("get_shard_blocks last_mc_seq_no {} returned: {}", - last_mc_seq_no, returned_list.string().unwrap_or_default()); - Ok(blocks) - } - - pub async fn update_shard_blocks(&self, last_mc_state: &Arc) -> Result<()> { - // Read shards from state - let (shards_info, _) = prepare_resolver_ctx(last_mc_state)?; - - let mut removed_list = string_builder::Builder::default(); - - let mut shard_hashes = self.shard_blocks.write().await; - let now = Instant::now(); - - // Mark all invalid items - for (group, value) in shard_hashes.iter_mut() { - // Find an existing info - let existing = shards_info - .get_group_and_info(&group.shard_ident) - .filter(|(expected_group, _)| expected_group == group); - - let retain = match existing { - Some((_, info)) => { - // Mark all invalid top block descriptions in a valid group - for (&seqno, item) in value.items.iter_mut() { - let is_new = seqno >= info.min_seqno; - let is_valid = is_new && item.top_block.validate(last_mc_state).is_ok(); - - if is_new { - // Yield after each `validate`, because it takes ~100mcs - tokio::task::yield_now().await; - } - - if !is_valid { - let id = group.clone().with_seqno(seqno); - self.send_to_storage(StoreAction::Remove(id)); - removed_list.append(format!("\n{} {}", seqno, group)); - } - - item.is_valid = is_valid; - } - - !value.items.is_empty() - } - None => { - // Remove all items - for &seqno in value.items.keys() { - let id = group.clone().with_seqno(seqno); - self.send_to_storage(StoreAction::Remove(id)); - removed_list.append(format!("\n{} {}", seqno, group)); - } - false - } - }; - value.is_valid = retain; - } - - // Remove all marked values - shard_hashes.retain(|_, value| { - if value.is_valid { - value.items.retain(|_, item| item.is_valid); - !value.items.is_empty() - } else { - false - } - }); - - drop(shard_hashes); - - const TIME_THRESHOLD: Duration = Duration::from_millis(1); - if now.elapsed() > TIME_THRESHOLD { - log::warn!( - "update_shard_blocks lock took longer than expected: {}ms / 1ms", - now.elapsed().as_millis(), - ); - } - - self.last_mc_seq_no.store(last_mc_state.block_id().seq_no(), Ordering::Release); - - log::trace!("update_shard_blocks last_mc_state {} removed: {}", - last_mc_state.block_id(), removed_list.string().unwrap_or_default()); - Ok(()) - } - - fn send_to_storage(&self, action: StoreAction) { - if let Some(storage_sender) = self.storage_sender.as_ref() { - match storage_sender.send(action) { - Ok(_) => log::trace!("ShardBlocksPool::send_to_storage: sent"), - Err(err) => log::error!("ShardBlocksPool::send_to_storage: can't send {}", err), - } - } - } -} - -pub fn resend_top_shard_blocks_worker(engine: Arc) { - tokio::spawn(async move { - engine.acquire_stop(Engine::MASK_SERVICE_TOP_SHARDBLOCKS_SENDER); - loop { - if engine.check_stop() { - break - } - // 2..3 seconds - let delay = rand::thread_rng().gen_range(2000, 3000); - futures_timer::Delay::new(Duration::from_millis(delay)).await; - match resend_top_shard_blocks(engine.deref()).await { - Ok(_) => log::trace!("resend_top_shard_blocks: ok"), - Err(e) => log::error!("resend_top_shard_blocks: {:?}", e) - } - } - engine.release_stop(Engine::MASK_SERVICE_TOP_SHARDBLOCKS_SENDER); - }); -} - -async fn resend_top_shard_blocks(engine: &dyn EngineOperations) -> Result<()> { - let mc_state = engine.load_last_applied_mc_state().await?; - - let tsbs = engine.get_own_shard_blocks(&mc_state).await?; - for tsb in tsbs { - engine.send_top_shard_block_description(tsb, 0, true).await?; - } - Ok(()) -} - -pub fn save_top_shard_blocks_worker( - engine: Arc, - mut receiver: tokio::sync::mpsc::UnboundedReceiver -) { - tokio::spawn(async move { - while let Some(action) = receiver.recv().await { - match action { - StoreAction::Save(id, tsb) => { - match engine.save_top_shard_block(&id, &tsb) { - Ok(_) => log::trace!("save_top_shard_block {}: OK", id), - Err(e) => log::error!("save_top_shard_block {}: {:?}", id, e), - } - } - StoreAction::Remove(id) => { - match engine.remove_top_shard_block(&id) { - Ok(_) => log::trace!("remove_top_shard_block {}: OK", id), - Err(e) => log::error!("remove_top_shard_block {}: {:?}", id, e), - } - } - } - } - }); -} - -fn prepare_resolver_ctx( - mc_state: &Arc, -) -> Result<(TopBlockResolverShardsInfo, TopBlockResolverContext)> { - let shard_hashes = mc_state.shard_state_extra()?.shards(); - - let mut shards = HashMap::new(); - let resolved_block_ids = dashmap::DashMap::default(); - shard_hashes.iterate_shards(|key, value| { - let min_seqno = value.seq_no + 1; - - if value.before_split { - // Add shard info for each shard after split - let (left, right) = key.split()?; - - let (left_collators, right_collators) = value - .collators - .map(|c| (Some(c.next), c.next2)) - .unwrap_or_default(); - - // Same info for both shards - let mut info = TopBlockResolverShardInfo { - cc_seqno: value.next_catchain_seqno, - min_seqno, - collators: left_collators, - }; - shards.insert(left, info.clone()); - - info.collators = right_collators; - shards.insert(right, info); - } else if value.before_merge { - // Add only one info for the merged shards - - let key = key.merge()?; - match shards.entry(key) { - hash_map::Entry::Occupied(mut entry) => { - let merged = entry.get_mut(); - merged.min_seqno = std::cmp::max(merged.min_seqno, min_seqno); - merged.cc_seqno = std::cmp::max(merged.cc_seqno, value.next_catchain_seqno) + 1; - } - hash_map::Entry::Vacant(entry) => { - entry.insert(TopBlockResolverShardInfo { - cc_seqno: value.next_catchain_seqno, - min_seqno, - collators: value.collators.map(|c| c.next), - }); - } - } - } else { - shards.insert(key.clone(), TopBlockResolverShardInfo { - cc_seqno: value.next_catchain_seqno, - min_seqno, - collators: value.collators.map(|c| if min_seqno <= c.current.finish { - c.current - } else { - c.next - }), - }); - } - - // Applied blocks are resolved by definition - resolved_block_ids.insert((key, value.seq_no), BlockIdPart { - root_hash: value.root_hash, - file_hash: value.file_hash, - }); - - Ok(true) - })?; - - let mc_state = mc_state.clone(); - let shards = TopBlockResolverShardsInfo { mc_state, shards }; - let ctx = TopBlockResolverContext { - resolved_block_ids, - block_flags: Default::default(), - }; - - Ok((shards, ctx)) -} - -struct TopBlockResolverContext { - resolved_block_ids: dashmap::DashMap<(ShardIdent, u32), BlockIdPart>, - block_flags: dashmap::DashMap> -} - -impl TopBlockResolverContext { - async fn resolve_shard_blocks( - &self, - shard_ident: &ShardIdent, - engine: &dyn EngineOperations, - shards: &TopBlockResolverShardsInfo, - shard_blocks: &HashMap, - ) -> Option> { - enum NextCandidate { - Leaf, - Found(Arc), - } - - // Prepare an iterator over possible candidates - let (group, info) = shards.get_group_and_info(shard_ident)?; - let top_blocks = shard_blocks.get(&group)?; - let mut tbds_candidates = top_blocks - .items - .range(info.allowed_range()?) - .map(|(_, value)| value); - - let mut result = None; - let mut stack = Vec::::new(); - - // Iterate for each possible candidate, starting from the earliest - 'candidates: while let Some(candidate) = tbds_candidates.next() { - let candidate = &candidate.top_block; - - // Fast path for already applied candidates - match self.is_resolved(candidate.proof_for()) { - // Found the exact resolved block - Some(true) => { - result = Some(candidate); - continue; - } - // Fork happened - None => break, - // Block hasn't beed resolved yet - _ => {}, - } - - // Check candidate with the latest masterchain state - if !shards.prevalidate(&candidate) { - break; - } - - // Yield after each `prevalidate`, because it takes ~100mcs - tokio::task::yield_now().await; - - // Reset and reuse the stack of graph nodes - stack.clear(); - // Start DFS traversing from the candidate itself - stack.push(candidate.clone().into()); - - while let Some(iter) = stack.last_mut() { - // Get next reference from the deepest (current) graph node - let Some(ref_block_id) = iter.next() else { - // Mark as applied if there are no more references to check. - // (The oldest candidates will be marked first) - match self.mark_as_resolved(iter.tbds.proof_for().clone()) { - Ok(()) => { - log::trace!("Resolved {}", iter.tbds.proof_for()); - stack.pop(); - continue; - }, - Err(e) => { - log::error!("Failed to mark block as resolved: {e:?}"); - break 'candidates; - } - } - }; - - // Don't visit already applied tbds - match self.is_resolved(ref_block_id) { - // Found the exact resolved block - Some(true) => continue, - // Fork happened - None => break 'candidates, - // Block hasn't beed resolved yet - _ => {} - } - - // Search for the top block description - let tbds = 'tbds: { - let group_and_info = shards.get_group_and_info(ref_block_id.shard()); - - // Handle old blocks case - if group_and_info.is_none() && shards.is_old_block(ref_block_id) { - break 'tbds if matches!( - self.get_block_flags(engine, ref_block_id), - Some(flags) if flags.is_applied - ) { - Some(NextCandidate::Leaf) - } else { - log::debug!("Old block not found while resolving {ref_block_id}"); - None - } - } - - group_and_info.and_then(|(group, info)| { - let is_old_block = ref_block_id.seq_no < info.min_seqno; - - if !matches!( - self.get_block_flags(engine, ref_block_id), - Some(flags) if - is_old_block && flags.is_applied || - !is_old_block && flags.has_state - ) { - log::debug!("Block not found while resolving {ref_block_id}, is_old: {is_old_block}"); - return None; - } - - if is_old_block { - // Referenced block id is not later than last applied block for this shard - return Some(NextCandidate::Leaf); - } - - // Search for the specified top block description - let candidate = shard_blocks - .get(&group)? - .items - .get(&ref_block_id.seq_no) - .map(|group| NextCandidate::Found(group.top_block.clone())); - - if candidate.is_none() { - log::debug!("Block candidate not found while resolving {ref_block_id}"); - } - - candidate - }) - }; - - match tbds { - // We found a new node to resolve - Some(NextCandidate::Found(tbds)) => { - if shards.prevalidate(&tbds) { - // Yield after each `prevalidate`, because it takes ~100mcs - tokio::task::yield_now().await; - - stack.push(tbds.into()) - } else { - // We found an invalid candidate - break 'candidates; - } - } - // We found a reference which was already applied - Some(NextCandidate::Leaf) => { - match self.mark_as_resolved(ref_block_id.clone()) { - Ok(()) => continue, - Err(e) => { - log::error!("Failed to mark block as resolved: {e:?}"); - break 'candidates; - } - } - }, - // We found a candidate which has a hole in its references tree - None => { - break 'candidates; - } - } - } - - // We can get to this point only if there were no holes in the references tree - result = Some(candidate); - } - - // Return the latest known candidate - result.cloned() - } - - fn is_resolved(&self, block_id: &BlockIdExt) -> Option { - match self.resolved_block_ids.get(&(block_id.shard().clone(), block_id.seq_no())) { - Some(part) => { - if part.root_hash == block_id.root_hash && part.file_hash == block_id.file_hash { - // There is a resolved block with the exact full id - Some(true) - } else { - // There is some block but with a different id. It indicates that there were - // some forks in shards and we must not include such block. - log::warn!( - "Fork detected while resolving {block_id}, old hash: {}", - part.root_hash, - ); - None - } - }, - None => Some(false), - } - } - - fn mark_as_resolved(&self, block_id: BlockIdExt) -> Result<()> { - use dashmap::mapref::entry::Entry; - match self.resolved_block_ids.entry((block_id.shard_id, block_id.seq_no)) { - Entry::Vacant(entry) => { - entry.insert(BlockIdPart { - root_hash: block_id.root_hash, - file_hash: block_id.file_hash, - }); - Ok(()) - } - Entry::Occupied(entry) => { - let existing = entry.get(); - if existing.root_hash == block_id.root_hash && existing.file_hash == block_id.file_hash { - Ok(()) - } else { - fail!( - "Trying to replace an already resolved block {} with a different block {} for {}: {}", - existing.root_hash, - block_id.root_hash, - entry.key().0, - entry.key().1, - ) - } - } - } - } - - fn get_block_flags( - &self, - engine: &dyn EngineOperations, - block_id: &BlockIdExt, - ) -> Option { - use dashmap::mapref::entry::Entry; - - if let Some(flags) = self.block_flags.get(block_id) { - return *flags; - } - - // NOTE: "error" state must also be cached - let flags = engine.load_block_handle(block_id).ok().flatten().map(|handle| { - BlockFlags { - is_applied: handle.is_applied(), - has_state: handle.has_state(), - } - }); - - match self.block_flags.entry(block_id.clone()) { - // Ignore new value if previous already exists - Entry::Occupied(entry) => *entry.get(), - // Cache flags if it is the first time we fetched them - Entry::Vacant(entry) => *entry.insert(flags), - } - } -} - -// TODO: wrap flags in BlockMeta to ensure atomicity across multiple flags. -#[derive(Copy, Clone)] -struct BlockFlags { - is_applied: bool, - has_state: bool, -} - -struct BlockIdPart { - root_hash: ton_types::UInt256, - file_hash: ton_types::UInt256, -} - -struct TopBlockResolverShardsInfo { - mc_state: Arc, - shards: HashMap, -} - -impl TopBlockResolverShardsInfo { - fn get_group_and_info( - &self, - shard_ident: &ton_block::ShardIdent, - ) -> Option<(TopBlockDescrGroup, &TopBlockResolverShardInfo)> { - let info = self.shards.get(shard_ident)?; - - let group = TopBlockDescrGroup { - shard_ident: shard_ident.clone(), - cc_seqno: info.cc_seqno, - }; - - Some((group, info)) - } - - fn is_old_block(&self, block_id: &BlockIdExt) -> bool { - for (shard, info) in &self.shards { - if block_id.shard().intersect_with(shard) && block_id.seq_no < info.min_seqno { - return true; - } - } - false - } - - fn prevalidate(&self, tbds: &TopBlockDescrStuff) -> bool { - // NOTE: `prevalidate` is more strict than `validate` - let mut res_flags = 0; - match tbds.prevalidate( - self.mc_state.block_id(), - &self.mc_state, - TbdMode::FAIL_NEW | TbdMode::FAIL_TOO_NEW, - &mut res_flags, - ) { - Ok(_) => true, - // We found an invalid candidate - Err(e) => { - log::debug!( - "ShardTopBlockDescr for {} skipped: res_flags = {}, error: {}", - tbds.proof_for(), res_flags, e - ); - false - } - } - } -} - -#[derive(Debug, Clone)] -struct TopBlockResolverShardInfo { - cc_seqno: u32, - min_seqno: u32, - collators: Option, -} - -impl TopBlockResolverShardInfo { - fn allowed_range(&self) -> Option { - let max_seqno = self - .collators - .as_ref() - .map(|collators| collators.finish); - - if matches!(max_seqno, Some(max_seqno) if max_seqno < self.min_seqno) { - None - } else { - Some(AllowedRange { - min_seqno: self.min_seqno, - max_seqno, - }) - } - } -} - -#[derive(Copy, Clone)] -struct AllowedRange { - min_seqno: u32, - max_seqno: Option, -} - -impl std::ops::RangeBounds for AllowedRange { - fn start_bound(&self) -> std::ops::Bound<&u32> { - std::ops::Bound::Included(&self.min_seqno) - } - - fn end_bound(&self) -> std::ops::Bound<&u32> { - match &self.max_seqno { - Some(max_seqno) => std::ops::Bound::Included(max_seqno), - None => std::ops::Bound::Unbounded, - } - } -} - -/// A lending iterator around shared ids list. -struct RefShardBlocksIter { - tbds: Arc, - index: usize, -} - -impl RefShardBlocksIter { - fn next(&mut self) -> Option<&BlockIdExt> { - let result = self.tbds.ref_shard_blocks().get(self.index); - self.index += result.is_some() as usize; - result.map(|(id, _)| id) - } -} - -impl From> for RefShardBlocksIter { - fn from(tbds: Arc) -> Self { - Self { - tbds, - index: 0, - } - } -} diff --git a/src/shard_state.rs b/src/shard_state.rs index 7f2ee01c..14b704bf 100644 --- a/src/shard_state.rs +++ b/src/shard_state.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -19,13 +19,13 @@ use adnl::{declare_counted, common::{CountedObject, Counter}}; #[cfg(feature = "telemetry")] use std::sync::atomic::Ordering; use std::{io::Write, sync::Arc}; -use ton_block::{ +use ever_block::{ BlockIdExt, ShardAccount, ShardIdent, ShardStateUnsplit, ShardStateSplit, Serializable, Deserializable, ConfigParams, McShardRecord, McStateExtra, ShardDescr, ShardHashes, HashmapAugType, InRefValue, BinTree, BinTreeType, WorkchainDescr, OutMsgQueue, ProcessedInfo, MerkleProof, }; -use ton_types::{ +use ever_block::{ AccountId, Cell, SliceData, error, fail, Result, UInt256, BocWriter, BocReader, read_single_root_boc, }; diff --git a/src/shard_states_keeper.rs b/src/shard_states_keeper.rs index 2cc62f73..fc58b967 100644 --- a/src/shard_states_keeper.rs +++ b/src/shard_states_keeper.rs @@ -9,8 +9,8 @@ use storage::{ block_handle_db::BlockHandle, shardstate_db_async::AllowStateGcResolver, shardstate_db_async::SsNotificationCallback, error::StorageError, }; -use ton_block::{BlockIdExt, ShardIdent}; -use ton_types::{fail, error, Result, UInt256, BocReader, Cell}; +use ever_block::{BlockIdExt, ShardIdent}; +use ever_block::{fail, error, Result, UInt256, BocReader, Cell}; use adnl::common::add_unbound_object_to_map_with_update; use std::{ ops::Deref, sync::Arc, time::{Duration, Instant} }; diff --git a/src/sync.rs b/src/sync.rs index 0818d0d4..fa6c3f59 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -25,8 +25,8 @@ use storage::{ }, block_handle_db::BlockHandle }; -use ton_block::{BlockIdExt, BASE_WORKCHAIN_ID}; -use ton_types::{error, fail, KeyId, Result}; +use ever_block::{BlockIdExt, BASE_WORKCHAIN_ID}; +use ever_block::{error, fail, KeyId, Result}; //type PreDownloadTask = (u32, JoinHandle>>); diff --git a/src/tests/test_block.rs b/src/tests/test_block.rs index 0e563e69..81b7fafe 100644 --- a/src/tests/test_block.rs +++ b/src/tests/test_block.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,13 +7,12 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use super::*; -use ton_block::ShardIdent; -use ton_types::read_single_root_boc; +use ever_block::{Block, BlockIdExt, BlockProof, MerkleProof, read_single_root_boc, ShardIdent}; #[test] fn test_block_stuff_deserialize() { @@ -36,8 +35,8 @@ fn test_block_stuff_deserialize() { fn test_construct_and_check_prev_stuff_master() { let proof_data = std::fs::read("src/tests/static/test_master_block_proof_shuffle/proof__3236531").unwrap(); let proof_root = read_single_root_boc(&proof_data).unwrap(); - let proof = ton_block::BlockProof::construct_from_cell(proof_root.clone()).unwrap(); - let merkle_proof = ton_block::MerkleProof::construct_from_cell(proof.root.clone()).unwrap(); + let proof = BlockProof::construct_from_cell(proof_root.clone()).unwrap(); + let merkle_proof = MerkleProof::construct_from_cell(proof.root.clone()).unwrap(); let block_virt_root = merkle_proof.proof.clone().virtualize(1); let (id, stuff) = construct_and_check_prev_stuff( @@ -46,7 +45,7 @@ fn test_construct_and_check_prev_stuff_master() { true ).unwrap(); - let virt_block = ton_block::Block::construct_from_cell(block_virt_root.clone()).unwrap(); + let virt_block = Block::construct_from_cell(block_virt_root.clone()).unwrap(); let virt_block_info = virt_block.read_info().unwrap(); let prev = virt_block_info.read_prev_ids().unwrap(); let prev = &prev[0]; @@ -72,8 +71,8 @@ fn test_construct_and_check_prev_stuff_master() { fn test_construct_and_check_prev_stuff_shard() { let proof_data = std::fs::read("src/tests/static/test_shard_block_proof/proof_4377262").unwrap(); let proof_root = read_single_root_boc(&proof_data).unwrap(); - let proof = ton_block::BlockProof::construct_from_cell(proof_root.clone()).unwrap(); - let merkle_proof = ton_block::MerkleProof::construct_from_cell(proof.root.clone()).unwrap(); + let proof = BlockProof::construct_from_cell(proof_root.clone()).unwrap(); + let merkle_proof = MerkleProof::construct_from_cell(proof.root.clone()).unwrap(); let block_virt_root = merkle_proof.proof.clone().virtualize(1); let (id, stuff) = construct_and_check_prev_stuff( @@ -82,12 +81,12 @@ fn test_construct_and_check_prev_stuff_shard() { true ).unwrap(); - let virt_block = ton_block::Block::construct_from_cell(block_virt_root.clone()).unwrap(); + let virt_block = Block::construct_from_cell(block_virt_root.clone()).unwrap(); let virt_block_info = virt_block.read_info().unwrap(); let prev = virt_block_info.read_prev_ids().unwrap(); let prev = &prev[0]; - let prev_block_id = ton_block::BlockIdExt { + let prev_block_id = BlockIdExt { shard_id: virt_block_info.shard().clone(), seq_no: prev.seq_no, root_hash: prev.root_hash.clone(), @@ -96,7 +95,7 @@ fn test_construct_and_check_prev_stuff_shard() { let mc_block_id = virt_block_info.read_master_ref().unwrap().unwrap().master; let mc_block_id = BlockIdExt { - shard_id: ton_block::ShardIdent::masterchain(), + shard_id: ShardIdent::masterchain(), seq_no: mc_block_id.seq_no, root_hash: mc_block_id.root_hash.clone(), file_hash: mc_block_id.file_hash.clone() diff --git a/src/tests/test_block_proof.rs b/src/tests/test_block_proof.rs index 8b4dea9f..967cc89e 100644 --- a/src/tests/test_block_proof.rs +++ b/src/tests/test_block_proof.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/tests/test_control.rs b/src/tests/test_control.rs index 4b9d8bca..b4692acf 100644 --- a/src/tests/test_control.rs +++ b/src/tests/test_control.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -50,11 +50,11 @@ use ton_api::{ }; use ton_api::ton::raw::ShardAccountMeta; use ton_api::ton::rpc::raw::{GetAccountMetaByBlock, GetShardAccountMeta}; -use ton_block::{ +use ever_block::{ Account, BlockIdExt, ConfigParamEnum, ConfigParams, Deserializable, generate_test_account_by_init_code_hash, Message, Serializable, ShardIdent }; -use ton_types::{ +use ever_block::{ error, fail, base64_encode, Ed25519KeyOption, KeyId, KeyOption, Result, UInt256 }; diff --git a/src/tests/test_engine.rs b/src/tests/test_engine.rs index 08acb9c7..34f72c35 100644 --- a/src/tests/test_engine.rs +++ b/src/tests/test_engine.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -16,7 +16,7 @@ use crate::{ test_helper::{configure_ip, get_config, init_test} }; use std::{fs::remove_dir_all, sync::Arc, time::Duration}; -use ton_types::Result; +use ever_block::Result; fn start_node( rt: &tokio::runtime::Runtime, diff --git a/src/tests/test_ext_messages.rs b/src/tests/test_ext_messages.rs index 2169d9cb..37674845 100644 --- a/src/tests/test_ext_messages.rs +++ b/src/tests/test_ext_messages.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,18 +7,20 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ -use std::{cmp::min, time::SystemTime}; +use std::cmp::min; +use std::time::SystemTime; +use crate::engine::now_duration; use super::*; -use ton_block::{ +use ever_block::{ InternalMessageHeader, ExternalInboundMessageHeader, Serializable, GetRepresentationHash, MsgAddressInt, MsgAddressExt, }; -use ton_types::{ +use ever_block::{ BuilderData, IBitstring, CellType, SliceData, write_boc, BocWriter }; @@ -199,15 +201,15 @@ fn test_messages_pool() { // create 3 messages, 2 of them are with the prefix 0x01 and one with 0x22 let m = create_external_message(1, vec!(1)); let id1 = m.hash().unwrap(); - mp.new_message(id1.clone(), m, 0).unwrap(); + mp.new_message(&id1, m, 0).unwrap(); let m = create_external_message(1, vec!(2)); let id2 = m.hash().unwrap(); - mp.new_message(id2.clone(), m, 0).unwrap(); + mp.new_message(&id2, m, 0).unwrap(); let m = create_external_message(0x22, vec!(2)); let id3 = m.hash().unwrap(); - mp.new_message(id3.clone(), m.clone(), 0).unwrap(); + mp.new_message(&id3, m.clone(), 0).unwrap(); // get messages for shard 0x8000_0000_0000_0000 - total 3 messages let m1 = mp.get_messages(&ShardIdent::with_tagged_prefix(0, 0x8000_0000_0000_0000).unwrap(), 1).unwrap(); @@ -265,11 +267,16 @@ fn test_messages_pool() { async fn check_messages(mp: Arc, shard: ShardIdent, now: u32, expected_count: usize) -> Result<()> { - for _ in 0..20 { + let iterations = 20; + for i in 1..=iterations { // let count = mp.clone().get_messages(&shard, now).unwrap().len(); - let count = mp.clone().iter(shard.clone(), now, u64::MAX).count(); + let count = mp.clone().iter( + shard.clone(), + now, + u64::MAX + ).count(); if count != expected_count { - fail!("Wrong messages count for shard {} expected {}, got {}", shard, expected_count, count) + fail!("Wrong messages count for shard {} expected {}, got {} on {} iteration", shard, expected_count, count, i) } } Ok(()) @@ -280,15 +287,16 @@ async fn test_ext_messages_multi_threads() { const M: usize = 50; let mp = Arc::new(MessagesPool::new(0, None)); - // for dst_shard in [0, 0x40, 0x80, 0xC0] { - for dst_shard in [0, 0x20, 0x40, 0x60, 0x80, 0xA0, 0xC0, 0xE0] { + // total 8 prefixes by 50 messages in each + for prefix in [0, 0x20, 0x40, 0x60, 0x80, 0xA0, 0xC0, 0xE0] { for i in 0..M { - let m = create_external_message(dst_shard, vec!(i as u8)); + let m = create_external_message(prefix, vec!(i as u8)); let id = m.hash().unwrap(); - mp.new_message(id.clone(), m, 0).unwrap(); + mp.new_message(&id, m, 0).unwrap(); } } + // get messages to destination shards let tests = [ [(0x20, M*2), (0x60, M*2), (0xA0, M*2), (0xE0, M*2)], [(0x40, M*4), (0xA0, M*2), (0xD0, M), (0xF0, M)], @@ -315,11 +323,11 @@ fn test_external_messages_maximum_queue_length() { for i in 0..maximum_queue_length { let m = create_external_message(0, vec!(i as u8)); let id = m.hash().unwrap(); - mp.new_message(id.clone(), m, 0).unwrap(); + mp.new_message(&id, m, 0).unwrap(); } let m = create_external_message(0, vec!(maximum_queue_length as u8)); let id = m.hash().unwrap(); - mp.new_message(id.clone(), m, 0).unwrap_err(); + mp.new_message(&id, m, 0).unwrap_err(); } #[test] @@ -333,17 +341,20 @@ fn test_external_messages_big_load() { for j in 0..rate_per_second { let m = create_external_message(0, (i * rate_per_second + j).to_be_bytes().to_vec()); let id = m.hash().unwrap(); - mp.new_message(id.clone(), m, now + i).unwrap(); + mp.new_message(&id, m, now + i).unwrap(); } } - let n = SystemTime::now(); - let now = now_duration().as_millis() as u64; - let count = mp.clone().iter( - ShardIdent::full(0), - (now / 1000) as u32, - now + limit - ).take(100).count(); - let n = n.elapsed().unwrap().as_millis(); + let (count, n) = { + let n = SystemTime::now(); + let now = now_duration().as_millis() as u64; + let count = mp.clone().iter( + ShardIdent::full(0), + (now / 1000) as u32, + now + limit + ).take(100).count(); + let n = n.elapsed().unwrap().as_millis(); + (count, n) + }; println!("count = {}, time = {:?}", count, n); assert_eq!(0, count); assert!((n as u64) < limit * 3); diff --git a/src/tests/test_helper.rs b/src/tests/test_helper.rs index 27515f91..5f02e442 100644 --- a/src/tests/test_helper.rs +++ b/src/tests/test_helper.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -33,12 +33,17 @@ use crate::validator::{ #[cfg(feature = "telemetry")] use crate::{collator_test_bundle::create_engine_telemetry, engine_traits::EngineTelemetry}; +use ever_block::{ + error, Account, BlkMasterInfo, Block, BlockIdExt, BlockSignatures, Cell, ConfigParam0, + ConfigParam34, ConfigParamEnum, ConfigParams, Deserializable, HashmapAugType, InMsgDescr, + InRefValue, McStateExtra, Message, OutMsgDescr, Serializable, ShardAccount, + ShardAccountBlocks, ShardIdent, ShardStateUnsplit, Transaction, U15, UInt256, + ValidatorBaseInfo, ValidatorDescr, ValidatorSet, write_boc +}; +use ever_block_json::*; use std::{path::Path, sync::{{Arc, RwLock}, atomic::{AtomicU32, Ordering}}, time::Duration}; use storage::block_handle_db::{BlockHandle, Callback, StoreJob}; use ton_api::ton::ton_node::broadcast::BlockBroadcast; -use ton_block::*; -use ton_block_json::*; -use ton_types::{error, write_boc, Cell, UInt256}; include!("../../common/src/config.rs"); include!("../../common/src/test.rs"); @@ -313,7 +318,7 @@ pub fn gen_master_state( } ss.write_custom(Some(&ms)).unwrap(); let cell = ss.serialize().unwrap(); - let bytes = ton_types::write_boc(&cell).unwrap(); + let bytes = write_boc(&cell).unwrap(); #[cfg(feature = "telemetry")] let telemetry = telemetry.unwrap_or_else(|| create_engine_telemetry()); let allocated = allocated.unwrap_or_else(|| create_engine_allocated()); @@ -362,7 +367,7 @@ pub fn gen_shard_state( ).unwrap(); } let cell = ss.serialize().unwrap(); - let bytes = ton_types::write_boc(&cell).unwrap(); + let bytes = write_boc(&cell).unwrap(); #[cfg(feature = "telemetry")] let telemetry = telemetry.unwrap_or_else(|| create_engine_telemetry()); let allocated = allocated.unwrap_or_else(|| create_engine_allocated()); @@ -571,7 +576,7 @@ impl TestEngine { in_msgs.iterate_with_keys(|key, in_msg| { let msg = in_msg.read_message()?; if msg.is_inbound_external() { - self.ext_messages.new_message(key, Arc::new(msg), self.now())?; + self.ext_messages.new_message(&key, Arc::new(msg), self.now())?; } Ok(true) })?; @@ -742,23 +747,23 @@ impl TestEngine { let state_stuff = self.load_state(block_stuff.id()).await?; std::fs::write( &format!("{}/state_real.txt", res_path), - ton_block_json::debug_state(state_stuff.state()?.clone())? + debug_state(state_stuff.state()?.clone())? )?; std::fs::write( &format!("{}/state_candidate.txt", res_path), - ton_block_json::debug_state(new_state.clone())? + debug_state(new_state.clone())? )?; // std::fs::write( // &format!("{}/{}-state_real.txt", res_path, shard), - // ton_block_json::debug_state(state_stuff.state()?.clone())? + // debug_state(state_stuff.state()?.clone())? //)?; // std::fs::write( // &format!("{}/{}-state_candidate.txt", res_path, shard), - // ton_block_json::debug_state(new_state.clone())? + // debug_state(new_state.clone())? //)?; - // let cell = ton_types::deserialize_tree_of_cells( + // let cell = ever_block::deserialize_tree_of_cells( // &mut std::io::Cursor::new(&block_candidate.data) // )?; // std::fs::write( @@ -1060,7 +1065,7 @@ impl EngineOperations for TestEngine { Some(self.db.load_block_proof(&handle, !id.shard().is_masterchain()).await?) )) } - fn new_external_message(&self, id: UInt256, message: Arc) -> Result<()> { + fn new_external_message(&self, id: &UInt256, message: Arc) -> Result<()> { self.ext_messages.new_message(id, message, self.now()) } fn get_external_messages_iterator( @@ -1068,7 +1073,13 @@ impl EngineOperations for TestEngine { shard: ShardIdent, finish_time_ms: u64 ) -> Box, UInt256)> + Send + Sync> { - Box::new(self.ext_messages.clone().iter(shard, self.now(), finish_time_ms)) + Box::new( + self.ext_messages.clone().iter( + shard, + self.now(), + finish_time_ms + ) + ) } fn complete_external_messages( &self, diff --git a/src/tests/test_internal_db.rs b/src/tests/test_internal_db.rs index 1607ae5f..2499a5c8 100644 --- a/src/tests/test_internal_db.rs +++ b/src/tests/test_internal_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -28,11 +28,11 @@ use std::{future::{self, Future}, ops::Deref, pin::Pin, sync::Arc, time::Duratio use storage::{ block_handle_db::{BlockHandle, Callback}, shardstate_db_async::SsNotificationCallback }; -use ton_block::{ +use ever_block::{ BlockIdExt, ShardIdent, TopBlockDescr, BlockSignatures, ShardStateUnsplit, Serializable }; -use ton_types::{error, fail, Result, sha256_digest_slices, UInt256}; +use ever_block::{error, fail, Result, sha256_digest_slices, UInt256}; use storage::types::BlockMeta; include!("../../common/src/test.rs"); diff --git a/src/tests/test_remp_client.rs b/src/tests/test_remp_client.rs index f4edf0d2..ca60d6ea 100644 --- a/src/tests/test_remp_client.rs +++ b/src/tests/test_remp_client.rs @@ -16,14 +16,14 @@ use storage::{types::BlockMeta, block_handle_db::{BlockHandle, BlockHandleStorag use ton_api::ton::ton_node::{ RempMessage, RempMessageLevel, RempMessageStatus, RempReceipt }; -use ton_block::{ +use ever_block::{ ConfigParams, FutureSplitMerge, ShardHashes, ShardIdent, ShardStateUnsplit, ValidatorDescr, ValidatorSet, SigPubKey, ShardDescr, CatchainConfig, ConfigParamEnum, ConfigParam34, ConfigParam36, BinTree, InRefValue, McStateExtra, Block, BlockExtra, InMsg, McBlockExtra, BlockIdExt, Message, Transaction, ExternalInboundMessageHeader, MsgAddressExt, MsgAddressInt, InMsgDescr, GetRepresentationHash, Serializable, ShardAccount, }; -use ton_types::{ +use ever_block::{ error, fail, AccountId, Ed25519KeyOption, KeyId, Result, SliceData, UInt256 }; diff --git a/src/tests/test_shard_blocks.rs b/src/tests/test_shard_blocks.rs index 86869aa2..6460c990 100644 --- a/src/tests/test_shard_blocks.rs +++ b/src/tests/test_shard_blocks.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -18,8 +18,8 @@ use crate::collator_test_bundle::{create_block_handle_storage, create_engine_all use crate::collator_test_bundle::create_engine_telemetry; use std::{sync::{atomic::{AtomicU32, Ordering}, Arc}, collections::HashSet}; use storage::{block_handle_db::{BlockHandle, BlockHandleStorage}, types::BlockMeta}; -use ton_block::{BlockIdExt, ShardIdent}; -use ton_types::UInt256; +use ever_block::{BlockIdExt, ShardIdent}; +use ever_block::UInt256; struct TestEngine { pub last_applied_mc_block_seqno: AtomicU32, diff --git a/src/tests/test_shard_state.rs b/src/tests/test_shard_state.rs index 474152ce..3419ed5d 100644 --- a/src/tests/test_shard_state.rs +++ b/src/tests/test_shard_state.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -15,7 +15,7 @@ use super::*; use crate::collator_test_bundle::create_engine_allocated; #[cfg(feature = "telemetry")] use crate::collator_test_bundle::create_engine_telemetry; -use ton_block::ShardIdent; +use ever_block::{ShardIdent, write_boc}; #[test] fn test_shard_state_deserilaize() { @@ -30,7 +30,7 @@ fn test_shard_state_deserilaize() { let telemetry = create_engine_telemetry(); let allocated = create_engine_allocated(); let cell = ss.serialize().unwrap(); - let bytes = ton_types::write_boc(&cell).unwrap(); + let bytes = write_boc(&cell).unwrap(); let check = ShardStateStuff::deserialize_zerostate( zero_state_id.clone(), &bytes, @@ -54,7 +54,7 @@ fn test_shard_state_deserilaize() { ss.set_seq_no(1); let cell = ss.serialize().unwrap(); - let bytes = ton_types::write_boc(&cell).unwrap(); + let bytes = write_boc(&cell).unwrap(); let block_id = BlockIdExt { shard_id: ShardIdent::masterchain(), seq_no: 1, diff --git a/src/tests/test_sync.rs b/src/tests/test_sync.rs index 39beafc8..7482f38a 100644 --- a/src/tests/test_sync.rs +++ b/src/tests/test_sync.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/tests/test_telemetry.rs b/src/tests/test_telemetry.rs index 72c3a13f..cacf9793 100644 --- a/src/tests/test_telemetry.rs +++ b/src/tests/test_telemetry.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,13 +7,13 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use super::*; use std::time::Duration; -use ton_block::ShardIdent; +use ever_block::ShardIdent; #[test] pub fn test_fullnode_telemetry() { diff --git a/src/types/accounts.rs b/src/types/accounts.rs index 8df24471..96ab50fe 100644 --- a/src/types/accounts.rs +++ b/src/types/accounts.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,17 +7,17 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use std::sync::{atomic::AtomicU64, Arc}; -use ton_block::{ +use ever_block::{ Account, AccountBlock, Augmentation, CopyleftRewards, Deserializable, HashUpdate, HashmapAugType, LibDescr, Libraries, Serializable, ShardAccount, ShardAccounts, StateInitLib, Transaction, Transactions, }; -use ton_types::{fail, AccountId, Cell, HashmapRemover, Result, UInt256}; +use ever_block::{fail, AccountId, Cell, HashmapRemover, Result, UInt256}; pub struct ShardAccountStuff { account_addr: AccountId, diff --git a/src/types/awaiters_pool.rs b/src/types/awaiters_pool.rs index be9e507f..23c212f5 100644 --- a/src/types/awaiters_pool.rs +++ b/src/types/awaiters_pool.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -18,7 +18,7 @@ use std::{ sync::{Arc, atomic::AtomicBool, atomic::Ordering}, fmt::Display, hash::Hash, cmp::Ord, time::Duration }; -use ton_types::{Result, error}; +use ever_block::{Result, error}; use adnl::{declare_counted, common::{add_counted_object_to_map, CountedObject, Counter}}; #[cfg(test)] diff --git a/src/types/limits.rs b/src/types/limits.rs index 54dc4645..fe296f71 100644 --- a/src/types/limits.rs +++ b/src/types/limits.rs @@ -7,13 +7,13 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use std::{collections::HashSet, cmp::max, sync::Arc}; -use ton_block::{BlockLimits, ParamLimitIndex}; -use ton_types::{Cell, Result, UInt256, UsageTree}; +use ever_block::{BlockLimits, ParamLimitIndex}; +use ever_block::{Cell, Result, UInt256, UsageTree}; pub struct BlockLimitStatus { accounts: u32, diff --git a/src/types/lockfree_cache.rs b/src/types/lockfree_cache.rs index 9d11222e..936b64a6 100644 --- a/src/types/lockfree_cache.rs +++ b/src/types/lockfree_cache.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,11 +7,11 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ -use ton_types::Result; +use ever_block::Result; use adnl::common::{add_unbound_object_to_map_with_update, CountedObject}; use std::{ time::{SystemTime, Duration, UNIX_EPOCH}, diff --git a/src/types/messages.rs b/src/types/messages.rs index 2b24943e..1def827c 100644 --- a/src/types/messages.rs +++ b/src/types/messages.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,18 +7,18 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use std::fmt::{self, Display, Formatter}; -use ton_block::{ +use ever_block::{ GlobalCapabilities, Message, EnqueuedMsg, MsgEnvelope, AccountIdPrefixFull, IntermediateAddress, OutMsgQueueKey, Serializable, Deserializable, Grams, ShardIdent, AddSub, }; -use ton_executor::{BlockchainConfig, CalcMsgFwdFees}; -use ton_types::{error, fail, Result, AccountId, Cell, SliceData, UInt256}; +use ever_executor::{BlockchainConfig, CalcMsgFwdFees}; +use ever_block::{error, fail, Result, AccountId, Cell, SliceData, UInt256}; #[cfg(test)] #[path = "tests/test_messages.rs"] diff --git a/src/types/mod.rs b/src/types/mod.rs index 08d3d9d4..11fd351f 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/types/mpmc_channel.rs b/src/types/mpmc_channel.rs index 874721df..232bd28c 100644 --- a/src/types/mpmc_channel.rs +++ b/src/types/mpmc_channel.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,12 +7,12 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use std::sync::atomic::{AtomicU32, AtomicBool, Ordering}; -use ton_types::{Result, fail}; +use ever_block::{Result, fail}; #[cfg(test)] #[path = "tests/test_mpmc_channel.rs"] diff --git a/src/types/shard_blocks_observer.rs b/src/types/shard_blocks_observer.rs index 02b77858..6c741291 100644 --- a/src/types/shard_blocks_observer.rs +++ b/src/types/shard_blocks_observer.rs @@ -3,8 +3,8 @@ use crate::{ block::BlockStuff, shard_state::ShardHashesStuff, }; -use ton_types::{Result, error}; -use ton_block::{BlockIdExt, SHARD_FULL, ShardIdent, BASE_WORKCHAIN_ID, MASTERCHAIN_ID}; +use ever_block::{Result, error}; +use ever_block::{BlockIdExt, SHARD_FULL, ShardIdent, BASE_WORKCHAIN_ID, MASTERCHAIN_ID}; use std::{collections::HashSet, sync::Arc}; use storage::block_handle_db::BlockHandle; diff --git a/src/types/tests/test_awaiters_pool.rs b/src/types/tests/test_awaiters_pool.rs index b5ec75ee..ac696b91 100644 --- a/src/types/tests/test_awaiters_pool.rs +++ b/src/types/tests/test_awaiters_pool.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -20,7 +20,7 @@ use std::{ time::Duration, sync::{Arc, atomic::{AtomicU32, Ordering}} }; -use ton_types::fail; +use ever_block::fail; async fn op(number: Arc) -> Result { futures_timer::Delay::new(Duration::from_millis(1000)).await; diff --git a/src/types/tests/test_lockfree_cache.rs b/src/types/tests/test_lockfree_cache.rs index 35c5b670..22715985 100644 --- a/src/types/tests/test_lockfree_cache.rs +++ b/src/types/tests/test_lockfree_cache.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/types/tests/test_messages.rs b/src/types/tests/test_messages.rs index b89e60b5..bb3da3e6 100644 --- a/src/types/tests/test_messages.rs +++ b/src/types/tests/test_messages.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,13 +7,13 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use super::*; use std::str::FromStr; -use ton_block::{ +use ever_block::{ CurrencyCollection, InternalMessageHeader, MsgAddressInt }; diff --git a/src/types/top_block_descr.rs b/src/types/top_block_descr.rs index b4c4312a..8b076dd9 100644 --- a/src/types/top_block_descr.rs +++ b/src/types/top_block_descr.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -19,24 +19,20 @@ use crate::{ }; use crate::validator::validator_utils::calc_subset_for_workchain_standard; -use bitflags::bitflags; +use ever_block::{ + error, fail, AddSub, Block, BlockInfo, BlockIdExt, BlockSignatures, BocReader, BocWriter, + Cell, CopyleftRewards, CurrencyCollection, Deserializable, HashmapAugType, McShardRecord, + MerkleProof, Result, Serializable, ShardIdent, TopBlockDescr, UInt256 +}; use std::{ cmp::{max, Ordering, PartialOrd, Ord}, convert::TryInto, fmt, io::{Write, Read, Cursor}, sync::{Arc, atomic::{AtomicI8, self}} }; -use ton_block::{ - Block, TopBlockDescr, BlockInfo, BlockIdExt, MerkleProof, McShardRecord, - Deserializable, HashmapAugType, BlockSignatures, CurrencyCollection, - AddSub, ShardIdent, Serializable, CopyleftRewards -}; -use ton_types::{ - error, Result, fail, Cell, UInt256, -}; use ton_api::ton::ton_node::newshardblock::NewShardBlock; pub use self::id::TopBlockDescrId; -bitflags! { +bitflags::bitflags! { pub struct Mode: u8 { const DEFAULT = 0; const FAIL_NEW = 1; @@ -166,7 +162,7 @@ impl TopBlockDescrStuff { let mut bytes = Cursor::new(bytes); // Read BOC first - let root = ton_types::BocReader::new().read(&mut bytes)?.withdraw_single_root()?; + let root = BocReader::new().read(&mut bytes)?.withdraw_single_root()?; // Try to read meta from the remaining data. Defaults to 0 for compatibility let mut meta = 0u8; @@ -184,7 +180,7 @@ impl TopBlockDescrStuff { let root_cell = self.tbd.serialize()?; let mut result = Vec::new(); - ton_types::BocWriter::with_root(&root_cell)?.write(&mut result)?; + BocWriter::with_root(&root_cell)?.write(&mut result)?; result.push(meta); Ok(result) } diff --git a/src/validating_utils.rs b/src/validating_utils.rs index 74cfa299..8df53a9a 100644 --- a/src/validating_utils.rs +++ b/src/validating_utils.rs @@ -7,16 +7,16 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::{validator::validator_utils::compute_validator_set_cc, shard_state::ShardStateStuff}; -use ton_block::{ +use ever_block::{ ShardIdent, BlockIdExt, ConfigParams, McStateExtra, ShardHashes, ValidatorSet, McShardRecord, INVALID_WORKCHAIN_ID, MASTERCHAIN_ID, GlobalCapabilities, }; -use ton_types::{fail, error, Result, Sha256, UInt256}; +use ever_block::{fail, error, Result, Sha256, UInt256}; use std::{collections::HashSet, cmp::max, iter::Iterator}; #[cfg(not(feature = "fast_finality_extra"))] diff --git a/src/validator/accept_block.rs b/src/validator/accept_block.rs index af60391a..ba5f7d97 100644 --- a/src/validator/accept_block.rs +++ b/src/validator/accept_block.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,28 +7,25 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::{ block::{construct_and_check_prev_stuff, BlockStuff, make_queue_update_from_block_raw}, - shard_state::ShardStateStuff, - block_proof::BlockProofStuff, - engine_traits::EngineOperations, - full_node::apply_block::calc_shard_state, + block_proof::BlockProofStuff, engine_traits::EngineOperations, + full_node::apply_block::calc_shard_state, shard_state::ShardStateStuff, types::top_block_descr::TopBlockDescrStuff, validator::validator_utils::check_crypto_signatures, validating_utils::{UNREGISTERED_CHAIN_MAX_LEN, fmt_block_id_short}, }; use storage::block_handle_db::BlockHandle; use std::{cmp::{max, min}, sync::Arc, ops::Deref, time::Duration, collections::HashSet}; -use ton_block::{ - Block, TopBlockDescr, BlockIdExt, MerkleProof, McShardRecord, CryptoSignaturePair, - Deserializable, BlockSignatures, ValidatorSet, BlockProof, Serializable, BlockSignaturesPure, - ValidatorBaseInfo, OutQueueUpdate -}; -use ton_types::{error, Result, fail, UInt256, UsageTree, HashmapType}; +use ever_block::{ + error, fail, Block, BlockIdExt, BlockProof, BlockSignatures, BlockSignaturesPure, + CryptoSignaturePair, Deserializable, HashmapType, McShardRecord, MerkleProof, OutQueueUpdate, + Result, Serializable, TopBlockDescr, ValidatorBaseInfo, ValidatorSet, UInt256, UsageTree +}; use ton_api::ton::ton_node::{ blocksignature::BlockSignature, broadcast::{BlockBroadcast, QueueUpdateBroadcast} }; @@ -483,7 +480,7 @@ fn create_new_proof_internal( // check signatures // TODO make function somewhere, BlockProofStuff contains same code - let checked_data = ton_block::Block::build_data_for_sign( + let checked_data = Block::build_data_for_sign( &id.root_hash, &id.file_hash ); diff --git a/src/validator/candidate_db.rs b/src/validator/candidate_db.rs index df401bb7..261b39f0 100644 --- a/src/validator/candidate_db.rs +++ b/src/validator/candidate_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,15 +7,15 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use catchain::{BlockHash, CatchainFactory}; use storage::{db_impl_single, db::traits::{DbKey, KvcWriteable}, traits::Serializable}; use std::{fmt::{Formatter, Display}, io::{Read, Write}, sync::Arc}; -use ton_block::{BlockIdExt, ShardIdent}; -use ton_types::{error, Result, UInt256}; +use ever_block::{BlockIdExt, ShardIdent}; +use ever_block::{error, Result, UInt256}; use validator_session::{ValidatorBlockCandidate, ValidatorBlockId}; #[derive(PartialEq, Eq, Hash)] diff --git a/src/validator/catchain_overlay.rs b/src/validator/catchain_overlay.rs index ba6267c7..a7d444f1 100644 --- a/src/validator/catchain_overlay.rs +++ b/src/validator/catchain_overlay.rs @@ -1,7 +1,7 @@ use crate::engine_traits::PrivateOverlayOperations; use adnl::PrivateOverlayShortId; use std::sync::Arc; -use ton_types::{Result, UInt256}; +use ever_block::{Result, UInt256}; use validator_session::{PublicKeyHash, CatchainOverlayPtr, CatchainNode}; pub(crate) struct CatchainOverlayManagerImpl { diff --git a/src/validator/collator.rs b/src/validator/collator.rs index ba0e90bd..f484b182 100644 --- a/src/validator/collator.rs +++ b/src/validator/collator.rs @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -49,7 +49,7 @@ use std::{ }, time::{Duration, Instant}, }; -use ton_block::{ +use ever_block::{ AddSub, BlkPrevInfo, Block, BlockCreateStats, BlockExtra, BlockIdExt, BlockInfo, CommonMsgInfo, ConfigParams, CopyleftRewards, CreatorStats, CurrencyCollection, Deserializable, ExtBlkRef, FutureSplitMerge, GlobalCapabilities, GlobalVersion, Grams, HashmapAugType, InMsg, InMsgDescr, @@ -60,11 +60,11 @@ use ton_block::{ Transaction, TransactionTickTock, UnixTime32, ValidatorSet, ValueFlow, WorkchainDescr, Workchains, Account, AccountIdPrefixFull, OutQueueUpdates, OutMsgQueueInfo, MASTERCHAIN_ID }; -use ton_executor::{ +use ever_executor::{ BlockchainConfig, ExecuteParams, OrdinaryTransactionExecutor, TickTockTransactionExecutor, TransactionExecutor, }; -use ton_types::{error, fail, AccountId, Cell, HashmapType, Result, UInt256, UsageTree, SliceData}; +use ever_block::{error, fail, AccountId, Cell, HashmapType, Result, UInt256, UsageTree, SliceData}; use crate::validator::validator_utils::is_remp_enabled; @@ -371,7 +371,7 @@ impl CollatorData { // log::trace!( // "new transaction, message {:x}\n{}", // in_msg_opt.map(|m| m.message_cell().unwrap().repr_hash()).unwrap_or_default(), - // ton_block_json::debug_transaction(transaction.clone()).unwrap_or_default(), + // ever_block_json::debug_transaction(transaction.clone()).unwrap_or_default(), // ); self.execute_count += 1; let gas_used = transaction.gas_used().unwrap_or(0); @@ -431,7 +431,7 @@ impl CollatorData { // let mut data = self.out_msg_queue_info.del_message(key)?; // let created_lt = u64::construct_from(&mut data)?; // let enq = MsgEnqueueStuff::construct_from(&mut data, created_lt)?; - // let data = ton_types::write_boc(&enq.message_cell())?; + // let data = ever_block::write_boc(&enq.message_cell())?; // log::debug!("del_out_msg_from_state {:x} size {}", key, data.len()); log::debug!("del_out_msg_from_state {:x}", key); self.dequeue_count += 1; @@ -1607,8 +1607,8 @@ impl Collator { ); } prev_state.proc_info()?.iterate_slices_with_keys(|ref mut key, ref mut value| { - let key = ton_block::ProcessedInfoKey::construct_from(key)?; - let value = ton_block::ProcessedUpto::construct_from(value)?; + let key = ever_block::ProcessedInfoKey::construct_from(key)?; + let value = ever_block::ProcessedUpto::construct_from(value)?; log::trace!( "{}: prev processed upto {} {:x} - {} {:x}", self.collated_block_descr, @@ -2409,22 +2409,34 @@ impl Collator { exec_manager: &mut ExecutionManager, ) -> Result<()> { if collator_data.skip_extmsg() { - log::debug!("{}: skipping processing of inbound external messages", self.collated_block_descr); + log::debug!( + "{}: skipping processing of inbound external messages", + self.collated_block_descr + ); return Ok(()) } - let finish_time_ms = self.get_external_messages_finish_time_micros(); log::debug!("{}: process_inbound_external_messages", self.collated_block_descr); - for (msg, msg_id) in self.engine.get_external_messages_iterator(self.shard.clone(), finish_time_ms) { + let finish_time_ms = self.get_external_messages_finish_time_micros(); + let mut iter = self.engine.get_external_messages_iterator(self.shard.clone(), finish_time_ms); + loop { + let Some((msg, msg_id)) = iter.next() else { + break; + }; let header = msg.ext_in_header() .ok_or_else(|| error!("message {:x} is not external inbound message", msg_id))?; if self.shard.contains_address(&header.dst)? { if !collator_data.limit_fits(ParamLimitIndex::Soft) { - log::debug!("{}: BLOCK FULL, stop processing external messages", self.collated_block_descr); + log::debug!( + "{}: BLOCK FULL, stop processing external messages", + self.collated_block_descr + ); break } if self.check_cutoff_timeout() { - log::warn!("{}: TIMEOUT is elapsed, stop processing external messages", - self.collated_block_descr); + log::warn!( + "{}: TIMEOUT is elapsed, stop processing external messages", + self.collated_block_descr + ); break } log::debug!("{}: message {:x} sent to execution", self.collated_block_descr, msg_id); @@ -2830,8 +2842,8 @@ impl Collator { .read_out_msg_queue_info()? .proc_info() .iterate_slices_with_keys(|ref mut key, ref mut value| { - let key = ton_block::ProcessedInfoKey::construct_from(key)?; - let value = ton_block::ProcessedUpto::construct_from(value)?; + let key = ever_block::ProcessedInfoKey::construct_from(key)?; + let value = ever_block::ProcessedUpto::construct_from(value)?; log::trace!( "{}: new processed upto {} {:x} - {} {:x}", self.collated_block_descr, @@ -2901,11 +2913,11 @@ impl Collator { log::trace!("{}: finalize_block: fill block candidate", self.collated_block_descr); let cell = new_block.serialize()?; block_id.root_hash = cell.repr_hash(); - let data = ton_types::write_boc(&cell)?; + let data = ever_block::write_boc(&cell)?; block_id.file_hash = UInt256::calc_file_hash(&data); // !!!! DEBUG !!!! - // if let Ok(block_str) = ton_block_json::debug_block(new_block.clone()) { + // if let Ok(block_str) = ever_block_json::debug_block(new_block.clone()) { // let _ = std::fs::write( // format!("tmp/{}.json", block_id), block_str // ); diff --git a/src/validator/fabric.rs b/src/validator/fabric.rs index 08712c81..f79b805f 100644 --- a/src/validator/fabric.rs +++ b/src/validator/fabric.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -15,14 +15,17 @@ use std::{ sync::Arc, time::SystemTime, }; -use super::validator_utils::{validator_query_candidate_to_validator_block_candidate, pairvec_to_cryptopair_vec, get_first_block_seqno_after_prevs}; +use super::validator_utils::{ + validator_query_candidate_to_validator_block_candidate, pairvec_to_cryptopair_vec, + get_first_block_seqno_after_prevs +}; use crate::{ collator_test_bundle::CollatorTestBundle, engine_traits::EngineOperations, - validator::verification::VerificationManagerPtr, - validator::{CollatorSettings, validate_query::ValidateQuery, collator}, validating_utils::{fmt_next_block_descr_from_next_seqno, fmt_next_block_descr} + validator::{CollatorSettings, validate_query::ValidateQuery, collator}, + validating_utils::{fmt_next_block_descr_from_next_seqno, fmt_next_block_descr} }; -use ton_block::{BlockIdExt, ShardIdent, ValidatorSet, Deserializable}; -use ton_types::{Result, UInt256}; +use crate::validator::verification::VerificationManagerPtr; +use ever_block::{Block, BlockIdExt, Deserializable, Result, ShardIdent, UInt256, ValidatorSet}; use validator_session::{ValidatorBlockCandidate, BlockPayloadPtr, PublicKeyHash, PublicKey}; #[allow(dead_code)] @@ -30,7 +33,7 @@ pub async fn run_validate_query_any_candidate( block: super::BlockCandidate, engine: Arc, ) -> Result { - let real_block = ton_block::Block::construct_from_bytes(&block.data)?; + let real_block = Block::construct_from_bytes(&block.data)?; let shard = block.block_id.shard().clone(); let info = real_block.read_info()?; let prev = info.read_prev_ids()?; @@ -52,7 +55,10 @@ pub async fn run_validate_query_any_candidate( )?; let validator_set = ValidatorSet::with_cc_seqno(0, 0, 0, cc_seqno_with_delta, nodes)?; - log::debug!(target: "verificator", "ValidatorSetForVerification cc_seqno: {:?}", validator_set.cc_seqno()); + log::debug!( + target: "verificator", + "ValidatorSetForVerification cc_seqno: {:?}", validator_set.cc_seqno() + ); run_validate_query( shard, SystemTime::now(), @@ -184,7 +190,7 @@ pub async fn run_accept_block_query( approve_signatures: Vec<(PublicKeyHash, BlockPayloadPtr)>, send_broadcast: bool, engine: Arc, -) -> ton_types::Result<()> { +) -> Result<()> { let sigs = pairvec_to_cryptopair_vec(signatures)?; let approve_sigs = pairvec_to_cryptopair_vec(approve_signatures)?; super::accept_block::accept_block( diff --git a/src/validator/log_parser.rs b/src/validator/log_parser.rs index 8c393b35..aa9ceee7 100644 --- a/src/validator/log_parser.rs +++ b/src/validator/log_parser.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/validator/message_cache.rs b/src/validator/message_cache.rs index a23ea2d9..186a664b 100644 --- a/src/validator/message_cache.rs +++ b/src/validator/message_cache.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -47,11 +47,10 @@ use ton_api::{ } }; -use ton_block::{ - Deserializable, Message, Serializable, MsgAddressInt, MsgAddrStd, - ExternalInboundMessageHeader, BlockIdExt, UnixTime32 +use ever_block::{ + error, fail, BlockIdExt, Deserializable, ExternalInboundMessageHeader, KeyId, Message, + MsgAddressInt, MsgAddrStd, Result, Serializable, SliceData, UInt256, UnixTime32 }; -use ton_types::{error, fail, KeyId, SliceData, Result, UInt256}; #[cfg(test)] #[path = "tests/test_message_cache.rs"] @@ -126,7 +125,7 @@ impl RmqMessage { #[allow(dead_code)] pub fn make_test_message(body: &SliceData) -> Result { let address = UInt256::rand(); - let msg = ton_block::Message::with_ext_in_header_and_body(ExternalInboundMessageHeader { + let msg = Message::with_ext_in_header_and_body(ExternalInboundMessageHeader { src: Default::default(), dst: MsgAddressInt::AddrStd(MsgAddrStd { anycast: None, diff --git a/src/validator/mod.rs b/src/validator/mod.rs index 7287f2f3..1b4ed909 100644 --- a/src/validator/mod.rs +++ b/src/validator/mod.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -39,8 +39,8 @@ pub mod slashing; mod verification; use std::sync::Arc; -use ton_types::{Result, UInt256, error}; -use ton_block::{ +use ever_block::{Result, UInt256, error}; +use ever_block::{ BlkMasterInfo, BlockIdExt, ConfigParams, CurrencyCollection, ExtBlkRef, McStateExtra, Libraries, }; diff --git a/src/validator/mutex_wrapper.rs b/src/validator/mutex_wrapper.rs index c4b846c3..5da630e3 100644 --- a/src/validator/mutex_wrapper.rs +++ b/src/validator/mutex_wrapper.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/validator/out_msg_queue.rs b/src/validator/out_msg_queue.rs index 88900950..ad21ba12 100644 --- a/src/validator/out_msg_queue.rs +++ b/src/validator/out_msg_queue.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -22,16 +22,12 @@ use std::{ cmp::max, iter::Iterator, sync::{Arc, atomic::{AtomicBool, Ordering}}, collections::{btree_map::{self, BTreeMap}, HashMap, HashSet}, }; -use ton_block::{ - BlockIdExt, ShardIdent, Serializable, Deserializable, - OutMsgQueueInfo, OutMsgQueue, OutMsgQueueKey, IhrPendingInfo, - ProcessedInfo, ProcessedUpto, ProcessedInfoKey, - ShardHashes, AccountIdPrefixFull, - HashmapAugType, ShardStateUnsplit, -}; -use ton_types::{ - error, fail, BuilderData, Cell, LabelReader, SliceData, IBitstring, Result, UInt256, - HashmapType, HashmapFilterResult, HashmapRemover, UsageTree, HashmapSubtree, +use ever_block::{ + error, fail, AccountIdPrefixFull, BlockIdExt, BuilderData, Cell, Deserializable, + HashmapAugType, HashmapFilterResult, HashmapRemover, HashmapSubtree, HashmapType, + IBitstring, IhrPendingInfo, LabelReader, MASTERCHAIN_ID, OutMsgQueue, OutMsgQueueInfo, + OutMsgQueueKey, ProcessedInfo, ProcessedInfoKey, ProcessedUpto, Result, Serializable, + ShardIdent, ShardHashes, ShardStateUnsplit, SliceData, UInt256, UsageTree }; #[cfg(test)] @@ -548,7 +544,7 @@ impl OutMsgQueueInfoStuff { stop_flag: &Option<&AtomicBool>, ) -> Result<()> { let workchain = self.shard().workchain_id(); - let masterchain = workchain == ton_block::MASTERCHAIN_ID; + let masterchain = workchain == MASTERCHAIN_ID; for entry in &mut self.entries { if entry.ref_shards.is_none() { check_stop_flag(stop_flag)?; diff --git a/src/validator/out_msg_queue_cleaner.rs b/src/validator/out_msg_queue_cleaner.rs index 5192b0eb..c607b938 100644 --- a/src/validator/out_msg_queue_cleaner.rs +++ b/src/validator/out_msg_queue_cleaner.rs @@ -1,11 +1,24 @@ +/* +* Copyright (C) 2019-2024 EverX. All Rights Reserved. +* +* Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use +* this file except in compliance with the License. +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific EVERX DEV software governing permissions and +* limitations under the License. +*/ + use std::{ cell::{RefCell, RefMut}, collections::{BTreeMap, BTreeSet}, rc::Rc, time::Instant, }; -use ton_block::OutMsgQueue; -use ton_types::{ +use ever_block::OutMsgQueue; +use ever_block::{ error, BuilderData, Cell, HashmapFilterResult, HashmapRemover, HashmapType, IBitstring, LabelReader, Result, SliceData, }; diff --git a/src/validator/reliable_message_queue.rs b/src/validator/reliable_message_queue.rs index 7baddebe..62b78ef7 100644 --- a/src/validator/reliable_message_queue.rs +++ b/src/validator/reliable_message_queue.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -25,8 +25,8 @@ use ton_api::ton::ton_node::{ RempMessageStatus, RempMessageLevel, rempmessagestatus::{RempAccepted, RempIgnored, RempRejected}, RempCatchainRecord }; -use ton_block::{ShardIdent, Message, BlockIdExt, ValidatorDescr}; -use ton_types::{UInt256, Result, fail}; +use ever_block::{ShardIdent, Message, BlockIdExt, ValidatorDescr}; +use ever_block::{UInt256, Result, fail}; use catchain::{PrivateKey, PublicKey}; use crate::{ engine_traits::EngineOperations, diff --git a/src/validator/remp_block_parser.rs b/src/validator/remp_block_parser.rs index bb91a202..e0a79f3b 100644 --- a/src/validator/remp_block_parser.rs +++ b/src/validator/remp_block_parser.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -17,8 +17,8 @@ use std::time::Duration; use crossbeam_channel::{Sender, Receiver, unbounded, TryRecvError}; -use ton_types::{Result, UInt256, error, fail}; -use ton_block::{BlockIdExt, Deserializable, HashmapAugType, InMsg, ShardIdent}; +use ever_block::{Result, UInt256, error, fail}; +use ever_block::{BlockIdExt, Deserializable, HashmapAugType, InMsg, ShardIdent}; use ton_api::ton::ton_node::{RempMessageLevel, RempMessageStatus, rempmessagestatus::RempAccepted}; use storage::block_handle_db::BlockHandle; diff --git a/src/validator/remp_catchain.rs b/src/validator/remp_catchain.rs index d43a9407..40f81c91 100644 --- a/src/validator/remp_catchain.rs +++ b/src/validator/remp_catchain.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -37,8 +37,8 @@ use catchain::{ use ton_api::{ IntoBoxed, ton::ton_node::RempCatchainRecord }; -use ton_block::ValidatorDescr; -use ton_types::{error, fail, KeyId, Result, UInt256}; +use ever_block::ValidatorDescr; +use ever_block::{error, fail, KeyId, Result, UInt256}; const REMP_CATCHAIN_START_POLLING_INTERVAL: Duration = Duration::from_millis(50); diff --git a/src/validator/remp_manager.rs b/src/validator/remp_manager.rs index 5bae2886..a6221dab 100644 --- a/src/validator/remp_manager.rs +++ b/src/validator/remp_manager.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -21,9 +21,9 @@ use std::{ use std::cmp::{max, Reverse}; use std::collections::BinaryHeap; -use ton_block::{BlockIdExt, CatchainConfig, Message, ShardIdent, UnixTime32}; +use ever_block::{BlockIdExt, CatchainConfig, Message, ShardIdent, UnixTime32}; use ton_api::ton::ton_node::RempMessageStatus; -use ton_types::{error, fail, KeyId, Result, SliceData, UInt256}; +use ever_block::{error, fail, KeyId, Result, SliceData, UInt256}; use crate::{ config::RempConfig, diff --git a/src/validator/remp_service.rs b/src/validator/remp_service.rs index cd7f343b..4efe4081 100644 --- a/src/validator/remp_service.rs +++ b/src/validator/remp_service.rs @@ -1,3 +1,16 @@ +/* +* Copyright (C) 2019-2024 EverX. All Rights Reserved. +* +* Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use +* this file except in compliance with the License. +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific EVERX DEV software governing permissions and +* limitations under the License. +*/ + use crate::{ engine_traits::{EngineOperations, RempCoreInterface}, ext_messages::create_ext_message, network::remp::RempMessagesSubscriber, @@ -5,7 +18,7 @@ use crate::{ use std::{ops::Deref, sync::Arc}; use ton_api::ton::ton_node::RempMessage; -use ton_types::{error, fail, KeyId, Result}; +use ever_block::{error, fail, KeyId, Result}; #[derive(Default)] pub struct RempService { diff --git a/src/validator/sessions_computing.rs b/src/validator/sessions_computing.rs index 1f8c0da1..f50e2ce4 100644 --- a/src/validator/sessions_computing.rs +++ b/src/validator/sessions_computing.rs @@ -1,11 +1,24 @@ +/* +* Copyright (C) 2019-2024 EverX. All Rights Reserved. +* +* Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use +* this file except in compliance with the License. +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific EVERX DEV software governing permissions and +* limitations under the License. +*/ + use std::{ collections::HashMap, fmt::{Display, Formatter}, sync::Arc }; use dashmap::DashMap; -use ton_types::{error, fail, Result, UInt256}; -use ton_block::{ValidatorSet, ShardIdent, ValidatorDescr}; +use ever_block::{error, fail, Result, UInt256}; +use ever_block::{ValidatorSet, ShardIdent, ValidatorDescr}; use crate::validator::validator_utils::validatorset_to_string; /// 1) shard, cc_seqno -> session_id diff --git a/src/validator/slashing.rs b/src/validator/slashing.rs index f9e19b39..b4ee6d6a 100644 --- a/src/validator/slashing.rs +++ b/src/validator/slashing.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,23 +7,22 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::{engine_traits::EngineOperations, shard_state::ShardStateStuff, validator::UInt256}; -use ever_crypto::Ed25519KeyOption; -use num_bigint::BigUint; + +use ever_abi::{Contract, Function, Token, TokenValue, Uint}; +use ever_block::{ + error, ConfigParamEnum, ExternalInboundMessageHeader, HashmapAugType, Message, MsgAddressExt, + MsgAddressInt, Result, Serializable, SigPubKey, SlashingConfig, SliceData, write_boc +}; +#[cfg(feature = "slashing")] +use ever_block::{base64_encode, Ed25519KeyOption}; use rand::Rng; -use spin::mutex::SpinMutex; use std::{fmt, sync::Arc}; use storage::block_handle_db::BlockHandle; -use ton_abi::{Contract, Function, Token, TokenValue, Uint}; -use ton_block::{ - ConfigParamEnum, ExternalInboundMessageHeader, HashmapAugType, Message, MsgAddressExt, - MsgAddressInt, Serializable, SigPubKey, SlashingConfig, -}; -use ton_types::{error, Result, write_boc, SliceData}; use validator_session::{ PrivateKey, PublicKey, SlashingAggregatedMetric, SlashingMetric, SlashingNode, SlashingValidatorStat, @@ -41,7 +40,8 @@ lazy_static::lazy_static! { .expect("Elector contract must have 'report' function for slashing") .clone(); // it should be got from config params - static ref ELECTOR_ADDRESS: MsgAddressInt = "-1:3333333333333333333333333333333333333333333333333333333333333333".parse().unwrap(); + static ref ELECTOR_ADDRESS: MsgAddressInt = + "-1:3333333333333333333333333333333333333333333333333333333333333333".parse().unwrap(); } /// Slashing manager pointer @@ -49,7 +49,7 @@ pub type SlashingManagerPtr = Arc; /// Slashing manager pub struct SlashingManager { - manager: SpinMutex, + manager: spin::mutex::SpinMutex, send_messages_block_offset: u32, } @@ -71,7 +71,7 @@ impl SlashingManager { Arc::new(SlashingManager { send_messages_block_offset: rng.gen(), - manager: SpinMutex::new(SlashingManagerImpl::default()), + manager: spin::mutex::SpinMutex::new(SlashingManagerImpl::default()) }) } @@ -242,7 +242,7 @@ impl SlashingManager { fn convert_to_u256(value: &[u8]) -> TokenValue { assert!(value.len() == 32); TokenValue::Uint(Uint { - number: BigUint::from_bytes_be(value), + number: num_bigint::BigUint::from_bytes_be(value), size: 256, }) } @@ -347,7 +347,7 @@ impl SlashingManager { fn serialize_message(message: &Arc) -> Result<(UInt256, Vec)> { let cell = message.serialize()?; let id = cell.repr_hash(); - let bytes = ton_types::write_boc(&cell)?; + let bytes = write_boc(&cell)?; Ok((id, bytes)) } diff --git a/src/validator/telemetry.rs b/src/validator/telemetry.rs index ef2a6b04..dccfbe07 100644 --- a/src/validator/telemetry.rs +++ b/src/validator/telemetry.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -21,7 +21,7 @@ use std::{ cmp::{max, min}, collections::HashMap, }; -use ton_block::ShardIdent; +use ever_block::ShardIdent; const TR_PER_BLOCK_STEPS: usize = 10; const TR_PER_BLOCK_STEP: u32 = 100; diff --git a/src/validator/tests/test_collator.rs b/src/validator/tests/test_collator.rs index c6b4fb2c..7560ce27 100644 --- a/src/validator/tests/test_collator.rs +++ b/src/validator/tests/test_collator.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -21,7 +21,7 @@ use crate::{ validator_utils::compute_validator_set_cc, }, }; -use ton_types::Result; +use ever_block::Result; use pretty_assertions::assert_eq; use std::sync::Arc; @@ -90,8 +90,8 @@ async fn try_collate_by_engine( let new_block = Block::construct_from_bytes(&block_candidate.data)?; - // std::fs::write(&format!("{}/state_candidate.json", RES_PATH), ton_block_json::debug_state(new_state.clone())?)?; - // std::fs::write(&format!("{}/block_candidate.json", RES_PATH), ton_block_json::debug_block_full(&new_block)?)?; + // std::fs::write(&format!("{}/state_candidate.json", RES_PATH), ever_block_json::debug_state(new_state.clone())?)?; + // std::fs::write(&format!("{}/block_candidate.json", RES_PATH), ever_block_json::debug_block_full(&new_block)?)?; let validator_query = ValidateQuery::new( shard.clone(), diff --git a/src/validator/tests/test_log_parser.rs b/src/validator/tests/test_log_parser.rs index 610f1389..2c5ed616 100644 --- a/src/validator/tests/test_log_parser.rs +++ b/src/validator/tests/test_log_parser.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/validator/tests/test_message_cache.rs b/src/validator/tests/test_message_cache.rs index 099cc1ff..fec7d46d 100644 --- a/src/validator/tests/test_message_cache.rs +++ b/src/validator/tests/test_message_cache.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -18,8 +18,8 @@ use openssl::rand::rand_bytes; use rand::{Rng, thread_rng}; use adnl::telemetry::Metric; use ton_api::ton::ton_node::{RempMessageLevel, RempMessageStatus, rempmessagestatus::RempAccepted}; -use ton_block::{BlockIdExt, ShardIdent}; -use ton_types::{Result, SliceData, error, UInt256}; +use ever_block::{BlockIdExt, ShardIdent}; +use ever_block::{Result, SliceData, error, UInt256}; use crate::engine_traits::RempDuplicateStatus; use crate::ext_messages::get_level_and_level_change; use crate::validator::message_cache::{MessageCache, RmqMessage}; diff --git a/src/validator/tests/test_out_msg_queue.rs b/src/validator/tests/test_out_msg_queue.rs index 402332b6..823a9270 100644 --- a/src/validator/tests/test_out_msg_queue.rs +++ b/src/validator/tests/test_out_msg_queue.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -15,7 +15,7 @@ use std::{collections::BinaryHeap, str::FromStr, time::Instant}; use super::*; use crate::types::messages::MsgEnqueueStuff; -use ton_block::*; +use ever_block::*; // TODO: need tests to illustrate adding, routing, fetching message // create internal message in one shard // put it to its queue @@ -272,8 +272,7 @@ pub fn generate_test_queue( enqueue_lt: u64, mut test_addresses: Vec<&str>, ) -> (OutMsgQueue, BinaryHeap) { - use ton_block::*; - use ton_types::*; + use ever_block::*; let use_test_addresses = test_addresses.len() as u64 == size; test_addresses.reverse(); @@ -335,8 +334,7 @@ pub fn generate_test_queue( #[test] fn test_clean_queue() { - use ton_block::*; - use ton_types::*; + use ever_block::*; // init log let level = log::LevelFilter::Debug; diff --git a/src/validator/tests/test_rmq_messages.rs b/src/validator/tests/test_rmq_messages.rs index 3e4398d0..038fce89 100644 --- a/src/validator/tests/test_rmq_messages.rs +++ b/src/validator/tests/test_rmq_messages.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/validator/tests/test_session_id.rs b/src/validator/tests/test_session_id.rs index e38997a0..d6831ed3 100644 --- a/src/validator/tests/test_session_id.rs +++ b/src/validator/tests/test_session_id.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -16,7 +16,7 @@ use std::{ io::{self, BufRead}, time::Duration, }; -use ton_block::{signature::SigPubKey, validators::ValidatorDescr}; +use ever_block::{signature::SigPubKey, validators::ValidatorDescr}; use super::*; use crate::validator::{log_parser::LogParser, sessions_computing::GeneralSessionInfo}; diff --git a/src/validator/tests/test_slashing.rs b/src/validator/tests/test_slashing.rs index 33a97030..530f9f63 100644 --- a/src/validator/tests/test_slashing.rs +++ b/src/validator/tests/test_slashing.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/validator/tests/test_telemetry.rs b/src/validator/tests/test_telemetry.rs index f9a82e62..3f911ed8 100644 --- a/src/validator/tests/test_telemetry.rs +++ b/src/validator/tests/test_telemetry.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,12 +7,12 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use super::*; -use ton_block::ShardIdent; +use ever_block::ShardIdent; use std::time::Duration; #[test] diff --git a/src/validator/tests/test_validate_query.rs b/src/validator/tests/test_validate_query.rs index 3e4398d0..038fce89 100644 --- a/src/validator/tests/test_validate_query.rs +++ b/src/validator/tests/test_validate_query.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/src/validator/tests/test_validator_utils.rs b/src/validator/tests/test_validator_utils.rs index 929052b7..3815f98d 100644 --- a/src/validator/tests/test_validator_utils.rs +++ b/src/validator/tests/test_validator_utils.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -18,12 +18,11 @@ use crate::{ validator::accept_block::create_new_proof }; -use ton_block::{ - MASTERCHAIN_ID, +use ever_block::{ Block, BlockIdExt, ConfigParamEnum, CryptoSignature, CryptoSignaturePair, Deserializable, - SigPubKey, + KeyOption, KeyOptionJson, MASTERCHAIN_ID, SigPubKey, }; -use ton_types::{error, HashmapType}; +use ever_block::{error, HashmapType}; use crate::validator::accept_block::create_new_proof_link; fn block_config(block_stuff: &BlockStuff) -> Result { @@ -34,7 +33,7 @@ fn block_config(block_stuff: &BlockStuff) -> Result { ) } -pub fn mine_key_for_workchain(id_opt: Option) -> (ton_types::KeyOptionJson, Arc) { +pub fn mine_key_for_workchain(id_opt: Option) -> (KeyOptionJson, Arc) { loop { if let Ok((private, public)) = Ed25519KeyOption::generate_with_json() { if id_opt.is_none() || Some(calc_workchain_id_by_adnl_id(public.id().data())) == id_opt { @@ -196,7 +195,7 @@ fn check_any_keyblock_validator_set(file_name: &str) { fn test_create_new_proof_with_workchains() { let block_stuff = BlockStuff::read_block_from_file("src/tests/static/key_block.boc").unwrap(); let validator_set = block_config(&block_stuff).unwrap().validator_set().unwrap(); - let data = ton_block::Block::build_data_for_sign( + let data = Block::build_data_for_sign( block_stuff.id().root_hash(), block_stuff.id().file_hash() ); diff --git a/src/validator/tests/test_workchains_fast_finality.rs b/src/validator/tests/test_workchains_fast_finality.rs deleted file mode 100644 index a83d8d8d..00000000 --- a/src/validator/tests/test_workchains_fast_finality.rs +++ /dev/null @@ -1,3 +0,0 @@ -use ton_block::{CollatorRange, ShardCollators, ShardIdent}; -use ton_types::Result; - diff --git a/src/validator/validate_query.rs b/src/validator/validate_query.rs index 2309db0f..144d79b4 100644 --- a/src/validator/validate_query.rs +++ b/src/validator/validate_query.rs @@ -7,15 +7,13 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use super::{BlockCandidate, McData}; use crate::{ - block::BlockStuff, - engine_traits::EngineOperations, - error::NodeError, + block::BlockStuff, engine_traits::EngineOperations, error::NodeError, shard_state::ShardStateStuff, types::{ messages::{count_matching_bits, perform_hypercube_routing, MsgEnqueueStuff}, @@ -27,11 +25,29 @@ use crate::{ UNREGISTERED_CHAIN_MAX_LEN, fmt_next_block_descr, }, validator::{out_msg_queue::MsgQueueManager, validator_utils::calc_subset_for_masterchain}, - validator::verification::VerificationManagerPtr, CHECK, }; +use crate::validator::verification::VerificationManagerPtr; use adnl::common::add_unbound_object_to_map_with_update; +use ever_block::{ + fail, Account, AccountBlock, AccountId, AccountIdPrefixFull, AccountStatus, AddSub, + base64_encode, BlockCreateStats, BlockError, BlockExtra, BlockIdExt, BlockInfo, BlockLimits, + Cell, CellType, config_params, ConfigParamEnum, ConfigParams, CopyleftRewards, Counters, + CreatorStats, CurrencyCollection, DepthBalanceInfo, Deserializable, EnqueuedMsg, + GlobalCapabilities, Grams, HashmapAugType, HashmapType, InMsg, InMsgDescr, + INVALID_WORKCHAIN_ID, KeyExtBlkRef, KeyMaxLt, LibDescr, Libraries, McBlockExtra, + MASTERCHAIN_ID, MAX_SPLIT_DEPTH, McShardRecord, McStateExtra, MerkleProof, MerkleUpdate, + Message, MsgAddressInt, MsgEnvelope, OutMsg, OutMsgDescr, OutMsgQueueInfo, OutMsgQueueKey, + OutQueueUpdate, read_boc, Result, Serializable, ShardAccount, ShardAccountBlocks, + ShardAccounts, ShardFeeCreated, ShardHashes, ShardIdent, SliceData, StateInitLib, + TopBlockDescrSet, TrComputePhase, Transaction, TransactionDescr, ValidatorSet, ValueFlow, + U15, UInt256, WorkchainDescr, write_boc +}; +use ever_executor::{ + BlockchainConfig, CalcMsgFwdFees, ExecuteParams, OrdinaryTransactionExecutor, + TickTockTransactionExecutor, TransactionExecutor, +}; use std::{ collections::HashMap, sync::{ @@ -39,26 +55,6 @@ use std::{ Arc, }, }; -use ton_block::{ - config_params, Account, AccountBlock, AccountIdPrefixFull, AccountStatus, AddSub, - BlockCreateStats, BlockError, BlockExtra, BlockIdExt, BlockInfo, BlockLimits, ConfigParamEnum, - ConfigParams, CopyleftRewards, Counters, CreatorStats, CurrencyCollection, DepthBalanceInfo, - Deserializable, EnqueuedMsg, GlobalCapabilities, Grams, HashmapAugType, InMsg, InMsgDescr, - KeyExtBlkRef, KeyMaxLt, LibDescr, Libraries, McBlockExtra, McShardRecord, McStateExtra, - MerkleProof, MerkleUpdate, Message, MsgAddressInt, MsgEnvelope, OutMsg, OutMsgDescr, - OutMsgQueueKey, Serializable, ShardAccount, ShardAccountBlocks, ShardAccounts, ShardFeeCreated, - ShardHashes, ShardIdent, StateInitLib, TopBlockDescrSet, TrComputePhase, Transaction, - TransactionDescr, ValidatorSet, ValueFlow, WorkchainDescr, INVALID_WORKCHAIN_ID, - MASTERCHAIN_ID, U15, OutMsgQueueInfo, OutQueueUpdate, MAX_SPLIT_DEPTH -}; -use ton_executor::{ - BlockchainConfig, CalcMsgFwdFees, ExecuteParams, OrdinaryTransactionExecutor, - TickTockTransactionExecutor, TransactionExecutor, -}; -use ton_types::{ - read_boc, fail, AccountId, base64_encode, Cell, CellType, HashmapType, Result, - SliceData, UInt256 -}; use crate::engine_traits::RempDuplicateStatus; use crate::validator::validator_utils::is_remp_enabled; @@ -261,9 +257,8 @@ impl ValidateQuery { create_stats_enabled: Default::default(), block_create_total: Default::default(), block_create_count: Default::default(), - next_block_descr, - verification_manager, + verification_manager } } @@ -4534,8 +4529,8 @@ impl ValidateQuery { ) -> Result<()> { log::trace!(target: "validate_reject", "acc_before: {}\nacc_after: {}\nconfig: {}\ntrans_origin: {}\ntrans_execute: {}", - base64_encode(ton_types::write_boc(&account_before)?), - base64_encode(ton_types::write_boc(&account_after)?), + base64_encode(write_boc(&account_before)?), + base64_encode(write_boc(&account_after)?), base64_encode(config.write_to_bytes()?), base64_encode(trans.write_to_bytes()?), base64_encode(trans_execute.write_to_bytes()?) diff --git a/src/validator/validator_group.rs b/src/validator/validator_group.rs index a379e13f..94ead864 100644 --- a/src/validator/validator_group.rs +++ b/src/validator/validator_group.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -16,8 +16,8 @@ use std::ops::RangeInclusive; use crossbeam_channel::Receiver; use catchain::utils::get_hash; -use ton_block::{BlockIdExt, ShardIdent, ValidatorSet, ValidatorDescr}; -use ton_types::{fail, error, Result, UInt256}; +use ever_block::{BlockIdExt, ShardIdent, ValidatorSet, ValidatorDescr}; +use ever_block::{fail, error, Result, UInt256}; use validator_session::{ BlockHash, BlockPayloadPtr, CatchainOverlayManagerPtr, SessionId, SessionPtr, SessionListenerPtr, SessionFactory, @@ -61,7 +61,7 @@ use crate::validator::validator_utils::get_first_block_seqno_after_prevs; // #[cfg(feature = "fast_finality")] // use crate::validator::workchains_fast_finality::compute_actual_finish; -use crate::validator::verification::{VerificationManagerPtr}; +use crate::validator::verification::VerificationManagerPtr; #[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] pub enum ValidatorGroupStatus { @@ -635,7 +635,12 @@ impl ValidatorGroup { } } - pub async fn on_generate_slot(&self, round: u32, callback: ValidatorBlockCandidateCallback, rt: tokio::runtime::Handle) { + pub async fn on_generate_slot( + &self, + round: u32, + callback: ValidatorBlockCandidateCallback, + rt: tokio::runtime::Handle + ) { let next_block_descr = self.get_next_block_descr().await; log::info!( target: "validator", @@ -659,12 +664,17 @@ impl ValidatorGroup { }; if let Some(rmq) = self.get_reliable_message_queue().await { - log::info!(target: "validator", "ValidatorGroup::on_generate_slot: ({}) collecting REMP messages for {} for collation: {}", + log::info!( + target: "validator", + "ValidatorGroup::on_generate_slot: ({}) collecting REMP messages \ + for {} for collation: {}", next_block_descr, self.info_round(round).await, include_external_messages ); if include_external_messages { if let Err(e) = rmq.collect_messages_for_collation().await { - log::error!(target: "validator", "({}): Error collecting messages for {}: `{}`", + log::error!( + target: "validator", + "({}): Error collecting messages for {}: `{}`", next_block_descr, self.info_round(round).await, e @@ -698,6 +708,7 @@ impl ValidatorGroup { }, None => None, }; + let result_message = match &result { Ok(_) => { let now = std::time::SystemTime::now() @@ -1046,7 +1057,7 @@ impl ValidatorGroup { } #[cfg(feature = "slashing")] - pub fn on_slashing_statistics(&self, round: u32, stat: SlashingValidatorStat) { + pub async fn on_slashing_statistics(&self, round: u32, stat: SlashingValidatorStat) { log::debug!( target: "validator", "({}): ValidatorGroup::on_slashing_statistics round {}, stat {:?}", diff --git a/src/validator/validator_manager.rs b/src/validator/validator_manager.rs index 0f68f2d5..5299ca47 100644 --- a/src/validator/validator_manager.rs +++ b/src/validator/validator_manager.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -19,23 +19,32 @@ use crate::{ validator::{ remp_block_parser::{RempMasterblockObserver, find_previous_sessions}, remp_manager::{RempManager, RempInterfaceQueues}, - sessions_computing::{GeneralSessionInfo, SessionValidatorsInfo, SessionValidatorsList, SessionValidatorsCache}, - fabric::run_validate_query_any_candidate, + sessions_computing::{ + GeneralSessionInfo, SessionValidatorsInfo, SessionValidatorsList, + SessionValidatorsCache + }, validator_group::{ValidatorGroup, ValidatorGroupStatus}, validator_utils::{ get_first_block_seqno_after_prevs, get_masterchain_seqno, get_block_info_by_id, compute_validator_list_id, get_group_members_by_validator_descrs, - is_remp_enabled, try_calc_subset_for_workchain, - validatordescr_to_catchain_node, validatorset_to_string, - ValidatorListHash, ValidatorSubsetInfo, - try_calc_vset_for_workchain, + is_remp_enabled, try_calc_subset_for_workchain, validatordescr_to_catchain_node, + validatorset_to_string, ValidatorListHash, ValidatorSubsetInfo }, out_msg_queue::OutMsgQueueInfoStuff, }, }; -use crate::validator::validator_utils::try_calc_subset_for_workchain_standard; - +use crate::validator::{ + BlockCandidate, + fabric::run_validate_query_any_candidate, + validator_utils::{ + is_smft_enabled, try_calc_vset_for_workchain, try_calc_subset_for_workchain_standard + }, + verification::{ + GENERATE_MISSING_BLS_KEY, VerificationFactory, VerificationListener, + VerificationManagerPtr + } +}; #[cfg(feature = "slashing")] use crate::validator::slashing::{SlashingManager, SlashingManagerPtr}; @@ -47,18 +56,15 @@ use std::{ sync::Arc, time::{Duration, SystemTime} }; -use crate::validator::verification::{VerificationFactory, VerificationListener, VerificationManagerPtr}; -use crate::validator::verification::GENERATE_MISSING_BLS_KEY; -use crate::validator::BlockCandidate; use spin::mutex::SpinMutex; use tokio::time::timeout; use ton_api::IntoBoxed; -use ton_block::{ +use ever_block::{ BlockIdExt, ConfigParamEnum, ConsensusConfig, FutureSplitMerge, McStateExtra, ShardDescr, ShardIdent, ValidatorDescr, ValidatorSet, BASE_WORKCHAIN_ID, MASTERCHAIN_ID, GlobalCapabilities, CatchainConfig, UnixTime32 }; -use ton_types::{error, fail, Result, UInt256}; +use ever_block::{error, fail, Result, UInt256}; use crate::block::BlockIdExtExtention; @@ -368,13 +374,14 @@ impl ValidatorManagerImpl { #[cfg(feature = "slashing")] slashing_manager: SlashingManager::create(), verification_manager: SpinMutex::new(None), - verification_listener: SpinMutex::new(None), + verification_listener: SpinMutex::new(None) }, remp_interface_queues) } /// Create/destroy verification manager fn update_verification_manager_usage(&self, mc_state_extra: &McStateExtra) { - let smft_enabled = !self.config.smft_disabled && crate::validator::validator_utils::is_smft_enabled(self.engine.clone(), mc_state_extra.config()); + let smft_enabled = !self.config.smft_disabled && + is_smft_enabled(self.engine.clone(), mc_state_extra.config()); let verification_manager = self.verification_manager.lock().clone(); let has_verification_manager = verification_manager.is_some(); @@ -1310,7 +1317,7 @@ impl ValidatorManagerImpl { self.config.unsafe_resync_catchains.contains(next_cc_seqno), #[cfg(feature = "slashing")] self.slashing_manager.clone(), - verification_manager, + verification_manager )); self.validator_sessions.insert(session_id, session); } diff --git a/src/validator/validator_session_listener.rs b/src/validator/validator_session_listener.rs index fdeff1e3..0b5b004b 100644 --- a/src/validator/validator_session_listener.rs +++ b/src/validator/validator_session_listener.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -218,28 +218,49 @@ impl CatchainReplayListener for ValidatorSessionListener { } } -async fn process_validation_action (action: ValidationAction, g: Arc, rt: tokio::runtime::Handle) { +async fn process_validation_action( + action: ValidationAction, + g: Arc, + rt: tokio::runtime::Handle +) { let action_str = format!("{}", action); let next_block_descr = g.get_next_block_descr().await; - log::info!(target: "validator", "({}): Processing action: {}, {}", next_block_descr, action_str, g.info().await); + log::info!( + target: "validator", + "({}): Processing action: {}, {}", next_block_descr, action_str, g.info().await + ); match action { - ValidationAction::OnGenerateSlot {round, callback} => g.on_generate_slot (round, callback, rt).await, + ValidationAction::OnGenerateSlot {round, callback} => g.on_generate_slot( + round, + callback, + rt + ).await, ValidationAction::OnCandidate {round, source, root_hash, data, collated_data, callback} => g.on_candidate (round, source, root_hash, data, collated_data, callback).await, - ValidationAction::OnBlockCommitted(OnBlockCommitted{ round, source, root_hash, file_hash, data, signatures, approve_signatures }) => + ValidationAction::OnBlockCommitted( + OnBlockCommitted { + round, source, root_hash, file_hash, data, signatures, approve_signatures + } + ) => //panic!("ValidatorAction::OnBlockCommitted must be processed in a separate thread!"); - g.on_block_committed (round, source, root_hash, file_hash, data, signatures, approve_signatures).await, + g.on_block_committed ( + round, source, root_hash, file_hash, data, signatures, approve_signatures + ).await, ValidationAction::OnBlockSkipped { round } => g.on_block_skipped(round).await, - ValidationAction::OnGetApprovedCandidate { source, root_hash, file_hash, collated_data_hash, callback} => - g.on_get_approved_candidate(source, root_hash, file_hash, collated_data_hash, callback).await, + ValidationAction::OnGetApprovedCandidate { + source, root_hash, file_hash, collated_data_hash, callback + } => + g.on_get_approved_candidate( + source, root_hash, file_hash, collated_data_hash, callback + ).await, #[cfg(feature = "slashing")] ValidationAction::OnSlashingStatistics { round, stat } => - g.on_slashing_statistics(round, stat) + g.on_slashing_statistics(round, stat).await } } @@ -318,7 +339,11 @@ pub async fn process_validation_queue( let start_time = SystemTime::now(); let rt_clone = rt.clone(); let mut join_handle = rt.spawn(async move { - process_validation_action (action, g_clone, rt_clone).await; + process_validation_action( + action, + g_clone, + rt_clone + ).await; }); loop { diff --git a/src/validator/validator_utils.rs b/src/validator/validator_utils.rs index 4a02c914..9df997d1 100644 --- a/src/validator/validator_utils.rs +++ b/src/validator/validator_utils.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -17,18 +17,16 @@ use crate::{ }; use catchain::{BlockPayloadPtr, CatchainNode, PublicKey, PublicKeyHash}; +use ever_block::{ + error, fail, BlockIdExt, BlockInfo, BlockSignatures, BlockSignaturesPure, BuilderData, + ConfigParams, CryptoSignature, CryptoSignaturePair, Deserializable, Ed25519KeyOption, + GlobalCapabilities, HashmapType, KeyId, Message, Result, Serializable, Sha256, ShardIdent, + SigPubKey, UInt256, UnixTime32, ValidatorBaseInfo, ValidatorDescr, ValidatorSet, Workchains, + WorkchainDescr +}; +use ever_block::CatchainConfig; use std::{collections::HashMap, fmt::Debug, hash::Hash, sync::Arc}; use ton_api::ton::engine::validator::validator::groupmember::GroupMember; -use ton_block::{ - BlockIdExt, BlockInfo, BlockSignatures, BlockSignaturesPure, CatchainConfig, ConfigParams, - CryptoSignature, CryptoSignaturePair, Deserializable, GlobalCapabilities, Message, - Serializable, ShardIdent, SigPubKey, UnixTime32, ValidatorBaseInfo, ValidatorDescr, - ValidatorSet, Workchains, WorkchainDescr -}; -use ton_types::{ - error, fail, BuilderData, HashmapType, Ed25519KeyOption, KeyId, - Result, Sha256, UInt256 -}; use validator_session::SessionNode; #[cfg(test)] @@ -111,7 +109,7 @@ pub fn validatordescr_to_catchain_node(descr: &ValidatorDescr) -> CatchainNode { } } -pub fn validatordescr_to_session_node(descr: &ValidatorDescr) -> ton_types::Result { +pub fn validatordescr_to_session_node(descr: &ValidatorDescr) -> Result { Ok(validator_session::SessionNode { adnl_id: get_adnl_id(descr), public_key: sigpubkey_to_publickey(&descr.public_key), diff --git a/src/validator/verification/block.rs b/src/validator/verification/block.rs index b586f8d9..42c4760a 100644 --- a/src/validator/verification/block.rs +++ b/src/validator/verification/block.rs @@ -21,7 +21,7 @@ use spin::mutex::SpinMutex; use ton_api::ton::ton_node::blockcandidatestatus::BlockCandidateStatus; use ton_api::ton::ton_node::broadcast::BlockCandidateBroadcast; use ton_api::IntoBoxed; -use ton_types::Result; +use ever_block::Result; use validator_session::ValidatorWeight; use catchain::serialize_tl_boxed_object; @@ -250,8 +250,8 @@ impl Block { return serialized_block_status.clone(); } - let ton_block = self.status().into_boxed(); - let serialized_block_status = serialize_tl_boxed_object!(&ton_block); + let ever_block = self.status().into_boxed(); + let serialized_block_status = serialize_tl_boxed_object!(&ever_block); let serialized_block_status = catchain::CatchainFactory::create_block_payload(serialized_block_status); diff --git a/src/validator/verification/mod.rs b/src/validator/verification/mod.rs index 88b0d27f..c6d9f705 100644 --- a/src/validator/verification/mod.rs +++ b/src/validator/verification/mod.rs @@ -11,6 +11,8 @@ * limitations under the License. */ +#![cfg(not(feature = "fast_finality"))] + extern crate catchain; use crate::engine_traits::EngineOperations; @@ -19,11 +21,7 @@ use std::collections::HashMap; /// API dependencies use std::sync::Arc; use std::sync::Weak; -use ton_block::BlockIdExt; -use ton_block::ValidatorDescr; -use ton_types::UInt256; -use ton_types::KeyOption; -use ton_types::Result; +use ever_block::{BlockIdExt, KeyOption, Result, UInt256, ValidatorDescr}; use validator_session::PrivateKey; use validator_session::PublicKeyHash; use catchain::profiling::InstanceCounter; diff --git a/src/validator/verification/multi_signature_bls.rs b/src/validator/verification/multi_signature_bls.rs index a2896ee9..0448965c 100644 --- a/src/validator/verification/multi_signature_bls.rs +++ b/src/validator/verification/multi_signature_bls.rs @@ -12,19 +12,18 @@ */ use super::*; -use ton_types::Result; +use ever_block::{ + crc32_digest, Result, + bls::{ + aggregate_two_bls_signatures, aggregate_public_keys_based_on_nodes_info, + BLS_PUBLIC_KEY_LEN, BLS_SECRET_KEY_LEN, get_nodes_info_from_sig, NodesInfo, + sign_and_add_node_info, truncate_nodes_info_and_verify + } +}; use std::time::SystemTime; use std::time::Duration; use validator_session::ValidatorWeight; use catchain::check_execution_time; -use ton_types::bls::get_nodes_info_from_sig; -use ton_types::bls::sign_and_add_node_info; -use ton_types::bls::aggregate_two_bls_signatures; -use ton_types::bls::aggregate_public_keys_based_on_nodes_info; -use ton_types::bls::NodesInfo; -use ton_types::bls::BLS_PUBLIC_KEY_LEN; -use ton_types::bls::BLS_SECRET_KEY_LEN; -use ton_types::bls::truncate_nodes_info_and_verify; /* Constants @@ -155,7 +154,7 @@ impl MultiSignature { } } - let hash = ton_types::crc32_digest(Self::raw_byte_access(&new_nodes)); + let hash = crc32_digest(Self::raw_byte_access(&new_nodes)); (new_nodes, hash) } diff --git a/src/validator/verification/multi_signature_unsafe.rs b/src/validator/verification/multi_signature_unsafe.rs index 1bd4a63a..decc1a4b 100644 --- a/src/validator/verification/multi_signature_unsafe.rs +++ b/src/validator/verification/multi_signature_unsafe.rs @@ -12,9 +12,8 @@ */ use super::*; -use ton_types::Result; +use ever_block::{crc32_digest, Result, bls::BLS_PUBLIC_KEY_LEN}; use validator_session::ValidatorWeight; -use ton_types::bls::BLS_PUBLIC_KEY_LEN; /* =============================================================================== @@ -142,7 +141,7 @@ impl MultiSignature { /// Update hash fn update_hash(&mut self) { - self.hash = ton_types::crc32_digest(Self::raw_byte_access(&self.nodes)) + self.hash = crc32_digest(Self::raw_byte_access(&self.nodes)) } /// Serialize signature diff --git a/src/validator/verification/utils.rs b/src/validator/verification/utils.rs index a58032fe..22953184 100644 --- a/src/validator/verification/utils.rs +++ b/src/validator/verification/utils.rs @@ -18,8 +18,8 @@ use std::time::Duration; use std::sync::atomic::AtomicBool; use std::sync::atomic::Ordering; use log::warn; -use ton_api::IntoBoxed; -use ton_types::KeyOption; +use ever_block::{KeyId, KeyOption, Result}; +use ton_api::IntoBoxed; /* Constants @@ -81,12 +81,12 @@ impl Drop for HangCheck { Utils */ -pub(crate) fn get_adnl_id(validator: &ValidatorDescr) -> Arc { +pub(crate) fn get_adnl_id(validator: &ValidatorDescr) -> Arc { super::super::validator_utils::get_adnl_id(validator) //ever_crypto::KeyId::from_data(validator.compute_node_id_short().inner()) } -pub(crate) fn into_public_key_tl(opt: &Arc) -> ton_types::Result { +pub(crate) fn into_public_key_tl(opt: &Arc) -> Result { let pub_key = opt.pub_key()?; use ton_api::ton::pub_::publickey::Bls; Ok(Bls { @@ -95,8 +95,7 @@ pub(crate) fn into_public_key_tl(opt: &Arc) -> ton_typ } pub(crate) fn generate_test_bls_key(public_key: &Arc) -> Result> { - use ton_types::BlsKeyOption; - use ton_types::BLS_KEY_MATERIAL_LEN; + use ever_block::{BlsKeyOption, BLS_KEY_MATERIAL_LEN}; log::debug!(target: "verificator", "Generate BLS key from public validator's key {}", public_key.id()); diff --git a/src/validator/verification/verification_manager.rs b/src/validator/verification/verification_manager.rs index 50c408b9..2493c5c6 100644 --- a/src/validator/verification/verification_manager.rs +++ b/src/validator/verification/verification_manager.rs @@ -24,7 +24,7 @@ use std::time::Duration; use std::time::UNIX_EPOCH; use spin::mutex::SpinMutex; use ton_api::ton::ton_node::broadcast::BlockCandidateBroadcast; -use ton_types::Result; +use ever_block::Result; use catchain::utils::MetricsDumper; use catchain::utils::MetricsHandle; use catchain::PublicKeyHash; diff --git a/src/validator/verification/workchain.rs b/src/validator/verification/workchain.rs index 41bb3534..39f18af8 100644 --- a/src/validator/verification/workchain.rs +++ b/src/validator/verification/workchain.rs @@ -32,16 +32,15 @@ use tokio::time::sleep; use std::time::SystemTime; use std::time::Duration; use spin::mutex::SpinMutex; +use ever_block::{crc32_digest, Result, bls::BLS_PUBLIC_KEY_LEN}; use ton_api::ton::ton_node::blockcandidatestatus::BlockCandidateStatus; use ton_api::ton::ton_node::broadcast::BlockCandidateBroadcast; -use ton_types::Result; use validator_session::ValidatorWeight; use catchain::utils::MetricsDumper; use catchain::utils::MetricsHandle; use metrics::Recorder; use catchain::utils::add_compute_relative_metric; use catchain::utils::add_compute_result_metric; -use ton_types::bls::BLS_PUBLIC_KEY_LEN; //TODO: cutoff weight configuration //TODO: neighbours mode configuration @@ -1068,7 +1067,7 @@ impl Workchain { payload.append(&mut local_key_payload); let payload_ptr = unsafe { std::slice::from_raw_parts(payload.as_ptr() as *const u8, payload.len()) }; - let hash = ton_types::crc32_digest(payload_ptr); + let hash = crc32_digest(payload_ptr); if self.wc_validators.len () < 1 { return false; //no verification in empty workchain diff --git a/src/validator/verification/workchain_overlay.rs b/src/validator/verification/workchain_overlay.rs index 85fa7a6f..242aaacf 100644 --- a/src/validator/verification/workchain_overlay.rs +++ b/src/validator/verification/workchain_overlay.rs @@ -38,7 +38,7 @@ use std::time::SystemTime; use tokio::time::sleep; use ton_api::ton::ton_node::blockcandidatestatus::BlockCandidateStatus; use ton_api::ton::ton_node::Broadcast; -use ton_types::Result; +use ever_block::Result; //TODO: traffic metrics & derivatives //TODO: remove dependency from CatchainClient? (use private overlay directly) diff --git a/src/validator/workchains_fast_finality.rs b/src/validator/workchains_fast_finality.rs deleted file mode 100644 index d88880ca..00000000 --- a/src/validator/workchains_fast_finality.rs +++ /dev/null @@ -1,75 +0,0 @@ -use std::sync::Arc; -use ton_types::{Result, fail, error}; -use ton_block::{ShardHashes, ShardIdent, ValidatorSet}; -use crate::shard_state::ShardStateStuff; -use crate::validator::sessions_computing::SessionValidatorsInfo; -use crate::validator::validator_utils::ValidatorSubsetInfo; - -#[cfg(test)] -#[path = "tests/test_workchains_fast_finality.rs"] -mod tests; - -/* #[cfg(feature = "fast_finality")] -fn get_possible_next_collator_range_for_shard( - col: &ShardCollators, current_shard: &ShardIdent, shard_id: &ShardIdent -) -> Result> -{ - let mut shards = Vec::new(); - // Shard may stay in place - if col.next2.is_none() { - shards.push((current_shard.clone(), col.next.clone())) - } - // Shard may merge with something else - if !current_shard.is_full() && col.next2.is_none() { - shards.push((current_shard.merge()?, col.next.clone())); - } - // Shard may split - if current_shard.can_split() { - if let Some(next_right) = &col.next2 { - let (l, r) = current_shard.split()?; - shards.push((l, col.next.clone())); - shards.push((r, next_right.clone())); - } - } - - shards.retain(|(candidate,_collator)| candidate == shard_id); - if shards.len() > 1 { - fail!("Too many next collator ranges for shard {}: current shard {}, {:?}", shard_id, current_shard, shards); - } - Ok(shards.get(0).map(|(_,collator)| collator.clone())) -} */ - -/* -*/ - -/* #[cfg(feature = "fast_finality")] -pub fn try_calc_next_subset_for_workchain_fast_finality( - vset: &ValidatorSet, - cc_seqno: u32, - mc_state: &ShardStateStuff, - future_shard: &ShardIdent -) -> Result> { - - log::debug!( - target: "validator_manager", - "try_calc_next_subset_for_workchain_fast_finality: mc_state: {}, future_shard {}", - mc_state.block_id(), future_shard - ); - - let shards = mc_state.shards()?; - let mut possible_validators = Vec::new(); - - shards.iterate_shards_for_workchain(future_shard.workchain_id(), |ident, descr| { - let collators = descr.collators.ok_or_else(|| error!("{} has no collator info", ident))?; - let possible_next = get_possible_next_collator_range_for_shard(&collators, &ident, &future_shard)?; - if let Some(rng) = possible_next { - if !possible_validators.contains(&rng) { - possible_validators.push(rng); - } - }; - Ok(true) - })?; - - get_validator_descrs_by_collator_range(&vset, cc_seqno, &possible_validators, true) -} */ - diff --git a/storage/Cargo.toml b/storage/Cargo.toml index 234cc66f..afd588d3 100644 --- a/storage/Cargo.toml +++ b/storage/Cargo.toml @@ -26,11 +26,10 @@ serde_derive = '1.0.114' strum = '0.18.0' strum_macros = '0.18.0' tokio = { features = [ 'fs', 'rt-multi-thread' ], version = '1.5' } -adnl = { git = 'https://github.com/tonlabs/ever-adnl.git', tag = '0.10.15' } -lockfree = { git = 'https://github.com/tonlabs/lockfree.git' } -ton_api = { git = 'https://github.com/tonlabs/ever-tl.git', package = 'ton_api', tag = '0.3.72' } -ton_block = { git = 'https://github.com/tonlabs/ever-block.git', tag = '1.9.141' } -ton_types = { git = 'https://github.com/tonlabs/ever-types.git', tag = '2.0.39' } +adnl = { git = 'https://github.com/everx-labs/ever-adnl.git', tag = '0.10.22' } +ever_block = { git = 'https://github.com/everx-labs/ever-block.git', tag = '1.10.0' } +lockfree = { git = 'https://github.com/everx-labs/lockfree.git' } +ton_api = { git = 'https://github.com/everx-labs/ever-tl.git', package = 'ton_api', tag = '0.3.77' } [build-dependencies] cc = { features = [ 'parallel' ], version = '1.0.61' } diff --git a/storage/benches/shardstate_db.rs b/storage/benches/shardstate_db.rs index 8de13d6a..b57328bd 100644 --- a/storage/benches/shardstate_db.rs +++ b/storage/benches/shardstate_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -19,8 +19,8 @@ use storage::{ }; #[cfg(feature = "telemetry")] use storage::StorageTelemetry; -use ton_block::{BlockIdExt, ShardIdent}; -use ton_types::{Cell, Result, BuilderData}; +use ever_block::{BlockIdExt, ShardIdent}; +use ever_block::{Cell, Result, BuilderData}; use rand::{Rng, SeedableRng}; include!("../src/db/tests/destroy_db.rs"); diff --git a/storage/src/archives/archive_manager.rs b/storage/src/archives/archive_manager.rs index 9fa5cbab..ea9828e8 100644 --- a/storage/src/archives/archive_manager.rs +++ b/storage/src/archives/archive_manager.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -25,10 +25,10 @@ use crate::{ use crate::StorageTelemetry; use std::{borrow::Borrow, hash::Hash, io::ErrorKind, path::PathBuf, sync::Arc, time::Instant}; use tokio::io::AsyncWriteExt; -use ton_block::{ +use ever_block::{ BlockIdExt, ShardIdent, }; -use ton_types::{error, fail, Result, UInt256}; +use ever_block::{error, fail, Result, UInt256}; #[cfg(test)] #[path = "tests/test_archive_manager.rs"] diff --git a/storage/src/archives/archive_slice.rs b/storage/src/archives/archive_slice.rs index bcafcdf6..147a4fcf 100644 --- a/storage/src/archives/archive_slice.rs +++ b/storage/src/archives/archive_slice.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -28,8 +28,8 @@ use crate::{ use crate::StorageTelemetry; use std::{borrow::Borrow, hash::Hash, io::SeekFrom, path::PathBuf, sync::Arc}; use tokio::io::{AsyncReadExt, AsyncSeekExt}; -use ton_block::BlockIdExt; -use ton_types::{error, fail, Result, UInt256}; +use ever_block::BlockIdExt; +use ever_block::{error, fail, Result, UInt256}; #[cfg(test)] #[path = "tests/test_archive_slice.rs"] diff --git a/storage/src/archives/file_maps.rs b/storage/src/archives/file_maps.rs index 54a4c472..7d9d9357 100644 --- a/storage/src/archives/file_maps.rs +++ b/storage/src/archives/file_maps.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -25,8 +25,8 @@ use adnl::{declare_counted, common::{CountedObject, Counter}}; use std::{path::PathBuf, sync::Arc}; #[cfg(feature = "telemetry")] use std::sync::atomic::Ordering; -use ton_types::{Result, error, fail}; -use ton_block::BlockIdExt; +use ever_block::{Result, error, fail}; +use ever_block::BlockIdExt; use super::ARCHIVE_SLICE_SIZE; diff --git a/storage/src/archives/mod.rs b/storage/src/archives/mod.rs index ecf8b898..d3a25089 100644 --- a/storage/src/archives/mod.rs +++ b/storage/src/archives/mod.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/storage/src/archives/package.rs b/storage/src/archives/package.rs index 1043c1fc..59327f8b 100644 --- a/storage/src/archives/package.rs +++ b/storage/src/archives/package.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,14 +7,14 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::archives::package_entry::{PackageEntry, PKG_ENTRY_HEADER_SIZE}; use std::{io::SeekFrom, path::{Path, PathBuf}, sync::atomic::{AtomicU64, Ordering}}; use tokio::io::{AsyncSeekExt, AsyncWriteExt}; -use ton_types::{error, fail, Result}; +use ever_block::{error, fail, Result}; #[cfg(test)] #[path = "tests/test_package.rs"] diff --git a/storage/src/archives/package_entry.rs b/storage/src/archives/package_entry.rs index 1ee439c0..bb06b61b 100644 --- a/storage/src/archives/package_entry.rs +++ b/storage/src/archives/package_entry.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,13 +7,13 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::traits::Serializable; use std::io::{Read, Write}; -use ton_types::{ByteOrderRead, fail, Result}; +use ever_block::{ByteOrderRead, fail, Result}; pub(crate) const PKG_ENTRY_HEADER_SIZE: usize = 8; const PKG_ENTRY_HEADER_MAGIC: u16 = 0x1E8B; diff --git a/storage/src/archives/package_entry_id.rs b/storage/src/archives/package_entry_id.rs index 975d6c58..3e84e0b0 100644 --- a/storage/src/archives/package_entry_id.rs +++ b/storage/src/archives/package_entry_id.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -17,8 +17,8 @@ use std::fmt::{Display, Formatter}; use std::hash::{Hash, Hasher}; use std::str::FromStr; -use ton_block::{BlockIdExt, ShardIdent}; -use ton_types::{error, fail, base64_encode, Result, UInt256}; +use ever_block::{BlockIdExt, ShardIdent}; +use ever_block::{error, fail, base64_encode, Result, UInt256}; #[cfg(test)] #[path = "tests/test_package_entry_id.rs"] diff --git a/storage/src/archives/package_entry_meta.rs b/storage/src/archives/package_entry_meta.rs index 4e622efc..03c022cd 100644 --- a/storage/src/archives/package_entry_meta.rs +++ b/storage/src/archives/package_entry_meta.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/storage/src/archives/package_entry_meta_db.rs b/storage/src/archives/package_entry_meta_db.rs index 95f7f653..b21dfd19 100644 --- a/storage/src/archives/package_entry_meta_db.rs +++ b/storage/src/archives/package_entry_meta_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/storage/src/archives/package_id.rs b/storage/src/archives/package_id.rs index 60f4ec4f..cc937e6d 100644 --- a/storage/src/archives/package_id.rs +++ b/storage/src/archives/package_id.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,13 +7,13 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::archives::{ARCHIVE_SIZE, KEY_ARCHIVE_SIZE}; use std::{cmp::Ordering, ffi::OsString, path::{Path, PathBuf}}; -use ton_block::UnixTime32; +use ever_block::UnixTime32; #[cfg(test)] #[path = "tests/test_package_id.rs"] diff --git a/storage/src/archives/package_index_db.rs b/storage/src/archives/package_index_db.rs index 8f91c88b..d94a46ad 100644 --- a/storage/src/archives/package_index_db.rs +++ b/storage/src/archives/package_index_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,13 +7,13 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::{db_impl_cbor, db::traits::{KvcWriteable, U32Key}}; use std::convert::TryInto; -use ton_types::Result; +use ever_block::Result; #[derive(serde::Serialize, serde::Deserialize)] pub struct PackageIndexEntry { diff --git a/storage/src/archives/package_info.rs b/storage/src/archives/package_info.rs index da8ad1ce..89bb151c 100644 --- a/storage/src/archives/package_info.rs +++ b/storage/src/archives/package_info.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -18,7 +18,7 @@ use adnl::{declare_counted, common::{CountedObject, Counter}}; use std::sync::Arc; #[cfg(feature = "telemetry")] use std::sync::atomic::Ordering; -use ton_types::Result; +use ever_block::Result; //#[derive(Debug)] declare_counted!( diff --git a/storage/src/archives/package_offsets_db.rs b/storage/src/archives/package_offsets_db.rs index b83daca0..8abfc949 100644 --- a/storage/src/archives/package_offsets_db.rs +++ b/storage/src/archives/package_offsets_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -16,8 +16,8 @@ use crate::{ db::traits::{DbKey, KvcWriteable} }; use std::{borrow::Borrow, collections::hash_map::DefaultHasher, hash::{Hash, Hasher}}; -use ton_block::BlockIdExt; -use ton_types::UInt256; +use ever_block::BlockIdExt; +use ever_block::UInt256; pub struct PackageOffsetKey { entry_id_hash: [u8; 8], diff --git a/storage/src/archives/package_status_db.rs b/storage/src/archives/package_status_db.rs index d07c5469..c7fe12dd 100644 --- a/storage/src/archives/package_status_db.rs +++ b/storage/src/archives/package_status_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -16,7 +16,7 @@ use crate::{ db::traits::KvcTransactional, traits::Serializable }; use std::borrow::Borrow; -use ton_types::Result; +use ever_block::Result; db_impl_base!(PackageStatusDb, KvcTransactional, PackageStatusKey); diff --git a/storage/src/archives/package_status_key.rs b/storage/src/archives/package_status_key.rs index 4b04110b..c001ad19 100644 --- a/storage/src/archives/package_status_key.rs +++ b/storage/src/archives/package_status_key.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/storage/src/archives/tests/test_archive_manager.rs b/storage/src/archives/tests/test_archive_manager.rs index 519d3cdf..54e161fb 100644 --- a/storage/src/archives/tests/test_archive_manager.rs +++ b/storage/src/archives/tests/test_archive_manager.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -22,8 +22,8 @@ use crate::{ #[cfg(feature = "telemetry")] use crate::StorageTelemetry; use std::{path::Path, sync::Arc}; -use ton_block::{BlockIdExt, ShardIdent}; -use ton_types::{error, Result, UInt256}; +use ever_block::{BlockIdExt, ShardIdent}; +use ever_block::{error, Result, UInt256}; include!("../../db/tests/destroy_db.rs"); diff --git a/storage/src/archives/tests/test_archive_slice.rs b/storage/src/archives/tests/test_archive_slice.rs index 6eaf5d03..f7cdc858 100644 --- a/storage/src/archives/tests/test_archive_slice.rs +++ b/storage/src/archives/tests/test_archive_slice.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -24,8 +24,8 @@ use crate::{ #[cfg(feature = "telemetry")] use crate::StorageTelemetry; use std::{future::Future, path::Path, pin::Pin, sync::Arc}; -use ton_block::{BlockIdExt, ShardIdent}; -use ton_types::{error, Result, UInt256}; +use ever_block::{BlockIdExt, ShardIdent}; +use ever_block::{error, Result, UInt256}; include!("../../db/tests/destroy_db.rs"); diff --git a/storage/src/archives/tests/test_package.rs b/storage/src/archives/tests/test_package.rs index c3c4394d..a1f7e0bc 100644 --- a/storage/src/archives/tests/test_package.rs +++ b/storage/src/archives/tests/test_package.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -16,8 +16,8 @@ use crate::archives::{ package_entry_id::{GetFileName, PackageEntryId}, package_id::PackageId }; use std::{fs, path::{Path, PathBuf}, str::FromStr}; -use ton_block::BlockIdExt; -use ton_types::{Result, UInt256}; +use ever_block::BlockIdExt; +use ever_block::{Result, UInt256}; const DB_PATH: &str = "../target/test"; diff --git a/storage/src/archives/tests/test_package_entry_id.rs b/storage/src/archives/tests/test_package_entry_id.rs index 855e9579..f5cb01f9 100644 --- a/storage/src/archives/tests/test_package_entry_id.rs +++ b/storage/src/archives/tests/test_package_entry_id.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,14 +7,14 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use super::*; use crate::archives::package_entry_id::{GetFileName, PackageEntryId}; -use ton_block::{BlockIdExt, ShardIdent}; -use ton_types::UInt256; +use ever_block::{BlockIdExt, ShardIdent}; +use ever_block::UInt256; #[test] fn test_filenames() { diff --git a/storage/src/archives/tests/test_package_id.rs b/storage/src/archives/tests/test_package_id.rs index ee2b6fa7..fe258c93 100644 --- a/storage/src/archives/tests/test_package_id.rs +++ b/storage/src/archives/tests/test_package_id.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,14 +7,14 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::archives::package_id::PackageType; use super::PackageId; use std::path::Path; -use ton_block::UnixTime32; +use ever_block::UnixTime32; #[test] fn test_construction() { diff --git a/storage/src/block_db.rs b/storage/src/block_db.rs index e3766c1d..ae27e274 100644 --- a/storage/src/block_db.rs +++ b/storage/src/block_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,11 +7,11 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::{db_impl_base, db::traits::KvcWriteable}; -use ton_block::BlockIdExt; +use ever_block::BlockIdExt; db_impl_base!(BlockDb, KvcWriteable, BlockIdExt); diff --git a/storage/src/block_handle_db.rs b/storage/src/block_handle_db.rs index 98cd8ea0..f3ebb43e 100644 --- a/storage/src/block_handle_db.rs +++ b/storage/src/block_handle_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -28,8 +28,8 @@ use adnl::{ use std::{io::{Cursor, Write, Read}, sync::{Arc, Weak}}; #[cfg(feature = "telemetry")] use std::sync::atomic::{AtomicBool, Ordering}; -use ton_block::{BlockIdExt, ShardIdent}; -use ton_types::{error, fail, Result, UInt256, ByteOrderRead}; +use ever_block::{BlockIdExt, ShardIdent}; +use ever_block::{error, fail, Result, UInt256, ByteOrderRead}; #[cfg(test)] #[path = "tests/test_block_handle_db.rs"] diff --git a/storage/src/block_info_db.rs b/storage/src/block_info_db.rs index 91645d6c..be26b5b1 100644 --- a/storage/src/block_info_db.rs +++ b/storage/src/block_info_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,11 +7,11 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::{db_impl_base, db::traits::KvcWriteable}; -use ton_block::BlockIdExt; +use ever_block::BlockIdExt; db_impl_base!(BlockInfoDb, KvcWriteable, BlockIdExt); diff --git a/storage/src/catchain_persistent_db.rs b/storage/src/catchain_persistent_db.rs index c3dc5938..bde48a7f 100644 --- a/storage/src/catchain_persistent_db.rs +++ b/storage/src/catchain_persistent_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,10 +7,10 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::{db_impl_single, db::traits::KvcWriteable}; -db_impl_single!(CatchainPersistentDb, KvcWriteable, ton_types::types::UInt256); +db_impl_single!(CatchainPersistentDb, KvcWriteable, ever_block::types::UInt256); diff --git a/storage/src/cell_db.rs b/storage/src/cell_db.rs index 5ade5f73..156d3140 100644 --- a/storage/src/cell_db.rs +++ b/storage/src/cell_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -20,7 +20,7 @@ use crate::{ use crate::dynamic_boc_rc_db::DynamicBocDb; use std::{sync::Arc, io::{Cursor, Write}}; -use ton_types::{Result, IndexedCellsStorage, RawCell, MAX_REFERENCES_COUNT, ByteOrderRead, UInt256}; +use ever_block::{Result, IndexedCellsStorage, RawCell, MAX_REFERENCES_COUNT, ByteOrderRead, UInt256}; db_impl_base!(CellDb, KvcTransactional, UInt256); diff --git a/storage/src/db/async_adapter.rs b/storage/src/db/async_adapter.rs index e1e1f45f..034199e9 100644 --- a/storage/src/db/async_adapter.rs +++ b/storage/src/db/async_adapter.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -19,7 +19,7 @@ use crate::{ }; use async_trait::async_trait; use std::{fmt::Debug, marker::PhantomData, ops::Deref}; -use ton_types::Result; +use ever_block::Result; /// This facade wraps key-value collections implementing sync traits into async traits #[derive(Debug)] diff --git a/storage/src/db/filedb.rs b/storage/src/db/filedb.rs index 8df5b64e..26be0f29 100644 --- a/storage/src/db/filedb.rs +++ b/storage/src/db/filedb.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -17,7 +17,7 @@ use crate::{ }; use std::{io::{ErrorKind, SeekFrom, Write, Read, Seek}, path::{Path, PathBuf}}; use tokio::io::{AsyncReadExt, AsyncSeekExt}; -use ton_types::{error, Result}; +use ever_block::{error, Result}; #[derive(Debug)] pub struct FileDb { diff --git a/storage/src/db/memorydb.rs b/storage/src/db/memorydb.rs index 43ca8dab..7b40ce5c 100644 --- a/storage/src/db/memorydb.rs +++ b/storage/src/db/memorydb.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -19,7 +19,7 @@ use crate::{ }; use std::sync::{Arc, Mutex}; use fnv::FnvHashMap; -use ton_types::Result; +use ever_block::Result; pub type MemoryDbMap = FnvHashMap, Vec>; diff --git a/storage/src/db/mod.rs b/storage/src/db/mod.rs index e9886f1c..c2b32a64 100644 --- a/storage/src/db/mod.rs +++ b/storage/src/db/mod.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/storage/src/db/rocksdb.rs b/storage/src/db/rocksdb.rs index d8fc6122..eb414080 100644 --- a/storage/src/db/rocksdb.rs +++ b/storage/src/db/rocksdb.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -27,8 +27,8 @@ use std::{ fmt::{Debug, Formatter}, ops::Deref, path::Path, sync::{Arc, atomic::{AtomicI32, Ordering}}, io::Cursor, collections::HashSet, }; -use ton_types::{fail, error, Result}; -use ton_block::BlockIdExt; +use ever_block::{fail, error, Result}; +use ever_block::BlockIdExt; pub const LAST_UNNEEDED_KEY_BLOCK: &str = "LastUnneededKeyBlockId"; // Latest key block we can delete in archives GC pub const NODE_STATE_DB_NAME: &str = "node_state_db"; diff --git a/storage/src/db/tests/destroy_db.rs b/storage/src/db/tests/destroy_db.rs index daadcc8f..f564e4a5 100644 --- a/storage/src/db/tests/destroy_db.rs +++ b/storage/src/db/tests/destroy_db.rs @@ -1,5 +1,5 @@ -pub async fn destroy_rocks_db(path: &str, name: &str) -> ton_types::Result<()> { +pub async fn destroy_rocks_db(path: &str, name: &str) -> ever_block::Result<()> { tokio::time::sleep(std::time::Duration::from_millis(1000)).await; let mut path = std::path::Path::new(path); let db_path = path.join(name); @@ -21,7 +21,7 @@ pub async fn destroy_rocks_db(path: &str, name: &str) -> ton_types::Result<()> { // Clean up DB folder if db_path.exists() { std::fs::remove_dir_all(db_path).map_err( - |e| ton_types::error!("Can't clean DB folder: {}", e) + |e| ever_block::error!("Can't clean DB folder: {}", e) )? } // Clean up upper folder if empty @@ -30,7 +30,7 @@ pub async fn destroy_rocks_db(path: &str, name: &str) -> ton_types::Result<()> { break } std::fs::remove_dir_all(path).map_err( - |e| ton_types::error!("Can't clean DB enclosing folder: {}", e) + |e| ever_block::error!("Can't clean DB enclosing folder: {}", e) )?; path = if let Some(path) = path.parent() { path diff --git a/storage/src/db/tests/mod.rs b/storage/src/db/tests/mod.rs index 9aee997b..8b3e71a6 100644 --- a/storage/src/db/tests/mod.rs +++ b/storage/src/db/tests/mod.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -18,7 +18,7 @@ pub mod test_rocksdb; pub mod utils { use crate::{db::traits::DbKey, error::StorageError}; - use ton_types::Result; + use ever_block::Result; pub const KEY0: &[u8] = b"key0"; pub const KEY1: &[u8] = b"key1"; diff --git a/storage/src/db/tests/test_filedb.rs b/storage/src/db/tests/test_filedb.rs index ee794cb1..622c2c06 100644 --- a/storage/src/db/tests/test_filedb.rs +++ b/storage/src/db/tests/test_filedb.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -18,7 +18,7 @@ use crate::{ error::StorageError }; use std::{ops::{Deref, DerefMut}, path::Path}; -use ton_types::Result; +use ever_block::Result; const KEY0: &[u8] = b"key0key0key0key0"; const KEY1: &[u8] = b"key1key1key1key1"; diff --git a/storage/src/db/tests/test_memorydb.rs b/storage/src/db/tests/test_memorydb.rs index e5d28dcb..b1436cb6 100644 --- a/storage/src/db/tests/test_memorydb.rs +++ b/storage/src/db/tests/test_memorydb.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -23,7 +23,7 @@ use crate::{ }, error::StorageError }; -use ton_types::Result; +use ever_block::Result; #[test] fn test_get_put_delete() -> Result<()> { diff --git a/storage/src/db/tests/test_rocksdb.rs b/storage/src/db/tests/test_rocksdb.rs index 3e022b5d..aafcaffa 100644 --- a/storage/src/db/tests/test_rocksdb.rs +++ b/storage/src/db/tests/test_rocksdb.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 EverX. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -25,7 +25,7 @@ use crate::{ }; use rocksdb::{DB, Options, WriteBatch, Cache, BlockBasedOptions, MultiThreaded, DBWithThreadMode}; use std::{path::Path, sync::Arc}; -use ton_types::Result; +use ever_block::Result; include!("destroy_db.rs"); diff --git a/storage/src/db/traits/async_traits.rs b/storage/src/db/traits/async_traits.rs index cef9181b..e27da740 100644 --- a/storage/src/db/traits/async_traits.rs +++ b/storage/src/db/traits/async_traits.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,14 +7,14 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::{db::traits::DbKey, types::DbSlice}; use async_trait::async_trait; use std::fmt::Debug; -use ton_types::Result; +use ever_block::Result; /// Trait for key-value collections #[async_trait] diff --git a/storage/src/db/traits/db_key.rs b/storage/src/db/traits/db_key.rs index 09c219c3..af0b7ec7 100644 --- a/storage/src/db/traits/db_key.rs +++ b/storage/src/db/traits/db_key.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,11 +7,11 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ -use ton_types::types::UInt256; +use ever_block::types::UInt256; /// Trait for database key pub trait DbKey { diff --git a/storage/src/db/traits/mod.rs b/storage/src/db/traits/mod.rs index b45fc9c7..fc11a71b 100644 --- a/storage/src/db/traits/mod.rs +++ b/storage/src/db/traits/mod.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/storage/src/db/traits/sync_traits.rs b/storage/src/db/traits/sync_traits.rs index d8989ef0..674c3650 100644 --- a/storage/src/db/traits/sync_traits.rs +++ b/storage/src/db/traits/sync_traits.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,13 +7,13 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::{db::traits::DbKey, error::StorageError, types::DbSlice}; use std::{fmt::Debug, sync::Arc}; -use ton_types::Result; +use ever_block::Result; /// Trait for key-value collections pub trait Kvc: Debug + Send + Sync { diff --git a/storage/src/dynamic_boc_rc_db.rs b/storage/src/dynamic_boc_rc_db.rs index 518fe33d..c1edd70e 100644 --- a/storage/src/dynamic_boc_rc_db.rs +++ b/storage/src/dynamic_boc_rc_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -23,11 +23,11 @@ use std::{ }; //#[cfg(test)] //use std::path::Path; -use ton_types::{ +use ever_block::{ error, fail, BuilderData, ByteOrderRead, Cell, CellByHashStorage, CellData, DoneCellsStorage, OrderedCellsStorage, Result, UInt256, MAX_LEVEL }; -use ton_block::merkle_update::CellsFactory; +use ever_block::merkle_update::CellsFactory; pub const BROKEN_CELL_BEACON_FILE: &str = "ton_node.broken_cell"; diff --git a/storage/src/error.rs b/storage/src/error.rs index 4de33e85..2bd39e94 100644 --- a/storage/src/error.rs +++ b/storage/src/error.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,11 +7,11 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ -use ton_block::BlockIdExt; +use ever_block::BlockIdExt; #[derive(Debug, PartialEq, failure::Fail)] pub enum StorageError { diff --git a/storage/src/lib.rs b/storage/src/lib.rs index cb9c8536..dcf7f01d 100644 --- a/storage/src/lib.rs +++ b/storage/src/lib.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/storage/src/macros.rs b/storage/src/macros.rs index edb5a45a..8b1f472a 100644 --- a/storage/src/macros.rs +++ b/storage/src/macros.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -34,7 +34,7 @@ macro_rules! db_impl_base { db: std::sync::Arc<$crate::db::rocksdb::RocksDb>, family: impl ToString, create_if_not_exist: bool, - ) -> ton_types::Result { + ) -> ever_block::Result { let ret = Self { db: Box::new(db.table(family, create_if_not_exist)?) }; @@ -46,7 +46,7 @@ macro_rules! db_impl_base { // pub fn with_path( // path: &str, // name: &str - // ) -> ton_types::Result { + // ) -> ever_block::Result { // let db = $crate::db::rocksdb::RocksDb::with_path(path, name); // let ret = Self { // db: Box::new(db) @@ -56,7 +56,7 @@ macro_rules! db_impl_base { // /// Destroys instance of RocksDB with given path // #[allow(dead_code)] - // pub fn destroy_db(path: impl AsRef) -> ton_types::Result { + // pub fn destroy_db(path: impl AsRef) -> ever_block::Result { // $crate::db::rocksdb::RocksDb::destroy_db(path) // } } @@ -91,7 +91,7 @@ macro_rules! db_impl_single { pub fn with_path( path: &str, name: &str - ) -> ton_types::Result { + ) -> ever_block::Result { let db = $crate::db::rocksdb::RocksDb::with_path(path, name)?; let ret = Self { db @@ -101,11 +101,11 @@ macro_rules! db_impl_single { /// Destroys instance of RocksDB with given path #[allow(dead_code)] - pub fn destroy(&mut self) -> ton_types::Result { + pub fn destroy(&mut self) -> ever_block::Result { let path = self.db.path().to_path_buf(); if let Some(db) = std::sync::Arc::get_mut(&mut self.db) { if let Err(err) = $crate::db::traits::Kvc::destroy(db) { - ton_types::fail!( + ever_block::fail!( "Database {:?} destroying error: {}", path, err @@ -114,7 +114,7 @@ macro_rules! db_impl_single { Ok(true) } } else { - ton_types::fail!("operation pending in db {:?}", path) + ever_block::fail!("operation pending in db {:?}", path) } } @@ -149,7 +149,7 @@ macro_rules! db_impl_cbor { } #[allow(dead_code)] - pub fn try_get_value(&self, key: &$key_type) -> ton_types::Result> { + pub fn try_get_value(&self, key: &$key_type) -> ever_block::Result> { if let Some(db_slice) = self.try_get(key)? { return Ok(Some(serde_cbor::from_slice(db_slice.as_ref())?)); } @@ -158,12 +158,12 @@ macro_rules! db_impl_cbor { } #[allow(dead_code)] - pub fn get_value(&self, key: &$key_type) -> ton_types::Result<$value_type> { + pub fn get_value(&self, key: &$key_type) -> ever_block::Result<$value_type> { Ok(serde_cbor::from_slice(self.get(key)?.as_ref())?) } #[allow(dead_code)] - pub fn put_value(&self, key: &$key_type, value: impl std::borrow::Borrow<$value_type>) -> ton_types::Result<()> { + pub fn put_value(&self, key: &$key_type, value: impl std::borrow::Borrow<$value_type>) -> ever_block::Result<()> { self.put(key, &serde_cbor::to_vec(value.borrow())?) } } @@ -177,7 +177,7 @@ macro_rules! db_impl_serializable { impl $type { #[allow(dead_code)] - pub fn try_get_value(&self, key: &$key_type) -> ton_types::Result> { + pub fn try_get_value(&self, key: &$key_type) -> ever_block::Result> { if let Some(db_slice) = self.try_get(key)? { return Ok(Some(<$value_type>::from_slice(db_slice.as_ref())?)); } @@ -186,12 +186,12 @@ macro_rules! db_impl_serializable { } #[allow(dead_code)] - pub fn get_value(&self, key: &$key_type) -> ton_types::Result<$value_type> { + pub fn get_value(&self, key: &$key_type) -> ever_block::Result<$value_type> { <$value_type>::from_slice(self.get(key)?.as_ref()) } #[allow(dead_code)] - pub fn put_value(&self, key: &$key_type, value: impl std::borrow::Borrow<$value_type>) -> ton_types::Result<()> { + pub fn put_value(&self, key: &$key_type, value: impl std::borrow::Borrow<$value_type>) -> ever_block::Result<()> { self.put(key, &value.borrow().to_vec()?) } } diff --git a/storage/src/node_state_db.rs b/storage/src/node_state_db.rs index a8c45308..0579cd00 100644 --- a/storage/src/node_state_db.rs +++ b/storage/src/node_state_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/storage/src/shard_top_blocks_db.rs b/storage/src/shard_top_blocks_db.rs index 2d0184b2..0d760d9f 100644 --- a/storage/src/shard_top_blocks_db.rs +++ b/storage/src/shard_top_blocks_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/storage/src/shardstate_db_async.rs b/storage/src/shardstate_db_async.rs index b97210e9..db8867b4 100644 --- a/storage/src/shardstate_db_async.rs +++ b/storage/src/shardstate_db_async.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -29,8 +29,8 @@ use std::{ sync::{Arc, atomic::{AtomicU8, AtomicU32, Ordering}}, time::{Duration, SystemTime, UNIX_EPOCH}, }; -use ton_block::{BlockIdExt, CellsFactory}; -use ton_types::{ +use ever_block::{BlockIdExt, CellsFactory}; +use ever_block::{ ByteOrderRead, Cell, Result, fail, error, DoneCellsStorage, OrderedCellsStorage, CellByHashStorage, UInt256, }; diff --git a/storage/src/status_db.rs b/storage/src/status_db.rs index 92525c45..669392ca 100644 --- a/storage/src/status_db.rs +++ b/storage/src/status_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,13 +7,13 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use std::borrow::Borrow; -use ton_types::Result; +use ever_block::Result; use crate::db_impl_base; use crate::db::traits::KvcWriteable; diff --git a/storage/src/tests/mod.rs b/storage/src/tests/mod.rs index d861ab03..28940abf 100644 --- a/storage/src/tests/mod.rs +++ b/storage/src/tests/mod.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -27,8 +27,8 @@ pub mod utils { use crate::StorageTelemetry; use fnv::FnvHashSet; use std::sync::Arc; - use ton_block::{BlockIdExt, SHARD_FULL, ShardIdent}; - use ton_types::{Cell, Result, UInt256, read_single_root_boc}; + use ever_block::{BlockIdExt, SHARD_FULL, ShardIdent}; + use ever_block::{Cell, Result, UInt256, read_single_root_boc}; pub fn get_test_raw_boc() -> Vec { include_bytes!("testdata/2467080").to_vec() diff --git a/storage/src/tests/test_block_db.rs b/storage/src/tests/test_block_db.rs index b870cd0e..2d90dd7a 100644 --- a/storage/src/tests/test_block_db.rs +++ b/storage/src/tests/test_block_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,12 +7,12 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::{block_db::BlockDb, tests::utils::*}; -use ton_types::Result; +use ever_block::Result; #[test] fn test_get_put_raw_block() -> Result<()> { diff --git a/storage/src/tests/test_block_handle_db.rs b/storage/src/tests/test_block_handle_db.rs index 4bf5c424..9a3fa6c0 100644 --- a/storage/src/tests/test_block_handle_db.rs +++ b/storage/src/tests/test_block_handle_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -17,8 +17,8 @@ use crate::{ tests::utils::create_block_handle_storage, types::BlockMeta }; -use ton_block::{BlockIdExt, ShardIdent}; -use ton_types::UInt256; +use ever_block::{BlockIdExt, ShardIdent}; +use ever_block::UInt256; include!("../db/tests/destroy_db.rs"); diff --git a/storage/src/tests/test_catchain_persistent_db.rs b/storage/src/tests/test_catchain_persistent_db.rs index 67a6213b..fea9836f 100644 --- a/storage/src/tests/test_catchain_persistent_db.rs +++ b/storage/src/tests/test_catchain_persistent_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,12 +7,12 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::catchain_persistent_db::CatchainPersistentDb; -use ton_types::Result; +use ever_block::Result; #[test] fn test_destroy() -> Result<()> { diff --git a/storage/src/tests/test_cell_db.rs b/storage/src/tests/test_cell_db.rs index 17c09fa0..f9f7759b 100644 --- a/storage/src/tests/test_cell_db.rs +++ b/storage/src/tests/test_cell_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -15,7 +15,7 @@ use crate::{ cell_db::CellDb, tests::utils::*, types::{StorageCell} }; use std::{io::Cursor, sync::Arc}; -use ton_types::{Cell, Result, cells_serialization::deserialize_tree_of_cells, UInt256}; +use ever_block::{Cell, Result, cells_serialization::deserialize_tree_of_cells, UInt256}; use std::ops::Deref; use crate::dynamic_boc_db::DynamicBocDb; diff --git a/storage/src/tests/test_dynamic_boc_db.rs b/storage/src/tests/test_dynamic_boc_db.rs index 86542c9c..6e256c0f 100644 --- a/storage/src/tests/test_dynamic_boc_db.rs +++ b/storage/src/tests/test_dynamic_boc_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,13 +7,13 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::{dynamic_boc_db::DynamicBocDb, tests::utils::*}; use std::sync::Arc; -use ton_types::Result; +use ever_block::Result; use std::ops::Deref; #[test] diff --git a/storage/src/tests/test_dynamic_boc_rc_db.rs b/storage/src/tests/test_dynamic_boc_rc_db.rs index 63871429..62ec82d8 100644 --- a/storage/src/tests/test_dynamic_boc_rc_db.rs +++ b/storage/src/tests/test_dynamic_boc_rc_db.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -18,8 +18,8 @@ use crate::{ #[cfg(feature = "telemetry")] use crate::StorageTelemetry; use std::sync::Arc; -use ton_block::CellsFactory; -use ton_types::{BuilderData, Cell, IBitstring, Result}; +use ever_block::CellsFactory; +use ever_block::{BuilderData, Cell, IBitstring, Result}; include!("../db/tests/destroy_db.rs"); include!("../../../common/src/log.rs"); diff --git a/storage/src/tests/test_shardstate_db_async.rs b/storage/src/tests/test_shardstate_db_async.rs index df1d4ef3..83c223fc 100644 --- a/storage/src/tests/test_shardstate_db_async.rs +++ b/storage/src/tests/test_shardstate_db_async.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -20,8 +20,8 @@ use crate::StorageTelemetry; use std::{ fs::read, path::Path, sync::{Arc, atomic::AtomicU32}, time::Duration }; -use ton_block::{BlockIdExt, ShardIdent}; -use ton_types::{Cell, Result, UInt256, read_single_root_boc}; +use ever_block::{BlockIdExt, ShardIdent}; +use ever_block::{Cell, Result, UInt256, read_single_root_boc}; include!("../db/tests/destroy_db.rs"); include!("../../../common/src/log.rs"); diff --git a/storage/src/traits.rs b/storage/src/traits.rs index 86c11423..75b795cc 100644 --- a/storage/src/traits.rs +++ b/storage/src/traits.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,14 +7,14 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use std::io::{Cursor, Read, Write}; -use ton_block::{BlockIdExt, ShardIdent}; -use ton_types::{ByteOrderRead, Result, UInt256}; +use ever_block::{BlockIdExt, ShardIdent}; +use ever_block::{ByteOrderRead, Result, UInt256}; pub trait Serializable { fn serialize(&self, writer: &mut W) -> Result<()>; diff --git a/storage/src/types/block_id.rs b/storage/src/types/block_id.rs index e50582b7..70a8c32f 100644 --- a/storage/src/types/block_id.rs +++ b/storage/src/types/block_id.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,12 +7,12 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::db::traits::DbKey; -use ton_block::BlockIdExt; +use ever_block::BlockIdExt; impl DbKey for BlockIdExt { fn key_name(&self) -> &'static str { diff --git a/storage/src/types/block_meta.rs b/storage/src/types/block_meta.rs index 29753fac..7b24e41f 100644 --- a/storage/src/types/block_meta.rs +++ b/storage/src/types/block_meta.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -15,8 +15,8 @@ use crate::{block_handle_db, traits::Serializable}; use std::{io::{Read, Write}, sync::atomic::{AtomicU64, Ordering}}; #[cfg(test)] use std::sync::atomic::AtomicU32; -use ton_block::{Block, INVALID_WORKCHAIN_ID}; -use ton_types::{ByteOrderRead, Result}; +use ever_block::{Block, INVALID_WORKCHAIN_ID}; +use ever_block::{ByteOrderRead, Result}; #[derive(Debug, Default)] pub struct BlockMeta { diff --git a/storage/src/types/db_slice.rs b/storage/src/types/db_slice.rs index 60e01fc9..a84c0f36 100644 --- a/storage/src/types/db_slice.rs +++ b/storage/src/types/db_slice.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/storage/src/types/mod.rs b/storage/src/types/mod.rs index c9bf0258..c4f76ca0 100644 --- a/storage/src/types/mod.rs +++ b/storage/src/types/mod.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/storage/src/types/shard_ident_key.rs b/storage/src/types/shard_ident_key.rs index dafcc763..793f705a 100644 --- a/storage/src/types/shard_ident_key.rs +++ b/storage/src/types/shard_ident_key.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,13 +7,13 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::{db::traits::DbKey, traits::Serializable}; -use ton_block::ShardIdent; -use ton_types::Result; +use ever_block::ShardIdent; +use ever_block::Result; pub struct ShardIdentKey(Vec); diff --git a/storage/src/types/status_key.rs b/storage/src/types/status_key.rs index a6f9fed3..33626991 100644 --- a/storage/src/types/status_key.rs +++ b/storage/src/types/status_key.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/storage/src/types/storage_cell.rs b/storage/src/types/storage_cell.rs index e7c6723d..66707572 100644 --- a/storage/src/types/storage_cell.rs +++ b/storage/src/types/storage_cell.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,13 +7,13 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::{dynamic_boc_rc_db::DynamicBocDb, TARGET}; use std::{io::{Cursor, Write}, sync::{Arc,Weak, atomic::{AtomicU64, Ordering}}}; -use ton_types::{ +use ever_block::{ error, fail, ByteOrderRead, Cell, CellData, CellImpl, CellType, LevelMask, Result, UInt256, MAX_LEVEL, MAX_REFERENCES_COUNT }; diff --git a/storage/src/types/tests/mod.rs b/storage/src/types/tests/mod.rs index 6097a0ff..96fde35d 100644 --- a/storage/src/types/tests/mod.rs +++ b/storage/src/types/tests/mod.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/storage/src/types/tests/test_block_id.rs b/storage/src/types/tests/test_block_id.rs index 506e1234..6b9b1e93 100644 --- a/storage/src/types/tests/test_block_id.rs +++ b/storage/src/types/tests/test_block_id.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,13 +7,13 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::{db::traits::DbKey, tests::utils::{FILE_HASH, ROOT_HASH}}; -use ton_block::{BlockIdExt, ShardIdent}; -use ton_types::UInt256; +use ever_block::{BlockIdExt, ShardIdent}; +use ever_block::UInt256; fn create_block_id() -> BlockIdExt { BlockIdExt::with_params( diff --git a/storage/src/types/tests/test_serialization.rs b/storage/src/types/tests/test_serialization.rs index 5b41db80..b226fc88 100644 --- a/storage/src/types/tests/test_serialization.rs +++ b/storage/src/types/tests/test_serialization.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -16,8 +16,8 @@ use crate::{ traits::Serializable, types::BlockMeta }; use std::{cell::RefCell, sync::atomic::Ordering}; -use ton_block::{BlockIdExt, ShardIdent}; -use ton_types::Result; +use ever_block::{BlockIdExt, ShardIdent}; +use ever_block::Result; static SHARD_IDENT_SERIALIZED: [u8; 12] = [ // workchain_id = -1 (4 bytes) diff --git a/tests/test_run_net/log_cfg.yml b/tests/test_run_net/log_cfg.yml index b94b4edd..13c1f09c 100644 --- a/tests/test_run_net/log_cfg.yml +++ b/tests/test_run_net/log_cfg.yml @@ -16,7 +16,7 @@ appenders: rolling_logfile: kind: rolling_file encoder: - pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l} [{h({t})}@{file}(({line}))] {I}: {m}{n}" + pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l} [{h({t})}] {I}: {m}{n}" path: '/shared/output_NODE_NUM.log' policy: kind: compound @@ -36,7 +36,7 @@ root: loggers: # node messages - ton_node: + ever_node: level: trace boot: level: trace @@ -59,7 +59,7 @@ loggers: level: warn # block messages - ton_block: + ever_block: level: off # block messages diff --git a/tests/test_run_net/restart_nodes.sh b/tests/test_run_net/restart_nodes.sh index c3bef296..97d3b3be 100644 --- a/tests/test_run_net/restart_nodes.sh +++ b/tests/test_run_net/restart_nodes.sh @@ -1,11 +1,11 @@ #!/bin/bash -NODES=$(pgrep ton_node | wc -l) +NODES=$(pgrep ever-node | wc -l) echo "Stopping $NODES nodes..." -pkill ton_node -while pgrep -x "ton_node" > /dev/null +pkill ever-node +while pgrep -x "ever-node" > /dev/null do sleep 1 done @@ -26,5 +26,5 @@ cd $NODE_TARGET for (( N=0; N < $NODES; N++ )) do echo " Starting node #$N..." - ./ton_node --configs configs_$N -z . > "$TEST_ROOT/tmp/output_$N.log" 2>&1 & + ./ever-node --configs configs_$N -z . > "$TEST_ROOT/tmp/output_$N.log" 2>&1 & done diff --git a/tests/test_run_net/stop_network.sh b/tests/test_run_net/stop_network.sh index e086d0b4..6ac7ac07 100644 --- a/tests/test_run_net/stop_network.sh +++ b/tests/test_run_net/stop_network.sh @@ -1,9 +1,9 @@ #!/bin/bash -NODES=$(pgrep ton_node | wc -l) +NODES=$(pgrep ever-node | wc -l) NODES=$((NODES - 1)) TEST_ROOT=$(pwd); NODE_TARGET=$TEST_ROOT/../../target/release/ -pkill -9 ton_node +pkill -9 ever-node bash ./remove_junk.sh "$NODE_TARGET" "$NODES" > /dev/null 2>&1 diff --git a/tests/test_run_net/test_run_net.sh b/tests/test_run_net/test_run_net.sh index 51f5e74e..8ae7827e 100644 --- a/tests/test_run_net/test_run_net.sh +++ b/tests/test_run_net/test_run_net.sh @@ -29,7 +29,7 @@ fi echo "Preparations..." -pkill -9 ton_node > /dev/null 2>&1 || echo "No ton_node processes" +pkill -9 ever-node > /dev/null 2>&1 || echo "No ever-node processes" bash ./remove_junk.sh "$NODE_TARGET" "$NODES" > /dev/null 2>&1 echo "Building $(pwd)" @@ -106,7 +106,7 @@ do cp $NODE_TARGET/default_config$N.json $TEST_ROOT/tmp/default_config$N.json rm tmp_output > /dev/null 2>&1 - (./ton_node --configs . --ckey "$(cat console_public_json)" > tmp_output 2>&1 & wait 2>/dev/null) & + (./ever-node --configs . --ckey "$(cat console_public_json)" > tmp_output 2>&1 & wait 2>/dev/null) & echo " waiting for 5 secs" sleep 5 if [ ! -f "console_config.json" ]; then @@ -136,7 +136,7 @@ do cp $NODE_TARGET/config.json $TEST_ROOT/tmp/config$N.json - pkill -9 ton_node > /dev/null 2>&1 || echo "No ton_node processes" + pkill -9 ever-node > /dev/null 2>&1 || echo "No ever-node processes" done @@ -218,7 +218,7 @@ do cp $TEST_ROOT/tmp/ton-global.config.json $NODE_TARGET/configs_$N/ton-global.config.json # rm $TEST_ROOT/tmp/output_$N.log - ./ton_node --configs configs_$N -z . > "$TEST_ROOT/tmp/output_$N.log" 2>&1 & + ./ever-node --configs configs_$N -z . > "$TEST_ROOT/tmp/output_$N.log" 2>&1 & done @@ -260,4 +260,4 @@ echo "Started" # fi # fi -# pkill -9 ton_node +# pkill -9 ever-node diff --git a/tests/test_run_net/test_run_net_ci_public.sh b/tests/test_run_net/test_run_net_ci_public.sh index 38362784..711cff96 100644 --- a/tests/test_run_net/test_run_net_ci_public.sh +++ b/tests/test_run_net/test_run_net_ci_public.sh @@ -27,7 +27,7 @@ fi echo "Preparations..." -pkill -9 ton_node > /dev/null 2>&1 || echo "No ton_node processes" +pkill -9 ever-node > /dev/null 2>&1 || echo "No ever-node processes" cd "$TEST_ROOT" ./remove_junk.sh "$NODE_TARGET" "$NODES" > /dev/null 2>&1 || echo "Some unexpected error, but we don't give a shit about it" @@ -67,7 +67,7 @@ for (( N=1; N <= NODES; N++ )) ; do echo "Validator's #$N config generating..." - pkill -9 ton_node > /dev/null 2>&1 || echo "No ton_node processes" + pkill -9 ever-node > /dev/null 2>&1 || echo "No ever-node processes" ./keygen > "$TEST_ROOT/tmp/genkey$N" jq -c .public "$TEST_ROOT/tmp/genkey$N" > console_public_json @@ -106,7 +106,7 @@ for (( N=1; N <= NODES; N++ )) ; do cp "$NODE_TARGET/default_config$N.json" "$TEST_ROOT/tmp/default_config$N.json" rm -f tmp_output > /dev/null 2>&1 - (./ton_node --configs . --ckey "$(cat console_public_json)" > tmp_output & wait 2>/dev/null) & + (./ever-node --configs . --ckey "$(cat console_public_json)" > tmp_output & wait 2>/dev/null) & echo " waiting for 3 secs" sleep 3 if [[ ! -f "console_config.json" ]] ; then @@ -136,7 +136,7 @@ for (( N=1; N <= NODES; N++ )) ; do cp "$NODE_TARGET/config.json" "$TEST_ROOT/tmp/config$N.json" - pkill -9 ton_node > /dev/null 2>&1 || echo "No ton_node processes" + pkill -9 ever-node > /dev/null 2>&1 || echo "No ever-node processes" done @@ -216,7 +216,7 @@ do cp "$TEST_ROOT/tmp/ton-global.config.json" "$NODE_TARGET/configs_$N/ton-global.config.json" # rm /shared/output_$N.log - (./ton_node --configs configs_$N -z . > "$NODE_LOG/output_$N.log" 2>&1 & wait 2>/dev/null) & + (./ever-node --configs configs_$N -z . > "$NODE_LOG/output_$N.log" 2>&1 & wait 2>/dev/null) & done @@ -237,7 +237,7 @@ function find_block { echo "ERROR: Can't find applied block ($1) on node #$N!" PID="$(ps ax | grep configs_$N | grep -v grep | awk '{print $1}')" gdb -p "$PID" -ex "thread apply all bt" -ex "detach" -ex "quit" > "$NODE_LOG/output_trace_$N.log" - pkill -9 ton_node > /dev/null 2>&1 + pkill -9 ever-node > /dev/null 2>&1 exit 1 fi fi @@ -312,6 +312,6 @@ if [[ ! "$REMP_TEST" == "true" ]] ; then fi fi -pkill -9 ton_node > /dev/null 2>&1 +pkill -9 ever-node > /dev/null 2>&1 echo "TEST PASSED" diff --git a/validator-session/Cargo.toml b/validator-session/Cargo.toml index 71dec32c..955e3120 100644 --- a/validator-session/Cargo.toml +++ b/validator-session/Cargo.toml @@ -15,12 +15,11 @@ log = '0.4' metrics = '0.21.0' metrics-core = '0.5' rand = '0.8' -adnl = { git = 'https://github.com/tonlabs/ever-adnl.git', tag = '0.10.15' } +adnl = { git = 'https://github.com/everx-labs/ever-adnl.git', tag = '0.10.22' } catchain = { path = '../catchain' } +ever_block = { git = 'https://github.com/everx-labs/ever-block.git', tag = '1.10.0' } storage = { path = '../storage' } -ton_api = { git = 'https://github.com/tonlabs/ever-tl.git', package = 'ton_api', tag = '0.3.72' } -ton_block = { git = 'https://github.com/tonlabs/ever-block.git', tag = '1.9.141' } -ton_types = { git = 'https://github.com/tonlabs/ever-types.git', tag = '2.0.39' } +ton_api = { git = 'https://github.com/everx-labs/ever-tl.git', package = 'ton_api', tag = '0.3.77' } [dev-dependencies] chrono = '0.4' diff --git a/validator-session/src/block_candidate.rs b/validator-session/src/block_candidate.rs index 52dba8bc..81bfbcf4 100644 --- a/validator-session/src/block_candidate.rs +++ b/validator-session/src/block_candidate.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/validator-session/src/cache.rs b/validator-session/src/cache.rs index 500620fb..fbc0eb55 100644 --- a/validator-session/src/cache.rs +++ b/validator-session/src/cache.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/validator-session/src/lib.rs b/validator-session/src/lib.rs index 414e8383..7be1fa3b 100644 --- a/validator-session/src/lib.rs +++ b/validator-session/src/lib.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -98,10 +98,10 @@ pub type BlockId = BlockHash; lazy_static::lazy_static! { /// Block candidate identifier for skip round (optional case to identify candidate as empty) - pub static ref SKIP_ROUND_CANDIDATE_BLOCKID : BlockId = ton_types::UInt256::default(); + pub static ref SKIP_ROUND_CANDIDATE_BLOCKID : BlockId = ever_block::UInt256::default(); /// Default block ID for internal use - pub static ref DEFAULT_BLOCKID : BlockId = ton_types::UInt256::default(); + pub static ref DEFAULT_BLOCKID : BlockId = ever_block::UInt256::default(); } /// Overlay manager diff --git a/validator-session/src/old_round.rs b/validator-session/src/old_round.rs index 70601733..5df6051f 100644 --- a/validator-session/src/old_round.rs +++ b/validator-session/src/old_round.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/validator-session/src/round.rs b/validator-session/src/round.rs index 0c5328c2..43c860d5 100644 --- a/validator-session/src/round.rs +++ b/validator-session/src/round.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/validator-session/src/round_attempt.rs b/validator-session/src/round_attempt.rs index 44335901..4b96cd04 100644 --- a/validator-session/src/round_attempt.rs +++ b/validator-session/src/round_attempt.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/validator-session/src/sent_block.rs b/validator-session/src/sent_block.rs index 94f8d598..2592421d 100644 --- a/validator-session/src/sent_block.rs +++ b/validator-session/src/sent_block.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/validator-session/src/session.rs b/validator-session/src/session.rs index 277d1cc5..e315ba32 100644 --- a/validator-session/src/session.rs +++ b/validator-session/src/session.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -28,7 +28,7 @@ use catchain::{ }; use metrics::Recorder; use std::{fmt, sync::{Arc, atomic::{AtomicBool, Ordering}}, time::{Duration, SystemTime}}; -use ton_types::Result; +use ever_block::Result; /* Constants diff --git a/validator-session/src/session_description.rs b/validator-session/src/session_description.rs index d7141c44..5b519bcf 100644 --- a/validator-session/src/session_description.rs +++ b/validator-session/src/session_description.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -20,7 +20,7 @@ use catchain::{serialize_tl_boxed_object, profiling::ResultStatusCounter}; use rand::Rng; use std::{collections::HashMap, fmt, time::{Duration, SystemTime}}; use ton_api::IntoBoxed; -use ton_types::{Result, UInt256}; +use ever_block::{Result, UInt256}; /* Constants diff --git a/validator-session/src/session_processor.rs b/validator-session/src/session_processor.rs index 6fd5f363..9795a521 100644 --- a/validator-session/src/session_processor.rs +++ b/validator-session/src/session_processor.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -23,9 +23,11 @@ use crate::{ task_queue::{ CompletionHandler, CompletionHandlerId, CompletionHandlerPtr, create_completion_handler, post_callback_closure, post_closure - }, + }, ton }; +#[cfg(feature = "slashing")] +use crate::{SlashingValidatorStat, slashing::Node}; use catchain::{ check_execution_time, instrument, serialize_tl_boxed_object, BlockPtr, CatchainPtr, ExternalQueryResponseCallback, profiling::ResultStatusCounter, @@ -37,7 +39,7 @@ use std::{ time::{Duration, SystemTime, UNIX_EPOCH} }; use ton_api::IntoBoxed; -use ton_types::{error, KeyId, Result, UInt256}; +use ever_block::{error, KeyId, Result, UInt256}; /* Constants @@ -2080,7 +2082,7 @@ impl SessionProcessorImpl { .get_mut(public_key_hash) .unwrap(); - use slashing::Metric::*; + use crate::slashing::Metric::*; slashing_node.increment(TotalRoundsCount, 1); if self.description.get_node_priority(i, self.current_round) >= 0 { @@ -3193,21 +3195,21 @@ impl SessionProcessorImpl { check_execution_time!(20000); instrument!(); - trace!( - "SessionProcessor::notify_slashing_statistics: post on_slashing_statistics event for further processing" + log::trace!( + "SessionProcessor::notify_slashing_statistics: \ + post on_slashing_statistics event for further processing" ); let listener = self.session_listener.clone(); post_callback_closure(&self.callbacks_task_queue, move || { check_execution_time!(20000); - if let Some(listener) = listener.upgrade() { - trace!("SessionProcessor::notify_session_statistics: on_slashing_statistics start"); - + log::trace!( + "SessionProcessor::notify_session_statistics: on_slashing_statistics start" + ); listener.on_slashing_statistics(round, stat); - - trace!( + log::trace!( "SessionProcessor::notify_session_statistics: on_slashing_statistics finish" ); } @@ -3458,7 +3460,7 @@ impl SessionProcessorImpl { for node in &ids { slashing_stat.validators_stat.insert( node.public_key.id().clone(), - slashing::Node::new(node.public_key.clone()), + Node::new(node.public_key.clone()), ); } diff --git a/validator-session/src/session_state.rs b/validator-session/src/session_state.rs index ac6b6b8f..0c00bb5a 100644 --- a/validator-session/src/session_state.rs +++ b/validator-session/src/session_state.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/validator-session/src/slashing.rs b/validator-session/src/slashing.rs index d74207da..82a84611 100644 --- a/validator-session/src/slashing.rs +++ b/validator-session/src/slashing.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2023 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -20,7 +20,7 @@ pub type PublicKeyHash = ::catchain::PublicKeyHash; pub type PublicKey = ::catchain::PublicKey; /// Slashing params -pub type SlashingConfig = ::ton_block::SlashingConfig; +pub type SlashingConfig = ::ever_block::SlashingConfig; /// Session statistics metric #[derive(Clone, Copy, Debug)] @@ -367,8 +367,14 @@ impl AggregatedValidatorStat { continue; } - debug!("Add validator {} to slashed list because of score {:.4} with protection level {:.2} and min confidence level {:.4}", - &hex::encode(entry.public_key.pub_key().expect("PublicKey is assigned")), score, min_slashing_protection_score, metric_norm.min_confidence_value); + log::debug!( + "Add validator {} to slashed list because of score {:.4} \ + with protection level {:.2} and min confidence level {:.4}", + &hex::encode(entry.public_key.pub_key().expect("PublicKey is assigned")), + score, + min_slashing_protection_score, + metric_norm.min_confidence_value + ); slashed_validators.push(SlashedNode { public_key: entry.public_key.clone(), diff --git a/validator-session/src/task_queue.rs b/validator-session/src/task_queue.rs index 80432a74..95e1b9b3 100644 --- a/validator-session/src/task_queue.rs +++ b/validator-session/src/task_queue.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,13 +7,13 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ use crate::SessionProcessor; use std::sync::Arc; -use ton_types::Result; +use ever_block::Result; /// Task of task queue pub type TaskPtr = Box; diff --git a/validator-session/src/utils.rs b/validator-session/src/utils.rs index e85fc6b1..a29e3395 100644 --- a/validator-session/src/utils.rs +++ b/validator-session/src/utils.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/validator-session/src/vector.rs b/validator-session/src/vector.rs index ef583305..d1cbedbe 100644 --- a/validator-session/src/vector.rs +++ b/validator-session/src/vector.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/validator-session/src/vector_bool.rs b/validator-session/src/vector_bool.rs index 41631715..7272281a 100644 --- a/validator-session/src/vector_bool.rs +++ b/validator-session/src/vector_bool.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/validator-session/src/vote_candidate.rs b/validator-session/src/vote_candidate.rs index 8342ad82..20ea3202 100644 --- a/validator-session/src/vote_candidate.rs +++ b/validator-session/src/vote_candidate.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ diff --git a/validator-session/tests/test_fast_session.rs b/validator-session/tests/test_fast_session.rs index 03f415f4..55ab1beb 100644 --- a/validator-session/tests/test_fast_session.rs +++ b/validator-session/tests/test_fast_session.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -18,7 +18,7 @@ use std::{ fs::File, io::{LineWriter, Write}, path::Path, sync::{Arc, Mutex, atomic::{AtomicBool, Ordering}}, time::Duration }; -use ton_types::{Ed25519KeyOption, UInt256}; +use ever_block::{Ed25519KeyOption, UInt256}; use validator_session::*; const MAX_WAIT_ROUND: u32 = 1000; //max round for waiting in the test diff --git a/validator-session/tests/test_hash.rs b/validator-session/tests/test_hash.rs index 161f6cf1..56c76ff0 100644 --- a/validator-session/tests/test_hash.rs +++ b/validator-session/tests/test_hash.rs @@ -1,5 +1,5 @@ /* -* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. +* Copyright (C) 2019-2024 EverX. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. @@ -7,7 +7,7 @@ * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific TON DEV software governing permissions and +* See the License for the specific EVERX DEV software governing permissions and * limitations under the License. */ @@ -16,7 +16,7 @@ use colored::Colorize; use rand::Rng; use std::{fmt, io::Write, time::{Duration, SystemTime}}; use ton_api::IntoBoxed; -use ton_types::{fail, KeyId}; +use ever_block::{fail, KeyId}; use validator_session::*; /* @@ -579,7 +579,7 @@ fn test_state_hashes_part1(options: &SessionOptions, total_nodes: u32) { assert!(c1 != c2); - let zero_hash: ton_types::UInt256 = zero_hash.into(); + let zero_hash: ever_block::UInt256 = zero_hash.into(); let mut state = SessionFactory::create_state(&mut description); let mut attempt_id = 1000000000; From be0fab066cce6e94fa4ea5a7a25d24af5b0a1df6 Mon Sep 17 00:00:00 2001 From: Slava Date: Sun, 21 Apr 2024 12:45:48 +0300 Subject: [PATCH 2/3] Updated common submodule --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index c7530858..51590a6a 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit c7530858ae244d210e45c9ae2b07f24f320551c8 +Subproject commit 51590a6a9d775f311b5133f09f1101f0a59cba0a From 5319af5042e8bb74683ca79f74706de5653f9c7e Mon Sep 17 00:00:00 2001 From: ViacheslavB Date: Sun, 21 Apr 2024 14:48:41 +0300 Subject: [PATCH 3/3] Fix some ton artifacts --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index a7446b5c..07f6fa2b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -282,7 +282,7 @@ fn get_build_info() -> String { info += &format!( "EVER Node, version {}\n\ Rust: {}\n\ - TON NODE git commit: {}\n\ + EVER NODE git commit: {}\n\ ADNL git commit: {}\n\ EVER_BLOCK git commit: {}\n\ EVER_BLOCK_JSON git commit: {}\n\