Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 0312606

Browse files
committed
Push clean changes
1 parent 4bb91a4 commit 0312606

File tree

3 files changed

+3
-13
lines changed

3 files changed

+3
-13
lines changed

src/definitions/constants.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ pub(crate) const N_DEFAULT_TOPICS: usize = 1; // Events have one default topic.
1414
pub(crate) const CONSUMED_MSG_TO_L2_ENCODED_DATA_SIZE: usize =
1515
(L1_TO_L2_MSG_HEADER_SIZE + 1) - CONSUMED_MSG_TO_L2_N_TOPICS;
1616

17-
/// Sender and sequencer balance updates.
18-
pub(crate) const FEE_TRANSFER_N_STORAGE_CHANGES: usize = 2;
19-
20-
/// Exclude the sequencer balance update, since it's charged once throught the batch.
21-
pub(crate) const FEE_TRANSFER_N_STORAGE_CHANGES_TO_CHARGE: usize =
22-
FEE_TRANSFER_N_STORAGE_CHANGES - 1;
23-
2417
lazy_static! {
2518
pub(crate) static ref QUERY_VERSION_BASE: Felt252 =
2619
felt_str!("340282366920938463463374607431768211456");

src/state/cached_state.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ impl<T: StateReader> State for CachedState<T> {
265265
self.cache.storage_initial_values.clone(),
266266
);
267267

268-
let n_modified_contracts = {
269268
let storage_unique_updates = storage_updates.keys().map(|k| k.0.clone());
270269

271270
let class_hash_updates: Vec<_> = subtract_mappings(
@@ -289,8 +288,6 @@ impl<T: StateReader> State for CachedState<T> {
289288
modified_contracts.extend(class_hash_updates);
290289
modified_contracts.extend(nonce_updates);
291290

292-
modified_contracts.len()
293-
};
294291

295292
// Add fee transfer storage update before actually charging it, as it needs to be included in the
296293
// calculation of the final fee.
@@ -300,9 +297,10 @@ impl<T: StateReader> State for CachedState<T> {
300297
(fee_token_address.clone(), sender_low_key),
301298
Felt252::default(),
302299
);
300+
modified_contracts.remove(fee_token_address);
303301
}
304302

305-
Ok((n_modified_contracts, storage_updates.len()))
303+
Ok((modified_contracts.len(), storage_updates.len()))
306304
}
307305

308306
fn get_class_hash_at(&mut self, contract_address: &Address) -> Result<ClassHash, StateError> {

src/utils.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::core::errors::hash_errors::HashError;
2-
use crate::definitions::constants::FEE_TRANSFER_N_STORAGE_CHANGES_TO_CHARGE;
32
use crate::services::api::contract_classes::deprecated_contract_class::EntryPointType;
43
use crate::state::state_api::State;
54
use crate::{
@@ -188,7 +187,7 @@ pub fn calculate_tx_resources(
188187
let l1_gas_usage = calculate_tx_gas_usage(
189188
l2_to_l1_messages,
190189
n_modified_contracts,
191-
n_storage_changes + FEE_TRANSFER_N_STORAGE_CHANGES_TO_CHARGE,
190+
n_storage_changes,
192191
l1_handler_payload_size,
193192
n_deployments,
194193
);

0 commit comments

Comments
 (0)