Skip to content

Commit 34f471d

Browse files
chore(papyrus_base_layer): move default anvil l1 account address to common place (#6131)
1 parent ac968ae commit 34f471d

6 files changed

Lines changed: 10 additions & 13 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/apollo_l1_provider/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ apollo_l1_provider_types = { workspace = true, features = ["testing"] }
3333
apollo_state_sync_types = { workspace = true, features = ["testing"] }
3434
assert_matches.workspace = true
3535
itertools.workspace = true
36-
mempool_test_utils.workspace = true
3736
papyrus_base_layer = { workspace = true, features = ["testing"] }
3837
pretty_assertions.workspace = true
3938
rstest.workspace = true

crates/apollo_l1_provider/src/l1_scraper_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use apollo_l1_provider_types::{Event, L1ProviderClient, MockL1ProviderClient};
99
use apollo_state_sync_types::communication::MockStateSyncClient;
1010
use apollo_state_sync_types::state_sync_types::SyncBlock;
1111
use itertools::Itertools;
12-
use mempool_test_utils::starknet_api_test_utils::DEFAULT_ANVIL_L1_ACCOUNT_ADDRESS;
1312
use papyrus_base_layer::ethereum_base_layer_contract::{
1413
EthereumBaseLayerConfig,
1514
EthereumBaseLayerContract,
@@ -18,6 +17,7 @@ use papyrus_base_layer::ethereum_base_layer_contract::{
1817
use papyrus_base_layer::test_utils::{
1918
anvil_instance_from_config,
2019
ethereum_base_layer_config_for_anvil,
20+
DEFAULT_ANVIL_L1_ACCOUNT_ADDRESS,
2121
};
2222
use papyrus_base_layer::MockBaseLayerContract;
2323
use starknet_api::block::BlockNumber;

crates/mempool_test_utils/src/starknet_api_test_utils.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use blockifier_test_utils::cairo_versions::{CairoVersion, RunnableCairo1};
99
use blockifier_test_utils::calldata::create_trivial_calldata;
1010
use blockifier_test_utils::contracts::FeatureContract;
1111
use papyrus_base_layer::ethereum_base_layer_contract::L1ToL2MessageArgs;
12+
use papyrus_base_layer::test_utils::DEFAULT_ANVIL_L1_ACCOUNT_ADDRESS;
1213
use starknet_api::abi::abi_utils::selector_from_name;
1314
use starknet_api::block::GasPrice;
1415
use starknet_api::core::{ClassHash, CompiledClassHash, ContractAddress, Nonce};
@@ -54,12 +55,6 @@ pub const VALID_L1_DATA_GAS_MAX_PRICE_PER_UNIT: u128 = 100000000000;
5455
pub const VALID_ACCOUNT_BALANCE: Fee =
5556
Fee(VALID_L2_GAS_MAX_AMOUNT as u128 * VALID_L2_GAS_MAX_PRICE_PER_UNIT * 1000);
5657

57-
// Default funded account, there are more fixed funded accounts,
58-
// see https://github.com/foundry-rs/foundry/tree/master/crates/anvil.
59-
// This address is the sender address of messages sent to L2 by Anvil.
60-
pub const DEFAULT_ANVIL_L1_ACCOUNT_ADDRESS: StarkHash =
61-
StarkHash::from_hex_unchecked("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
62-
6358
// Utils.
6459

6560
// TODO(Noam): Merge this into test_valid_resource_bounds

crates/papyrus_base_layer/src/base_layer_test.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use assert_matches::assert_matches;
22
use pretty_assertions::assert_eq;
33
use starknet_api::block::{BlockHash, BlockHashAndNumber, BlockNumber};
44
use starknet_api::core::EntryPointSelector;
5-
use starknet_api::hash::StarkHash;
65
use starknet_api::transaction::L1HandlerTransaction;
76
use starknet_api::{calldata, contract_address, felt};
87

@@ -17,6 +16,7 @@ use crate::test_utils::{
1716
anvil_instance_from_config,
1817
ethereum_base_layer_config_for_anvil,
1918
get_test_ethereum_node,
19+
DEFAULT_ANVIL_L1_ACCOUNT_ADDRESS,
2020
};
2121
use crate::{BaseLayerContract, L1Event};
2222

@@ -120,9 +120,6 @@ async fn events_from_other_contract() {
120120
"The two contracts should be different."
121121
);
122122

123-
// TODO(Arni): This constant is defined somewhere else. Move it to a share location and use it.
124-
pub const DEFAULT_ANVIL_L1_ACCOUNT_ADDRESS: StarkHash =
125-
StarkHash::from_hex_unchecked("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
126123
let this_l1_handler = L1HandlerTransaction {
127124
contract_address: contract_address!("0x12"),
128125
entry_point_selector: EntryPointSelector(felt!("0x34")),

crates/papyrus_base_layer/src/test_utils.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use alloy::providers::Provider;
99
use alloy::rpc::types::TransactionRequest;
1010
use colored::*;
1111
use ethers::utils::{Ganache, GanacheInstance};
12+
use starknet_api::hash::StarkHash;
1213
use tar::Archive;
1314
use tempfile::{tempdir, TempDir};
1415
use tracing::info;
@@ -33,6 +34,12 @@ const DEFAULT_ANVIL_PORT: u16 = 8545;
3334
pub const DEFAULT_ANVIL_L1_DEPLOYED_ADDRESS: &str = "0x5fbdb2315678afecb367f032d93f642f64180aa3";
3435
pub const DEFAULT_ANVIL_ADDITIONAL_ADDRESS_INDEX: usize = 3;
3536

37+
// Default funded account, there are more fixed funded accounts,
38+
// see https://github.com/foundry-rs/foundry/tree/master/crates/anvil.
39+
// This address is the sender address of messages sent to L2 by Anvil.
40+
pub const DEFAULT_ANVIL_L1_ACCOUNT_ADDRESS: StarkHash =
41+
StarkHash::from_hex_unchecked("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
42+
3643
// Returns a Ganache instance, preset with a Starknet core contract and some state updates:
3744
// Starknet contract address: 0xe2aF2c1AE11fE13aFDb7598D0836398108a4db0A
3845
// Ethereum block number starknet block number starknet block hash

0 commit comments

Comments
 (0)