diff --git a/consensus/consensus-types/src/block_data.rs b/consensus/consensus-types/src/block_data.rs index bcac689bb5a53..f93e2314b0c23 100644 --- a/consensus/consensus-types/src/block_data.rs +++ b/consensus/consensus-types/src/block_data.rs @@ -279,7 +279,7 @@ impl BlockData { pub fn dummy_with_validator_txns(txns: Vec) -> Self { Self::new_proposal_ext( txns, - Payload::empty(false, true), + Payload::empty(false), Author::ONE, vec![], 1, @@ -450,7 +450,7 @@ fn test_reconfiguration_suffix() { ), ); let reconfig_suffix_block = BlockData::new_proposal( - Payload::empty(false, true), + Payload::empty(false), AccountAddress::random(), Vec::new(), 2, diff --git a/consensus/consensus-types/src/block_test.rs b/consensus/consensus-types/src/block_test.rs index 5f12f57a4c7f0..eb29299c7de62 100644 --- a/consensus/consensus-types/src/block_test.rs +++ b/consensus/consensus-types/src/block_test.rs @@ -71,7 +71,7 @@ fn test_nil_block() { nil_block_qc.certified_block().id() ); let nil_block_child = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 2, aptos_infallible::duration_since_epoch().as_micros() as u64, nil_block_qc, @@ -90,7 +90,7 @@ fn test_block_relation() { // Test genesis and the next block let genesis_block = Block::make_genesis_block(); let quorum_cert = certificate_for_genesis(); - let payload = Payload::empty(false, true); + let payload = Payload::empty(false); let next_block = Block::new_proposal( payload.clone(), 1, @@ -117,7 +117,7 @@ fn test_same_qc_different_authors() { let signer = signers.first().unwrap(); let genesis_qc = certificate_for_genesis(); let round = 1; - let payload = Payload::empty(false, true); + let payload = Payload::empty(false); let current_timestamp = aptos_infallible::duration_since_epoch().as_micros() as u64; let block_round_1 = Block::new_proposal( payload.clone(), @@ -179,7 +179,7 @@ fn test_block_metadata_bitvec() { &ledger_info, Block::make_genesis_block_from_ledger_info(&ledger_info).id(), ); - let payload = Payload::empty(false, true); + let payload = Payload::empty(false); let start_round = 1; let start_timestamp = aptos_infallible::duration_since_epoch().as_micros() as u64; @@ -253,7 +253,7 @@ fn test_failed_authors_well_formed() { let other = Author::random(); // Test genesis and the next block let quorum_cert = certificate_for_genesis(); - let payload = Payload::empty(false, true); + let payload = Payload::empty(false); let create_block = |round: Round, failed_authors: Vec<(Round, Author)>| { Block::new_proposal( diff --git a/consensus/consensus-types/src/block_test_utils.rs b/consensus/consensus-types/src/block_test_utils.rs index e3dea0d69966f..774789a332de8 100644 --- a/consensus/consensus-types/src/block_test_utils.rs +++ b/consensus/consensus-types/src/block_test_utils.rs @@ -42,7 +42,7 @@ prop_compose! { parent_qc in Just(parent_qc) ) -> Block { Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), round, aptos_infallible::duration_since_epoch().as_micros() as u64, parent_qc, diff --git a/consensus/consensus-types/src/common.rs b/consensus/consensus-types/src/common.rs index 67fc3a68531e8..bb613839c3407 100644 --- a/consensus/consensus-types/src/common.rs +++ b/consensus/consensus-types/src/common.rs @@ -268,13 +268,14 @@ impl Payload { } } - pub fn empty(quorum_store_enabled: bool, allow_batches_without_pos_in_proposal: bool) -> Self { + pub fn empty(quorum_store_enabled: bool) -> Self { if quorum_store_enabled { - if allow_batches_without_pos_in_proposal { - Payload::QuorumStoreInlineHybrid(Vec::new(), ProofWithData::new(Vec::new()), None) - } else { - Payload::InQuorumStore(ProofWithData::new(Vec::new())) - } + Payload::OptQuorumStore(OptQuorumStorePayload::new( + Vec::<(BatchInfo, Vec)>::new().into(), + Vec::::new().into(), + Vec::>::new().into(), + PayloadExecutionLimit::None, + )) } else { Payload::DirectMempool(Vec::new()) } diff --git a/consensus/consensus-types/src/opt_proposal_msg.rs b/consensus/consensus-types/src/opt_proposal_msg.rs index f91a2623a8d7d..9386f7a9c6244 100644 --- a/consensus/consensus-types/src/opt_proposal_msg.rs +++ b/consensus/consensus-types/src/opt_proposal_msg.rs @@ -189,7 +189,7 @@ mod tests { let opt_block_data = OptBlockData::new( vec![], - Payload::empty(false, true), + Payload::empty(false), signer.author(), epoch, round, @@ -243,7 +243,7 @@ mod tests { let block_data = msg.take_block_data(); let epoch_2_block_data = OptBlockData::new( vec![], - Payload::empty(false, true), + Payload::empty(false), signer.author(), 2, // Different epoch block_data.round(), diff --git a/consensus/safety-rules/src/test_utils.rs b/consensus/safety-rules/src/test_utils.rs index 5619a53680482..1e115f817e02c 100644 --- a/consensus/safety-rules/src/test_utils.rs +++ b/consensus/safety-rules/src/test_utils.rs @@ -79,7 +79,7 @@ pub fn make_proposal_with_qc( validator_signer: &ValidatorSigner, ) -> VoteProposal { make_proposal_with_qc_and_proof( - Payload::empty(false, true), + Payload::empty(false), round, empty_proof(), qc, diff --git a/consensus/safety-rules/src/tests/suite.rs b/consensus/safety-rules/src/tests/suite.rs index 76cbe9d922f5d..1ca0bcd724c29 100644 --- a/consensus/safety-rules/src/tests/suite.rs +++ b/consensus/safety-rules/src/tests/suite.rs @@ -33,13 +33,7 @@ fn make_proposal_with_qc_and_proof( qc: QuorumCert, signer: &ValidatorSigner, ) -> VoteProposal { - test_utils::make_proposal_with_qc_and_proof( - Payload::empty(false, true), - round, - proof, - qc, - signer, - ) + test_utils::make_proposal_with_qc_and_proof(Payload::empty(false), round, proof, qc, signer) } fn make_proposal_with_parent( @@ -48,13 +42,7 @@ fn make_proposal_with_parent( committed: Option<&VoteProposal>, signer: &ValidatorSigner, ) -> VoteProposal { - test_utils::make_proposal_with_parent( - Payload::empty(false, true), - round, - parent, - committed, - signer, - ) + test_utils::make_proposal_with_parent(Payload::empty(false), round, parent, committed, signer) } pub type Callback = Box (Box, ValidatorSigner)>; @@ -450,7 +438,7 @@ fn test_voting_bad_epoch(safety_rules: &Callback) { let a1 = test_utils::make_proposal_with_qc(round + 1, genesis_qc, &signer); let a2 = test_utils::make_proposal_with_parent_and_overrides( - Payload::empty(false, true), + Payload::empty(false), round + 3, &a1, None, @@ -618,7 +606,7 @@ fn test_validator_not_in_set(safety_rules: &Callback) { next_epoch_state.verifier = ValidatorVerifier::new_single(rand_signer.author(), rand_signer.public_key()).into(); let a2 = test_utils::make_proposal_with_parent_and_overrides( - Payload::empty(false, true), + Payload::empty(false), round + 2, &a1, Some(&a1), @@ -656,7 +644,7 @@ fn test_key_not_in_store(safety_rules: &Callback) { next_epoch_state.verifier = ValidatorVerifier::new_single(signer.author(), rand_signer.public_key()).into(); let a2 = test_utils::make_proposal_with_parent_and_overrides( - Payload::empty(false, true), + Payload::empty(false), round + 2, &a1, Some(&a1), diff --git a/consensus/src/block_storage/block_store_test.rs b/consensus/src/block_storage/block_store_test.rs index bc84d9f5632dd..d1e3bb045f1ae 100644 --- a/consensus/src/block_storage/block_store_test.rs +++ b/consensus/src/block_storage/block_store_test.rs @@ -354,7 +354,7 @@ async fn test_illegal_timestamp() { let block_store = build_default_empty_tree(); let genesis = block_store.ordered_root(); let block_with_illegal_timestamp = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 0, // This timestamp is illegal, it is the same as genesis genesis.timestamp_usecs(), @@ -457,7 +457,7 @@ async fn test_need_sync_for_ledger_info() { certificate_for_genesis(), 1, round, - Payload::empty(false, true), + Payload::empty(false), vec![], ); gen_test_certificate( diff --git a/consensus/src/consensusdb/consensusdb_test.rs b/consensus/src/consensusdb/consensusdb_test.rs index b36dbda99e207..3d470fe3383e8 100644 --- a/consensus/src/consensusdb/consensusdb_test.rs +++ b/consensus/src/consensusdb/consensusdb_test.rs @@ -99,7 +99,7 @@ fn test_dag() { Author::random(), 123, vec![], - Payload::empty(false, true), + Payload::empty(false), vec![], Extensions::empty(), ); diff --git a/consensus/src/dag/adapter.rs b/consensus/src/dag/adapter.rs index 7303c8ecab484..ab9f542ffd5e9 100644 --- a/consensus/src/dag/adapter.rs +++ b/consensus/src/dag/adapter.rs @@ -99,7 +99,6 @@ pub(super) struct OrderedNotifierAdapter { epoch_state: Arc, ledger_info_provider: Arc>, block_ordered_ts: Arc>>, - allow_batches_without_pos_in_proposal: bool, } impl OrderedNotifierAdapter { @@ -109,7 +108,6 @@ impl OrderedNotifierAdapter { epoch_state: Arc, parent_block_info: BlockInfo, ledger_info_provider: Arc>, - allow_batches_without_pos_in_proposal: bool, ) -> Self { Self { executor_channel, @@ -118,7 +116,6 @@ impl OrderedNotifierAdapter { epoch_state, ledger_info_provider, block_ordered_ts: Arc::new(RwLock::new(BTreeMap::new())), - allow_batches_without_pos_in_proposal, } } @@ -148,10 +145,7 @@ impl OrderedNotifier for OrderedNotifierAdapter { let timestamp = anchor.metadata().timestamp(); let author = *anchor.author(); let mut validator_txns = vec![]; - let mut payload = Payload::empty( - !anchor.payload().is_direct(), - self.allow_batches_without_pos_in_proposal, - ); + let mut payload = Payload::empty(!anchor.payload().is_direct()); let mut node_digests = vec![]; for node in &ordered_nodes { validator_txns.extend(node.validator_txns().clone()); diff --git a/consensus/src/dag/bootstrap.rs b/consensus/src/dag/bootstrap.rs index fff53764e52aa..d8473840e103d 100644 --- a/consensus/src/dag/bootstrap.rs +++ b/consensus/src/dag/bootstrap.rs @@ -339,7 +339,6 @@ pub struct DagBootstrapper { randomness_config: OnChainRandomnessConfig, jwk_consensus_config: OnChainJWKConsensusConfig, executor: BoundedExecutor, - allow_batches_without_pos_in_proposal: bool, } impl DagBootstrapper { @@ -364,7 +363,6 @@ impl DagBootstrapper { randomness_config: OnChainRandomnessConfig, jwk_consensus_config: OnChainJWKConsensusConfig, executor: BoundedExecutor, - allow_batches_without_pos_in_proposal: bool, ) -> Self { Self { self_peer, @@ -386,7 +384,6 @@ impl DagBootstrapper { randomness_config, jwk_consensus_config, executor, - allow_batches_without_pos_in_proposal, } } @@ -536,7 +533,6 @@ impl DagBootstrapper { self.epoch_state.clone(), parent_block_info, ledger_info_provider.clone(), - self.allow_batches_without_pos_in_proposal, )); let order_rule = Arc::new(Mutex::new(OrderRule::new( @@ -649,7 +645,6 @@ impl DagBootstrapper { self.config.node_payload_config.clone(), health_backoff.clone(), self.quorum_store_enabled, - self.allow_batches_without_pos_in_proposal, ); let rb_handler = NodeBroadcastHandler::new( dag_store.clone(), @@ -768,7 +763,6 @@ pub(super) fn bootstrap_dag_for_test( OnChainRandomnessConfig::default_enabled(), OnChainJWKConsensusConfig::default_enabled(), BoundedExecutor::new(2, Handle::current()), - true, ); let (_base_state, handler, fetch_service) = bootstraper.full_bootstrap(); diff --git a/consensus/src/dag/dag_driver.rs b/consensus/src/dag/dag_driver.rs index 063e2f09cdfe9..c9c03f71a4da4 100644 --- a/consensus/src/dag/dag_driver.rs +++ b/consensus/src/dag/dag_driver.rs @@ -64,7 +64,6 @@ pub(crate) struct DagDriver { payload_config: DagPayloadConfig, health_backoff: HealthBackoff, quorum_store_enabled: bool, - allow_batches_without_pos_in_proposal: bool, } impl DagDriver { @@ -85,7 +84,6 @@ impl DagDriver { payload_config: DagPayloadConfig, health_backoff: HealthBackoff, quorum_store_enabled: bool, - allow_batches_without_pos_in_proposal: bool, ) -> Self { let pending_node = storage .get_pending_node() @@ -110,7 +108,6 @@ impl DagDriver { payload_config, health_backoff, quorum_store_enabled, - allow_batches_without_pos_in_proposal, }; // If we were broadcasting the node for the round already, resume it @@ -281,13 +278,7 @@ impl DagDriver { Ok(payload) => payload, Err(e) => { error!("error pulling payload: {}", e); - ( - vec![], - Payload::empty( - self.quorum_store_enabled, - self.allow_batches_without_pos_in_proposal, - ), - ) + (vec![], Payload::empty(self.quorum_store_enabled)) }, }; diff --git a/consensus/src/dag/tests/dag_driver_tests.rs b/consensus/src/dag/tests/dag_driver_tests.rs index 7e73a7a57573e..4ab1f401d24e7 100644 --- a/consensus/src/dag/tests/dag_driver_tests.rs +++ b/consensus/src/dag/tests/dag_driver_tests.rs @@ -208,7 +208,6 @@ fn setup( NoPipelineBackpressure::new(), ), false, - true, ) } diff --git a/consensus/src/dag/tests/helpers.rs b/consensus/src/dag/tests/helpers.rs index 258df20443902..567a68d289357 100644 --- a/consensus/src/dag/tests/helpers.rs +++ b/consensus/src/dag/tests/helpers.rs @@ -68,7 +68,7 @@ pub(crate) fn new_certified_node( author, 0, vec![], - Payload::empty(false, true), + Payload::empty(false), parents, Extensions::empty(), ); @@ -87,7 +87,7 @@ pub(crate) fn new_node( author, timestamp, vec![], - Payload::empty(false, true), + Payload::empty(false), parents, Extensions::empty(), ) diff --git a/consensus/src/dag/tests/types_test.rs b/consensus/src/dag/tests/types_test.rs index 8be958b380491..a99501ed9ccae 100644 --- a/consensus/src/dag/tests/types_test.rs +++ b/consensus/src/dag/tests/types_test.rs @@ -24,7 +24,7 @@ fn test_node_verify() { let invalid_node = Node::new_for_test( NodeMetadata::new_for_test(0, 0, signers[0].author(), 0, HashValue::random()), - Payload::empty(false, true), + Payload::empty(false), vec![], Extensions::empty(), ); @@ -73,7 +73,7 @@ fn test_certified_node_verify() { let invalid_node = Node::new_for_test( NodeMetadata::new_for_test(0, 0, signers[0].author(), 0, HashValue::random()), - Payload::empty(false, true), + Payload::empty(false), vec![], Extensions::empty(), ); diff --git a/consensus/src/epoch_manager.rs b/consensus/src/epoch_manager.rs index 7837c4fbcb9b5..38274acbf8ddd 100644 --- a/consensus/src/epoch_manager.rs +++ b/consensus/src/epoch_manager.rs @@ -943,9 +943,6 @@ impl EpochManager

{ chain_health_backoff_config, self.quorum_store_enabled, onchain_consensus_config.effective_validator_txn_config(), - self.config - .quorum_store - .allow_batches_without_pos_in_proposal, opt_qs_payload_param_provider, ); let (round_manager_tx, round_manager_rx) = aptos_channel::new( @@ -1508,9 +1505,6 @@ impl EpochManager

{ onchain_randomness_config, onchain_jwk_consensus_config, self.bounded_executor.clone(), - self.config - .quorum_store - .allow_batches_without_pos_in_proposal, ); let (dag_rpc_tx, dag_rpc_rx) = aptos_channel::new(QueueStyle::FIFO, 10, None); diff --git a/consensus/src/liveness/proposal_generator.rs b/consensus/src/liveness/proposal_generator.rs index 8a326cc9a495c..28b6dafe99c1a 100644 --- a/consensus/src/liveness/proposal_generator.rs +++ b/consensus/src/liveness/proposal_generator.rs @@ -403,8 +403,6 @@ pub struct ProposalGenerator { last_round_generated: Mutex, quorum_store_enabled: bool, vtxn_config: ValidatorTxnConfig, - - allow_batches_without_pos_in_proposal: bool, opt_qs_payload_param_provider: Arc, proposal_under_backpressure: Mutex, @@ -428,7 +426,6 @@ impl ProposalGenerator { chain_health_backoff_config: ChainHealthBackoffConfig, quorum_store_enabled: bool, vtxn_config: ValidatorTxnConfig, - allow_batches_without_pos_in_proposal: bool, opt_qs_payload_param_provider: Arc, ) -> Self { Self { @@ -448,7 +445,6 @@ impl ProposalGenerator { last_round_generated: Mutex::new(0), quorum_store_enabled, vtxn_config, - allow_batches_without_pos_in_proposal, opt_qs_payload_param_provider, proposal_under_backpressure: Mutex::new(false), } @@ -507,10 +503,7 @@ impl ProposalGenerator { // after reconfiguration until it's committed ( vec![], - Payload::empty( - self.quorum_store_enabled, - self.allow_batches_without_pos_in_proposal, - ), + Payload::empty(self.quorum_store_enabled), hqc.certified_block().timestamp_usecs(), ) } else { diff --git a/consensus/src/liveness/proposal_generator_test.rs b/consensus/src/liveness/proposal_generator_test.rs index f53d25c648b68..7bc117b64fc5e 100644 --- a/consensus/src/liveness/proposal_generator_test.rs +++ b/consensus/src/liveness/proposal_generator_test.rs @@ -53,7 +53,6 @@ async fn test_proposal_generation_empty_tree() { ChainHealthBackoffConfig::new_no_backoff(), false, ValidatorTxnConfig::default_disabled(), - true, Arc::new(MockOptQSPayloadProvider {}), ); let proposer_election = Arc::new(UnequivocalProposerElection::new(Arc::new( @@ -100,7 +99,6 @@ async fn test_proposal_generation_parent() { ChainHealthBackoffConfig::new_no_backoff(), false, ValidatorTxnConfig::default_disabled(), - true, Arc::new(MockOptQSPayloadProvider {}), ); let proposer_election = Arc::new(UnequivocalProposerElection::new(Arc::new( @@ -177,7 +175,6 @@ async fn test_old_proposal_generation() { ChainHealthBackoffConfig::new_no_backoff(), false, ValidatorTxnConfig::default_disabled(), - true, Arc::new(MockOptQSPayloadProvider {}), ); let proposer_election = Arc::new(UnequivocalProposerElection::new(Arc::new( @@ -219,7 +216,6 @@ async fn test_correct_failed_authors() { ChainHealthBackoffConfig::new_no_backoff(), false, ValidatorTxnConfig::default_disabled(), - true, Arc::new(MockOptQSPayloadProvider {}), ); let proposer_election = Arc::new(UnequivocalProposerElection::new(Arc::new( diff --git a/consensus/src/liveness/unequivocal_proposer_election_test.rs b/consensus/src/liveness/unequivocal_proposer_election_test.rs index 6462544fc7835..8086bc9f580f0 100644 --- a/consensus/src/liveness/unequivocal_proposer_election_test.rs +++ b/consensus/src/liveness/unequivocal_proposer_election_test.rs @@ -37,7 +37,7 @@ fn test_is_valid_proposal() { let quorum_cert = certificate_for_genesis(); let good_proposal = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 1, 1, quorum_cert.clone(), @@ -46,7 +46,7 @@ fn test_is_valid_proposal() { ) .unwrap(); let bad_author_proposal = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 1, 1, quorum_cert.clone(), @@ -55,7 +55,7 @@ fn test_is_valid_proposal() { ) .unwrap(); let bad_duplicate_proposal = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 1, 2, quorum_cert.clone(), @@ -64,7 +64,7 @@ fn test_is_valid_proposal() { ) .unwrap(); let next_good_proposal = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 2, 3, quorum_cert.clone(), @@ -73,7 +73,7 @@ fn test_is_valid_proposal() { ) .unwrap(); let next_bad_duplicate_proposal = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 2, 4, quorum_cert, diff --git a/consensus/src/network_tests.rs b/consensus/src/network_tests.rs index 3839b37c43c9f..d6f63bcb06ef1 100644 --- a/consensus/src/network_tests.rs +++ b/consensus/src/network_tests.rs @@ -690,7 +690,7 @@ mod tests { let previous_qc = certificate_for_genesis(); let proposal = ProposalMsg::new( Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 1, 1, previous_qc.clone(), diff --git a/consensus/src/pipeline/tests/test_utils.rs b/consensus/src/pipeline/tests/test_utils.rs index d2e55fe7892c0..204da73701469 100644 --- a/consensus/src/pipeline/tests/test_utils.rs +++ b/consensus/src/pipeline/tests/test_utils.rs @@ -69,13 +69,7 @@ pub fn prepare_executed_blocks_with_ledger_info( assert!(num_blocks > 0); let p1 = if let Some(parent) = some_parent { - make_proposal_with_parent( - Payload::empty(false, true), - init_round, - &parent, - None, - signer, - ) + make_proposal_with_parent(Payload::empty(false), init_round, &parent, None, signer) } else { make_proposal_with_qc(init_round, init_qc.unwrap(), signer) }; @@ -85,13 +79,8 @@ pub fn prepare_executed_blocks_with_ledger_info( for i in 1..num_blocks { println!("Generating {}", i); let parent = proposals.last().unwrap(); - let proposal = make_proposal_with_parent( - Payload::empty(false, true), - init_round + i, - parent, - None, - signer, - ); + let proposal = + make_proposal_with_parent(Payload::empty(false), init_round + i, parent, None, signer); proposals.push(proposal); } diff --git a/consensus/src/quorum_store/proof_manager.rs b/consensus/src/quorum_store/proof_manager.rs index 37ade0454b24c..91ec3e2431a23 100644 --- a/consensus/src/quorum_store/proof_manager.rs +++ b/consensus/src/quorum_store/proof_manager.rs @@ -7,7 +7,7 @@ use crate::{ quorum_store::{batch_generator::BackPressure, batch_proof_queue::BatchProofQueue, counters}, }; use aptos_consensus_types::{ - common::{Payload, PayloadFilter, ProofWithData, TxnSummaryWithExpiration}, + common::{Payload, PayloadFilter, TxnSummaryWithExpiration}, payload::{OptQuorumStorePayload, PayloadExecutionLimit}, proof_of_store::{BatchInfoExt, ProofOfStore, ProofOfStoreMsg}, request_response::{GetPayloadCommand, GetPayloadResponse}, @@ -34,7 +34,6 @@ pub struct ProofManager { back_pressure_total_proof_limit: u64, remaining_total_proof_num: u64, allow_batches_without_pos_in_proposal: bool, - enable_payload_v2: bool, } impl ProofManager { @@ -44,7 +43,6 @@ impl ProofManager { back_pressure_total_proof_limit: u64, batch_store: Arc, allow_batches_without_pos_in_proposal: bool, - enable_payload_v2: bool, batch_expiry_gap_when_init_usecs: u64, ) -> Self { Self { @@ -58,7 +56,6 @@ impl ProofManager { back_pressure_total_proof_limit, remaining_total_proof_num: 0, allow_batches_without_pos_in_proposal, - enable_payload_v2, } } @@ -224,7 +221,7 @@ impl ProofManager { )) } } else if proof_block.is_empty() && inline_block.is_empty() { - Payload::empty(true, self.allow_batches_without_pos_in_proposal) + Payload::empty(true) } else { trace!( "QS: GetBlockRequest excluded len {}, block len {}, inline len {}", @@ -232,8 +229,7 @@ impl ProofManager { proof_block.len(), inline_block.len() ); - // Both QuorumStoreInlineHybrid and QuorumStoreInlineHybridV2 use BatchInfo - // So we need to convert BatchInfoExt to BatchInfo + // Convert to BatchInfo for V1 let inline_block_v1: Vec<_> = inline_block .into_iter() .map(|(info, txns)| (info.info().clone(), txns)) @@ -245,20 +241,12 @@ impl ProofManager { ProofOfStore::new(info.info().clone(), sig) }) .collect(); - - if self.enable_payload_v2 { - Payload::QuorumStoreInlineHybridV2( - inline_block_v1, - ProofWithData::new(proof_block_v1), - PayloadExecutionLimit::None, - ) - } else { - Payload::QuorumStoreInlineHybrid( - inline_block_v1, - ProofWithData::new(proof_block_v1), - None, - ) - } + Payload::OptQuorumStore(OptQuorumStorePayload::new( + inline_block_v1.into(), + Vec::new().into(), + proof_block_v1.into(), + PayloadExecutionLimit::None, + )) }; let res = GetPayloadResponse::GetPayloadResponse(response); diff --git a/consensus/src/quorum_store/quorum_store_builder.rs b/consensus/src/quorum_store/quorum_store_builder.rs index 7b8985d930d78..65d7eef244673 100644 --- a/consensus/src/quorum_store/quorum_store_builder.rs +++ b/consensus/src/quorum_store/quorum_store_builder.rs @@ -371,7 +371,6 @@ impl InnerBuilder { * self.num_validators, self.batch_store.clone().unwrap(), self.config.allow_batches_without_pos_in_proposal, - self.config.enable_payload_v2, self.config.batch_expiry_gap_when_init_usecs, ); spawn_named!( diff --git a/consensus/src/quorum_store/tests/proof_manager_test.rs b/consensus/src/quorum_store/tests/proof_manager_test.rs index 0648a3991b014..067114c74a797 100644 --- a/consensus/src/quorum_store/tests/proof_manager_test.rs +++ b/consensus/src/quorum_store/tests/proof_manager_test.rs @@ -17,7 +17,7 @@ use std::{cmp::max, collections::HashSet}; fn create_proof_manager() -> ProofManager { let batch_store = batch_store_for_test(5 * 1024 * 1024); - ProofManager::new(PeerId::random(), 10, 10, batch_store, true, true, 1) + ProofManager::new(PeerId::random(), 10, 10, batch_store, true, 1) } fn create_proof( @@ -78,41 +78,29 @@ async fn get_proposal( fn assert_payload_response( payload: Payload, expected: &[ProofOfStore], - max_txns_from_block_to_execute: Option, - expected_block_gas_limit: Option, + _max_txns_from_block_to_execute: Option, + _expected_block_gas_limit: Option, ) { match payload { - Payload::InQuorumStore(proofs) => { - assert_eq!(proofs.proofs.len(), expected.len()); - for proof in proofs.proofs { - assert!(expected.contains(&proof.into())); + Payload::OptQuorumStore(opt_qs) => { + match opt_qs { + aptos_consensus_types::payload::OptQuorumStorePayload::V1(p) => { + let proofs = &p.proof_with_data().batch_summary; + assert_eq!(proofs.len(), expected.len()); + for proof in proofs { + let proof_ext: ProofOfStore = proof.clone().into(); + assert!(expected.contains(&proof_ext)); + } + }, + aptos_consensus_types::payload::OptQuorumStorePayload::V2(p) => { + let proofs = &p.proof_with_data().batch_summary; + assert_eq!(proofs.len(), expected.len()); + for proof in proofs { + assert!(expected.contains(proof)); + } + }, } }, - Payload::InQuorumStoreWithLimit(proofs) => { - assert_eq!(proofs.proof_with_data.proofs.len(), expected.len()); - for proof in proofs.proof_with_data.proofs { - assert!(expected.contains(&proof.into())); - } - assert_eq!(proofs.max_txns_to_execute, max_txns_from_block_to_execute); - }, - Payload::QuorumStoreInlineHybrid(_inline_batches, proofs, max_txns_to_execute) => { - assert_eq!(proofs.proofs.len(), expected.len()); - for proof in proofs.proofs { - assert!(expected.contains(&proof.into())); - } - assert_eq!(max_txns_to_execute, max_txns_from_block_to_execute); - }, - Payload::QuorumStoreInlineHybridV2(_inline_batches, proofs, execution_limits) => { - assert_eq!(proofs.proofs.len(), expected.len()); - for proof in proofs.proofs { - assert!(expected.contains(&proof.into())); - } - assert_eq!( - execution_limits.max_txns_to_execute(), - max_txns_from_block_to_execute - ); - assert_eq!(execution_limits.block_gas_limit(), expected_block_gas_limit); - }, _ => panic!("Unexpected variant"), } } diff --git a/consensus/src/round_manager_fuzzing.rs b/consensus/src/round_manager_fuzzing.rs index 6aabc05beace2..e387ddee9cbad 100644 --- a/consensus/src/round_manager_fuzzing.rs +++ b/consensus/src/round_manager_fuzzing.rs @@ -187,7 +187,6 @@ fn create_node_for_fuzzing() -> RoundManager { ChainHealthBackoffConfig::new_no_backoff(), false, ValidatorTxnConfig::default_disabled(), - true, Arc::new(MockOptQSPayloadProvider {}), ); diff --git a/consensus/src/round_manager_tests/consensus_test.rs b/consensus/src/round_manager_tests/consensus_test.rs index 9276ddd151f9d..4e4001890e53e 100644 --- a/consensus/src/round_manager_tests/consensus_test.rs +++ b/consensus/src/round_manager_tests/consensus_test.rs @@ -272,7 +272,7 @@ fn vote_on_successful_proposal() { node.next_proposal().await; let proposal = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 1, 1, genesis_qc.clone(), @@ -322,7 +322,7 @@ fn delay_proposal_processing_in_sync_only() { // Set sync only to true so that new proposal processing is delayed. node.block_store.set_back_pressure_for_test(true); let proposal = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 1, 1, genesis_qc.clone(), @@ -383,7 +383,7 @@ fn no_vote_on_old_proposal() { let node = &mut nodes[0]; let genesis_qc = certificate_for_genesis(); let new_block = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 1, 1, genesis_qc.clone(), @@ -393,7 +393,7 @@ fn no_vote_on_old_proposal() { .unwrap(); let new_block_id = new_block.id(); let old_block = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 1, 2, genesis_qc, @@ -444,7 +444,7 @@ fn no_vote_on_mismatch_round() { .unwrap(); let genesis_qc = certificate_for_genesis(); let correct_block = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 1, 1, genesis_qc.clone(), @@ -453,7 +453,7 @@ fn no_vote_on_mismatch_round() { ) .unwrap(); let block_skip_round = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 2, 2, genesis_qc.clone(), @@ -579,7 +579,7 @@ fn no_vote_on_invalid_proposer() { let mut node = nodes.pop().unwrap(); let genesis_qc = certificate_for_genesis(); let correct_block = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 1, 1, genesis_qc.clone(), @@ -588,7 +588,7 @@ fn no_vote_on_invalid_proposer() { ) .unwrap(); let block_incorrect_proposer = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 1, 1, genesis_qc.clone(), @@ -649,7 +649,7 @@ fn new_round_on_timeout_certificate() { .unwrap(); let genesis_qc = certificate_for_genesis(); let correct_block = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 1, 1, genesis_qc.clone(), @@ -658,7 +658,7 @@ fn new_round_on_timeout_certificate() { ) .unwrap(); let block_skip_round = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 2, 2, genesis_qc.clone(), @@ -742,7 +742,7 @@ fn reject_invalid_failed_authors() { let create_proposal = |round: Round, failed_authors: Vec<(Round, Author)>| { let block = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), round, 2, genesis_qc.clone(), @@ -828,7 +828,7 @@ fn response_on_block_retrieval() { let genesis_qc = certificate_for_genesis(); let block = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 1, 1, genesis_qc.clone(), @@ -958,7 +958,7 @@ fn recover_on_restart() { genesis_qc.clone(), i, i, - Payload::empty(false, true), + Payload::empty(false), (std::cmp::max(1, i.saturating_sub(10))..i) .map(|i| (i, inserter.signer().author())) .collect(), diff --git a/consensus/src/round_manager_tests/mod.rs b/consensus/src/round_manager_tests/mod.rs index cd3901984322e..e69114b82b144 100644 --- a/consensus/src/round_manager_tests/mod.rs +++ b/consensus/src/round_manager_tests/mod.rs @@ -444,7 +444,6 @@ impl NodeSetup { ChainHealthBackoffConfig::new_no_backoff(), false, onchain_consensus_config.effective_validator_txn_config(), - true, Arc::new(MockOptQSPayloadProvider {}), ); diff --git a/consensus/src/round_manager_tests/opt_proposal_test.rs b/consensus/src/round_manager_tests/opt_proposal_test.rs index b147a2c02143e..a58fb02ede7df 100644 --- a/consensus/src/round_manager_tests/opt_proposal_test.rs +++ b/consensus/src/round_manager_tests/opt_proposal_test.rs @@ -288,7 +288,7 @@ fn test_process_either_optimistic_or_normal_proposal() { let opt_block_data = OptBlockData::new( Vec::new(), - Payload::empty(false, false), + Payload::empty(false), proposal_msg.proposer(), proposal_msg.proposal().epoch(), proposal_msg.proposal().round(), diff --git a/consensus/src/round_manager_tests/vtxn_on_proposal_test.rs b/consensus/src/round_manager_tests/vtxn_on_proposal_test.rs index 332959b8fbcac..4c1dd5e7fb599 100644 --- a/consensus/src/round_manager_tests/vtxn_on_proposal_test.rs +++ b/consensus/src/round_manager_tests/vtxn_on_proposal_test.rs @@ -54,7 +54,7 @@ fn no_vote_on_proposal_ext_when_feature_disabled() { let invalid_block = Block::new_proposal_ext( vec![ValidatorTransaction::dummy(vec![0xFF]); 5], - Payload::empty(false, true), + Payload::empty(false), 1, 1, genesis_qc.clone(), @@ -64,7 +64,7 @@ fn no_vote_on_proposal_ext_when_feature_disabled() { .unwrap(); let valid_block = Block::new_proposal( - Payload::empty(false, true), + Payload::empty(false), 1, 1, genesis_qc, @@ -242,7 +242,7 @@ fn assert_process_proposal_result( let genesis_qc = certificate_for_genesis(); let block = Block::new_proposal_ext( vtxns, - Payload::empty(false, true), + Payload::empty(false), 1, 1, genesis_qc.clone(), @@ -344,7 +344,7 @@ fn no_vote_on_proposal_ext_when_receiving_limit_exceeded() { let block_vtxns_too_large = Block::new_proposal_ext( vec![ValidatorTransaction::dummy(vec![0xFF; 200]); 5], // total_bytes >= 200 * 5 = 1000 - Payload::empty(false, true), + Payload::empty(false), 1, 1, genesis_qc.clone(), diff --git a/consensus/src/test_utils/mock_execution_client.rs b/consensus/src/test_utils/mock_execution_client.rs index 647155f9e2bdc..0bdfe4d03cc3e 100644 --- a/consensus/src/test_utils/mock_execution_client.rs +++ b/consensus/src/test_utils/mock_execution_client.rs @@ -143,10 +143,7 @@ impl TExecutionClient for MockExecutionClient { for block in &blocks { self.block_cache.lock().insert( block.id(), - block - .payload() - .unwrap_or(&Payload::empty(false, true)) - .clone(), + block.payload().unwrap_or(&Payload::empty(false)).clone(), ); } diff --git a/consensus/src/test_utils/mod.rs b/consensus/src/test_utils/mod.rs index a948bb720eed5..55e64397ad109 100644 --- a/consensus/src/test_utils/mod.rs +++ b/consensus/src/test_utils/mod.rs @@ -210,7 +210,7 @@ impl TreeInserter { parent_qc, parent.timestamp_usecs() + 1, round, - Payload::empty(false, true), + Payload::empty(false), vec![], )) .await