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

[consensus] split round timeout msg out of vote msg #14433

Merged
merged 4 commits into from
Oct 2, 2024
Merged

Conversation

ibalajiarun
Copy link
Contributor

@ibalajiarun ibalajiarun commented Aug 27, 2024

Description

This PR splits out the timeout data from the Vote struct into new RoundTimeout struct. This means validators do not need to form and vote on a nil block when timing out a round. Also, the purpose of the nil block is satisfied by the order vote mechanism, which ensures the parent gets a QC even if the next round proposal fails/timeout.

The change is behind a local config, which can be flipped after a full binary rollout.

Test Plan

Compat test flipping config flag false to true: https://github.com/aptos-labs/aptos-core/actions/runs/10603758720

This PR adds a Smoke test to flip the flag as well

Copy link

trunk-io bot commented Aug 27, 2024

⏱️ 15h 19m total CI duration on this PR
Slowest 15 Jobs Cumulative Duration Recent Runs
execution-performance / single-node-performance 4h 1m 🟩🟩🟩🟩🟩 (+6 more)
forge-compat-test / forge 1h 22m 🟥🟩🟩 (+2 more)
forge-e2e-test / forge 1h 21m 🟥🟩🟩 (+3 more)
test-target-determinator 1h 1m 🟩🟩🟩🟩 (+8 more)
execution-performance / test-target-determinator 54m 🟩🟩🟩🟩🟩 (+6 more)
general-lints 43m 🟩🟩🟩🟩🟩 (+20 more)
rust-cargo-deny 42m 🟩🟩🟩🟩🟩 (+20 more)
check-dynamic-deps 33m 🟩🟩🟩🟩🟩 (+20 more)
semgrep/ci 12m 🟩🟩🟩🟩🟩 (+20 more)
indexer-grpc-e2e-tests / test-indexer-grpc-docker-compose 11m 🟩🟩🟩🟩 (+2 more)
check 10m 🟥🟥🟥🟩🟩 (+6 more)
rust-move-tests 10m 🟩
rust-move-tests 9m 🟩
rust-move-tests 9m 🟩
rust-move-tests 9m 🟩

🚨 1 job on the last run was significantly faster/slower than expected

Job Duration vs 7d avg Delta
forge-compat-test / forge 22m 15m +47%

settingsfeedbackdocs ⋅ learn more about trunk.io

@ibalajiarun ibalajiarun force-pushed the balaji/vote-v2 branch 2 times, most recently from 1bccc3d to 141cab9 Compare August 27, 2024 20:53
timeout: TwoChainTimeout,
author: Author,
/// LedgerInfo of a block that is going to be committed in case this vote gathers QC.
ledger_info: LedgerInfo,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, why the timeout carries a ledger info?

response_sender: callback,
})
},
ConsensusMsg::RandGenMessage(req) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, is this block just formatting change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added RoundTimeoutMsg handling, and then the formatter took over.

}
}

/// Insert a vote and if the vote is valid, return a QuorumCertificate preferentially over a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the comment seems out-of-date, this function only aggregates tc?

VoteReceptionResult::NewQuorumCertificate(qc) => {
unreachable!()
},
VoteReceptionResult::New2ChainTimeoutCertificate(tc) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably can split the vote from timeout in the pending_vote too, so the result can be separate (after we disable the current vote msg)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add a TODO to do this after disabling the current vote handling.

