Skip to content

Commit

Permalink
enable-able
Browse files Browse the repository at this point in the history
  • Loading branch information
msmouse committed Jun 22, 2024
1 parent 1c93889 commit 9ae4f50
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
10 changes: 10 additions & 0 deletions consensus/src/transaction_shuffler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,15 @@ pub fn create_transaction_shuffler(
entry_fun_conflict_window_size: entry_fun_conflict_window_size as usize,
})
},
UseCaseAware { sender_spread_factor, platform_use_case_spread_factor, user_use_case_spread_factor } => {
info!("Using use case aware transaction shuffling");
Arc::new(use_case_aware::UseCaseAwareShuffler {
config: use_case_aware::Config {
sender_spread_factor,
platform_use_case_spread_factor,
user_use_case_spread_factor,
}
})
},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,11 @@ where
}

// 3. If nothing is ready, return the next eligible from the delay queue
let ret = self.delayed_queue.pop_head(false);
self.delayed_queue.pop_head(false)
// println!(
// "--- {}: force select head {:?} from the delay queue",
// self.output_idx, ret
// );
ret
}
}

Expand Down
14 changes: 10 additions & 4 deletions consensus/src/transaction_shuffler/use_case_aware/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ mod tests;

#[derive(Clone, Debug, Default)]
pub(crate) struct Config {
sender_spread_factor: usize,
platform_use_case_spread_factor: usize,
user_use_case_spread_factor: usize,
pub sender_spread_factor: usize,
pub platform_use_case_spread_factor: usize,
pub user_use_case_spread_factor: usize,
}

impl Config {
Expand All @@ -34,7 +34,13 @@ impl Config {
}

pub struct UseCaseAwareShuffler {
config: Config,
pub config: Config,
}

impl UseCaseAwareShuffler {
pub fn new(config: Config) -> Self {
Self { config }
}
}

impl TransactionShuffler for UseCaseAwareShuffler {
Expand Down
5 changes: 5 additions & 0 deletions types/src/on_chain_config/execution_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ pub enum TransactionShufflerType {
module_conflict_window_size: u32,
entry_fun_conflict_window_size: u32,
},
UseCaseAware {
sender_spread_factor: usize,
platform_use_case_spread_factor: usize,
user_use_case_spread_factor: usize,
},
}

#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
Expand Down

0 comments on commit 9ae4f50

Please sign in to comment.