Repository navigation
Conversation
The Petri branch of manageProposeBlockHash signed any hash from any shard member (accept-and-sign). Block compilation is now deterministic, so the branch can use verify-then-sign instead: - refuse when the claimed proposer differs from the authenticated sender - refuse when the proposer is not the elected secretary - fall through to the existing candidate comparison, so we only sign a hash equal to the block we compiled ourselves getSecretaryIdentity is exported so the election logic is shared.
broadcastBlockHash added every valid (identity, signature) pair a responder returned, so one responder could pad its reply with signatures from keys outside the shard and push the secretary over the BFT threshold. Only identities in the shard (plus our own) are now accepted. petri_submitBlockHash likewise refuses submissions from senders that are not in the shard.
Add blockHashSigning.test.ts, which imports manageProposeBlockHash and broadcastBlockHash and uses real ed25519 signatures. It covers hash mismatch, non-secretary proposer, sender spoofing, missing candidate, the matching-hash happy path, and quorum padding with non-shard keys. Remove the 'Verify-then-sign model' tests that compared string literals without calling the signing code, and correct the finalizer comment.
consensus.md and VADEMECUM.md still described the accept-and-sign model that the signing fix replaced. Also drop the uint8ArrayToHex import that the removed accept-and-sign branch used.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Automated launch review: needs-changes at An automated reviewer checked this PR for the Demos mainnet launch, using public research on how established chains handle the same problem. Each finding cites the code at this head. If a finding is wrong, reply here with the reason.
|
Fixes for the security-review findings on #692 (Petri). This PR targets the
petribranch, so merging it adds these commits to #692.d85522f0shard ∪ {self}count;petri_submitBlockHashrefuses non-shard senders00831e27d85522f0,2902874d,db4472b3testing/petri/blockHashSigning.test.tsuses the production modules and real ed25519 signatures2902874dgetShardpredates this PR. After fix 1, divergent views cost liveness instead of safetyNote: Petri is enabled by default (
src/config/defaults.ts). Please confirm that's intended for mainnet.Tests:
bun test testing/petri/blockHashSigning.test.ts: 6 pass (5 of these fail before the fix).bun test testing/petri/: 224 pass, 1 fail. That failure exists before the change too.🤖 Generated with Claude Code