@@ -1545,6 +1671,9 @@ impl RoundManager {
VerifiedEvent::VoteMsg(vote_msg) => {
monitor!("process_vote", self.process_vote_msg(*vote_msg).await)
}
VerifiedEvent::RoundTimeoutV2Msg(vote_msg) => {
monitor!("process_vote", self.process_round_timeout_msg(*vote_msg).await)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/process_vote/process_timeout

main: ConsensusConfigV1,
quorum_store_enabled: bool,
order_vote_enabled: bool,
round_timeout_msg_enabled: bool,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason this needs to be on-chain config? we should be able to support both modes and transition in two releases?

@ibalajiarun ibalajiarun force-pushed the balaji/vote-v2 branch 6 times, most recently from 5672524 to c37d436 Compare August 28, 2024 00:03
@ibalajiarun ibalajiarun changed the title Balaji/vote v2 [consensus] split round timeout msg out of vote msg Aug 28, 2024
@ibalajiarun ibalajiarun added the CICD:run-forge-e2e-perf Run the e2e perf forge only label Aug 28, 2024

This comment has been minimized.

@ibalajiarun ibalajiarun added the CICD:run-e2e-tests when this label is present github actions will run all land-blocking e2e tests from the PR label Aug 28, 2024

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@ibalajiarun ibalajiarun requested a review from zekun000 August 29, 2024 14:58
@ibalajiarun ibalajiarun force-pushed the balaji/vote-v2 branch 2 times, most recently from 810b8ea to 0f4ff74 Compare September 6, 2024 15:38
@@ -225,7 +228,7 @@ impl RoundState {

/// Return if already voted for timeout
pub fn is_vote_timeout(&self) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name is a bit confusing, this should be already_vote_timeout or something?

@@ -405,6 +406,12 @@ impl NetworkSender {
self.broadcast(msg).await
}

pub async fn broadcast_round_timeout(&self, round_timeout: RoundTimeoutMsg) {
fail_point!("consensus::send::vote", |_| ());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/vote/timeout

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reused the name to preserve any existing usages but I don't see any usages for these failpoints.

@@ -99,6 +100,83 @@ impl PendingVotes {
}
}

/// Insert a RoundTimeout and return a TimeoutCertificate if it can be formed
pub fn insert_round_timeout(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should re-use the code for insert_vote as well? at least majority piece

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean checking if there was an existing timeout vote?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no I mean code wise it's duplicate of the piece in insert_vote?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return result changes between the two implementations. In the old code, we return vote voting power if we don't have enough to aggregate regardless, but in new code, we return the tc voting power. If we want to keep existing logic then we have to keep them separate.

@@ -1197,6 +1253,9 @@ impl RoundManager {
state = vote.vote_data().proposed().executed_state_id(),
is_timeout = vote.is_timeout(),
);
if self.local_config.enable_round_timeout_msg {
error!("Received Vote with Timeout with Round Timeout Message enabled.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this holds, during rollout, some nodes will have the flag enabled while others don't. the flag can only control sender side but not receiver

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is meant to be a debugging statement, but since we don't send debug logs to humio, I made them errors. 🤦🏽. I just record the log and continue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it'll happen all the time during rollout (if there's timeout)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is what my expectation is. If it can be useful to debug, why not? Don't you think it's useful? I can downgrade to warn as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably don't want noise during the rollout, this doesn't give much information as well since it's expected during the release

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed it. Done.

epoch = timeout.epoch(),
round = timeout.round(),
);
if !self.local_config.enable_round_timeout_msg {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this too, the first release needs to have nodes enabling receiving, then the following release enabling the flag for sending

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above. just logging for debugging and send to humio. I plan to ignore it from alerts. I could also make this a warn instead.

@ibalajiarun ibalajiarun force-pushed the balaji/vote-v2 branch 2 times, most recently from 8d78e14 to 410c341 Compare September 30, 2024 22:29
@ibalajiarun ibalajiarun requested a review from zekun000 October 1, 2024 19:32
);
ensure!(
self.round_timeout.two_chain_timeout().hqc_round()
<= self.sync_info.highest_certified_round(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need <= here?

@ibalajiarun ibalajiarun enabled auto-merge (squash) October 2, 2024 00:05

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

github-actions bot commented Oct 2, 2024

✅ Forge suite realistic_env_max_load success on d065858957566d652115306ab821c5d04904baeb

two traffics test: inner traffic : committed: 14388.90 txn/s, latency: 2761.04 ms, (p50: 2700 ms, p70: 2700, p90: 3000 ms, p99: 3200 ms), latency samples: 5471000
two traffics test : committed: 99.91 txn/s, latency: 1659.25 ms, (p50: 1400 ms, p70: 1500, p90: 1600 ms, p99: 10600 ms), latency samples: 1740
Latency breakdown for phase 0: ["QsBatchToPos: max: 0.244, avg: 0.228", "QsPosToProposal: max: 1.146, avg: 1.121", "ConsensusProposalToOrdered: max: 0.325, avg: 0.292", "ConsensusOrderedToCommit: max: 0.412, avg: 0.399", "ConsensusProposalToCommit: max: 0.703, avg: 0.691"]
Max non-epoch-change gap was: 0 rounds at version 0 (avg 0.00) [limit 4], 0.62s no progress at version 2489658 (avg 0.20s) [limit 15].
Max epoch-change gap was: 0 rounds at version 0 (avg 0.00) [limit 4], 8.66s no progress at version 2489656 (avg 8.66s) [limit 15].
Test Ok

Copy link
Contributor

github-actions bot commented Oct 2, 2024

✅ Forge suite compat success on 7ef01a26f8d8a38610e3d364b722df517c970749 ==> d065858957566d652115306ab821c5d04904baeb

Compatibility test results for 7ef01a26f8d8a38610e3d364b722df517c970749 ==> d065858957566d652115306ab821c5d04904baeb (PR)
1. Check liveness of validators at old version: 7ef01a26f8d8a38610e3d364b722df517c970749
compatibility::simple-validator-upgrade::liveness-check : committed: 13545.06 txn/s, latency: 2500.60 ms, (p50: 2100 ms, p70: 2200, p90: 2800 ms, p99: 7800 ms), latency samples: 444960
2. Upgrading first Validator to new version: d065858957566d652115306ab821c5d04904baeb
compatibility::simple-validator-upgrade::single-validator-upgrading : committed: 7371.33 txn/s, latency: 3871.65 ms, (p50: 4400 ms, p70: 4600, p90: 4700 ms, p99: 4800 ms), latency samples: 139020
compatibility::simple-validator-upgrade::single-validator-upgrade : committed: 6849.07 txn/s, latency: 4635.00 ms, (p50: 4700 ms, p70: 4800, p90: 6800 ms, p99: 7100 ms), latency samples: 227080
3. Upgrading rest of first batch to new version: d065858957566d652115306ab821c5d04904baeb
compatibility::simple-validator-upgrade::half-validator-upgrading : committed: 7468.29 txn/s, latency: 3827.11 ms, (p50: 4200 ms, p70: 4600, p90: 4600 ms, p99: 4800 ms), latency samples: 139420
compatibility::simple-validator-upgrade::half-validator-upgrade : committed: 7411.63 txn/s, latency: 4325.40 ms, (p50: 4700 ms, p70: 4700, p90: 5600 ms, p99: 6100 ms), latency samples: 250140
4. upgrading second batch to new version: d065858957566d652115306ab821c5d04904baeb
compatibility::simple-validator-upgrade::rest-validator-upgrading : committed: 11118.45 txn/s, latency: 2502.88 ms, (p50: 2800 ms, p70: 2900, p90: 3000 ms, p99: 3200 ms), latency samples: 194620
compatibility::simple-validator-upgrade::rest-validator-upgrade : committed: 10002.48 txn/s, latency: 3130.41 ms, (p50: 2900 ms, p70: 3000, p90: 5700 ms, p99: 7100 ms), latency samples: 322780
5. check swarm health
Compatibility test for 7ef01a26f8d8a38610e3d364b722df517c970749 ==> d065858957566d652115306ab821c5d04904baeb passed
Test Ok

Copy link
Contributor

github-actions bot commented Oct 2, 2024

✅ Forge suite framework_upgrade success on 7ef01a26f8d8a38610e3d364b722df517c970749 ==> d065858957566d652115306ab821c5d04904baeb

Compatibility test results for 7ef01a26f8d8a38610e3d364b722df517c970749 ==> d065858957566d652115306ab821c5d04904baeb (PR)
Upgrade the nodes to version: d065858957566d652115306ab821c5d04904baeb
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1350.66 txn/s, submitted: 1354.47 txn/s, failed submission: 3.81 txn/s, expired: 3.81 txn/s, latency: 2361.04 ms, (p50: 2100 ms, p70: 2400, p90: 3600 ms, p99: 5400 ms), latency samples: 120580
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1150.05 txn/s, submitted: 1152.08 txn/s, failed submission: 2.02 txn/s, expired: 2.02 txn/s, latency: 2629.73 ms, (p50: 2400 ms, p70: 2700, p90: 3900 ms, p99: 5700 ms), latency samples: 102260
5. check swarm health
Compatibility test for 7ef01a26f8d8a38610e3d364b722df517c970749 ==> d065858957566d652115306ab821c5d04904baeb passed
Upgrade the remaining nodes to version: d065858957566d652115306ab821c5d04904baeb
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1214.90 txn/s, submitted: 1216.28 txn/s, failed submission: 1.38 txn/s, expired: 1.38 txn/s, latency: 2643.68 ms, (p50: 2700 ms, p70: 3000, p90: 3600 ms, p99: 5700 ms), latency samples: 105280
Test Ok

@ibalajiarun ibalajiarun merged commit 628e88b into main Oct 2, 2024
82 of 90 checks passed
@ibalajiarun ibalajiarun deleted the balaji/vote-v2 branch October 2, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants