diff --git a/crates/blockifier/src/blockifier/transaction_executor_test.rs b/crates/blockifier/src/blockifier/transaction_executor_test.rs index b6987122e3..0087cec725 100644 --- a/crates/blockifier/src/blockifier/transaction_executor_test.rs +++ b/crates/blockifier/src/blockifier/transaction_executor_test.rs @@ -239,7 +239,7 @@ fn test_l1_handler(block_context: BlockContext) { } #[rstest] -#[case::happy_flow(BouncerWeights::default(), 10)] +#[case::happy_flow(BouncerWeights::empty(), 10)] #[should_panic(expected = "BlockFull: Transaction cannot be added to the current block, block \ capacity reached.")] #[case::block_full( @@ -250,7 +250,7 @@ fn test_l1_handler(block_context: BlockContext) { 7 )] #[should_panic(expected = "Transaction size exceeds the maximum block capacity.")] -#[case::transaction_too_large(BouncerWeights::default(), 11)] +#[case::transaction_too_large(BouncerWeights::empty(), 11)] fn test_bouncing(#[case] initial_bouncer_weights: BouncerWeights, #[case] n_events: usize) { let max_n_events_in_block = 10; diff --git a/crates/blockifier/src/bouncer.rs b/crates/blockifier/src/bouncer.rs index 1508eeea31..462ac20c65 100644 --- a/crates/blockifier/src/bouncer.rs +++ b/crates/blockifier/src/bouncer.rs @@ -48,10 +48,6 @@ impl BouncerConfig { Self { block_max_capacity: BouncerWeights::max() } } - pub fn empty() -> Self { - Self::default() - } - pub fn has_room(&self, weights: BouncerWeights) -> bool { self.block_max_capacity.has_room(weights) } diff --git a/crates/blockifier/src/test_utils/struct_impls.rs b/crates/blockifier/src/test_utils/struct_impls.rs index 3e3808e9d5..f3061a0699 100644 --- a/crates/blockifier/src/test_utils/struct_impls.rs +++ b/crates/blockifier/src/test_utils/struct_impls.rs @@ -19,7 +19,7 @@ use super::update_json_value; use crate::abi::abi_utils::selector_from_name; use crate::abi::constants; use crate::blockifier::block::{BlockInfo, BlockNumberHashPair, GasPrices}; -use crate::bouncer::{BouncerConfig, BouncerWeights}; +use crate::bouncer::{BouncerConfig, BouncerWeights, BuiltinCount}; use crate::context::{BlockContext, ChainInfo, FeeTokenAddresses, TransactionContext}; use crate::execution::call_info::{CallExecution, CallInfo, Retdata}; use crate::execution::contract_class::{ContractClassV0, ContractClassV1}; @@ -278,3 +278,22 @@ impl L1HandlerTransaction { Self { tx, tx_hash, paid_fee_on_l1: l1_fee } } } + +impl BouncerConfig { + pub fn empty() -> Self { + Self { block_max_capacity: BouncerWeights::empty() } + } +} + +impl BouncerWeights { + pub fn empty() -> Self { + Self { + n_events: 0, + builtin_count: BuiltinCount::default(), + gas: 0, + message_segment_length: 0, + n_steps: 0, + state_diff_size: 0, + } + } +}