Skip to content

Commit

Permalink
Add econia transactions to transaction generator workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
vusirikala committed Jan 30, 2024
1 parent 99477c3 commit 97bf774
Show file tree
Hide file tree
Showing 19 changed files with 44,726 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ crate::gas_schedule::macros::define_gas_parameters!(
[
max_transaction_size_in_bytes: NumBytes,
"max_transaction_size_in_bytes",
64 * 1024
1024 * 1024
],
[
gas_unit_scaling_factor: GasScalingFactor,
Expand Down
9 changes: 8 additions & 1 deletion crates/transaction-generator-lib/src/args.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright © Aptos Foundation
// SPDX-License-Identifier: Apache-2.0

use crate::{publishing::module_simple::LoopType, EntryPoints, TransactionType};
use crate::{publishing::module_simple::LoopType, EntryPoints, TransactionType, WorkflowKind};
use clap::{Parser, ValueEnum};
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -58,6 +58,7 @@ pub enum TransactionTypeArg {
SmartTablePicture30KWith200Change,
SmartTablePicture1MWith1KChange,
SmartTablePicture1BWith1KChange,
Econia,
}

impl TransactionTypeArg {
Expand Down Expand Up @@ -377,6 +378,12 @@ impl TransactionTypeArg {
use_account_pool: sender_use_account_pool,
}
},
TransactionTypeArg::Econia => TransactionType::Workflow {
workflow_kind: WorkflowKind::Econia { num_users: 100000 },
num_modules: module_working_set_size,
move_stages_by_phase: true,
use_account_pool: sender_use_account_pool,
},
}
}

Expand Down
1 change: 1 addition & 0 deletions crates/transaction-generator-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ pub enum TransactionType {
#[derive(Debug, Copy, Clone)]
pub enum WorkflowKind {
CreateThenMint { count: usize, creation_balance: u64 },
Econia { num_users: usize },
}

impl Default for TransactionType {
Expand Down
74 changes: 74 additions & 0 deletions crates/transaction-generator-lib/src/publishing/module_simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ pub enum EntryPoints {
length: u64,
num_points_per_txn: usize,
},
EconiaRegisterMarket,
EconiaRegisterMarketUser,
EconiaDepositCoins,
EconiaPlaceBidLimitOrder,
EconiaPlaceAskLimitOrder,
EconiaPlaceRandomLimitOrder,
}

impl EntryPoints {
Expand Down Expand Up @@ -269,6 +275,12 @@ impl EntryPoints {
| EntryPoints::VectorPictureRead { .. }
| EntryPoints::InitializeSmartTablePicture
| EntryPoints::SmartTablePicture { .. } => "complex",
EntryPoints::EconiaRegisterMarket
| EntryPoints::EconiaRegisterMarketUser
| EntryPoints::EconiaDepositCoins
| EntryPoints::EconiaPlaceBidLimitOrder
| EntryPoints::EconiaPlaceAskLimitOrder
| EntryPoints::EconiaPlaceRandomLimitOrder => "econia",
}
}

Expand Down Expand Up @@ -317,6 +329,12 @@ impl EntryPoints {
EntryPoints::InitializeSmartTablePicture | EntryPoints::SmartTablePicture { .. } => {
"smart_table_picture"
},
EntryPoints::EconiaRegisterMarket
| EntryPoints::EconiaRegisterMarketUser
| EntryPoints::EconiaDepositCoins
| EntryPoints::EconiaPlaceBidLimitOrder
| EntryPoints::EconiaPlaceAskLimitOrder
| EntryPoints::EconiaPlaceRandomLimitOrder => "txn_generator_utils",
}
}

Expand Down Expand Up @@ -580,6 +598,61 @@ impl EntryPoints {
bcs::to_bytes(&colors).unwrap(), // colors
])
},
EntryPoints::EconiaRegisterMarket => {
get_payload(module_id, ident_str!("register_market").to_owned(), vec![])
},
EntryPoints::EconiaRegisterMarketUser => get_payload(
module_id,
ident_str!("register_market_accounts").to_owned(),
vec![bcs::to_bytes(&other.expect("Must provide other")).unwrap()],
),
EntryPoints::EconiaDepositCoins => {
let rng: &mut StdRng = rng.expect("Must provide RNG");
get_payload(module_id, ident_str!("deposit_coins").to_owned(), vec![
bcs::to_bytes(&rng.gen_range(0u64, 1000u64)).unwrap(), // amount
])
},
EntryPoints::EconiaPlaceBidLimitOrder => {
let rng: &mut StdRng = rng.expect("Must provide RNG");
get_payload(
module_id,
ident_str!("place_bid_limit_order").to_owned(),
vec![
bcs::to_bytes(&rng.gen_range(0u64, 30u64)).unwrap(), // amount
],
)
},
EntryPoints::EconiaPlaceAskLimitOrder => {
let rng: &mut StdRng = rng.expect("Must provide RNG");
get_payload(
module_id,
ident_str!("place_ask_limit_order").to_owned(),
vec![
bcs::to_bytes(&rng.gen_range(0u64, 30u64)).unwrap(), // amount
],
)
},
EntryPoints::EconiaPlaceRandomLimitOrder => {
let rng: &mut StdRng = rng.expect("Must provide RNG");
let is_bid: bool = rng.gen();
if is_bid {
get_payload(
module_id,
ident_str!("place_bid_limit_order").to_owned(),
vec![
bcs::to_bytes(&rng.gen_range(0u64, 30u64)).unwrap(), // amount
],
)
} else {
get_payload(
module_id,
ident_str!("place_ask_limit_order").to_owned(),
vec![
bcs::to_bytes(&rng.gen_range(0u64, 30u64)).unwrap(), // amount
],
)
}
},
}
}

Expand All @@ -597,6 +670,7 @@ impl EntryPoints {
Some(EntryPoints::InitializeVectorPicture { length: *length })
},
EntryPoints::SmartTablePicture { .. } => Some(EntryPoints::InitializeSmartTablePicture),
EntryPoints::EconiaRegisterMarketUser => Some(EntryPoints::EconiaRegisterMarket),
_ => None,
}
}
Expand Down
Loading

0 comments on commit 97bf774

Please sign in to comment.