diff --git a/rusk/benches/block_ingestion.rs b/rusk/benches/block_ingestion.rs index 84962d803c..1bcb328320 100644 --- a/rusk/benches/block_ingestion.rs +++ b/rusk/benches/block_ingestion.rs @@ -29,6 +29,8 @@ use tempfile::tempdir; use common::state::new_state; +const BLOCK_GAS_LIMIT: u64 = 1_000_000_000_000; + fn load_phoenix_txs() -> Vec { // The file "phoenix-txs" can be generated using // `generate_phoenix_txs()` in "tests/rusk-state.rs". @@ -164,7 +166,8 @@ pub fn accept_benchmark(c: &mut Criterion) { let snapshot = toml::from_str(include_str!("../tests/config/bench.toml")) .expect("Cannot deserialize config"); - let rusk = new_state(&tmp, &snapshot).expect("Creating state should work"); + let rusk = new_state(&tmp, &snapshot, BLOCK_GAS_LIMIT) + .expect("Creating state should work"); let phoenix_txs = load_phoenix_txs(); let moonlight_txs = load_moonlight_txs(); diff --git a/rusk/tests/common/state.rs b/rusk/tests/common/state.rs index e4c3965c2a..ee97c9c8a6 100644 --- a/rusk/tests/common/state.rs +++ b/rusk/tests/common/state.rs @@ -30,7 +30,11 @@ use tracing::info; use crate::common::keys::STAKE_SK; // Creates a Rusk initial state in the given directory -pub fn new_state>(dir: P, snapshot: &Snapshot) -> Result { +pub fn new_state>( + dir: P, + snapshot: &Snapshot, + block_gas_limit: u64, +) -> Result { let dir = dir.as_ref(); let (_, commit_id) = state::deploy(dir, snapshot, |_| {}) @@ -38,7 +42,7 @@ pub fn new_state>(dir: P, snapshot: &Snapshot) -> Result { let (sender, _) = broadcast::channel(10); - let rusk = Rusk::new(dir, None, None, u64::MAX, sender) + let rusk = Rusk::new(dir, None, None, block_gas_limit, u64::MAX, sender) .expect("Instantiating rusk should succeed"); assert_eq!( @@ -109,7 +113,6 @@ pub fn generator_procedure( let call_params = CallParams { round, - block_gas_limit, generator_pubkey, to_slash, voters_pubkey: None, diff --git a/rusk/tests/rusk-state.rs b/rusk/tests/rusk-state.rs index 5656a46224..ecdb1982a3 100644 --- a/rusk/tests/rusk-state.rs +++ b/rusk/tests/rusk-state.rs @@ -35,6 +35,7 @@ use tracing::info; use crate::common::state::new_state; const BLOCK_HEIGHT: u64 = 1; +const BLOCK_GAS_LIMIT: u64 = 100_000_000_000; const INITIAL_BALANCE: u64 = 10_000_000_000; // Creates the Rusk initial state for the tests below @@ -42,7 +43,7 @@ fn initial_state>(dir: P) -> Result { let snapshot = toml::from_str(include_str!("./config/rusk-state.toml")) .expect("Cannot deserialize config"); - new_state(dir, &snapshot) + new_state(dir, &snapshot, BLOCK_GAS_LIMIT) } fn leaves_from_height(rusk: &Rusk, height: u64) -> Result> { @@ -183,7 +184,7 @@ async fn generate_phoenix_txs() -> Result<(), Box> { let snapshot = toml::from_str(include_str!("./config/bench.toml")) .expect("Cannot deserialize config"); - let rusk = new_state(&tmp, &snapshot)?; + let rusk = new_state(&tmp, &snapshot, 100_000_000_000)?; let cache = Arc::new(std::sync::RwLock::new(std::collections::HashMap::new())); @@ -248,7 +249,7 @@ async fn generate_moonlight_txs() -> Result<(), Box> { let snapshot = toml::from_str(include_str!("./config/bench.toml")) .expect("Cannot deserialize config"); - let rusk = new_state(&tmp, &snapshot)?; + let rusk = new_state(&tmp, &snapshot, 100_000_000_000)?; let cache = Arc::new(std::sync::RwLock::new(std::collections::HashMap::new())); diff --git a/rusk/tests/services/contract_deployment.rs b/rusk/tests/services/contract_deployment.rs index 4cbf3b6035..59db166d7d 100644 --- a/rusk/tests/services/contract_deployment.rs +++ b/rusk/tests/services/contract_deployment.rs @@ -95,7 +95,7 @@ fn initial_state>(dir: P, deploy_bob: bool) -> Result { let (sender, _) = broadcast::channel(10); - let rusk = Rusk::new(dir, None, None, u64::MAX, sender) + let rusk = Rusk::new(dir, None, None, BLOCK_GAS_LIMIT, u64::MAX, sender) .expect("Instantiating rusk should succeed"); Ok(rusk) } diff --git a/rusk/tests/services/gas_behavior.rs b/rusk/tests/services/gas_behavior.rs index 31a0e3678d..d6f1ce9b4f 100644 --- a/rusk/tests/services/gas_behavior.rs +++ b/rusk/tests/services/gas_behavior.rs @@ -35,7 +35,7 @@ fn initial_state>(dir: P) -> Result { let snapshot = toml::from_str(include_str!("../config/gas-behavior.toml")) .expect("Cannot deserialize config"); - new_state(dir, &snapshot) + new_state(dir, &snapshot, BLOCK_GAS_LIMIT) } const SENDER_INDEX_0: u64 = 0; diff --git a/rusk/tests/services/multi_transfer.rs b/rusk/tests/services/multi_transfer.rs index 4619bcf650..a51c0c0439 100644 --- a/rusk/tests/services/multi_transfer.rs +++ b/rusk/tests/services/multi_transfer.rs @@ -32,7 +32,7 @@ fn initial_state>(dir: P) -> Result { toml::from_str(include_str!("../config/multi_transfer.toml")) .expect("Cannot deserialize config"); - new_state(dir, &snapshot) + new_state(dir, &snapshot, BLOCK_GAS_LIMIT) } /// Executes three different transactions in the same block, expecting only two diff --git a/rusk/tests/services/stake.rs b/rusk/tests/services/stake.rs index 5dbf9e8cd8..790e973de9 100644 --- a/rusk/tests/services/stake.rs +++ b/rusk/tests/services/stake.rs @@ -35,7 +35,7 @@ fn stake_state>(dir: P) -> Result { let snapshot = toml::from_str(include_str!("../config/stake.toml")) .expect("Cannot deserialize config"); - new_state(dir, &snapshot) + new_state(dir, &snapshot, BLOCK_GAS_LIMIT) } // Creates the Rusk initial state for the tests below @@ -43,7 +43,7 @@ fn slash_state>(dir: P) -> Result { let snapshot = toml::from_str(include_str!("../config/slash.toml")) .expect("Cannot deserialize config"); - new_state(dir, &snapshot) + new_state(dir, &snapshot, BLOCK_GAS_LIMIT) } /// Stakes an amount Dusk and produces a block with this single transaction, diff --git a/rusk/tests/services/transfer.rs b/rusk/tests/services/transfer.rs index 51e1095ff0..6bd77a7d03 100644 --- a/rusk/tests/services/transfer.rs +++ b/rusk/tests/services/transfer.rs @@ -29,7 +29,7 @@ fn initial_state>(dir: P) -> Result { let snapshot = toml::from_str(include_str!("../config/transfer.toml")) .expect("Cannot deserialize config"); - new_state(dir, &snapshot) + new_state(dir, &snapshot, BLOCK_GAS_LIMIT) } /// Transacts between two accounts on the in the same wallet and produces a diff --git a/rusk/tests/services/unspendable.rs b/rusk/tests/services/unspendable.rs index 8ffeebe6b6..2f34669a07 100644 --- a/rusk/tests/services/unspendable.rs +++ b/rusk/tests/services/unspendable.rs @@ -36,7 +36,7 @@ fn initial_state>(dir: P) -> Result { let snapshot = toml::from_str(include_str!("../config/unspendable.toml")) .expect("Cannot deserialize config"); - new_state(dir, &snapshot) + new_state(dir, &snapshot, BLOCK_GAS_LIMIT) } const SENDER_INDEX_0: u64 = 0;