Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove redundent function latest_constants_with_overrides #1963

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading