Skip to content

Commit

Permalink
feat(blockifier): enamble jemalloc feature accross the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ArniStarkware committed Jan 30, 2025
1 parent 3da9a71 commit 881ba69
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 27 deletions.
2 changes: 1 addition & 1 deletion crates/blockifier_reexecution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ blockifier_regression_https_testing = []

[dependencies]
assert_matches.workspace = true
blockifier = { workspace = true, features = ["reexecution"] }
blockifier = { workspace = true, features = ["jemalloc", "reexecution"] }
cairo-lang-starknet-classes.workspace = true
cairo-lang-utils.workspace = true
clap = { workspace = true, features = ["cargo", "derive"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/mempool_test_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ workspace = true

[dependencies]
assert_matches.workspace = true
blockifier = { workspace = true, features = ["testing"] }
blockifier = { workspace = true, features = ["jemalloc", "testing"] }
serde_json.workspace = true
starknet-types-core.workspace = true
starknet_api.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion crates/native_blockifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ name = "native_blockifier"
crate-type = ["cdylib"]

[dependencies]
# TODO(Dori, 1/1/2025): Add the "jemalloc" feature to the blockifier crate when possible.
# TODO(Dori, 1/1/2025): Add the "jemalloc" feature to the blockifier crate when possible. Currently,
# this is the only crate in the repository that does not use the "jemalloc" feature.
blockifier = { workspace = true, features = ["native_blockifier"] }
cairo-lang-starknet-classes.workspace = true
cairo-vm.workspace = true
Expand Down
36 changes: 20 additions & 16 deletions crates/native_blockifier/src/py_state_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,25 +148,29 @@ pub struct PyBlockInfo {
/// Block info cannot have gas prices set to zero; implement `Default` explicitly.
impl Default for PyBlockInfo {
fn default() -> Self {
let l1_gas_price = PyResourcePrice {
price_in_wei: DEFAULT_ETH_L1_GAS_PRICE.0,
price_in_fri: DEFAULT_STRK_L1_GAS_PRICE.0,
};
let l1_data_gas_price = PyResourcePrice {
price_in_wei: DEFAULT_ETH_L1_DATA_GAS_PRICE.0,
price_in_fri: DEFAULT_STRK_L1_DATA_GAS_PRICE.0,
};
let l2_gas_price = PyResourcePrice {
price_in_wei: VersionedConstants::latest_constants()
.convert_l1_to_l2_gas_price_round_up(DEFAULT_ETH_L1_GAS_PRICE)
.0,
price_in_fri: VersionedConstants::latest_constants()
.convert_l1_to_l2_gas_price_round_up(DEFAULT_STRK_L1_GAS_PRICE)
.0,
};

Self {
block_number: u64::default(),
block_timestamp: u64::default(),
l1_gas_price: PyResourcePrice {
price_in_wei: DEFAULT_ETH_L1_GAS_PRICE.0,
price_in_fri: DEFAULT_STRK_L1_GAS_PRICE.0,
},
l1_data_gas_price: PyResourcePrice {
price_in_wei: DEFAULT_ETH_L1_DATA_GAS_PRICE.0,
price_in_fri: DEFAULT_STRK_L1_DATA_GAS_PRICE.0,
},
l2_gas_price: PyResourcePrice {
price_in_wei: VersionedConstants::latest_constants()
.convert_l1_to_l2_gas_price_round_up(DEFAULT_ETH_L1_GAS_PRICE)
.0,
price_in_fri: VersionedConstants::latest_constants()
.convert_l1_to_l2_gas_price_round_up(DEFAULT_STRK_L1_GAS_PRICE)
.0,
},
l1_gas_price,
l1_data_gas_price,
l2_gas_price,
sequencer_address: PyFelt::default(),
use_kzg_da: bool::default(),
}
Expand Down
2 changes: 1 addition & 1 deletion crates/papyrus_execution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ testing = ["papyrus_test_utils", "rand", "rand_chacha"]

[dependencies]
anyhow.workspace = true
blockifier.workspace = true
blockifier = { workspace = true, features = ["jemalloc"] }
cairo-lang-starknet-classes.workspace = true
cairo-vm.workspace = true
indexmap.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions crates/papyrus_state_reader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ cairo_native = ["blockifier/cairo_native"]
workspace = true

[dependencies]
blockifier.workspace = true
blockifier = { workspace = true, features = ["jemalloc"] }
papyrus_storage.workspace = true
starknet-types-core.workspace = true
starknet_api.workspace = true

[dev-dependencies]
assert_matches.workspace = true
blockifier = { path = "../blockifier", features = ["testing"] }
blockifier = { path = "../blockifier", features = ["jemalloc", "testing"] }
indexmap.workspace = true
papyrus_storage = { path = "../papyrus_storage", features = ["testing"] }
rstest.workspace = true
2 changes: 1 addition & 1 deletion crates/starknet_batcher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ workspace = true

[dependencies]
async-trait.workspace = true
blockifier.workspace = true
blockifier = { workspace = true, features = ["jemalloc"] }
chrono.workspace = true
futures.workspace = true
indexmap.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/starknet_consensus_orchestrator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description = "Implements the consensus context and orchestrates the node's comp
assert_matches.workspace = true
async-trait.workspace = true
cairo-lang-starknet-classes.workspace = true
blockifier.workspace = true
blockifier = { workspace = true, features = ["jemalloc"] }
chrono.workspace = true
futures.workspace = true
indexmap.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/starknet_gateway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ testing = []
[dependencies]
async-trait.workspace = true
axum.workspace = true
blockifier = { workspace = true, features = ["testing"] }
blockifier = { workspace = true, features = ["jemalloc", "testing"] }
cairo-lang-starknet-classes.workspace = true
futures.workspace = true
mempool_test_utils.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/starknet_http_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ tracing.workspace = true
validator.workspace = true

[dev-dependencies]
blockifier = { path = "../blockifier", features = ["testing"] }
blockifier = { path = "../blockifier", features = ["jemalloc", "testing"] }
futures.workspace = true
mempool_test_utils.path = "../mempool_test_utils"
metrics.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/starknet_integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ workspace = true
[dependencies]
assert_matches.workspace = true
axum.workspace = true
blockifier.workspace = true
blockifier = { workspace = true, features = ["jemalloc"] }
cairo-lang-starknet-classes.workspace = true
futures.workspace = true
indexmap.workspace = true
Expand Down

0 comments on commit 881ba69

Please sign in to comment.