Skip to content

Commit

Permalink
Using source addresses from txn emitter
Browse files Browse the repository at this point in the history
  • Loading branch information
vusirikala committed Dec 2, 2024
1 parent 4f8b15e commit 28fa109
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/workflow-run-forge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:
FORGE_RUNNER_DURATION_SECS:
required: false
type: number
default: 480
default: 1000
description: Duration of the forge test run
FORGE_TEST_SUITE:
required: false
Expand Down
61 changes: 51 additions & 10 deletions crates/transaction-generator-lib/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,38 @@ pub enum TransactionTypeArg {
VectorPicture40,
VectorPictureRead40,
SmartTablePicture30KWith200Change,

EconiaBasic1Market,

EconiaMixed1Market,
EconiaMixed10Market,
EconiaMixed100Market,

EconiaMarket1Market,
EconiaMarket10Market,
EconiaMarket100Market,
EconiaBasic1MarketNoPublish,
EconiaMixed1MarketNoPublish,
EconiaMixed10MarketNoPublish,
EconiaMixed100MarketNoPublish,

EconiaBasic1MarketReuseAccounts,

EconiaMixed1MarketReuseAccounts,
EconiaMixed5MarketReuseAccounts,
EconiaMixed10MarketReuseAccounts,
EconiaMixed100MarketReuseAccounts,
EconiaMixed15MarketReuseAccounts,

EconiaMarket1MarketReuseAccounts,
EconiaMarket5MarketReuseAccounts,
EconiaMarket10MarketReuseAccounts,
EconiaMarket100MarketReuseAccounts,
EconiaMarket15MarketReuseAccounts,

EconiaBasic1MarketNoPublish,
EconiaMixed1MarketNoPublish,
EconiaMixed10MarketNoPublish,
EconiaMixed100MarketNoPublish,

EconiaMarket1MarketReuseAccountsNoPublish,
EconiaMarket10MarketReuseAccountsNoPublish,
EconiaMarket100MarketReuseAccountsNoPublish,

EconiaReal,
EconiaRealNoPublish,
SmartTablePicture1MWith256Change,
Expand Down Expand Up @@ -536,6 +547,21 @@ progress_type: WorkflowProgress::WhenDone {
publish_packages: true,
},
// progress_type: WorkflowProgress::MoveByPhases,
progress_type: WorkflowProgress::WhenDone {
delay_between_stages_s: 60,
},
num_modules: module_working_set_size,
use_account_pool: sender_use_account_pool,
},
TransactionTypeArg::EconiaMixed5MarketReuseAccounts => TransactionType::Workflow {
workflow_kind: WorkflowKind::Econia {
num_users: 600000,
flow_type: crate::EconiaFlowType::Mixed,
num_markets: 5,
reuse_accounts_for_orders: true,
publish_packages: true,
},
// progress_type: WorkflowProgress::MoveByPhases,
progress_type: WorkflowProgress::WhenDone {
delay_between_stages_s: 60,
},
Expand All @@ -557,11 +583,11 @@ progress_type: WorkflowProgress::WhenDone {
num_modules: module_working_set_size,
use_account_pool: sender_use_account_pool,
},
TransactionTypeArg::EconiaMixed100MarketReuseAccounts => TransactionType::Workflow {
TransactionTypeArg::EconiaMixed15MarketReuseAccounts => TransactionType::Workflow {
workflow_kind: WorkflowKind::Econia {
num_users: 600000,
flow_type: crate::EconiaFlowType::Mixed,
num_markets: 100,
num_markets: 15,
reuse_accounts_for_orders: true,
publish_packages: true,
},
Expand Down Expand Up @@ -605,6 +631,21 @@ progress_type: WorkflowProgress::WhenDone {
publish_packages: true,
},
// progress_type: WorkflowProgress::MoveByPhases,
progress_type: WorkflowProgress::WhenDone {
delay_between_stages_s: 60,
},
num_modules: module_working_set_size,
use_account_pool: sender_use_account_pool,
},
TransactionTypeArg::EconiaMarket5MarketReuseAccounts => TransactionType::Workflow {
workflow_kind: WorkflowKind::Econia {
num_users: 600000,
flow_type: crate::EconiaFlowType::Market,
num_markets: 5,
reuse_accounts_for_orders: true,
publish_packages: true,
},
// progress_type: WorkflowProgress::MoveByPhases,
progress_type: WorkflowProgress::WhenDone {
delay_between_stages_s: 60,
},
Expand All @@ -626,11 +667,11 @@ progress_type: WorkflowProgress::WhenDone {
num_modules: module_working_set_size,
use_account_pool: sender_use_account_pool,
},
TransactionTypeArg::EconiaMarket100MarketReuseAccounts => TransactionType::Workflow {
TransactionTypeArg::EconiaMarket15MarketReuseAccounts => TransactionType::Workflow {
workflow_kind: WorkflowKind::Econia {
num_users: 600000,
flow_type: crate::EconiaFlowType::Market,
num_markets: 100,
num_markets: 15,
reuse_accounts_for_orders: true,
publish_packages: true,
},
Expand Down
8 changes: 6 additions & 2 deletions crates/transaction-generator-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ pub async fn create_txn_generator_creator(
},
TransactionType::Workflow {
num_modules,
use_account_pool,
use_account_pool: _,
workflow_kind,
progress_type,
} => Box::new(
Expand All @@ -401,7 +401,11 @@ pub async fn create_txn_generator_creator(
&root_account,
txn_executor,
*num_modules,
Some(accounts_pool.clone()),
Some(Arc::new(source_accounts
.iter()
.map(|d| d.address())
.collect()
)),
cur_phase.clone(),
*progress_type,
)
Expand Down
65 changes: 27 additions & 38 deletions crates/transaction-generator-lib/src/workflow_delegator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use aptos_logger::{info, sample, sample::SampleRate};
use aptos_sdk::{
transaction_builder::TransactionFactory,
types::{transaction::SignedTransaction, LocalAccount},
move_types::account_address::AccountAddress,
};
use std::{
fmt::Debug,
Expand Down Expand Up @@ -278,7 +279,7 @@ impl WorkflowTxnGeneratorCreator {
root_account: &dyn RootAccountHandle,
txn_executor: &dyn ReliableTransactionSubmitter,
num_modules: usize,
initial_account_pool: Option<Arc<ObjectPool<LocalAccount>>>,
initial_account_pool: Option<Arc<Vec<AccountAddress>>>,
cur_phase: Arc<AtomicUsize>,
progress_type: WorkflowProgress,
) -> Self {
Expand Down Expand Up @@ -384,17 +385,13 @@ impl WorkflowTxnGeneratorCreator {
num_users,
flow_type,
num_markets,
reuse_accounts_for_orders,
reuse_accounts_for_orders: _,
publish_packages,
} => {
// let create_accounts = initial_account_pool.is_none();
let create_accounts = true;
// info!("Create_accounts {:?}", create_accounts);
let created_pool = initial_account_pool.unwrap_or(Arc::new(ObjectPool::new()));
let created_pool = Arc::new(ObjectPool::new());
let register_market_accounts_pool = Arc::new(ObjectPool::new());
let source_addresses: Vec<_> = created_pool.pool.read().iter().map(|a| a.address().clone()).collect();
info!("Source addresses length: {}", source_addresses.len());
let deposit_coins_pool = Arc::new(BucketedAccountPool::new(Arc::new(source_addresses.clone())));
let deposit_coins_pool = Arc::new(BucketedAccountPool::new(initial_account_pool.map_or(Arc::new(vec![]), |pool| pool.clone())));
// info!("Source addresses length: {}", initial_account_pool.map_or(0, |pool| pool.len()));
// let place_orders_pool = Arc::new(ObjectPool::new());

let mut packages = CustomModulesDelegationGeneratorCreator::publish_package(
Expand Down Expand Up @@ -484,19 +481,16 @@ impl WorkflowTxnGeneratorCreator {

let mut creators: Vec<Box<dyn TransactionGeneratorCreator>> = vec![];
let mut stage_switch_conditions = vec![];
if create_accounts {
info!("Creating {} accounts", num_users);
creators.push(Box::new(AccountGeneratorCreator::new(
txn_factory.clone(),
None,
Some(created_pool.clone()),
num_users,
400_000_000,
)));
stage_switch_conditions.push(StageSwitchCondition::MaxTransactions(
Arc::new(AtomicUsize::new(num_users)),
));
}
creators.push(Box::new(AccountGeneratorCreator::new(
txn_factory.clone(),
None,
Some(created_pool.clone()),
num_users,
400_000_000,
)));
stage_switch_conditions.push(StageSwitchCondition::MaxTransactions(
Arc::new(AtomicUsize::new(num_users)),
));

creators.push(Box::new(AccountsPoolWrapperCreator::new(
Box::new(CustomModulesDelegationGeneratorCreator::new_raw(
Expand Down Expand Up @@ -558,10 +552,7 @@ impl WorkflowTxnGeneratorCreator {
num_users,
publish_packages,
} => {
// let create_accounts = initial_account_pool.is_none();
let create_accounts = true;
// info!("Create_accounts {:?}", create_accounts);
let created_pool = initial_account_pool.unwrap_or(Arc::new(ObjectPool::new()));
let created_pool = Arc::new(ObjectPool::new());
let register_market_accounts_pool = Arc::new(ObjectPool::new());
let deposit_coins_pool = Arc::new(ObjectPool::new());
let deposit_coins_pool_with_added_history = Arc::new(ObjectPool::new());
Expand Down Expand Up @@ -622,18 +613,16 @@ impl WorkflowTxnGeneratorCreator {

let mut creators: Vec<Box<dyn TransactionGeneratorCreator>> = vec![];
let mut stage_switch_conditions = vec![];
if create_accounts {
creators.push(Box::new(AccountGeneratorCreator::new(
txn_factory.clone(),
None,
Some(created_pool.clone()),
num_users,
400_000_000,
)));
stage_switch_conditions.push(StageSwitchCondition::MaxTransactions(
Arc::new(AtomicUsize::new(num_users)),
));
}
creators.push(Box::new(AccountGeneratorCreator::new(
txn_factory.clone(),
None,
Some(created_pool.clone()),
num_users,
400_000_000,
)));
stage_switch_conditions.push(StageSwitchCondition::MaxTransactions(
Arc::new(AtomicUsize::new(num_users)),
));

creators.push(Box::new(AccountsPoolWrapperCreator::new(
Box::new(CustomModulesDelegationGeneratorCreator::new_raw(
Expand Down
7 changes: 5 additions & 2 deletions testsuite/forge-cli/src/suites/pfn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ pub fn get_pfn_test(test_name: &str, duration: Duration) -> Option<ForgeConfig>
"pfn_const_tps_with_realistic_env" => pfn_const_tps(duration, true, true, false, TransactionType::default(), 10000),

"pfn_const_tps_with_realistic_env_econia_basic_1market" => pfn_const_tps(duration, true, true, false, TransactionTypeArg::EconiaBasic1MarketReuseAccounts.materialize_default(), 10000),

"pfn_const_tps_with_realistic_env_econia_mixed_1market" => pfn_const_tps(duration, true, true, false, TransactionTypeArg::EconiaMixed1MarketReuseAccounts.materialize_default(), 10000),
"pfn_const_tps_with_realistic_env_econia_mixed_5market" => pfn_const_tps(duration, true, true, false, TransactionTypeArg::EconiaMixed5MarketReuseAccounts.materialize_default(), 10000),
"pfn_const_tps_with_realistic_env_econia_mixed_10market" => pfn_const_tps(duration, true, true, false, TransactionTypeArg::EconiaMixed10MarketReuseAccounts.materialize_default(), 10000),
"pfn_const_tps_with_realistic_env_econia_mixed_100market" => pfn_const_tps(duration, true, true, false, TransactionTypeArg::EconiaMixed100MarketReuseAccounts.materialize_default(), 10000),
"pfn_const_tps_with_realistic_env_econia_mixed_15market" => pfn_const_tps(duration, true, true, false, TransactionTypeArg::EconiaMixed15MarketReuseAccounts.materialize_default(), 10000),

"pfn_const_tps_with_realistic_env_econia_market_1market" => pfn_const_tps(duration, true, true, false, TransactionTypeArg::EconiaMarket1MarketReuseAccounts.materialize_default(), 10000),
"pfn_const_tps_with_realistic_env_econia_market_5market" => pfn_const_tps(duration, true, true, false, TransactionTypeArg::EconiaMarket5MarketReuseAccounts.materialize_default(), 10000),
"pfn_const_tps_with_realistic_env_econia_market_10market" => pfn_const_tps(duration, true, true, false, TransactionTypeArg::EconiaMarket10MarketReuseAccounts.materialize_default(), 10000),
"pfn_const_tps_with_realistic_env_econia_market_100market" => pfn_const_tps(duration, true, true, false, TransactionTypeArg::EconiaMarket100MarketReuseAccounts.materialize_default(), 10000),
"pfn_const_tps_with_realistic_env_econia_market_15market" => pfn_const_tps(duration, true, true, false, TransactionTypeArg::EconiaMarket15MarketReuseAccounts.materialize_default(), 10000),
"pfn_const_tps_with_realistic_env_econia_real" => pfn_const_tps(duration, true, true, false, TransactionTypeArg::EconiaReal.materialize_default(), 10000),

"pfn_performance" => pfn_performance(duration, false, false, true, 7, 1, false),
Expand Down

0 comments on commit 28fa109

Please sign in to comment.