Skip to content

Commit

Permalink
congestion: add hot.tg model strategy (near#11007)
Browse files Browse the repository at this point in the history
An approximation of what game.hot.tg workload would look like with new
gas costs.
  • Loading branch information
jakmeier authored Apr 10, 2024
1 parent 4c10f94 commit e13f60d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/congestion-model/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ fn workload(workload_name: &str) -> Box<dyn Producer> {
"One Hop All To One" => Box::new(AllForOneProducer::new(true, false, false)),
"Two Hop All To One" => Box::new(AllForOneProducer::new(false, true, false)),
"Three Hop All To One" => Box::new(AllForOneProducer::new(false, false, true)),
"Relayed Hot" => Box::new(AllForOneProducer::hot_tg()),
"Linear Imbalance" => Box::<LinearImbalanceProducer>::default(),
"Big Linear Imbalance" => Box::new(LinearImbalanceProducer::big_receipts()),
_ => panic!("unknown workload: {}", workload_name),
Expand Down Expand Up @@ -194,6 +195,7 @@ fn parse_workload_names(workload_name: &str) -> Vec<String> {
"One Hop All To One".to_string(),
"Two Hop All To One".to_string(),
"Three Hop All To One".to_string(),
"Relayed Hot".to_string(),
"Linear Imbalance".to_string(),
"Big Linear Imbalance".to_string(),
];
Expand Down
23 changes: 23 additions & 0 deletions tools/congestion-model/src/workload/all_for_one.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,29 @@ impl AllForOneProducer {
pub fn new(enable_one_hop: bool, enable_two_hops: bool, enable_three_hops: bool) -> Self {
Self { enable_one_hop, enable_two_hops, enable_three_hops, ..Default::default() }
}

/// Approximates the workload of game.hot.tg
pub fn hot_tg() -> Self {
Self {
// Usually, workloads are function calls through a relayer.
// Therefore, use 2-hop requests only.
enable_one_hop: false,
enable_two_hops: true,
enable_three_hops: false,
// The receipts are small, exact values should not matter.
receipt_size: 1024,
// Gas numbers based on reduced fn base gas costs and what traffic
// I could find on chain.
attached_gas: 30 * TGAS,
light_execution_gas: TGAS / 2,
last_execution_gas: 3 * TGAS,
conversion_gas: TGAS / 2,
// just send plenty
messages_per_round: 3000,
// empty iterator overwritten in init
round_robin_shards: Box::new(std::iter::empty()),
}
}
}

impl Default for AllForOneProducer {
Expand Down

0 comments on commit e13f60d

Please sign in to comment.