From a0b2115f8edb8b84f61b0e08d00dee21109c56b7 Mon Sep 17 00:00:00 2001 From: AvivYossef-starkware <141143145+AvivYossef-starkware@users.noreply.github.com> Date: Mon, 29 Jul 2024 13:58:21 +0300 Subject: [PATCH 01/13] refactor: committer create tree test (#133) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change is [Reviewable](https://reviewable.io/reviews/starkware-libs/sequencer/133) --- .../create_tree_test.rs | 24 +----------------- .../skeleton_forest_test.rs | 25 ++++++++++++++++--- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/crates/committer/src/patricia_merkle_tree/original_skeleton_tree/create_tree_test.rs b/crates/committer/src/patricia_merkle_tree/original_skeleton_tree/create_tree_test.rs index 4436c4bd5ab..a2fe4a1af91 100644 --- a/crates/committer/src/patricia_merkle_tree/original_skeleton_tree/create_tree_test.rs +++ b/crates/committer/src/patricia_merkle_tree/original_skeleton_tree/create_tree_test.rs @@ -5,17 +5,15 @@ use pretty_assertions::assert_eq; use rstest::rstest; use super::OriginalSkeletonTreeImpl; -use crate::block_committer::input::StarknetStorageValue; use crate::felt::Felt; use crate::hash::hash_trait::HashOutput; -use crate::patricia_merkle_tree::filled_tree::node::{ClassHash, CompiledClassHash, Nonce}; use crate::patricia_merkle_tree::internal_test_utils::{ small_tree_index_to_full, MockLeaf, OriginalSkeletonMockTrieConfig, }; use crate::patricia_merkle_tree::node_data::inner_node::{EdgePath, EdgePathLength, PathToBottom}; -use crate::patricia_merkle_tree::node_data::leaf::{ContractState, LeafModifications}; +use crate::patricia_merkle_tree::node_data::leaf::LeafModifications; use crate::patricia_merkle_tree::original_skeleton_tree::create_tree::SubTree; use crate::patricia_merkle_tree::original_skeleton_tree::node::OriginalSkeletonNode; use crate::patricia_merkle_tree::original_skeleton_tree::tree::OriginalSkeletonTree; @@ -412,26 +410,6 @@ pub(crate) fn create_mock_leaf_entry(val: u128) -> (StorageKey, StorageValue) { (leaf.get_db_key(&leaf.0.to_bytes_be()), leaf.serialize()) } -pub(crate) fn create_storage_leaf_entry(val: u128) -> (StorageKey, StorageValue) { - let leaf = StarknetStorageValue(Felt::from(val)); - (leaf.get_db_key(&leaf.0.to_bytes_be()), leaf.serialize()) -} - -pub(crate) fn create_compiled_class_leaf_entry(val: u128) -> (StorageKey, StorageValue) { - let leaf = CompiledClassHash(Felt::from(val)); - (leaf.get_db_key(&leaf.0.to_bytes_be()), leaf.serialize()) -} - -pub(crate) fn create_contract_state_leaf_entry(val: u128) -> (StorageKey, StorageValue) { - let felt = Felt::from(val); - let leaf = ContractState { - nonce: Nonce(felt), - storage_root_hash: HashOutput(felt), - class_hash: ClassHash(felt), - }; - (leaf.get_db_key(&felt.to_bytes_be()), leaf.serialize()) -} - fn create_patricia_key(val: u128) -> StorageKey { create_db_key(StarknetPrefix::InnerNode.to_storage_prefix(), &U256::from(val).to_be_bytes()) } diff --git a/crates/committer/src/patricia_merkle_tree/original_skeleton_tree/skeleton_forest_test.rs b/crates/committer/src/patricia_merkle_tree/original_skeleton_tree/skeleton_forest_test.rs index c3c63ecd0fa..3a52741c76e 100644 --- a/crates/committer/src/patricia_merkle_tree/original_skeleton_tree/skeleton_forest_test.rs +++ b/crates/committer/src/patricia_merkle_tree/original_skeleton_tree/skeleton_forest_test.rs @@ -21,19 +21,18 @@ use crate::patricia_merkle_tree::original_skeleton_tree::create_tree::create_tre create_32_bytes_entry, create_binary_entry, create_binary_skeleton_node, - create_compiled_class_leaf_entry, - create_contract_state_leaf_entry, create_edge_entry, create_edge_skeleton_node, create_expected_skeleton_nodes, create_root_edge_entry, - create_storage_leaf_entry, create_unmodified_subtree_skeleton_node, }; use crate::patricia_merkle_tree::original_skeleton_tree::skeleton_forest::ForestSortedIndices; use crate::patricia_merkle_tree::original_skeleton_tree::tree::OriginalSkeletonTreeImpl; use crate::patricia_merkle_tree::types::{NodeIndex, SortedLeafIndices, SubTreeHeight}; +use crate::storage::db_object::DBObject; use crate::storage::map_storage::MapStorage; +use crate::storage::storage_trait::{StorageKey, StorageValue}; macro_rules! compare_skeleton_tree { ($actual_skeleton:expr, $expected_skeleton:expr, $expected_indices:expr) => {{ @@ -45,6 +44,26 @@ macro_rules! compare_skeleton_tree { }}; } +pub(crate) fn create_storage_leaf_entry(val: u128) -> (StorageKey, StorageValue) { + let leaf = StarknetStorageValue(Felt::from(val)); + (leaf.get_db_key(&leaf.0.to_bytes_be()), leaf.serialize()) +} + +pub(crate) fn create_compiled_class_leaf_entry(val: u128) -> (StorageKey, StorageValue) { + let leaf = CompiledClassHash(Felt::from(val)); + (leaf.get_db_key(&leaf.0.to_bytes_be()), leaf.serialize()) +} + +pub(crate) fn create_contract_state_leaf_entry(val: u128) -> (StorageKey, StorageValue) { + let felt = Felt::from(val); + let leaf = ContractState { + nonce: Nonce(felt), + storage_root_hash: HashOutput(felt), + class_hash: ClassHash(felt), + }; + (leaf.get_db_key(&felt.to_bytes_be()), leaf.serialize()) +} + // This test assumes for simplicity that hash is addition (i.e hash(a,b) = a + b). // I.e., the value of a binary node is the sum of its children's values, and the value of an edge // node is the sum of its path, bottom value and path length. From c7871b4412398be3e6034765ae88201def77d957 Mon Sep 17 00:00:00 2001 From: dorimedini-starkware Date: Mon, 29 Jul 2024 16:36:45 +0300 Subject: [PATCH 02/13] chore: add taplo (#85) Signed-off-by: Dori Medini --- .github/workflows/main.yml | 13 ++++ Cargo.toml | 64 +++++++++---------- crates/committer_cli/Cargo.toml | 4 +- crates/gateway/Cargo.toml | 12 ++-- crates/mempool/Cargo.toml | 2 +- crates/mempool_node/Cargo.toml | 4 +- crates/mempool_test_utils/Cargo.toml | 8 +-- crates/mempool_types/Cargo.toml | 2 +- crates/papyrus_base_layer/Cargo.toml | 8 +-- crates/papyrus_common/Cargo.toml | 10 +-- crates/papyrus_config/Cargo.toml | 6 +- crates/papyrus_execution/Cargo.toml | 6 +- crates/papyrus_load_test/Cargo.toml | 6 +- crates/papyrus_monitoring_gateway/Cargo.toml | 2 +- crates/papyrus_network/Cargo.toml | 24 +++---- crates/papyrus_node/Cargo.toml | 14 ++-- crates/papyrus_p2p_sync/Cargo.toml | 4 +- crates/papyrus_proc_macros/Cargo.toml | 4 +- crates/papyrus_protobuf/Cargo.toml | 4 +- crates/papyrus_rpc/Cargo.toml | 12 ++-- crates/papyrus_storage/Cargo.toml | 17 ++--- crates/papyrus_sync/Cargo.toml | 16 ++--- crates/papyrus_test_utils/Cargo.toml | 8 +-- .../papyrus_block_builder/Cargo.toml | 4 +- .../sequencing/papyrus_consensus/Cargo.toml | 8 ++- crates/starknet_api/Cargo.toml | 1 - crates/starknet_client/Cargo.toml | 8 +-- crates/starknet_sierra_compile/Cargo.toml | 6 +- crates/tests-integration/Cargo.toml | 14 ++-- rustfmt.toml | 8 +-- 30 files changed, 153 insertions(+), 146 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 74545671a9c..6a6b2f7615d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -133,6 +133,19 @@ jobs: env: SEED: 0 + taplo: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - uses: baptiste0928/cargo-install@v3 + with: + crate: taplo-cli + version: '0.9.0' + locked: true + - run: scripts/taplo.sh + machete: runs-on: ubuntu-latest steps: diff --git a/Cargo.toml b/Cargo.toml index 1e3a2cea2b0..7d7f6505c30 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,38 +4,38 @@ resolver = "2" members = [ - "crates/blockifier", - "crates/committer", - "crates/committer_cli", - "crates/gateway", - "crates/mempool", - "crates/mempool_infra", - "crates/mempool_node", - "crates/mempool_test_utils", - "crates/mempool_types", - "crates/native_blockifier", - "crates/papyrus_base_layer", - "crates/papyrus_common", - "crates/papyrus_config", - "crates/papyrus_execution", - "crates/papyrus_load_test", - "crates/papyrus_monitoring_gateway", - "crates/papyrus_network", - "crates/papyrus_node", - "crates/papyrus_p2p_sync", - "crates/papyrus_proc_macros", - "crates/papyrus_protobuf", - "crates/papyrus_rpc", - "crates/papyrus_storage", - "crates/papyrus_sync", - "crates/papyrus_test_utils", - "crates/sequencing/papyrus_block_builder", - "crates/sequencing/papyrus_consensus", - "crates/starknet_api", - "crates/starknet_client", - "crates/starknet_sierra_compile", - "crates/task_executor", - "crates/tests-integration", + "crates/blockifier", + "crates/committer", + "crates/committer_cli", + "crates/gateway", + "crates/mempool", + "crates/mempool_infra", + "crates/mempool_node", + "crates/mempool_test_utils", + "crates/mempool_types", + "crates/native_blockifier", + "crates/papyrus_base_layer", + "crates/papyrus_common", + "crates/papyrus_config", + "crates/papyrus_execution", + "crates/papyrus_load_test", + "crates/papyrus_monitoring_gateway", + "crates/papyrus_network", + "crates/papyrus_node", + "crates/papyrus_p2p_sync", + "crates/papyrus_proc_macros", + "crates/papyrus_protobuf", + "crates/papyrus_rpc", + "crates/papyrus_storage", + "crates/papyrus_sync", + "crates/papyrus_test_utils", + "crates/sequencing/papyrus_block_builder", + "crates/sequencing/papyrus_consensus", + "crates/starknet_api", + "crates/starknet_client", + "crates/starknet_sierra_compile", + "crates/task_executor", + "crates/tests-integration", ] [workspace.package] diff --git a/crates/committer_cli/Cargo.toml b/crates/committer_cli/Cargo.toml index 9fc69e8e0e7..538dd1fff6d 100644 --- a/crates/committer_cli/Cargo.toml +++ b/crates/committer_cli/Cargo.toml @@ -14,7 +14,7 @@ criterion = { version = "0.5.1", features = ["html_reports"] } pretty_assertions.workspace = true [dependencies] -clap = { version = "4.5.4", features = ["cargo", "derive"] } +clap = { version = "4.5.4", features = ["cargo", "derive"] } committer = { path = "../committer", features = ["testing"] } derive_more.workspace = true ethnum.workspace = true @@ -27,7 +27,7 @@ serde_json = "1.0.116" serde_repr = "0.1.19" simplelog.workspace = true starknet-types-core.workspace = true -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"} +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } strum.workspace = true strum_macros.workspace = true thiserror.workspace = true diff --git a/crates/gateway/Cargo.toml b/crates/gateway/Cargo.toml index 6098c9fb0ff..3bb8317f722 100644 --- a/crates/gateway/Cargo.toml +++ b/crates/gateway/Cargo.toml @@ -18,18 +18,18 @@ blockifier = { path = "../blockifier", version = "0.8.0-rc.0", features = ["test cairo-lang-starknet-classes.workspace = true cairo-vm.workspace = true hyper.workspace = true +mempool_test_utils = { path = "../mempool_test_utils", version = "0.0" } num-traits.workspace = true -papyrus_config = { path = "../papyrus_config", version = "0.4.0-rc.0"} -papyrus_rpc = { path = "../papyrus_rpc", version = "0.4.0-rc.0"} +papyrus_config = { path = "../papyrus_config", version = "0.4.0-rc.0" } +papyrus_rpc = { path = "../papyrus_rpc", version = "0.4.0-rc.0" } reqwest.workspace = true serde.workspace = true serde_json.workspace = true -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"} +starknet-types-core.workspace = true +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } starknet_mempool_infra = { path = "../mempool_infra", version = "0.0" } starknet_mempool_types = { path = "../mempool_types", version = "0.0" } starknet_sierra_compile = { path = "../starknet_sierra_compile", version = "0.0" } -starknet-types-core.workspace = true -mempool_test_utils = { path = "../mempool_test_utils", version = "0.0"} thiserror.workspace = true tokio.workspace = true tracing.workspace = true @@ -37,8 +37,8 @@ validator.workspace = true [dev-dependencies] assert_matches.workspace = true -mockito = "1.4.0" mockall.workspace = true +mockito = "1.4.0" num-bigint.workspace = true pretty_assertions.workspace = true rstest.workspace = true diff --git a/crates/mempool/Cargo.toml b/crates/mempool/Cargo.toml index 93ae59475ef..4c48c6fc110 100644 --- a/crates/mempool/Cargo.toml +++ b/crates/mempool/Cargo.toml @@ -11,8 +11,8 @@ workspace = true [dependencies] async-trait.workspace = true derive_more.workspace = true +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } starknet_mempool_infra = { path = "../mempool_infra", version = "0.0" } -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"} starknet_mempool_types = { path = "../mempool_types", version = "0.0" } tokio.workspace = true diff --git a/crates/mempool_node/Cargo.toml b/crates/mempool_node/Cargo.toml index 5a0bca6baa4..5f4a3082048 100644 --- a/crates/mempool_node/Cargo.toml +++ b/crates/mempool_node/Cargo.toml @@ -13,7 +13,7 @@ anyhow.workspace = true clap.workspace = true const_format.workspace = true futures.workspace = true -papyrus_config = { path = "../papyrus_config", version = "0.4.0-rc.0"} +papyrus_config = { path = "../papyrus_config", version = "0.4.0-rc.0" } serde.workspace = true starknet_gateway = { path = "../gateway", version = "0.0" } starknet_mempool = { path = "../mempool", version = "0.0" } @@ -27,6 +27,6 @@ validator.workspace = true assert-json-diff.workspace = true assert_matches.workspace = true colored.workspace = true +mempool_test_utils = { path = "../mempool_test_utils" } pretty_assertions.workspace = true serde_json.workspace = true -mempool_test_utils = { path = "../mempool_test_utils" } diff --git a/crates/mempool_test_utils/Cargo.toml b/crates/mempool_test_utils/Cargo.toml index 9e6f31d4f88..5ec0f40f11e 100644 --- a/crates/mempool_test_utils/Cargo.toml +++ b/crates/mempool_test_utils/Cargo.toml @@ -9,9 +9,7 @@ license.workspace = true [dependencies] assert_matches.workspace = true -blockifier = { path = "../blockifier", version = "0.8.0-rc.0", features = ["testing"]} -starknet-types-core.workspace = true -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"} +blockifier = { path = "../blockifier", version = "0.8.0-rc.0", features = ["testing"] } serde_json.workspace = true - - +starknet-types-core.workspace = true +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } diff --git a/crates/mempool_types/Cargo.toml b/crates/mempool_types/Cargo.toml index 17671d95191..2edcc3ec211 100644 --- a/crates/mempool_types/Cargo.toml +++ b/crates/mempool_types/Cargo.toml @@ -10,7 +10,7 @@ workspace = true [dependencies] async-trait.workspace = true -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"} mockall.workspace = true +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } starknet_mempool_infra = { path = "../mempool_infra" } thiserror.workspace = true diff --git a/crates/papyrus_base_layer/Cargo.toml b/crates/papyrus_base_layer/Cargo.toml index a274b7386d8..adee0a6b0a2 100644 --- a/crates/papyrus_base_layer/Cargo.toml +++ b/crates/papyrus_base_layer/Cargo.toml @@ -12,7 +12,7 @@ papyrus_config = { path = "../papyrus_config", version = "0.4.0-rc.0" } rustc-hex.workspace = true serde.workspace = true serde_json.workspace = true -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"} +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } thiserror.workspace = true tokio = { workspace = true, features = ["full", "sync"] } url.workspace = true @@ -20,10 +20,8 @@ url.workspace = true [dev-dependencies] ethers-core = { version = "2.0.3" } pretty_assertions.workspace = true -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0", features = ["testing"] } starknet-types-core.workspace = true +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0", features = ["testing"] } tar = { version = "0.4.38" } tempfile.workspace = true -test-with = { version = "0.9.3", default-features = false, features = [ - "executable", -] } +test-with = { version = "0.9.3", default-features = false, features = ["executable"] } diff --git a/crates/papyrus_common/Cargo.toml b/crates/papyrus_common/Cargo.toml index 09510a0b2fe..aca3b30686a 100644 --- a/crates/papyrus_common/Cargo.toml +++ b/crates/papyrus_common/Cargo.toml @@ -9,19 +9,19 @@ description = "Common utils and objects for a Starknet node." [dependencies] cairo-lang-starknet-classes.workspace = true hex.workspace = true +indexmap.workspace = true itertools.workspace = true lazy_static.workspace = true +rand.workspace = true serde.workspace = true serde_json.workspace = true sha3.workspace = true -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"} starknet-types-core = { workspace = true, features = ["hash"] } +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } thiserror.workspace = true -rand.workspace = true -indexmap.workspace = true [dev-dependencies] assert_matches.workspace = true -pretty_assertions.workspace = true -serde_json = { workspace = true, features = ["arbitrary_precision"]} papyrus_test_utils = { path = "../papyrus_test_utils" } +pretty_assertions.workspace = true +serde_json = { workspace = true, features = ["arbitrary_precision"] } diff --git a/crates/papyrus_config/Cargo.toml b/crates/papyrus_config/Cargo.toml index 4027dee8e1a..ae614b1c5f8 100644 --- a/crates/papyrus_config/Cargo.toml +++ b/crates/papyrus_config/Cargo.toml @@ -7,13 +7,13 @@ license-file.workspace = true description = "A library for handling node configuration." [package.metadata.cargo-udeps.ignore] -development = ["tempfile"] # Dependency of a doc-test +development = ["tempfile"] # Dependency of a doc-test [dependencies] clap = { workspace = true, features = ["env", "string"] } itertools.workspace = true serde = { workspace = true, features = ["derive"] } -serde_json = { workspace = true, features = ["arbitrary_precision"]} +serde_json = { workspace = true, features = ["arbitrary_precision"] } strum_macros.workspace = true thiserror.workspace = true validator = { workspace = true, features = ["derive"] } @@ -22,5 +22,5 @@ validator = { workspace = true, features = ["derive"] } assert_matches.workspace = true itertools.workspace = true lazy_static.workspace = true -tempfile.workspace = true papyrus_test_utils = { path = "../papyrus_test_utils" } +tempfile.workspace = true diff --git a/crates/papyrus_execution/Cargo.toml b/crates/papyrus_execution/Cargo.toml index 5aaba14ddf6..0ccb4ad428a 100644 --- a/crates/papyrus_execution/Cargo.toml +++ b/crates/papyrus_execution/Cargo.toml @@ -7,11 +7,11 @@ license-file.workspace = true description = "Transaction and entry point execution functionality for a Papyrus node." [features] -testing = ["rand", "rand_chacha", "papyrus_test_utils"] +testing = ["papyrus_test_utils", "rand", "rand_chacha"] [dependencies] anyhow.workspace = true -blockifier = { path = "../blockifier", version = "0.8.0-rc.0"} +blockifier = { path = "../blockifier", version = "0.8.0-rc.0" } cairo-lang-starknet-classes.workspace = true cairo-vm.workspace = true indexmap.workspace = true @@ -25,7 +25,7 @@ rand = { workspace = true, optional = true } rand_chacha = { workspace = true, optional = true } serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true, features = ["arbitrary_precision"] } -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"} +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } starknet-types-core.workspace = true papyrus_test_utils = { path = "../papyrus_test_utils", optional = true } thiserror.workspace = true diff --git a/crates/papyrus_load_test/Cargo.toml b/crates/papyrus_load_test/Cargo.toml index b98e7286c10..9ac8731e570 100644 --- a/crates/papyrus_load_test/Cargo.toml +++ b/crates/papyrus_load_test/Cargo.toml @@ -13,11 +13,11 @@ anyhow.workspace = true assert_matches.workspace = true goose = "0.17.0" once_cell.workspace = true -serde = { workspace = true, features = ["derive"] } -serde_json = { workspace = true, features = ["arbitrary_precision"]} -tokio.workspace = true rand.workspace = true reqwest.workspace = true +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true, features = ["arbitrary_precision"] } +tokio.workspace = true [dev-dependencies] lazy_static.workspace = true diff --git a/crates/papyrus_monitoring_gateway/Cargo.toml b/crates/papyrus_monitoring_gateway/Cargo.toml index 5d276b4864b..75ceb6c6a9e 100644 --- a/crates/papyrus_monitoring_gateway/Cargo.toml +++ b/crates/papyrus_monitoring_gateway/Cargo.toml @@ -10,8 +10,8 @@ axum.workspace = true hyper = { workspace = true, features = ["full"] } metrics-exporter-prometheus = { version = "0.12.1" } metrics-process = { version = "1.0.11" } -papyrus_storage = { path = "../papyrus_storage", version = "0.4.0-rc.0" } papyrus_config = { path = "../papyrus_config", version = "0.4.0-rc.0" } +papyrus_storage = { path = "../papyrus_storage", version = "0.4.0-rc.0" } rand.workspace = true serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true, features = ["arbitrary_precision"] } diff --git a/crates/papyrus_network/Cargo.toml b/crates/papyrus_network/Cargo.toml index aa3b18d7b53..67163c58e63 100644 --- a/crates/papyrus_network/Cargo.toml +++ b/crates/papyrus_network/Cargo.toml @@ -10,8 +10,8 @@ testing = [] [[bin]] name = "streamed_bytes_benchmark" -required-features = ["clap"] path = "src/bin/streamed_bytes_benchmark.rs" +required-features = ["clap"] [dependencies] async-stream.workspace = true @@ -21,21 +21,21 @@ derive_more.workspace = true futures.workspace = true lazy_static.workspace = true libp2p = { workspace = true, features = [ - "gossipsub", - "identify", - "kad", - "macros", - "noise", - "quic", - "tcp", - "tokio", - "yamux", - "serde", + "gossipsub", + "identify", + "kad", + "macros", + "noise", + "quic", + "serde", + "tcp", + "tokio", + "yamux", ] } metrics.workspace = true -replace_with.workspace = true papyrus_common = { path = "../papyrus_common", version = "0.4.0-rc.0" } papyrus_config = { path = "../papyrus_config", version = "0.4.0-rc.0" } +replace_with.workspace = true serde = { workspace = true, features = ["derive"] } thiserror.workspace = true tokio = { workspace = true, features = ["full", "sync"] } diff --git a/crates/papyrus_node/Cargo.toml b/crates/papyrus_node/Cargo.toml index a83ca963c28..5d6a82e523c 100644 --- a/crates/papyrus_node/Cargo.toml +++ b/crates/papyrus_node/Cargo.toml @@ -6,7 +6,7 @@ repository.workspace = true license-file.workspace = true [package.metadata.cargo-udeps.ignore] -normal = ["papyrus_base_layer", "clap", "reqwest", "tokio"] +normal = ["clap", "papyrus_base_layer", "reqwest", "tokio"] [features] default = ["rpc"] @@ -14,8 +14,8 @@ rpc = ["papyrus_rpc"] [[bin]] name = "central_source_integration_test" -required-features = ["futures-util", "tokio-stream"] path = "src/bin/central_source_integration_test.rs" +required-features = ["futures-util", "tokio-stream"] [dependencies] anyhow.workspace = true @@ -26,8 +26,8 @@ itertools.workspace = true lazy_static.workspace = true once_cell.workspace = true papyrus_base_layer = { path = "../papyrus_base_layer", version = "0.4.0-rc.0" } -papyrus_config = { path = "../papyrus_config", version = "0.4.0-rc.0" } papyrus_common = { path = "../papyrus_common", version = "0.4.0-rc.0" } +papyrus_config = { path = "../papyrus_config", version = "0.4.0-rc.0" } papyrus_consensus = { path = "../sequencing/papyrus_consensus", version = "0.4.0-rc.0" } papyrus_monitoring_gateway = { path = "../papyrus_monitoring_gateway", version = "0.4.0-rc.0" } papyrus_network = { path = "../papyrus_network", version = "0.4.0-rc.0" } @@ -36,15 +36,15 @@ papyrus_protobuf = { path = "../papyrus_protobuf", version = "0.4.0-rc.0" } papyrus_rpc = { path = "../papyrus_rpc", version = "0.4.0-rc.0", optional = true } papyrus_storage = { path = "../papyrus_storage", version = "0.4.0-rc.0" } papyrus_sync = { path = "../papyrus_sync", version = "0.4.0-rc.0" } -reqwest = { workspace = true, features = ["json", "blocking"] } +reqwest = { workspace = true, features = ["blocking", "json"] } serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true, features = ["arbitrary_precision"] } starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0", features = ["testing"] } starknet_client = { path = "../starknet_client" } strum.workspace = true tokio = { workspace = true, features = ["full", "sync"] } -tracing-subscriber = { workspace = true, features = ["env-filter"] } tracing.workspace = true +tracing-subscriber = { workspace = true, features = ["env-filter"] } validator = { workspace = true, features = ["derive"] } # Binaries dependencies @@ -55,8 +55,8 @@ tokio-stream = { workspace = true, optional = true } [dev-dependencies] assert-json-diff.workspace = true colored.workspace = true +insta = { workspace = true, features = ["json"] } metrics-exporter-prometheus.workspace = true +papyrus_test_utils = { path = "../papyrus_test_utils" } pretty_assertions.workspace = true -insta = { workspace = true, features = ["json"] } tempfile.workspace = true -papyrus_test_utils = { path = "../papyrus_test_utils" } diff --git a/crates/papyrus_p2p_sync/Cargo.toml b/crates/papyrus_p2p_sync/Cargo.toml index 5f092a19b84..969ce5dc809 100644 --- a/crates/papyrus_p2p_sync/Cargo.toml +++ b/crates/papyrus_p2p_sync/Cargo.toml @@ -19,7 +19,7 @@ papyrus_proc_macros = { path = "../papyrus_proc_macros", version = "0.4.0-rc.0" papyrus_protobuf = { path = "../papyrus_protobuf", version = "0.4.0-rc.0" } papyrus_storage = { path = "../papyrus_storage", version = "0.4.0-rc.0" } serde.workspace = true -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"} +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } starknet-types-core.workspace = true thiserror.workspace = true tokio.workspace = true @@ -34,7 +34,7 @@ static_assertions.workspace = true rand.workspace = true rand_chacha.workspace = true papyrus_test_utils = { path = "../papyrus_test_utils" } -papyrus_protobuf = { path = "../papyrus_protobuf", features = ["testing"]} +papyrus_protobuf = { path = "../papyrus_protobuf", features = ["testing"] } # The `metrics` crate is used by `latency_histogram` proc macro, which is used in this crate. [package.metadata.cargo-machete] diff --git a/crates/papyrus_proc_macros/Cargo.toml b/crates/papyrus_proc_macros/Cargo.toml index 5d2a030af33..6b39f41d91b 100644 --- a/crates/papyrus_proc_macros/Cargo.toml +++ b/crates/papyrus_proc_macros/Cargo.toml @@ -7,15 +7,15 @@ license-file.workspace = true description = "Procedural macros for the Papyrus node" [dependencies] -syn = { version = "2.0.39", features = ["full"] } quote = "1.0.26" +syn = { version = "2.0.39", features = ["full"] } [dev-dependencies] metrics.workspace = true metrics-exporter-prometheus.workspace = true papyrus_common = { path = "../papyrus_common", version = "0.4.0-dev.1" } -prometheus-parse.workspace = true papyrus_test_utils = { path = "../papyrus_test_utils" } +prometheus-parse.workspace = true [lib] proc-macro = true diff --git a/crates/papyrus_protobuf/Cargo.toml b/crates/papyrus_protobuf/Cargo.toml index 894df504edc..703d10d11cf 100644 --- a/crates/papyrus_protobuf/Cargo.toml +++ b/crates/papyrus_protobuf/Cargo.toml @@ -6,7 +6,7 @@ repository.workspace = true license-file.workspace = true [features] -testing = ["rand", "rand_chacha", "papyrus_test_utils"] +testing = ["papyrus_test_utils", "rand", "rand_chacha"] [dependencies] indexmap.workspace = true @@ -15,7 +15,7 @@ primitive-types.workspace = true prost.workspace = true rand = { workspace = true, optional = true } rand_chacha = { workspace = true, optional = true } -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"} +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } starknet-types-core.workspace = true papyrus_test_utils = { path = "../papyrus_test_utils", optional = true } thiserror.workspace = true diff --git a/crates/papyrus_rpc/Cargo.toml b/crates/papyrus_rpc/Cargo.toml index 49cae5f47c2..d96ba0e4466 100644 --- a/crates/papyrus_rpc/Cargo.toml +++ b/crates/papyrus_rpc/Cargo.toml @@ -23,12 +23,12 @@ papyrus_config = { path = "../papyrus_config", version = "0.4.0-rc.0" } papyrus_execution = { path = "../papyrus_execution", version = "0.4.0-rc.0" } papyrus_proc_macros = { path = "../papyrus_proc_macros", version = "0.4.0-rc.0" } papyrus_storage = { path = "../papyrus_storage", version = "0.4.0-rc.0" } -starknet_client = { path = "../starknet_client", version = "0.4.0-rc.0" } regex = { workspace = true } serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true, features = ["arbitrary_precision"] } -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"} starknet-types-core.workspace = true +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } +starknet_client = { path = "../starknet_client", version = "0.4.0-rc.0" } tokio = { workspace = true, features = ["full", "sync"] } tower = { workspace = true, features = ["full"] } tracing.workspace = true @@ -41,6 +41,7 @@ cairo-lang-starknet-classes.workspace = true camelpaste.workspace = true derive_more.workspace = true enum-iterator.workspace = true +indexmap = { workspace = true, features = ["serde"] } insta = { workspace = true, features = ["json"] } itertools.workspace = true jsonschema.workspace = true @@ -49,15 +50,14 @@ metrics-exporter-prometheus.workspace = true mockall.workspace = true papyrus_execution = { path = "../papyrus_execution", features = ["testing"] } papyrus_storage = { path = "../papyrus_storage", features = ["testing"] } +papyrus_test_utils = { path = "../papyrus_test_utils" } pretty_assertions.workspace = true prometheus-parse.workspace = true +rand.workspace = true rand_chacha.workspace = true reqwest.workspace = true -papyrus_test_utils = { path = "../papyrus_test_utils" } +starknet-core.workspace = true starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0", features = ["testing"] } starknet_client = { path = "../starknet_client", features = ["testing"] } -starknet-core.workspace = true strum.workspace = true strum_macros.workspace = true -indexmap = { workspace = true, features = ["serde"] } -rand.workspace = true diff --git a/crates/papyrus_storage/Cargo.toml b/crates/papyrus_storage/Cargo.toml index 37b46ae80c6..02caac570fa 100644 --- a/crates/papyrus_storage/Cargo.toml +++ b/crates/papyrus_storage/Cargo.toml @@ -7,23 +7,23 @@ license-file.workspace = true description = "A storage implementation for a Starknet node." [features] -testing = ["tempfile"] document_calls = ["lazy_static"] +testing = ["tempfile"] [[bin]] name = "dump_declared_classes" -required-features = ["clap"] path = "src/bin/dump_declared_classes.rs" +required-features = ["clap"] [[bin]] name = "storage_benchmark" -required-features = ["clap", "statistical"] path = "src/bin/storage_benchmark.rs" +required-features = ["clap", "statistical"] [dependencies] byteorder.workspace = true -cairo-lang-starknet-classes.workspace = true cairo-lang-casm = { workspace = true, features = ["parity-scale-codec"] } +cairo-lang-starknet-classes.workspace = true cairo-lang-utils.workspace = true human_bytes.workspace = true indexmap = { workspace = true, features = ["serde"] } @@ -41,8 +41,8 @@ parity-scale-codec.workspace = true primitive-types.workspace = true serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true, features = ["arbitrary_precision"] } -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"} starknet-types-core = { workspace = true, features = ["papyrus-serialization"] } +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } tempfile = { workspace = true, optional = true } thiserror.workspace = true tracing = { workspace = true, features = ["log"] } @@ -56,14 +56,12 @@ statistical = { workspace = true, optional = true } [dev-dependencies] assert_matches.workspace = true -cairo-lang-casm = { workspace = true, features = [ - "parity-scale-codec", - "schemars", -] } +cairo-lang-casm = { workspace = true, features = ["parity-scale-codec", "schemars"] } camelpaste.workspace = true insta = { workspace = true, features = ["yaml"] } metrics-exporter-prometheus.workspace = true num-traits.workspace = true +papyrus_test_utils = { path = "../papyrus_test_utils" } paste.workspace = true pretty_assertions.workspace = true prometheus-parse.workspace = true @@ -74,5 +72,4 @@ simple_logger.workspace = true tempfile = { workspace = true } test-case.workspace = true test-log.workspace = true -papyrus_test_utils = { path = "../papyrus_test_utils" } tokio = { workspace = true, features = ["full", "sync"] } diff --git a/crates/papyrus_sync/Cargo.toml b/crates/papyrus_sync/Cargo.toml index 66011e9ca81..81fbc54a1f4 100644 --- a/crates/papyrus_sync/Cargo.toml +++ b/crates/papyrus_sync/Cargo.toml @@ -10,33 +10,33 @@ async-stream.workspace = true async-trait.workspace = true cairo-lang-starknet-classes.workspace = true chrono.workspace = true -futures-util.workspace = true futures.workspace = true +futures-util.workspace = true indexmap = { workspace = true, features = ["serde"] } itertools.workspace = true lru.workspace = true metrics.workspace = true -papyrus_storage = { path = "../papyrus_storage", version = "0.4.0-rc.0" } papyrus_base_layer = { path = "../papyrus_base_layer", version = "0.4.0-rc.0" } papyrus_common = { path = "../papyrus_common", version = "0.4.0-rc.0" } papyrus_config = { path = "../papyrus_config", version = "0.4.0-rc.0" } papyrus_proc_macros = { path = "../papyrus_proc_macros", version = "0.4.0-rc.0" } -reqwest = { workspace = true, features = ["json", "blocking"] } +papyrus_storage = { path = "../papyrus_storage", version = "0.4.0-rc.0" } +reqwest = { workspace = true, features = ["blocking", "json"] } serde = { workspace = true, features = ["derive"] } -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"} -starknet_client = { path = "../starknet_client" } starknet-types-core.workspace = true +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } +starknet_client = { path = "../starknet_client" } thiserror.workspace = true tokio = { workspace = true, features = ["full", "sync"] } tracing.workspace = true [dev-dependencies] -simple_logger.workspace = true assert_matches.workspace = true mockall.workspace = true papyrus_storage = { path = "../papyrus_storage", features = ["testing"] } +papyrus_test_utils = { path = "../papyrus_test_utils" } pretty_assertions.workspace = true -starknet_client = { path = "../starknet_client", features = ["testing"] } +simple_logger.workspace = true starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0", features = ["testing"] } -papyrus_test_utils = { path = "../papyrus_test_utils" } +starknet_client = { path = "../starknet_client", features = ["testing"] } tokio-stream.workspace = true diff --git a/crates/papyrus_test_utils/Cargo.toml b/crates/papyrus_test_utils/Cargo.toml index b66e0ee246c..2f59bd7be8a 100644 --- a/crates/papyrus_test_utils/Cargo.toml +++ b/crates/papyrus_test_utils/Cargo.toml @@ -8,20 +8,20 @@ license-file.workspace = true [features] [dependencies] -cairo-lang-starknet-classes.workspace = true cairo-lang-casm.workspace = true +cairo-lang-starknet-classes.workspace = true cairo-lang-utils.workspace = true indexmap = { workspace = true, features = ["serde"] } +num-bigint.workspace = true primitive-types = { workspace = true, features = ["serde"] } prometheus-parse.workspace = true -num-bigint.workspace = true rand.workspace = true rand_chacha.workspace = true reqwest = { workspace = true, features = ["json"] } serde = { workspace = true, features = ["derive"] } -serde_json = { workspace = true, features = ["arbitrary_precision"]} -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0", features = ["testing"] } +serde_json = { workspace = true, features = ["arbitrary_precision"] } starknet-types-core = { workspace = true, features = ["hash"] } +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0", features = ["testing"] } [dev-dependencies] pretty_assertions.workspace = true diff --git a/crates/sequencing/papyrus_block_builder/Cargo.toml b/crates/sequencing/papyrus_block_builder/Cargo.toml index bd32c581f74..a38a5ba9118 100644 --- a/crates/sequencing/papyrus_block_builder/Cargo.toml +++ b/crates/sequencing/papyrus_block_builder/Cargo.toml @@ -8,10 +8,10 @@ description = "A block-builder for Starknet blocks" [dependencies] papyrus_storage = { path = "../../papyrus_storage", version = "0.4.0-rc.0", features = ["testing"] } -starknet_api = { path = "../../starknet_api", version = "0.13.0-rc.0"} +starknet_api = { path = "../../starknet_api", version = "0.13.0-rc.0" } thiserror.workspace = true tracing.workspace = true [dev-dependencies] -pretty_assertions.workspace = true papyrus_test_utils = { path = "../../papyrus_test_utils" } +pretty_assertions.workspace = true diff --git a/crates/sequencing/papyrus_consensus/Cargo.toml b/crates/sequencing/papyrus_consensus/Cargo.toml index 6e5c4ddba54..4f5be1c80ba 100644 --- a/crates/sequencing/papyrus_consensus/Cargo.toml +++ b/crates/sequencing/papyrus_consensus/Cargo.toml @@ -11,20 +11,22 @@ async-trait.workspace = true futures.workspace = true metrics.workspace = true papyrus_common = { path = "../../papyrus_common", version = "0.4.0-dev.2" } -papyrus_network = { path = "../../papyrus_network", version = "0.4.0-dev.2" } papyrus_config = { path = "../../papyrus_config", version = "0.4.0-dev.2" } +papyrus_network = { path = "../../papyrus_network", version = "0.4.0-dev.2" } papyrus_protobuf = { path = "../../papyrus_protobuf", version = "0.4.0-dev.2" } papyrus_storage = { path = "../../papyrus_storage", version = "0.4.0-dev.2" } serde = { workspace = true, features = ["derive"] } -starknet_api = { path = "../../starknet_api", version = "0.13.0-rc.0"} starknet-types-core.workspace = true +starknet_api = { path = "../../starknet_api", version = "0.13.0-rc.0" } thiserror.workspace = true tokio = { workspace = true, features = ["full"] } tracing.workspace = true [dev-dependencies] mockall.workspace = true -papyrus_network = { path = "../../papyrus_network", version = "0.4.0-dev.2", features = ["testing"] } +papyrus_network = { path = "../../papyrus_network", version = "0.4.0-dev.2", features = [ + "testing", +] } papyrus_storage = { path = "../../papyrus_storage", features = ["testing"] } papyrus_test_utils = { path = "../../papyrus_test_utils" } test-case.workspace = true diff --git a/crates/starknet_api/Cargo.toml b/crates/starknet_api/Cargo.toml index bda96cb5769..cc7a44a7f34 100644 --- a/crates/starknet_api/Cargo.toml +++ b/crates/starknet_api/Cargo.toml @@ -30,4 +30,3 @@ thiserror = "1.0.31" [dev-dependencies] assert_matches = "1.5.0" rstest = "0.17.0" - diff --git a/crates/starknet_client/Cargo.toml b/crates/starknet_client/Cargo.toml index 6bfc284bd80..0454e7eb3bc 100644 --- a/crates/starknet_client/Cargo.toml +++ b/crates/starknet_client/Cargo.toml @@ -7,7 +7,7 @@ license-file.workspace = true description = "A client implementation that can communicate with Starknet." [features] -testing = ["enum-iterator", "mockall", "rand", "rand_chacha", "papyrus_test_utils"] +testing = ["enum-iterator", "mockall", "papyrus_test_utils", "rand", "rand_chacha"] [dependencies] async-trait.workspace = true @@ -21,12 +21,12 @@ papyrus_common = { path = "../papyrus_common", version = "0.4.0-rc.0" } papyrus_config = { path = "../papyrus_config", version = "0.4.0-rc.0" } rand = { workspace = true, optional = true } rand_chacha = { workspace = true, optional = true } -reqwest = { workspace = true, features = ["json", "blocking"] } +reqwest = { workspace = true, features = ["blocking", "json"] } serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true, features = ["arbitrary_precision"] } serde_repr.workspace = true -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"} -starknet-types-core = {workspace = true, features = ["serde"]} +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } +starknet-types-core = { workspace = true, features = ["serde"] } strum.workspace = true strum_macros.workspace = true papyrus_test_utils = { path = "../papyrus_test_utils", optional = true } diff --git a/crates/starknet_sierra_compile/Cargo.toml b/crates/starknet_sierra_compile/Cargo.toml index 7addf9cee22..641eadbb4a4 100644 --- a/crates/starknet_sierra_compile/Cargo.toml +++ b/crates/starknet_sierra_compile/Cargo.toml @@ -12,12 +12,12 @@ workspace = true cairo-lang-sierra.workspace = true cairo-lang-starknet-classes.workspace = true cairo-lang-utils.workspace = true -serde_json.workspace = true serde.workspace = true -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"} +serde_json.workspace = true starknet-types-core.workspace = true +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } thiserror.workspace = true [dev-dependencies] assert_matches.workspace = true -mempool_test_utils = {path = "../mempool_test_utils"} +mempool_test_utils = { path = "../mempool_test_utils" } diff --git a/crates/tests-integration/Cargo.toml b/crates/tests-integration/Cargo.toml index 0ae365efc4e..8bfc220c850 100644 --- a/crates/tests-integration/Cargo.toml +++ b/crates/tests-integration/Cargo.toml @@ -10,19 +10,19 @@ workspace = true [dependencies] axum.workspace = true -blockifier = { path = "../blockifier", version = "0.8.0-rc.0"} +blockifier = { path = "../blockifier", version = "0.8.0-rc.0" } cairo-lang-starknet-classes.workspace = true indexmap.workspace = true -papyrus_common = { path = "../papyrus_common", version = "0.4.0-rc.0"} -papyrus_rpc = { path = "../papyrus_rpc", version = "0.4.0-rc.0"} -papyrus_storage = { path = "../papyrus_storage", version = "0.4.0-rc.0"} -mempool_test_utils = { path = "../mempool_test_utils", version = "0.0" } itertools.workspace = true +mempool_test_utils = { path = "../mempool_test_utils", version = "0.0" } +papyrus_common = { path = "../papyrus_common", version = "0.4.0-rc.0" } +papyrus_rpc = { path = "../papyrus_rpc", version = "0.4.0-rc.0" } +papyrus_storage = { path = "../papyrus_storage", version = "0.4.0-rc.0" } reqwest.workspace = true serde_json.workspace = true -starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"} -starknet_client = { path = "../starknet_client", version = "0.4.0-rc.0"} starknet-types-core.workspace = true +starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } +starknet_client = { path = "../starknet_client", version = "0.4.0-rc.0" } starknet_gateway = { path = "../gateway", version = "0.0", features = ["testing"] } starknet_mempool_infra = { path = "../mempool_infra", version = "0.0" } starknet_mempool_node = { path = "../mempool_node", version = "0.0" } diff --git a/rustfmt.toml b/rustfmt.toml index 1cb6623287a..3820d621dd4 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,23 +1,23 @@ edition = "2021" +max_width = 100 newline_style = "Unix" use_field_init_shorthand = true use_small_heuristics = "Max" use_try_shorthand = true -max_width = 100 # Unstable features below -unstable_features = true -version = "Two" comment_width = 100 format_code_in_doc_comments = true format_macro_bodies = true format_macro_matchers = true format_strings = true +group_imports = "StdExternalCrate" imports_granularity = "Module" imports_layout = "HorizontalVertical" -group_imports = "StdExternalCrate" normalize_comments = true normalize_doc_attributes = true +unstable_features = true +version = "Two" wrap_comments = true # To use these settings in vscode, add the following line to your settings: From cebfa7562da09a3fac8626ff78195ec75331cae7 Mon Sep 17 00:00:00 2001 From: dorimedini-starkware Date: Mon, 29 Jul 2024 16:38:19 +0300 Subject: [PATCH 03/13] fix: ascii art spacing (#119) Signed-off-by: Dori Medini --- .../original_skeleton_tree/create_tree_test.rs | 10 +++++----- .../original_skeleton_tree/skeleton_forest_test.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/committer/src/patricia_merkle_tree/original_skeleton_tree/create_tree_test.rs b/crates/committer/src/patricia_merkle_tree/original_skeleton_tree/create_tree_test.rs index a2fe4a1af91..223ed323031 100644 --- a/crates/committer/src/patricia_merkle_tree/original_skeleton_tree/create_tree_test.rs +++ b/crates/committer/src/patricia_merkle_tree/original_skeleton_tree/create_tree_test.rs @@ -135,9 +135,9 @@ use crate::storage::storage_trait::{create_db_key, StarknetPrefix, StorageKey, S /// / \ /// 26 90 /// / / \ -/// * 25 65 +/// / 25 65 /// / \ / \ -/// 24 * 6 59 +/// 24 \ 6 59 /// / \ \ / / \ /// 11 13 20 5 19 40 /// @@ -149,9 +149,9 @@ use crate::storage::storage_trait::{create_db_key, StarknetPrefix, StorageKey, S /// / \ /// E B /// / / \ -/// * E B +/// / E B /// / \ / \ -/// 24 * E B +/// 24 \ E B /// \ / \ /// 20 5 40 #[case::tree_of_height_4_with_long_edge( @@ -293,7 +293,7 @@ fn test_create_tree( /// /// 1 /// / \ -/// * * +/// ^ / /// / \ / /// 4 5 6 /// / \ / \ / diff --git a/crates/committer/src/patricia_merkle_tree/original_skeleton_tree/skeleton_forest_test.rs b/crates/committer/src/patricia_merkle_tree/original_skeleton_tree/skeleton_forest_test.rs index 3a52741c76e..263d6f1462d 100644 --- a/crates/committer/src/patricia_merkle_tree/original_skeleton_tree/skeleton_forest_test.rs +++ b/crates/committer/src/patricia_merkle_tree/original_skeleton_tree/skeleton_forest_test.rs @@ -111,7 +111,7 @@ pub(crate) fn create_contract_state_leaf_entry(val: u128) -> (StorageKey, Storag /// / \ / /// E E B /// / \ / \ -/// * B B E +/// / B B E /// / / \ \ /// 303 NZ 47 UB /// From 856316143121887b3e6666565f24fb8d2d20fce3 Mon Sep 17 00:00:00 2001 From: dorimedini-starkware Date: Mon, 29 Jul 2024 16:54:04 +0300 Subject: [PATCH 04/13] chore(ci): remove duplicate Machete CI job (#118) Signed-off-by: Dori Medini --- .github/workflows/blockifier_ci.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/blockifier_ci.yml b/.github/workflows/blockifier_ci.yml index f5a994f2fd3..2a4c1d1a1e1 100644 --- a/.github/workflows/blockifier_ci.yml +++ b/.github/workflows/blockifier_ci.yml @@ -77,12 +77,3 @@ jobs: with: path: "target/release/native_blockifier.pypy39-pp73-x86_64-linux-gnu.so" destination: "native_blockifier_artifacts/${{ env.SHORT_HASH }}/release/" - - # Keep the name 'udeps' to match original action name, so we don't need to define specific branch - # rules on Github for specific version branches. - udeps: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Run Machete (detect unused dependencies) - uses: bnjbvr/cargo-machete@main From 97f66736e11d4b374720d0a1cc7c57d74eeb27e2 Mon Sep 17 00:00:00 2001 From: dorimedini-starkware Date: Tue, 30 Jul 2024 11:26:01 +0300 Subject: [PATCH 05/13] chore(ci): add blockifier scope to commitlint (#185) Signed-off-by: Dori Medini --- commitlint.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/commitlint.config.js b/commitlint.config.js index adb289042bb..859901f361d 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -22,6 +22,7 @@ const Configuration = { 'base_layer', 'block_builder', 'block_hash', + 'blockifier', 'ci', 'common', 'concurrency', From 22f49581db5a7e26be5745e0f81d61544157d8d0 Mon Sep 17 00:00:00 2001 From: dorimedini-starkware Date: Tue, 30 Jul 2024 12:31:15 +0300 Subject: [PATCH 06/13] chore(ci): add timestamp in forward-merge branch to prevent collisions (#191) Signed-off-by: Dori Medini --- scripts/merge_branches.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/merge_branches.py b/scripts/merge_branches.py index 21d9743af5b..6ae3c493385 100755 --- a/scripts/merge_branches.py +++ b/scripts/merge_branches.py @@ -11,6 +11,7 @@ import json import os import subprocess +import time from typing import Dict, List, Optional FINAL_BRANCH = "main" @@ -81,7 +82,7 @@ def merge_branches(src_branch: str, dst_branch: Optional[str]): user = os.environ["USER"] dst_branch = get_dst_branch(src_branch=src_branch, dst_branch_override=dst_branch) - merge_branch = f"{user}/merge-{src_branch}-into-{dst_branch}" + merge_branch = f"{user}/merge-{src_branch}-into-{dst_branch}-{int(time.time())}" print(f"Source branch: {src_branch}") print(f"Destination branch: {dst_branch}\n") From 13b2edf42d0947a83592e1d3bc648f92b331474f Mon Sep 17 00:00:00 2001 From: dorimedini-starkware Date: Tue, 30 Jul 2024 12:31:21 +0300 Subject: [PATCH 07/13] chore(ci): fix commitlint PR title check for forward-merge (#192) Signed-off-by: Dori Medini --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6a6b2f7615d..2337750bffd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,14 +28,14 @@ jobs: run: npm install --global @commitlint/cli @commitlint/config-conventional - name: Validate PR commits with commitlint - if: github.event_name == 'pull_request' && !(contains(github.event.pull_request.title, '/merge-main') || contains(github.event.pull_request.title, '/merge main')) + if: github.event_name == 'pull_request' && !(contains(github.event.pull_request.title, 'merge-main') || contains(github.event.pull_request.title, 'merge main')) env: BASE_SHA: ${{ github.event.pull_request.base.sha }} HEAD_SHA: ${{ github.event.pull_request.head.sha }} run: commitlint --from "$BASE_SHA" --to "$HEAD_SHA" --verbose - name: Validate PR title with commitlint - if: github.event_name != 'merge_group' && github.event_name != 'push' && !(contains(github.event.pull_request.title, '/merge-main') || contains(github.event.pull_request.title, '/merge main')) + if: github.event_name != 'merge_group' && github.event_name != 'push' && !(contains(github.event.pull_request.title, 'merge-main') || contains(github.event.pull_request.title, 'merge main')) env: TITLE: ${{ github.event.pull_request.title }} run: echo "$TITLE" | commitlint --verbose From 4c569778c8a1fa86a81e7dafcc8a56d71a0ab0c6 Mon Sep 17 00:00:00 2001 From: aner-starkware <147302140+aner-starkware@users.noreply.github.com> Date: Tue, 30 Jul 2024 15:00:01 +0300 Subject: [PATCH 08/13] test: add threads to regression test (#144) * test: add threads to regression test * test: add file printout in case of failure --- Cargo.lock | 2 + crates/committer_cli/Cargo.toml | 2 + .../src/tests/regression_tests.rs | 44 +++++++++++++------ 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6680afca254..cc8e8d91603 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1996,6 +1996,7 @@ dependencies = [ "criterion 0.5.1", "derive_more", "ethnum", + "futures", "indexmap 2.2.6", "log", "pretty_assertions", @@ -2009,6 +2010,7 @@ dependencies = [ "starknet_api", "strum 0.25.0", "strum_macros 0.25.3", + "tempfile", "thiserror", "tokio", ] diff --git a/crates/committer_cli/Cargo.toml b/crates/committer_cli/Cargo.toml index 538dd1fff6d..70dec1303e2 100644 --- a/crates/committer_cli/Cargo.toml +++ b/crates/committer_cli/Cargo.toml @@ -11,7 +11,9 @@ workspace = true [dev-dependencies] criterion = { version = "0.5.1", features = ["html_reports"] } +futures.workspace = true pretty_assertions.workspace = true +tempfile.workspace = true [dependencies] clap = { version = "4.5.4", features = ["cargo", "derive"] } diff --git a/crates/committer_cli/src/tests/regression_tests.rs b/crates/committer_cli/src/tests/regression_tests.rs index 8bbf8c59ca8..26b5df09ac9 100644 --- a/crates/committer_cli/src/tests/regression_tests.rs +++ b/crates/committer_cli/src/tests/regression_tests.rs @@ -1,10 +1,12 @@ use std::collections::HashMap; use std::fs; +use clap::Error; use committer::block_committer::input::{ConfigImpl, Input}; use committer::patricia_merkle_tree::external_test_utils::single_tree_flow_test; use serde::{Deserialize, Deserializer}; use serde_json::{Map, Value}; +use tempfile::NamedTempFile; use super::utils::parse_from_python::parse_input_single_storage_tree_flow_test; use crate::commands::commit; @@ -123,18 +125,15 @@ pub async fn test_regression_single_tree() { assert!(execution_time.as_secs_f64() < MAX_TIME_FOR_SINGLE_TREE_BECHMARK_TEST); } -pub async fn test_single_committer_flow(input: &str, output_path: &str) { +pub async fn test_single_committer_flow(input: String, output_path: String) -> Result<(), Error> { let CommitterRegressionInput { committer_input, contract_states_root: expected_contract_states_root, contract_classes_root: expected_contract_classes_root, expected_facts, - } = serde_json::from_str(input).unwrap(); - - let start = std::time::Instant::now(); + } = serde_json::from_str(&input).unwrap(); // Benchmark the committer flow test. commit(committer_input.0, output_path.to_owned()).await; - let execution_time = std::time::Instant::now() - start; // Assert correctness of the output of the committer flow test. let CommitterRegressionOutput { @@ -151,12 +150,21 @@ pub async fn test_single_committer_flow(input: &str, output_path: &str) { assert_eq!(storage_changes, *expected_facts); // Assert the execution time does not exceed the threshold. - assert!(execution_time.as_secs_f64() < MAX_TIME_FOR_COMMITTER_FLOW_BECHMARK_TEST); + // TODO(Aner, 20/06/2024): Add cpu_time time measurement and verify the time is below the + // threshold. + Ok(()) } #[ignore = "To avoid running the regression test in Coverage or without the --release flag."] #[tokio::test(flavor = "multi_thread")] pub async fn test_regression_committer_flow() { - test_single_committer_flow(FLOW_TEST_INPUT, OUTPUT_PATH).await; + let start = std::time::Instant::now(); + let result = + test_single_committer_flow(FLOW_TEST_INPUT.to_string(), OUTPUT_PATH.to_string()).await; + if result.is_err() { + panic!("Error {}", result.err().unwrap()); + } + let execution_time = std::time::Instant::now() - start; + assert!(execution_time.as_secs_f64() < MAX_TIME_FOR_COMMITTER_FLOW_BECHMARK_TEST); } #[ignore = "To avoid running the regression test in Coverage or without the --release flag."] @@ -167,12 +175,20 @@ pub async fn test_regression_committer_all_files() { EXPECTED_NUMBER_OF_FILES ); let dir_path = fs::read_dir("./test_inputs/regression_files").unwrap(); - for file_path in dir_path { - // TODO(Aner, 23/07/24): multi-thread the test. - test_single_committer_flow( - &fs::read_to_string(file_path.unwrap().path()).unwrap(), - OUTPUT_PATH, - ) - .await; + let mut tasks = Vec::with_capacity(EXPECTED_NUMBER_OF_FILES); + for entry in dir_path { + tasks.push(tokio::task::spawn(async move { + let file_path = entry.unwrap().path(); + let output_file = NamedTempFile::new().unwrap(); + let result = test_single_committer_flow( + fs::read_to_string(file_path.clone()).unwrap(), + output_file.path().to_str().unwrap().to_string(), + ) + .await; + if result.is_err() { + panic!("Error {} for file: {:?}", result.err().unwrap(), file_path); + } + })); } + futures::future::try_join_all(tasks).await.unwrap(); } From 5e95948600cf9a11f2192a78d3fc78b6c8343d5b Mon Sep 17 00:00:00 2001 From: dorimedini-starkware Date: Tue, 30 Jul 2024 18:30:57 +0300 Subject: [PATCH 09/13] chore(ci): more informative merge_status.py output (#211) Signed-off-by: Dori Medini --- scripts/merge_status.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/merge_status.py b/scripts/merge_status.py index eccc251972d..2a1dfc35f52 100755 --- a/scripts/merge_status.py +++ b/scripts/merge_status.py @@ -47,11 +47,11 @@ def print_merge_status(): ) if len(unmerged_commits_timestamps) == 0: - status = color_txt(BashColor.green, "Up to date") + status = color_txt(BashColor.green, "Up to date.") else: last_unmerged_commit_time = datetime.fromtimestamp(min(unmerged_commits_timestamps)) unmerged_days = (datetime.now() - last_unmerged_commit_time).days - status = f"{unmerged_days} days" + status = f"{unmerged_days} days, {len(unmerged_commits_timestamps)} unmerged commits." if unmerged_days > 7: status = color_txt(BashColor.red, status) From 9e9e1cfee4ccc51161e67c2e3cde62bbe6e2650f Mon Sep 17 00:00:00 2001 From: amosStarkware <88497213+amosStarkware@users.noreply.github.com> Date: Tue, 30 Jul 2024 18:59:47 +0300 Subject: [PATCH 10/13] fix: silence clippy (#212) --- .../src/patricia_merkle_tree/node_data/inner_node.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/committer/src/patricia_merkle_tree/node_data/inner_node.rs b/crates/committer/src/patricia_merkle_tree/node_data/inner_node.rs index 4250b0f05e0..4f2950a4f44 100644 --- a/crates/committer/src/patricia_merkle_tree/node_data/inner_node.rs +++ b/crates/committer/src/patricia_merkle_tree/node_data/inner_node.rs @@ -1,5 +1,4 @@ use ethnum::U256; -use strum_macros::{EnumDiscriminants, EnumIter}; use crate::felt::Felt; use crate::hash::hash_trait::HashOutput; @@ -12,8 +11,8 @@ use crate::patricia_merkle_tree::types::{NodeIndex, SubTreeHeight}; pub mod inner_node_test; #[derive(Clone, Debug, PartialEq, Eq)] -#[cfg_attr(any(test, feature = "testing"), derive(EnumDiscriminants))] -#[cfg_attr(any(test, feature = "testing"), strum_discriminants(derive(EnumIter)))] +#[cfg_attr(any(test, feature = "testing"), derive(strum_macros::EnumDiscriminants))] +#[cfg_attr(any(test, feature = "testing"), strum_discriminants(derive(strum_macros::EnumIter)))] // A Patricia-Merkle tree node's data, i.e., the pre-image of its hash. pub enum NodeData { Binary(BinaryData), From f85876d238840f9db0696dd2e871f0480637d7ed Mon Sep 17 00:00:00 2001 From: dorimedini-starkware Date: Wed, 31 Jul 2024 10:04:45 +0300 Subject: [PATCH 11/13] fix: add missing config.toml (#193) Signed-off-by: Dori Medini --- .github/workflows/blockifier_ci.yml | 4 +++- crates/native_blockifier/.cargo/config.toml | 18 ++++++++++++++++++ taplo.toml | 2 ++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 crates/native_blockifier/.cargo/config.toml diff --git a/.github/workflows/blockifier_ci.yml b/.github/workflows/blockifier_ci.yml index 2a4c1d1a1e1..58048dfa092 100644 --- a/.github/workflows/blockifier_ci.yml +++ b/.github/workflows/blockifier_ci.yml @@ -9,6 +9,7 @@ on: - v[0-9].** paths: - 'crates/blockifier/**' + - 'crates/native_blockifier/.cargo/config.toml' pull_request: types: @@ -19,6 +20,7 @@ on: - edited paths: - 'crates/blockifier/**' + - 'crates/native_blockifier/.cargo/config.toml' jobs: featureless-build: @@ -40,7 +42,7 @@ jobs: - uses: Swatinem/rust-cache@v2 with: - prefix-key: "v0-rust-ubuntu-20.04" + prefix-key: "v1-rust-ubuntu-20.04" - name: Build native blockifier run: ./build_native_blockifier.sh diff --git a/crates/native_blockifier/.cargo/config.toml b/crates/native_blockifier/.cargo/config.toml new file mode 100644 index 00000000000..72056763ad4 --- /dev/null +++ b/crates/native_blockifier/.cargo/config.toml @@ -0,0 +1,18 @@ +[env] +# Enforce native_blockifier linking with pypy3.9. +PYO3_PYTHON = "/usr/local/bin/pypy3.9" +# Increase Rust stack size. +# This should be large enough for `MAX_ENTRY_POINT_RECURSION_DEPTH` recursive entry point calls. +RUST_MIN_STACK = "4194304" # 4 MiB + +[target.x86_64-apple-darwin] +rustflags = [ + "-C", "link-arg=-undefined", + "-C", "link-arg=dynamic_lookup", +] + +[target.aarch64-apple-darwin] +rustflags = [ + "-C", "link-arg=-undefined", + "-C", "link-arg=dynamic_lookup", +] diff --git a/taplo.toml b/taplo.toml index a64174e9385..9b579983024 100644 --- a/taplo.toml +++ b/taplo.toml @@ -1,3 +1,5 @@ +exclude = ["crates/native_blockifier/.cargo/config.toml"] + [formatting] column_width = 100 reorder_arrays = true From 41810e8b9748be21feb505d275f1c46f5054766c Mon Sep 17 00:00:00 2001 From: Dori Medini Date: Wed, 31 Jul 2024 11:48:51 +0300 Subject: [PATCH 12/13] fix: conflict resolution Signed-off-by: Dori Medini --- Cargo.toml | 70 +------------------------------ crates/mempool_types/Cargo.toml | 4 -- crates/papyrus_network/Cargo.toml | 38 ----------------- 3 files changed, 1 insertion(+), 111 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 53848967773..f7badf4f4f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,74 +4,7 @@ resolver = "2" members = [ -<<<<<<< HEAD - "crates/batcher", - "crates/blockifier", - "crates/committer", - "crates/committer_cli", - "crates/gateway", - "crates/mempool", - "crates/mempool_infra", - "crates/mempool_node", - "crates/mempool_test_utils", - "crates/mempool_types", - "crates/native_blockifier", - "crates/papyrus_base_layer", - "crates/papyrus_common", - "crates/papyrus_config", - "crates/papyrus_execution", - "crates/papyrus_load_test", - "crates/papyrus_monitoring_gateway", - "crates/papyrus_network", - "crates/papyrus_node", - "crates/papyrus_p2p_sync", - "crates/papyrus_proc_macros", - "crates/papyrus_protobuf", - "crates/papyrus_rpc", - "crates/papyrus_storage", - "crates/papyrus_sync", - "crates/papyrus_test_utils", - "crates/sequencing/papyrus_block_builder", - "crates/sequencing/papyrus_consensus", - "crates/starknet_api", - "crates/starknet_client", - "crates/starknet_sierra_compile", - "crates/task_executor", - "crates/tests-integration", -||||||| 7ee04dbc - "crates/blockifier", - "crates/committer", - "crates/committer_cli", - "crates/gateway", - "crates/mempool", - "crates/mempool_infra", - "crates/mempool_node", - "crates/mempool_test_utils", - "crates/mempool_types", - "crates/native_blockifier", - "crates/papyrus_base_layer", - "crates/papyrus_common", - "crates/papyrus_config", - "crates/papyrus_execution", - "crates/papyrus_load_test", - "crates/papyrus_monitoring_gateway", - "crates/papyrus_network", - "crates/papyrus_node", - "crates/papyrus_p2p_sync", - "crates/papyrus_proc_macros", - "crates/papyrus_protobuf", - "crates/papyrus_rpc", - "crates/papyrus_storage", - "crates/papyrus_sync", - "crates/papyrus_test_utils", - "crates/sequencing/papyrus_block_builder", - "crates/sequencing/papyrus_consensus", - "crates/starknet_api", - "crates/starknet_client", - "crates/starknet_sierra_compile", - "crates/task_executor", - "crates/tests-integration", -======= + "crates/batcher", "crates/blockifier", "crates/committer", "crates/committer_cli", @@ -104,7 +37,6 @@ members = [ "crates/starknet_sierra_compile", "crates/task_executor", "crates/tests-integration", ->>>>>>> origin/main-v0.13.2 ] [workspace.package] diff --git a/crates/mempool_types/Cargo.toml b/crates/mempool_types/Cargo.toml index 01acc61ad8c..6ef05d7dbb2 100644 --- a/crates/mempool_types/Cargo.toml +++ b/crates/mempool_types/Cargo.toml @@ -11,11 +11,7 @@ workspace = true [dependencies] async-trait.workspace = true mockall.workspace = true -<<<<<<< HEAD serde = { workspace = true, feat = ["derive"] } -||||||| 7ee04dbc -======= starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" } ->>>>>>> origin/main-v0.13.2 starknet_mempool_infra = { path = "../mempool_infra" } thiserror.workspace = true diff --git a/crates/papyrus_network/Cargo.toml b/crates/papyrus_network/Cargo.toml index 16825cd4394..b6434068f73 100644 --- a/crates/papyrus_network/Cargo.toml +++ b/crates/papyrus_network/Cargo.toml @@ -8,20 +8,6 @@ license-file.workspace = true [features] testing = [] -<<<<<<< HEAD -||||||| 7ee04dbc -[[bin]] -name = "streamed_bytes_benchmark" -required-features = ["clap"] -path = "src/bin/streamed_bytes_benchmark.rs" - -======= -[[bin]] -name = "streamed_bytes_benchmark" -path = "src/bin/streamed_bytes_benchmark.rs" -required-features = ["clap"] - ->>>>>>> origin/main-v0.13.2 [dependencies] async-stream.workspace = true bytes.workspace = true @@ -29,29 +15,6 @@ derive_more.workspace = true futures.workspace = true lazy_static.workspace = true libp2p = { workspace = true, features = [ -<<<<<<< HEAD - "gossipsub", - "identify", - "kad", - "macros", - "noise", - "quic", - "serde", - "tcp", - "tokio", - "yamux", -||||||| 7ee04dbc - "gossipsub", - "identify", - "kad", - "macros", - "noise", - "quic", - "tcp", - "tokio", - "yamux", - "serde", -======= "gossipsub", "identify", "kad", @@ -62,7 +25,6 @@ libp2p = { workspace = true, features = [ "tcp", "tokio", "yamux", ->>>>>>> origin/main-v0.13.2 ] } metrics.workspace = true papyrus_common = { path = "../papyrus_common", version = "0.4.0-rc.0" } From 70e64a7b204b0566d44fc4cf1cb8e633006b84f8 Mon Sep 17 00:00:00 2001 From: Dori Medini Date: Wed, 31 Jul 2024 14:38:25 +0300 Subject: [PATCH 13/13] fix: cargo toml formatting Signed-off-by: Dori Medini --- crates/blockifier/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/blockifier/Cargo.toml b/crates/blockifier/Cargo.toml index e01457c0a6b..e351d799df3 100644 --- a/crates/blockifier/Cargo.toml +++ b/crates/blockifier/Cargo.toml @@ -38,7 +38,7 @@ num-integer.workspace = true num-rational.workspace = true num-traits.workspace = true once_cell.workspace = true -papyrus_config = { path = "../papyrus_config", version = "0.4.0-rc.0"} +papyrus_config = { path = "../papyrus_config", version = "0.4.0-rc.0" } paste.workspace = true phf.workspace = true rand = { workspace = true, optional = true }