From 258ba3e433022485e7489567a9af6a959b25f0b2 Mon Sep 17 00:00:00 2001 From: aldenhu Date: Fri, 14 Jun 2024 21:36:32 +0000 Subject: [PATCH] deprecate FairnessShuffler --- .../conflict_key/entry_fun.rs | 2 +- .../conflict_key/entry_fun_module.rs | 2 +- .../conflict_key/mod.rs | 2 +- .../conflict_key/test_utils.rs | 2 +- .../conflict_key/txn_sender.rs | 2 +- .../conflict_zone.rs | 2 +- .../{fairness => deprecated_fairness}/mod.rs | 4 ++-- .../pending_zone.rs | 2 +- .../selection_tracker.rs | 2 +- .../tests/manual.rs | 2 +- .../{fairness => deprecated_fairness}/tests/mod.rs | 0 .../tests/proptests.rs | 2 +- consensus/src/transaction_shuffler/mod.rs | 6 +++--- testsuite/forge-cli/src/main.rs | 6 +----- testsuite/forge-cli/src/suites/dag.rs | 12 ++---------- types/src/on_chain_config/execution_config.rs | 8 ++------ 16 files changed, 20 insertions(+), 36 deletions(-) rename consensus/src/transaction_shuffler/{fairness => deprecated_fairness}/conflict_key/entry_fun.rs (94%) rename consensus/src/transaction_shuffler/{fairness => deprecated_fairness}/conflict_key/entry_fun_module.rs (93%) rename consensus/src/transaction_shuffler/{fairness => deprecated_fairness}/conflict_key/mod.rs (98%) rename consensus/src/transaction_shuffler/{fairness => deprecated_fairness}/conflict_key/test_utils.rs (98%) rename consensus/src/transaction_shuffler/{fairness => deprecated_fairness}/conflict_key/txn_sender.rs (85%) rename consensus/src/transaction_shuffler/{fairness => deprecated_fairness}/conflict_zone.rs (97%) rename consensus/src/transaction_shuffler/{fairness => deprecated_fairness}/mod.rs (98%) rename consensus/src/transaction_shuffler/{fairness => deprecated_fairness}/pending_zone.rs (97%) rename consensus/src/transaction_shuffler/{fairness => deprecated_fairness}/selection_tracker.rs (93%) rename consensus/src/transaction_shuffler/{fairness => deprecated_fairness}/tests/manual.rs (98%) rename consensus/src/transaction_shuffler/{fairness => deprecated_fairness}/tests/mod.rs (100%) rename consensus/src/transaction_shuffler/{fairness => deprecated_fairness}/tests/proptests.rs (98%) diff --git a/consensus/src/transaction_shuffler/fairness/conflict_key/entry_fun.rs b/consensus/src/transaction_shuffler/deprecated_fairness/conflict_key/entry_fun.rs similarity index 94% rename from consensus/src/transaction_shuffler/fairness/conflict_key/entry_fun.rs rename to consensus/src/transaction_shuffler/deprecated_fairness/conflict_key/entry_fun.rs index 140191b1d523f2..7a3363dd9e9591 100644 --- a/consensus/src/transaction_shuffler/fairness/conflict_key/entry_fun.rs +++ b/consensus/src/transaction_shuffler/deprecated_fairness/conflict_key/entry_fun.rs @@ -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}; diff --git a/consensus/src/transaction_shuffler/fairness/conflict_key/entry_fun_module.rs b/consensus/src/transaction_shuffler/deprecated_fairness/conflict_key/entry_fun_module.rs similarity index 93% rename from consensus/src/transaction_shuffler/fairness/conflict_key/entry_fun_module.rs rename to consensus/src/transaction_shuffler/deprecated_fairness/conflict_key/entry_fun_module.rs index 56979f98d6d29b..948d2e8baa330f 100644 --- a/consensus/src/transaction_shuffler/fairness/conflict_key/entry_fun_module.rs +++ b/consensus/src/transaction_shuffler/deprecated_fairness/conflict_key/entry_fun_module.rs @@ -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; diff --git a/consensus/src/transaction_shuffler/fairness/conflict_key/mod.rs b/consensus/src/transaction_shuffler/deprecated_fairness/conflict_key/mod.rs similarity index 98% rename from consensus/src/transaction_shuffler/fairness/conflict_key/mod.rs rename to consensus/src/transaction_shuffler/deprecated_fairness/conflict_key/mod.rs index caaa2d75a37ada..1e233dbdc29fc3 100644 --- a/consensus/src/transaction_shuffler/fairness/conflict_key/mod.rs +++ b/consensus/src/transaction_shuffler/deprecated_fairness/conflict_key/mod.rs @@ -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; diff --git a/consensus/src/transaction_shuffler/fairness/conflict_key/test_utils.rs b/consensus/src/transaction_shuffler/deprecated_fairness/conflict_key/test_utils.rs similarity index 98% rename from consensus/src/transaction_shuffler/fairness/conflict_key/test_utils.rs rename to consensus/src/transaction_shuffler/deprecated_fairness/conflict_key/test_utils.rs index f9b9e9e72fd227..fec79e2c336174 100644 --- a/consensus/src/transaction_shuffler/fairness/conflict_key/test_utils.rs +++ b/consensus/src/transaction_shuffler/deprecated_fairness/conflict_key/test_utils.rs @@ -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::*; diff --git a/consensus/src/transaction_shuffler/fairness/conflict_key/txn_sender.rs b/consensus/src/transaction_shuffler/deprecated_fairness/conflict_key/txn_sender.rs similarity index 85% rename from consensus/src/transaction_shuffler/fairness/conflict_key/txn_sender.rs rename to consensus/src/transaction_shuffler/deprecated_fairness/conflict_key/txn_sender.rs index 3ec1905d869cb6..a742e7c2405733 100644 --- a/consensus/src/transaction_shuffler/fairness/conflict_key/txn_sender.rs +++ b/consensus/src/transaction_shuffler/deprecated_fairness/conflict_key/txn_sender.rs @@ -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; diff --git a/consensus/src/transaction_shuffler/fairness/conflict_zone.rs b/consensus/src/transaction_shuffler/deprecated_fairness/conflict_zone.rs similarity index 97% rename from consensus/src/transaction_shuffler/fairness/conflict_zone.rs rename to consensus/src/transaction_shuffler/deprecated_fairness/conflict_zone.rs index 983baaadedfb9b..00ad9aa54e1569 100644 --- a/consensus/src/transaction_shuffler/fairness/conflict_zone.rs +++ b/consensus/src/transaction_shuffler/deprecated_fairness/conflict_zone.rs @@ -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, }; diff --git a/consensus/src/transaction_shuffler/fairness/mod.rs b/consensus/src/transaction_shuffler/deprecated_fairness/mod.rs similarity index 98% rename from consensus/src/transaction_shuffler/fairness/mod.rs rename to consensus/src/transaction_shuffler/deprecated_fairness/mod.rs index fef6a42a673069..03cc1eb1c6d188 100644 --- a/consensus/src/transaction_shuffler/fairness/mod.rs +++ b/consensus/src/transaction_shuffler/deprecated_fairness/mod.rs @@ -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, @@ -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 { diff --git a/consensus/src/transaction_shuffler/fairness/pending_zone.rs b/consensus/src/transaction_shuffler/deprecated_fairness/pending_zone.rs similarity index 97% rename from consensus/src/transaction_shuffler/fairness/pending_zone.rs rename to consensus/src/transaction_shuffler/deprecated_fairness/pending_zone.rs index 8de932b65e601f..eb9c2af18455f9 100644 --- a/consensus/src/transaction_shuffler/fairness/pending_zone.rs +++ b/consensus/src/transaction_shuffler/deprecated_fairness/pending_zone.rs @@ -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, }; diff --git a/consensus/src/transaction_shuffler/fairness/selection_tracker.rs b/consensus/src/transaction_shuffler/deprecated_fairness/selection_tracker.rs similarity index 93% rename from consensus/src/transaction_shuffler/fairness/selection_tracker.rs rename to consensus/src/transaction_shuffler/deprecated_fairness/selection_tracker.rs index 571f817656ab84..3e10d4368642f5 100644 --- a/consensus/src/transaction_shuffler/fairness/selection_tracker.rs +++ b/consensus/src/transaction_shuffler/deprecated_fairness/selection_tracker.rs @@ -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, diff --git a/consensus/src/transaction_shuffler/fairness/tests/manual.rs b/consensus/src/transaction_shuffler/deprecated_fairness/tests/manual.rs similarity index 98% rename from consensus/src/transaction_shuffler/fairness/tests/manual.rs rename to consensus/src/transaction_shuffler/deprecated_fairness/tests/manual.rs index 69cd94c1412166..753ca542a8d3f7 100644 --- a/consensus/src/transaction_shuffler/fairness/tests/manual.rs +++ b/consensus/src/transaction_shuffler/deprecated_fairness/tests/manual.rs @@ -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, }; diff --git a/consensus/src/transaction_shuffler/fairness/tests/mod.rs b/consensus/src/transaction_shuffler/deprecated_fairness/tests/mod.rs similarity index 100% rename from consensus/src/transaction_shuffler/fairness/tests/mod.rs rename to consensus/src/transaction_shuffler/deprecated_fairness/tests/mod.rs diff --git a/consensus/src/transaction_shuffler/fairness/tests/proptests.rs b/consensus/src/transaction_shuffler/deprecated_fairness/tests/proptests.rs similarity index 98% rename from consensus/src/transaction_shuffler/fairness/tests/proptests.rs rename to consensus/src/transaction_shuffler/deprecated_fairness/tests/proptests.rs index 0195997fbf7684..6d111b03d28e61 100644 --- a/consensus/src/transaction_shuffler/fairness/tests/proptests.rs +++ b/consensus/src/transaction_shuffler/deprecated_fairness/tests/proptests.rs @@ -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, diff --git a/consensus/src/transaction_shuffler/mod.rs b/consensus/src/transaction_shuffler/mod.rs index 5cc43f2a2e8daa..bcc32e6f5d2c18 100644 --- a/consensus/src/transaction_shuffler/mod.rs +++ b/consensus/src/transaction_shuffler/mod.rs @@ -12,7 +12,7 @@ use aptos_types::{ use sender_aware::SenderAwareShuffler; use std::sync::Arc; -mod fairness; +mod deprecated_fairness; mod sender_aware; /// Interface to shuffle transactions @@ -48,7 +48,7 @@ pub fn create_transaction_shuffler( ); Arc::new(SenderAwareShuffler::new(conflict_window_size as usize)) }, - TransactionShufflerType::Fairness { + TransactionShufflerType::DeprecatedFairness { sender_conflict_window_size, module_conflict_window_size, entry_fun_conflict_window_size, @@ -59,7 +59,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, diff --git a/testsuite/forge-cli/src/main.rs b/testsuite/forge-cli/src/main.rs index c4131fb3acc97a..99ff15212fc7e7 100644 --- a/testsuite/forge-cli/src/main.rs +++ b/testsuite/forge-cli/src/main.rs @@ -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"] = diff --git a/testsuite/forge-cli/src/suites/dag.rs b/testsuite/forge-cli/src/suites/dag.rs index 90252cf7f77092..1d7eabdd5263e4 100644 --- a/testsuite/forge-cli/src/suites/dag.rs +++ b/testsuite/forge-cli/src/suites/dag.rs @@ -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"] = @@ -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"] = diff --git a/types/src/on_chain_config/execution_config.rs b/types/src/on_chain_config/execution_config.rs index 69f8ea20cad5f0..6f091d11cd30cb 100644 --- a/types/src/on_chain_config/execution_config.rs +++ b/types/src/on_chain_config/execution_config.rs @@ -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, }) @@ -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,