Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude expired transactions when counting block size during block creation #13850

Merged
merged 88 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
60e8b87
Use proof queue asynchronously
vusirikala Jun 3, 2024
b56cc33
Committing what I have
vusirikala Jun 3, 2024
a369c28
Sending AddBatches message
vusirikala Jun 3, 2024
80a5a34
Calcuating the remaining txns
vusirikala Jun 3, 2024
4e5babe
Calculate proof queue size correctly
vusirikala Jun 4, 2024
1653475
Add a counter
vusirikala Jun 4, 2024
844e4ae
Update pfn_const_tps test
vusirikala Jun 4, 2024
be89d17
Minor changes
vusirikala Jun 4, 2024
8d77c78
Minor change
vusirikala Jun 5, 2024
e064652
Add some coutners
vusirikala Jun 5, 2024
204d823
Rust lint
vusirikala Jun 5, 2024
32eb5a4
Increasing quorum store backpressure limits
vusirikala Jun 5, 2024
7f63400
setting dynamic_min_txns_per_sec to 160
vusirikala Jun 5, 2024
196412f
Merge branch 'main' into satya/proof_queue
vusirikala Jun 6, 2024
76f9326
Fixing the calculation
vusirikala Jun 6, 2024
4c7af58
increase vfns to 7
vusirikala Jun 7, 2024
f71d2d0
Fixing the typo in batch generator
vusirikala Jun 7, 2024
2ee53a8
Merge branch 'main' into satya/proof_queue
vusirikala Jun 10, 2024
30490c3
Merge branch 'main' into satya/proof_queue
vusirikala Jun 11, 2024
e1dcb03
Merge branch 'main' into satya/proof_queue
vusirikala Jun 12, 2024
6282c44
Merge branch 'main' into satya/proof_queue
vusirikala Jun 13, 2024
29951a9
Add increase fraction
vusirikala Jun 13, 2024
cc3d7a2
Removing skipped transactions after inserting them
vusirikala Jun 13, 2024
5319f79
Add some counters
vusirikala Jun 13, 2024
a4f11ab
Update consensus pending duration counter
vusirikala Jun 13, 2024
eabe96c
Add more counters
vusirikala Jun 13, 2024
0c413fd
Increasing block size to 2500
vusirikala Jun 13, 2024
78b559b
Update a counter
vusirikala Jun 13, 2024
056baec
Increase block size limit
vusirikala Jun 13, 2024
6e54abb
Resetting execution config params
vusirikala Jun 14, 2024
685325a
Moving proof queue to utils.rs
vusirikala Jun 14, 2024
4a4d884
Moving counters
vusirikala Jun 14, 2024
a9871d8
Use transaction summary
vusirikala Jun 14, 2024
13669ca
intelligent pull proofs
vusirikala Jun 14, 2024
1264dad
Fix a bug in pull proofs
vusirikala Jun 15, 2024
5c38ea5
Merge branch 'main' into satya/proof_queue_simple
vusirikala Jun 15, 2024
244720c
Fix the bug
vusirikala Jun 15, 2024
7b0f5bc
Merge branch 'satya/proof_queue_simple' into satya/pull_proofs
vusirikala Jun 15, 2024
822746a
Rest to full to false in every iteration
vusirikala Jun 17, 2024
9982f97
Addressing PR comments
vusirikala Jun 17, 2024
3a23414
Move backpressure_tx to proof queue
vusirikala Jun 17, 2024
8c107be
Add info statement
vusirikala Jun 17, 2024
2f2e7a4
Merge branch 'satya/proof_queue_simple' into satya/pull_proofs
vusirikala Jun 17, 2024
75fabfe
Change buckets
vusirikala Jun 18, 2024
f20dd13
Add some info statements
vusirikala Jun 18, 2024
07aed02
Merge branch 'satya/proof_queue_simple' into satya/pull_proofs
vusirikala Jun 18, 2024
cb1b61d
Merge branch 'main' into satya/proof_queue_simple
vusirikala Jun 18, 2024
45b40bc
Merge branch 'main' into satya/proof_queue_simple
vusirikala Jun 18, 2024
51ccb9d
Cleanup
vusirikala Jun 19, 2024
9c76004
Remove an unrelated change
vusirikala Jun 19, 2024
21bb0ad
Addressing PR comments
vusirikala Jun 24, 2024
6eaafb2
Addressing PR comments
vusirikala Jun 25, 2024
46f18f3
Add some timer counters
vusirikala Jun 25, 2024
b0f73fd
Add more timer counters
vusirikala Jun 25, 2024
2bd92e2
Minor optimization
vusirikala Jun 25, 2024
51dc66b
Proof queue to be part of proof manager
vusirikala Jun 25, 2024
895cb79
Merge branch 'main' into satya/proof_queue_simple
vusirikala Jun 25, 2024
4a104c2
Move some code to a function
vusirikala Jun 25, 2024
bd3f611
Merge branch 'satya/proof_queue_simple' into satya/pull_proofs
vusirikala Jun 25, 2024
529e12a
Minor fixes
vusirikala Jun 26, 2024
f183611
Merge branch 'main' into satya/pull_proofs
vusirikala Jun 26, 2024
80aa8bf
Add max_unique_txns parameter
vusirikala Jun 26, 2024
5fce8e6
Use Lazy
vusirikala Jun 26, 2024
adbb6fc
Removing comments
vusirikala Jun 26, 2024
9964b60
Minor change
vusirikala Jun 26, 2024
0b170d3
Minor change
vusirikala Jun 26, 2024
d2f0fba
Minor fix
vusirikala Jun 26, 2024
13ec31b
Add unit test and address PR comments
vusirikala Jun 26, 2024
c428b1c
Minor fix in proof manager
vusirikala Jun 27, 2024
1d9b169
Merge branch 'main' into satya/pull_proofs
vusirikala Jun 27, 2024
2712880
Use saturating_sub
vusirikala Jun 27, 2024
0a50de4
Exclude expired transactions when counting block size
vusirikala Jun 27, 2024
b0c8aa2
Merge branch 'main' into satya/pull_proofs
vusirikala Jun 27, 2024
9d33742
Merge branch 'main' into satya/pull_proofs
vusirikala Jul 1, 2024
d92bca4
Merge branch 'satya/pull_proofs' into satya/count_unexpired
vusirikala Jul 1, 2024
a2a1c38
Minor fix
vusirikala Jul 1, 2024
12ec7b0
Addressing PR comments
vusirikala Jul 1, 2024
cdfbb17
Merge branch 'main' into satya/count_unexpired
vusirikala Jul 2, 2024
fe057ff
Minor fix
vusirikala Jul 2, 2024
1d6ace5
Change the expiration units
vusirikala Jul 9, 2024
9ef0610
Merge branch 'main' into satya/count_unexpired
vusirikala Jul 9, 2024
fcbf70c
Fixing unit tests
vusirikala Jul 10, 2024
cfad57f
Update unit tests
vusirikala Jul 10, 2024
5646d7e
renaming
vusirikala Jul 10, 2024
8ab96f4
Add block_timestamp as inputt to pull_proofs
vusirikala Jul 10, 2024
0a93374
Fix test
vusirikala Jul 10, 2024
45148be
Merge branch 'main' into satya/count_unexpired
vusirikala Jul 10, 2024
6bb88b7
Typo
vusirikala Jul 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions consensus/consensus-types/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,36 @@ impl fmt::Display for TransactionSummary {
}
}

