Skip to content

Commit

Permalink
chore: remove redundent function latest_constants_with_overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
ArniStarkware committed Nov 12, 2024
1 parent 2190f01 commit 4fa0280
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
8 changes: 0 additions & 8 deletions crates/blockifier/src/versioned_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,6 @@ impl VersionedConstants {
Self { vm_resource_fee_cost, archival_data_gas_costs, ..latest }
}

// TODO(Arni): Share code with latest_with_overrides.
pub fn latest_constants_with_overrides(
validate_max_n_steps: u32,
max_recursion_depth: usize,
) -> Self {
Self { validate_max_n_steps, max_recursion_depth, ..Self::latest_constants().clone() }
}

// TODO(Arni): Consider replacing each call to this function with `latest_with_overrides`, and
// squashing the functions together.
/// Returns the latest versioned constants, applying the given overrides.
Expand Down
14 changes: 9 additions & 5 deletions crates/gateway/src/stateful_transaction_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use blockifier::bouncer::BouncerConfig;
use blockifier::context::{BlockContext, ChainInfo};
use blockifier::state::cached_state::CachedState;
use blockifier::transaction::account_transaction::AccountTransaction;
use blockifier::versioned_constants::VersionedConstants;
use blockifier::versioned_constants::{VersionedConstants, VersionedConstantsOverrides};
#[cfg(test)]
use mockall::automock;
use starknet_api::core::{ContractAddress, Nonce};
Expand Down Expand Up @@ -95,10 +95,14 @@ impl StatefulTransactionValidator {
let latest_block_info = get_latest_block_info(state_reader_factory)?;
let state_reader = state_reader_factory.get_state_reader(latest_block_info.block_number);
let state = CachedState::new(state_reader);
let versioned_constants = VersionedConstants::latest_constants_with_overrides(
self.config.validate_max_n_steps,
self.config.max_recursion_depth,
);
// TODO(Arni): Set versioned constants overrieds as part of the validate config.
let versioned_constants_overrides = VersionedConstantsOverrides {
validate_max_n_steps: self.config.validate_max_n_steps,
max_recursion_depth: self.config.max_recursion_depth,
..Default::default()
};
let versioned_constants =
VersionedConstants::get_versioned_constants(versioned_constants_overrides);
let mut block_info = latest_block_info;
block_info.block_number = block_info.block_number.unchecked_next();
// TODO(yael 21/4/24): create the block context using pre_process_block once we will be
Expand Down

0 comments on commit 4fa0280

Please sign in to comment.