Skip to content

Commit 8891c10

Browse files
authored
Adding inline transactions in payload to reduce latency (aptos-labs#12303)
* Create a channel between batch coordinator and proof manager * Add new variant to Payload * Adding inline transactions in proof manager * Fixing a unit test * Update get_transactions in payload_manager * Update max_txns_to_execute in proof_manager * Minor updates to max_txns_to_execute * 100 node forge test * 100 node forge * Add a TODO * 100 node forge * Sending only small batches to proof manager * Sending only small batches to proof manager * Remove expired batches in proof manager * Send only small batches to proof manager * Minor change * Send batches to proof manager only if there are less than 20 batches * Exclude batches * Storing only the most recent 20 batches in proof manager * Sending all batches to proof manager and inserting inline blocks only if proof of queue is empty * Maintaining ordering in inline blocks * Verifying batch hash before including in inline block * Adding some counters for testing * Minor update * Minor cleanup * Addressing some PR comments * Create a BatchQueue similar to ProofQueue * Minor change * Not removing excluded batches from batch queue * Change the structure of Payload * Make max_inline_txns configurable * Storing batches only in batchstore * Update Dag driver thresholds * Addressed PR comments * Minor edit to consensus.yaml * Addressing PR comments * Add allow_batches_without_pos_in_proposal flag to Payload::empty * Fixing unit tests * Fixing the smoke tests * Removing some comments * Addressing PR comments * Addressing PR comments
1 parent 60f4bff commit 8891c10

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+804
-189
lines changed

config/src/config/consensus_config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ pub struct ConsensusConfig {
2121
pub max_network_channel_size: usize,
2222
pub max_sending_block_txns: u64,
2323
pub max_sending_block_bytes: u64,
24+
pub max_sending_inline_txns: u64,
25+
pub max_sending_inline_bytes: u64,
2426
pub max_receiving_block_txns: u64,
2527
pub max_receiving_block_bytes: u64,
2628
pub max_pruned_blocks_in_mem: usize,
@@ -144,6 +146,8 @@ impl Default for ConsensusConfig {
144146
max_sending_block_txns: MAX_SENDING_BLOCK_TXNS,
145147
max_sending_block_bytes: 3 * 1024 * 1024, // 3MB
146148
max_receiving_block_txns: 10000.max(2 * MAX_SENDING_BLOCK_TXNS),
149+
max_sending_inline_txns: 100,
150+
max_sending_inline_bytes: 200 * 1024, // 200 KB
147151
max_receiving_block_bytes: 6 * 1024 * 1024, // 6MB
148152
max_pruned_blocks_in_mem: 100,
149153
mempool_executed_txn_timeout_ms: 1000,

config/src/config/quorum_store_config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ pub struct QuorumStoreConfig {
7171
pub back_pressure: QuorumStoreBackPressureConfig,
7272
pub num_workers_for_remote_batches: usize,
7373
pub batch_buckets: Vec<u64>,
74+
pub allow_batches_without_pos_in_proposal: bool,
7475
}
7576

7677
impl Default for QuorumStoreConfig {
@@ -107,6 +108,7 @@ impl Default for QuorumStoreConfig {
107108
// number of batch coordinators to handle QS batch messages, should be >= 1
108109
num_workers_for_remote_batches: 10,
109110
batch_buckets: DEFAULT_BUCKETS.to_vec(),
111+
allow_batches_without_pos_in_proposal: false,
110112
}
111113
}
112114
}

consensus/consensus-types/src/block.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ impl Block {
113113
Payload::InQuorumStore(pos) => pos.proofs.len(),
114114
Payload::DirectMempool(_txns) => 0,
115115
Payload::InQuorumStoreWithLimit(pos) => pos.proof_with_data.proofs.len(),
116+
Payload::QuorumStoreInlineHybrid(inline_batches, proof_with_data, _) => {
117+
inline_batches.len() + proof_with_data.proofs.len()
118+
},
116119
},
117120
}
118121
}

consensus/consensus-types/src/block_data.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ impl BlockData {
235235
pub fn dummy_with_validator_txns(txns: Vec<ValidatorTransaction>) -> Self {
236236
Self::new_proposal_ext(
237237
txns,
238-
Payload::empty(false),
238+
Payload::empty(false, true),
239239
Author::ONE,
240240
vec![],
241241
1,
@@ -385,7 +385,7 @@ fn test_reconfiguration_suffix() {
385385
),
386386
);
387387
let reconfig_suffix_block = BlockData::new_proposal(
388-
Payload::empty(false),
388+
Payload::empty(false, true),
389389
AccountAddress::random(),
390390
Vec::new(),
391391
2,

consensus/consensus-types/src/block_test.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ fn test_nil_block() {
7272
nil_block_qc.certified_block().id()
7373
);
7474
let nil_block_child = Block::new_proposal(
75-
Payload::empty(false),
75+
Payload::empty(false, true),
7676
2,
7777
aptos_infallible::duration_since_epoch().as_micros() as u64,
7878
nil_block_qc,
@@ -91,7 +91,7 @@ fn test_block_relation() {
9191
// Test genesis and the next block
9292
let genesis_block = Block::make_genesis_block();
9393
let quorum_cert = certificate_for_genesis();
94-
let payload = Payload::empty(false);
94+
let payload = Payload::empty(false, true);
9595
let next_block = Block::new_proposal(
9696
payload.clone(),
9797
1,
@@ -118,7 +118,7 @@ fn test_same_qc_different_authors() {
118118
let signer = signers.first().unwrap();
119119
let genesis_qc = certificate_for_genesis();
120120
let round = 1;
121-
let payload = Payload::empty(false);
121+
let payload = Payload::empty(false, true);
122122
let current_timestamp = aptos_infallible::duration_since_epoch().as_micros() as u64;
123123
let block_round_1 = Block::new_proposal(
124124
payload.clone(),
@@ -180,7 +180,7 @@ fn test_block_metadata_bitvec() {
180180
&ledger_info,
181181
Block::make_genesis_block_from_ledger_info(&ledger_info).id(),
182182
);
183-
let payload = Payload::empty(false);
183+
let payload = Payload::empty(false, true);
184184
let start_round = 1;
185185
let start_timestamp = aptos_infallible::duration_since_epoch().as_micros() as u64;
186186

@@ -254,7 +254,7 @@ fn test_failed_authors_well_formed() {
254254
let other = Author::random();
255255
// Test genesis and the next block
256256
let quorum_cert = certificate_for_genesis();
257-
let payload = Payload::empty(false);
257+
let payload = Payload::empty(false, true);
258258

259259
let create_block = |round: Round, failed_authors: Vec<(Round, Author)>| {
260260
Block::new_proposal(

consensus/consensus-types/src/block_test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ prop_compose! {
4343
parent_qc in Just(parent_qc)
4444
) -> Block {
4545
Block::new_proposal(
46-
Payload::empty(false),
46+
Payload::empty(false, true),
4747
round,
4848
aptos_infallible::duration_since_epoch().as_micros() as u64,
4949
parent_qc,

0 commit comments

Comments
 (0)