refactor(consensus): remove unused reveal proof cache

Reveal sidecars intentionally omit proof blobs to keep entropySet hashes deterministic. Remove the write-only proposalProofs_ cache and update the surrounding comments to match the current sidecar format.
This commit is contained in:
Nicholas Dudfield
2026-06-26 19:22:33 +07:00
parent ed3c0f07a7
commit cddcb83047
2 changed files with 10 additions and 27 deletions

View File

@@ -1039,7 +1039,6 @@ ConsensusExtensions::clearRngStatePreservingExport()
observedParticipantsBitmapBin_.clear();
likelyParticipants_.clear();
commitProofs_.clear();
proposalProofs_.clear();
//@@end round-stop-rng-reset
// Keep the round-level enable latches intact here. Consensus::startRound()
// calls preStartRound() first to snapshot which extensions are enabled for
@@ -1460,7 +1459,6 @@ ConsensusExtensions::onAcquiredSidecarSet(std::shared_ptr<SHAMap> const& map)
// A changed commitment invalidates any previously accepted
// reveal for this node in the same round.
pendingReveals_.erase(nodeId);
proposalProofs_.erase(nodeId);
}
}
else
@@ -1510,10 +1508,6 @@ ConsensusExtensions::onAcquiredSidecarSet(std::shared_ptr<SHAMap> const& map)
<< " seq=" << seq;
}
}
else if (parsedProof)
{
proposalProofs_.insert_or_assign(nodeId, *parsedProof);
}
++merged;
JLOG(j_.trace()) << "RNG: merged acquired entry"
@@ -2033,8 +2027,7 @@ ConsensusExtensions::harvestRngData(
// Any reveal accepted against the prior commitment is now stale.
// Drop it so reveal quorum cannot be satisfied by mismatched data.
if (pendingReveals_.erase(nodeId) > 0)
proposalProofs_.erase(nodeId);
pendingReveals_.erase(nodeId);
}
else if (inserted)
{
@@ -2109,11 +2102,10 @@ ConsensusExtensions::harvestRngData(
}
//@@end rng-harvest-reveal-verification
// Store proposal proofs for embedding in SHAMap entries.
// commitProofs_: only seq=0 (commitments always ride on seq=0,
// so all nodes store the same proof → deterministic commitSet).
// proposalProofs_: latest proof carrying a reveal (for entropySet).
if (position.myCommitment || position.myReveal)
// Store deterministic commit proofs for embedding in commitSet entries.
// Reveal sidecars intentionally omit proofs so entropySet hashes do not
// depend on proposal timing or sequence.
if (position.myCommitment)
{
auto makeProof = [&]() {
ProposalProof proof;
@@ -2130,9 +2122,6 @@ ConsensusExtensions::harvestRngData(
if (position.myCommitment && proposeSeq == 0)
commitProofs_.emplace(nodeId, makeProof());
if (position.myReveal)
proposalProofs_[nodeId] = makeProof();
}
}
@@ -2621,10 +2610,9 @@ ConsensusExtensions::decorateMessage(
<< " prevLedger=" << proposal.prevLedger();
}
// Store our own proposal proof for embedding in SHAMap entries.
// commitProofs_ gets seq=0 only (deterministic commitSet).
// proposalProofs_ gets the latest with a reveal (for entropySet).
if (signedPosition.myCommitment || signedPosition.myReveal)
// Store our own deterministic commit proof for commitSet entries.
// Reveal sidecars deliberately omit proofs.
if (signedPosition.myCommitment)
{
auto makeProof = [&]() {
ProposalProof proof;
@@ -2641,9 +2629,6 @@ ConsensusExtensions::decorateMessage(
if (signedPosition.myCommitment && proposal.proposeSeq() == 0)
commitProofs_.emplace(valKeys.nodeID, makeProof());
if (signedPosition.myReveal)
proposalProofs_[valKeys.nodeID] = makeProof();
}
}

View File

@@ -131,11 +131,9 @@ private:
void
clearRngStatePreservingExport();
// Proposal proofs keyed by NodeID.
// commitProofs_: only seq=0 proofs (deterministic across all nodes).
// proposalProofs_: latest proof with reveal (for entropySet).
// Commit proofs keyed by NodeID. Only seq=0 proofs are cached because the
// commit sidecar hash must be deterministic across all nodes.
hash_map<NodeID, ProposalProof> commitProofs_;
hash_map<NodeID, ProposalProof> proposalProofs_;
public:
ConsensusExtensions(Application& app, beast::Journal j);