From bd9ea665d7c43983e8808403c15fd558e5430caa Mon Sep 17 00:00:00 2001 From: Itay Tsabary Date: Thu, 14 Nov 2024 12:19:45 +0200 Subject: [PATCH] chore(tests_integration): return tx sender address commit-id:945de3b4 --- .../starknet_integration_tests/src/utils.rs | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/crates/starknet_integration_tests/src/utils.rs b/crates/starknet_integration_tests/src/utils.rs index cfeb4bacbc..587543e395 100644 --- a/crates/starknet_integration_tests/src/utils.rs +++ b/crates/starknet_integration_tests/src/utils.rs @@ -19,6 +19,7 @@ use papyrus_storage::StorageConfig; use reqwest::{Client, Response}; use starknet_api::block::BlockNumber; use starknet_api::contract_address; +use starknet_api::core::ContractAddress; use starknet_api::rpc_transaction::RpcTransaction; use starknet_api::transaction::TransactionHash; use starknet_batcher::block_builder::BlockBuilderConfig; @@ -185,12 +186,16 @@ fn create_txs_for_integration_test( fn create_txs_for_tx_generator_test_scenario( mut tx_generator: MultiAccountTransactionGenerator, n_txs: usize, -) -> Vec { +) -> (Vec, ContractAddress) { const ACCOUNT_ID_0: AccountId = 0; + let contract_address = tx_generator.account_with_id(ACCOUNT_ID_0).sender_address(); - (0..n_txs) - .map(|_| tx_generator.account_with_id(ACCOUNT_ID_0).generate_invoke_with_tip(1)) - .collect() + ( + (0..n_txs) + .map(|_| tx_generator.account_with_id(ACCOUNT_ID_0).generate_invoke_with_tip(1)) + .collect(), + contract_address, + ) } async fn send_rpc_txs<'a, Fut>( @@ -237,12 +242,14 @@ pub async fn run_transaction_generator_test_scenario<'a, Fut>( tx_generator: MultiAccountTransactionGenerator, n_txs: usize, send_rpc_tx_fn: &'a mut dyn FnMut(RpcTransaction) -> Fut, -) where +) -> (Vec, ContractAddress) +where Fut: Future + 'a, { - let rpc_txs = create_txs_for_tx_generator_test_scenario(tx_generator, n_txs); - - send_rpc_txs(rpc_txs, send_rpc_tx_fn).await; + let (rpc_txs, contract_address) = + create_txs_for_tx_generator_test_scenario(tx_generator, n_txs); + let tx_hashes = send_rpc_txs(rpc_txs, send_rpc_tx_fn).await; + (tx_hashes, contract_address) } pub async fn create_gateway_config(chain_info: ChainInfo) -> GatewayConfig {