Skip to content

Commit

Permalink
deprecate FairnessShuffler
Browse files Browse the repository at this point in the history
  • Loading branch information
msmouse committed Jun 17, 2024
1 parent c2b3482 commit 86b9d21
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 43 deletions.
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::transaction_shuffler::fairness::conflict_key::ConflictKey;
use crate::transaction_shuffler::deprecated_fairness::conflict_key::ConflictKey;
use aptos_types::transaction::{SignedTransaction, TransactionPayload};
use move_core_types::{identifier::Identifier, language_storage::ModuleId};

Expand Down
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::transaction_shuffler::fairness::conflict_key::ConflictKey;
use crate::transaction_shuffler::deprecated_fairness::conflict_key::ConflictKey;
use aptos_types::transaction::{SignedTransaction, TransactionPayload};
use move_core_types::language_storage::ModuleId;

Expand Down
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::transaction_shuffler::fairness::TxnIdx;
use crate::transaction_shuffler::deprecated_fairness::TxnIdx;
use std::{collections::HashMap, hash::Hash};

pub(crate) mod entry_fun;
Expand Down
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::transaction_shuffler::fairness::conflict_key::{
use crate::transaction_shuffler::deprecated_fairness::conflict_key::{
ConflictKey, ConflictKeyId, ConflictKeyRegistry,
};
use proptest::prelude::*;
Expand Down
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::transaction_shuffler::fairness::conflict_key::ConflictKey;
use crate::transaction_shuffler::deprecated_fairness::conflict_key::ConflictKey;
use aptos_types::transaction::SignedTransaction;
use move_core_types::account_address::AccountAddress;

Expand Down
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::transaction_shuffler::fairness::{
use crate::transaction_shuffler::deprecated_fairness::{
conflict_key::{ConflictKeyId, ConflictKeyRegistry, MapByKeyId},
TxnIdx,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use crate::transaction_shuffler::{
fairness::{
deprecated_fairness::{
conflict_key::{
entry_fun::EntryFunKey, entry_fun_module::EntryFunModuleKey, txn_sender::TxnSenderKey,
ConflictKeyRegistry,
Expand Down Expand Up @@ -178,7 +178,7 @@ impl<'a, const NUM_CONFLICT_ZONES: usize> FairnessShufflerImpl<'a, NUM_CONFLICT_

#[cfg(test)]
mod test_utils {
use crate::transaction_shuffler::fairness::FairnessShuffler;
use crate::transaction_shuffler::deprecated_fairness::FairnessShuffler;
use proptest::prelude::*;

impl FairnessShuffler {
Expand Down
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::transaction_shuffler::fairness::{
use crate::transaction_shuffler::deprecated_fairness::{
conflict_key::{ConflictKeyId, ConflictKeyRegistry, MapByKeyId},
TxnIdx,
};
Expand Down
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::transaction_shuffler::fairness::TxnIdx;
use crate::transaction_shuffler::deprecated_fairness::TxnIdx;

pub struct SelectionTracker {
selected_markers: Vec<bool>,
Expand Down
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::transaction_shuffler::fairness::{
use crate::transaction_shuffler::deprecated_fairness::{
conflict_key::ConflictKeyRegistry, FairnessShuffler, FairnessShufflerImpl,
};

Expand Down
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::transaction_shuffler::fairness::{
use crate::transaction_shuffler::deprecated_fairness::{
conflict_key::{
test_utils::{FakeEntryFunKey, FakeEntryFunModuleKey, FakeSenderKey, FakeTxn},
ConflictKeyRegistry, MapByKeyId,
Expand Down
16 changes: 6 additions & 10 deletions consensus/src/transaction_shuffler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@
// SPDX-License-Identifier: Apache-2.0

use aptos_logger::info;
use aptos_types::{
on_chain_config::{
TransactionShufflerType,
TransactionShufflerType::{DeprecatedSenderAwareV1, NoShuffling, SenderAwareV2},
},
transaction::SignedTransaction,
};
use aptos_types::{on_chain_config::TransactionShufflerType, transaction::SignedTransaction};
use sender_aware::SenderAwareShuffler;
use std::sync::Arc;

mod fairness;
mod deprecated_fairness;
mod sender_aware;

/// Interface to shuffle transactions
Expand All @@ -32,6 +26,8 @@ impl TransactionShuffler for NoOpShuffler {
pub fn create_transaction_shuffler(
shuffler_type: TransactionShufflerType,
) -> Arc<dyn TransactionShuffler> {
use TransactionShufflerType::*;

match shuffler_type {
NoShuffling => {
info!("Using no-op transaction shuffling");
Expand All @@ -48,7 +44,7 @@ pub fn create_transaction_shuffler(
);
Arc::new(SenderAwareShuffler::new(conflict_window_size as usize))
},
TransactionShufflerType::Fairness {
DeprecatedFairness {
sender_conflict_window_size,
module_conflict_window_size,
entry_fun_conflict_window_size,
Expand All @@ -59,7 +55,7 @@ pub fn create_transaction_shuffler(
module_conflict_window_size,
entry_fun_conflict_window_size
);
Arc::new(fairness::FairnessShuffler {
Arc::new(deprecated_fairness::FairnessShuffler {
sender_conflict_window_size: sender_conflict_window_size as usize,
module_conflict_window_size: module_conflict_window_size as usize,
entry_fun_conflict_window_size: entry_fun_conflict_window_size as usize,
Expand Down
6 changes: 1 addition & 5 deletions testsuite/forge-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2079,11 +2079,7 @@ fn realistic_network_tuned_for_throughput_test() -> ForgeConfig {
}
OnChainExecutionConfig::V4(config_v4) => {
config_v4.block_gas_limit_type = BlockGasLimitType::NoLimit;
config_v4.transaction_shuffler_type = TransactionShufflerType::Fairness {
sender_conflict_window_size: 256,
module_conflict_window_size: 2,
entry_fun_conflict_window_size: 3,
};
config_v4.transaction_shuffler_type = TransactionShufflerType::SenderAwareV2(256);
}
}
helm_values["chain"]["on_chain_execution_config"] =
Expand Down
12 changes: 2 additions & 10 deletions testsuite/forge-cli/src/suites/dag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,7 @@ fn dag_realistic_env_max_load_test(
}
OnChainExecutionConfig::V4(config_v4) => {
config_v4.block_gas_limit_type = BlockGasLimitType::NoLimit;
config_v4.transaction_shuffler_type = TransactionShufflerType::Fairness {
sender_conflict_window_size: 256,
module_conflict_window_size: 2,
entry_fun_conflict_window_size: 3,
};
config_v4.transaction_shuffler_type = TransactionShufflerType::SenderAwareV2(32);
}
}
helm_values["chain"]["on_chain_execution_config"] =
Expand Down Expand Up @@ -211,11 +207,7 @@ fn dag_reconfig_enable_test() -> ForgeConfig {
}
OnChainExecutionConfig::V4(config_v4) => {
config_v4.block_gas_limit_type = BlockGasLimitType::NoLimit;
config_v4.transaction_shuffler_type = TransactionShufflerType::Fairness {
sender_conflict_window_size: 256,
module_conflict_window_size: 2,
entry_fun_conflict_window_size: 3,
};
config_v4.transaction_shuffler_type = TransactionShufflerType::SenderAwareV2(32);
}
}
helm_values["chain"]["on_chain_execution_config"] =
Expand Down
8 changes: 2 additions & 6 deletions types/src/on_chain_config/execution_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ impl OnChainExecutionConfig {
/// Features that are ready for deployment can be enabled here.
pub fn default_for_genesis() -> Self {
OnChainExecutionConfig::V4(ExecutionConfigV4 {
transaction_shuffler_type: TransactionShufflerType::Fairness {
sender_conflict_window_size: 32,
module_conflict_window_size: 1,
entry_fun_conflict_window_size: 2,
},
transaction_shuffler_type: TransactionShufflerType::SenderAwareV2(32),
block_gas_limit_type: BlockGasLimitType::default_for_genesis(),
transaction_deduper_type: TransactionDeduperType::TxnHashAndAuthenticatorV1,
})
Expand Down Expand Up @@ -152,7 +148,7 @@ pub enum TransactionShufflerType {
NoShuffling,
DeprecatedSenderAwareV1(u32),
SenderAwareV2(u32),
Fairness {
DeprecatedFairness {
sender_conflict_window_size: u32,
module_conflict_window_size: u32,
entry_fun_conflict_window_size: u32,
Expand Down

0 comments on commit 86b9d21

Please sign in to comment.