#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize, Hash, Ord, PartialOrd)]
pub struct TxnSummaryWithExpiration {
pub sender: AccountAddress,
pub sequence_number: u64,
pub expiration_timestamp_secs: u64,
pub hash: HashValue,
}

impl TxnSummaryWithExpiration {
pub fn new(
sender: AccountAddress,
sequence_number: u64,
expiration_timestamp_secs: u64,
hash: HashValue,
) -> Self {
Self {
sender,
sequence_number,
expiration_timestamp_secs,
hash,
}
}
}

impl fmt::Display for TxnSummaryWithExpiration {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}:{}", self.sender, self.sequence_number,)
}
}

#[derive(Clone)]
pub struct TransactionInProgress {
pub gas_unit_price: u64,
Expand Down
9 changes: 6 additions & 3 deletions consensus/consensus-types/src/request_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use crate::common::{Payload, PayloadFilter};
use anyhow::Result;
use futures::channel::oneshot;
use std::{fmt, fmt::Formatter};
use std::{fmt, fmt::Formatter, time::Duration};

pub enum GetPayloadCommand {
/// Request to pull block to submit to consensus.
Expand All @@ -25,6 +25,8 @@ pub enum GetPayloadCommand {
PayloadFilter,
// callback to respond to
oneshot::Sender<Result<GetPayloadResponse>>,
// block timestamp
Duration,
),
}

Expand All @@ -40,11 +42,12 @@ impl fmt::Display for GetPayloadCommand {
return_non_full,
excluded,
_,
block_timestamp,
) => {
write!(
f,
"GetPayloadRequest [max_txns: {}, max_txns_after_filtering: {}, max_bytes: {}, max_inline_txns: {}, max_inline_bytes:{}, return_non_full: {}, excluded: {}]",
max_txns, max_txns_after_filtering, max_bytes, max_inline_txns, max_inline_bytes, return_non_full, excluded
"GetPayloadRequest [max_txns: {}, max_txns_after_filtering: {}, max_bytes: {}, max_inline_txns: {}, max_inline_bytes:{}, return_non_full: {}, excluded: {}, block_timestamp: {:?}]",
max_txns, max_txns_after_filtering, max_bytes, max_inline_txns, max_inline_bytes, return_non_full, excluded, block_timestamp
)
},
}
Expand Down
1 change: 1 addition & 0 deletions consensus/src/dag/dag_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ impl DagDriver {
false,
0,
0.0,
self.time_service.now_unix_time(),
)
.await
{
Expand Down
1 change: 1 addition & 0 deletions consensus/src/liveness/proposal_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ impl ProposalGenerator {
pending_ordering,
pending_blocks.len(),
max_fill_fraction,
timestamp,
)
.await
.context("Fail to retrieve payload")?;
Expand Down
7 changes: 7 additions & 0 deletions consensus/src/payload_client/mixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ impl PayloadClient for MixedPayloadClient {
pending_ordering: bool,
pending_uncommitted_blocks: usize,
recent_max_fill_fraction: f32,
block_timestamp: Duration,
) -> anyhow::Result<(Vec<ValidatorTransaction>, Payload), QuorumStoreError> {
// Pull validator txns first.
let validator_txn_pull_timer = Instant::now();
Expand Down Expand Up @@ -124,6 +125,7 @@ impl PayloadClient for MixedPayloadClient {
pending_ordering,
pending_uncommitted_blocks,
recent_max_fill_fraction,
block_timestamp,
)
.await?;

Expand Down Expand Up @@ -165,6 +167,7 @@ async fn mixed_payload_client_should_prioritize_validator_txns() {
false,
0,
0.,
aptos_infallible::duration_since_epoch(),
)
.await
.unwrap()
Expand All @@ -189,6 +192,7 @@ async fn mixed_payload_client_should_prioritize_validator_txns() {
false,
0,
0.,
aptos_infallible::duration_since_epoch(),
)
.await
.unwrap()
Expand All @@ -213,6 +217,7 @@ async fn mixed_payload_client_should_prioritize_validator_txns() {
false,
0,
0.,
aptos_infallible::duration_since_epoch(),
)
.await
.unwrap()
Expand All @@ -237,6 +242,7 @@ async fn mixed_payload_client_should_prioritize_validator_txns() {
false,
0,
0.,
aptos_infallible::duration_since_epoch(),
)
.await
.unwrap()
Expand Down Expand Up @@ -279,6 +285,7 @@ async fn mixed_payload_client_should_respect_validator_txn_feature_flag() {
false,
0,
0.,
aptos_infallible::duration_since_epoch(),
)
.await
.unwrap()
Expand Down
1 change: 1 addition & 0 deletions consensus/src/payload_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub trait PayloadClient: Send + Sync {
pending_ordering: bool,
pending_uncommitted_blocks: usize,
recent_max_fill_fraction: f32,
block_timestamp: Duration,
) -> anyhow::Result<(Vec<ValidatorTransaction>, Payload), QuorumStoreError>;

fn trace_payloads(&self) {}
Expand Down
2 changes: 2 additions & 0 deletions consensus/src/payload_client/user/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub trait UserPayloadClient: Send + Sync {
pending_ordering: bool,
pending_uncommitted_blocks: usize,
recent_max_fill_fraction: f32,
block_timestamp: Duration,
) -> anyhow::Result<Payload, QuorumStoreError>;
}

Expand Down Expand Up @@ -59,6 +60,7 @@ impl UserPayloadClient for DummyClient {
_pending_ordering: bool,
_pending_uncommitted_blocks: usize,
_recent_max_fill_fraction: f32,
_block_timestamp: Duration,
) -> anyhow::Result<Payload, QuorumStoreError> {
let timer = Instant::now();
let mut nxt_txn_idx = 0;
Expand Down
4 changes: 4 additions & 0 deletions consensus/src/payload_client/user/quorum_store_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ impl QuorumStoreClient {
max_inline_bytes: u64,
return_non_full: bool,
exclude_payloads: PayloadFilter,
block_timestamp: Duration,
) -> anyhow::Result<Payload, QuorumStoreError> {
let (callback, callback_rcv) = oneshot::channel();
let req = GetPayloadCommand::GetPayloadRequest(
Expand All @@ -63,6 +64,7 @@ impl QuorumStoreClient {
return_non_full,
exclude_payloads.clone(),
callback,
block_timestamp,
);
// send to shared mempool
self.consensus_to_quorum_store_sender
Expand Down Expand Up @@ -99,6 +101,7 @@ impl UserPayloadClient for QuorumStoreClient {
pending_ordering: bool,
pending_uncommitted_blocks: usize,
recent_max_fill_fraction: f32,
block_timestamp: Duration,
) -> anyhow::Result<Payload, QuorumStoreError> {
let return_non_full = recent_max_fill_fraction
< self.wait_for_full_blocks_above_recent_fill_threshold
Expand Down Expand Up @@ -126,6 +129,7 @@ impl UserPayloadClient for QuorumStoreClient {
max_inline_bytes,
return_non_full || return_empty || done,
exclude.clone(),
block_timestamp,
)
.await?;
if payload.is_empty() && !return_empty && !done {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ impl DirectMempoolQuorumStore {
return_non_full,
payload_filter,
callback,
_block_timestamp,
) => {
self.handle_block_request(
max_txns_after_filtering,
Expand Down
8 changes: 5 additions & 3 deletions consensus/src/quorum_store/proof_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
},
};
use aptos_consensus_types::{
common::{Payload, PayloadFilter, ProofWithData, TransactionSummary},
common::{Payload, PayloadFilter, ProofWithData, TxnSummaryWithExpiration},
proof_of_store::{BatchInfo, ProofOfStore, ProofOfStoreMsg},
request_response::{GetPayloadCommand, GetPayloadResponse},
};
Expand All @@ -29,7 +29,7 @@ use std::{
#[derive(Debug)]
pub enum ProofManagerCommand {
ReceiveProofs(ProofOfStoreMsg),
ReceiveBatches(Vec<(BatchInfo, Vec<TransactionSummary>)>),
ReceiveBatches(Vec<(BatchInfo, Vec<TxnSummaryWithExpiration>)>),
CommitNotification(u64, Vec<BatchInfo>),
Shutdown(tokio::sync::oneshot::Sender<()>),
}
Expand Down Expand Up @@ -168,7 +168,7 @@ impl ProofManager {

pub(crate) fn receive_batches(
&mut self,
batch_summaries: Vec<(BatchInfo, Vec<TransactionSummary>)>,
batch_summaries: Vec<(BatchInfo, Vec<TxnSummaryWithExpiration>)>,
) {
if self.allow_batches_without_pos_in_proposal {
let batches = batch_summaries
Expand Down Expand Up @@ -212,6 +212,7 @@ impl ProofManager {
return_non_full,
filter,
callback,
block_timestamp,
) => {
let excluded_batches: HashSet<_> = match filter {
PayloadFilter::Empty => HashSet::new(),
Expand All @@ -228,6 +229,7 @@ impl ProofManager {
max_txns_after_filtering,
max_bytes,
return_non_full,
block_timestamp,
);

counters::NUM_BATCHES_WITHOUT_PROOF_OF_STORE.observe(self.batch_queue.len() as f64);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ async fn test_block_request_no_txns() {
true,
PayloadFilter::DirectMempool(vec![]),
consensus_callback,
aptos_infallible::duration_since_epoch(),
))
.unwrap();

Expand Down
1 change: 1 addition & 0 deletions consensus/src/quorum_store/tests/proof_manager_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ async fn get_proposal(
true,
PayloadFilter::InQuorumStore(filter_set),
callback_tx,
aptos_infallible::duration_since_epoch(),
);
proof_manager.handle_proposal_request(req);
let GetPayloadResponse::GetPayloadResponse(payload) = callback_rx.await.unwrap().unwrap();
Expand Down
Loading
Loading