diff --git a/.env.test b/.env.test index 4fdaae38..d3bd9c0c 100644 --- a/.env.test +++ b/.env.test @@ -30,5 +30,5 @@ MONGODB_CONNECTION_STRING="mongodb://localhost:27017" # Ethereum Settlement DEFAULT_SETTLEMENT_CLIENT_RPC="http://localhost:3000" DEFAULT_L1_CORE_CONTRACT_ADDRESS="0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4" -TEST_IMPERSONATE_OPERATOR="1" +SHOULD_IMPERSONATE_ACCOUNT="true" TEST_DUMMY_CONTRACT_ADDRESS="0xE5b6F5e695BA6E4aeD92B68c4CC8Df1160D69A81" \ No newline at end of file diff --git a/crates/settlement-clients/ethereum/src/lib.rs b/crates/settlement-clients/ethereum/src/lib.rs index 8978b6f7..03c05d8e 100644 --- a/crates/settlement-clients/ethereum/src/lib.rs +++ b/crates/settlement-clients/ethereum/src/lib.rs @@ -40,15 +40,15 @@ pub mod config; pub mod conversion; // IMPORTANT to understand #[cfg(test)], #[cfg(not(test))] and SHOULD_IMPERSONATE_ACCOUNT -// Two tests : `update_state_blob_with_dummy_contract_works` & `update_state_blob_with_impersonation_works` use a env var `TEST_IMPERSONATE_OPERATOR` to inform the function `update_state_with_blobs` about the kind of testing, -// `TEST_IMPERSONATE_OPERATOR` can have any of "0" or "1" value : +// Two tests : `update_state_blob_with_dummy_contract_works` & `update_state_blob_with_impersonation_works` use a env var `SHOULD_IMPERSONATE_ACCOUNT` to inform the function `update_state_with_blobs` about the kind of testing, +// `SHOULD_IMPERSONATE_ACCOUNT` can have any of "0" or "1" value : // - if "0" then : Testing via default Anvil address. // - if "1" then : Testing via impersonating `Starknet Operator Address`. // Note : changing between "0" and "1" is handled automatically by each test function, `no` manual change in `env.test` is needed. #[cfg(test)] lazy_static! { - static ref SHOULD_IMPERSONATE_ACCOUNT: bool = get_env_var_or_panic("TEST_IMPERSONATE_OPERATOR") == *"1"; + static ref SHOULD_IMPERSONATE_ACCOUNT: bool = get_env_var_or_panic("SHOULD_IMPERSONATE_ACCOUNT") == *"true"; static ref TEST_DUMMY_CONTRACT_ADDRESS: String = get_env_var_or_panic("TEST_DUMMY_CONTRACT_ADDRESS"); static ref ADDRESS_TO_IMPERSONATE: Address = Address::from_str("0x2C169DFe5fBbA12957Bdd0Ba47d9CEDbFE260CA7").expect("Unable to parse address"); diff --git a/crates/settlement-clients/ethereum/src/tests/mod.rs b/crates/settlement-clients/ethereum/src/tests/mod.rs index 68c081b3..b50d9b4c 100644 --- a/crates/settlement-clients/ethereum/src/tests/mod.rs +++ b/crates/settlement-clients/ethereum/src/tests/mod.rs @@ -49,7 +49,7 @@ lazy_static! { .to_string(); static ref PORT: u16 = 3000_u16; static ref ETH_RPC: String = get_env_var_or_panic("ETHEREUM_BLAST_RPC_URL"); - static ref SHOULD_IMPERSONATE_ACCOUNT: bool = get_env_var_or_panic("TEST_IMPERSONATE_OPERATOR") == *"1"; + static ref SHOULD_IMPERSONATE_ACCOUNT: bool = get_env_var_or_panic("SHOULD_IMPERSONATE_ACCOUNT") == *"true"; static ref TEST_DUMMY_CONTRACT_ADDRESS: String = get_env_var_or_panic("TEST_DUMMY_CONTRACT_ADDRESS"); static ref STARKNET_OPERATOR_ADDRESS: Address = Address::from_str("0x2C169DFe5fBbA12957Bdd0Ba47d9CEDbFE260CA7").expect("Could not impersonate account."); @@ -107,7 +107,7 @@ fn setup_ethereum_test(block_no: u64) -> TestSetup { #[case::basic(20468828)] /// tests if the method is able to do a transaction with same function selector on a dummy contract. async fn update_state_blob_with_dummy_contract_works(#[case] fork_block_no: u64) { - env::set_var("TEST_IMPERSONATE_OPERATOR", "0"); + env::set_var("SHOULD_IMPERSONATE_ACCOUNT", "false"); let TestSetup { anvil, ethereum_settlement_client, provider } = setup_ethereum_test(fork_block_no); println!("{:?}", anvil);