Skip to content

Commit

Permalink
fix: remove adjust_tx_initiator helper
Browse files Browse the repository at this point in the history
  • Loading branch information
grw-ms committed Sep 21, 2023
1 parent b2f1815 commit 67d6e82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
5 changes: 2 additions & 3 deletions src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use crate::{
formatter,
system_contracts::{self, Options, SystemContracts},
utils::{
adjust_l1_gas_price_for_tx, adjust_tx_initiator, derive_gas_estimation_overhead,
to_human_size, IntoBoxedFuture,
adjust_l1_gas_price_for_tx, derive_gas_estimation_overhead, to_human_size, IntoBoxedFuture,
},
};
use clap::Parser;
Expand Down Expand Up @@ -1139,7 +1138,7 @@ impl<S: ForkSource + std::fmt::Debug> InMemoryNode<S> {
"🕵️ Executing tx from impersonated account {:?}",
impersonated_account
);
l2_tx = adjust_tx_initiator(l2_tx, impersonated_account);
l2_tx.common_data.initiator_address = impersonated_account;
}
}
log::info!("");
Expand Down
15 changes: 1 addition & 14 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ use zksync_basic_types::{H256, U256};
use zksync_state::StorageView;
use zksync_state::WriteStorage;
use zksync_types::{
api::Block, l2::L2Tx, zk_evm::zkevm_opcode_defs::system_params::MAX_TX_ERGS_LIMIT,
L2TxCommonData, MAX_TXS_IN_BLOCK,
api::Block, zk_evm::zkevm_opcode_defs::system_params::MAX_TX_ERGS_LIMIT, MAX_TXS_IN_BLOCK,
};
use zksync_utils::{ceil_div_u256, u256_to_h256};

use crate::{
fork::{ForkSource, ForkStorage},
node::{compute_hash, InMemoryNodeInner},
};
use zksync_basic_types::Address;

pub(crate) trait IntoBoxedFuture: Sized + Send + 'static {
fn into_boxed_future(self) -> Pin<Box<dyn Future<Output = Self> + Send>> {
Expand Down Expand Up @@ -247,17 +245,6 @@ pub fn mine_empty_blocks<S: std::fmt::Debug + ForkSource>(
node.current_batch = node.current_batch.saturating_add(1);
}

/// Adjusts the transaction initiator address.
pub fn adjust_tx_initiator(tx: L2Tx, initiator: Address) -> L2Tx {
L2Tx {
common_data: L2TxCommonData {
initiator_address: initiator,
..tx.common_data
},
..tx
}
}

#[cfg(test)]
mod tests {
use zksync_basic_types::U256;
Expand Down

0 comments on commit 67d6e82

Please sign in to comment.