Match commit votes against the full LedgerInfo - #429
Draft
sausagee wants to merge 2 commits into
Draft
Conversation
Keep AggregateSignature and SignatureWithStatus in compressed 96-byte wire form so LedgerInfo commit-vote matching is not blocked by G2 point recovery. Recover the group element only on verification and aggregation paths. BCS/JSON encoding stays identical to bls12381::Signature. This is a clean-room rewrite of the deferred-decompression invariant for m1; it does not cherry-pick or port aptos-labs/aptos-core. Co-authored-by: Young Yang Liauw <sausagee@users.noreply.github.com>
Admitting a commit vote into a partial proof now requires the vote's entire LedgerInfo (commit_info plus consensus_data_hash). A signature valid over a different consensus_data_hash is rejected. Aggregation recovery re-checks each signature against the aggregator's data and verifies the recovered certificate before returning it. Co-authored-by: Young Yang Liauw <sausagee@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Depends on / should land after #427 (clean-room deferred BLS decompression). This branch is stacked on
cursor/defer-bls-decompression-1a4b. Full-LedgerInfomatching needs that deferred-signature shape so a well-formed but invalid payload can still be compared as ledger fields without G2 recovery.Clean-room rewrite on this tree (not a cherry-pick, patch, or mechanical port from
aptos-labs/aptos-core). Upstream intent was read only to identify the bug and the invariant (aptos-labs/aptos-core#20335): a BLS commit vote is valid only for the exactLedgerInfoit signed (commit_infoplusconsensus_data_hash).Bug:
BufferItem::add_signature_if_matchedadmitted aCommitVoteinto the partial proof when onlycommit_infomatched. A vote signed over a differentconsensus_data_hash— a valid signature over a different message — could still aggregate.CommitVote::verifychecks the vote against its ownledger_infoand may setSignatureWithStatus::is_verified, which does not record which message was verified.Invariant:
LedgerInfoto equal the aggregator's data. Mismatch fails closed; the signature is not inserted.commit_infocompare;create_signature_aggregatorlater admits only full-LedgerInfomatches (unchanged).is_verifiedflag as proof of that binding. Unbound authors go to the pessimistic verify set.unsafe. Consensus-facing maps stayBTreeMap.How Has This Been Tested?
reject_vote_with_unrelated_consensus_data_hash_and_still_quorum(consensus/src/pipeline/buffer_item.rs) — a vote whoseconsensus_data_hashdiffers is rejected on both Executed and Signed items even thoughCommitVote::verifysucceeds; an honest quorum still produces a certificate that passesverify_signatures.signs_same_ledger_info_requires_consensus_data_hash(consensus/consensus-types/src/pipeline/commit_vote.rs) — helper requires bothcommit_infoandconsensus_data_hash.verified_signature_for_other_ledger_info_is_dropped_on_recovery(types/src/ledger_info.rs) — a signature valid over a differentLedgerInfo, already marked verified, is dropped on recovery; the remaining honest quorum still certifies.cargo test -p aptos-consensus-types— 20 passed (includes the new helper test).cargo test -p aptos-types— 222 passed / 3 ignored (includes the new recovery test and existingtest_signature_aggregator).cargo test -p aptos-consensus --lib— 319 passed / 6 ignored (includes the new mismatch/quorum test plus existingbuffer_itemhappy/bad paths).Aikido SAST was attempted on the new/modified files. The Aikido MCP is not authenticated in this environment (
aikido_full_scanrequires a browser sign-in), so the scan could not complete here.Key Areas to Review
admit_into_partial_commit_proof— fail-closed full-LedgerInfogate beforeadd_signature.SignatureAggregator::aggregate_and_verifyrecovery — always re-verify individuals againstself.data, then verify the recovered aggregate.Type of Change
Which Components or Systems Does This Change Impact?
aptos-consensus,aptos-consensus-types,aptos-typescommit-vote aggregationChecklist
RUST_SECURE_CODING.mdfollowed: nounsafe,BTreeMapfor consensus maps,Result/ fail-closed on mismatchNeed help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.