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

Fix DoubleProposalProofs #2983

Open
wants to merge 5 commits into
base: albatross
Choose a base branch
from
Open

Fix DoubleProposalProofs #2983

wants to merge 5 commits into from

Conversation

hrxi
Copy link
Member

@hrxi hrxi commented Oct 17, 2024

They required data unrelated to the signed proposals. It now uses the same signing infrastructure by factoring it out to TendermintProposal in a common crate.

Fixes #2981.

@hrxi hrxi requested a review from nibhar October 17, 2024 13:52
primitives/block/src/equivocation_proof.rs Outdated Show resolved Hide resolved
primitives/block/src/equivocation_proof.rs Outdated Show resolved Hide resolved
Copy link
Member

@nibhar nibhar left a comment

Choose a reason for hiding this comment

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

Looks good to me outside of the MacroHeader.round check being incorrect (existed prior to this PR). So that should be removed. Other comments are purely cosmetic .

primitives/block/src/equivocation_proof.rs Outdated Show resolved Hide resolved
primitives/block/src/equivocation_proof.rs Outdated Show resolved Hide resolved
primitives/block/src/equivocation_proof.rs Outdated Show resolved Hide resolved
@hrxi hrxi force-pushed the hrxi/double_proposal_proof branch 4 times, most recently from 117207b to 4f21297 Compare October 23, 2024 11:31
Copy link
Member

@nibhar nibhar left a comment

Choose a reason for hiding this comment

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

LGTM. Left minor comments only.

Comment on lines 334 to 335
let hash1: Blake2bHash = proposal1.proposal.hash();
let hash2: Blake2bHash = proposal2.proposal.hash();
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should add an assert for the equal rounds here. Not strictly necessary but DoubleProposalProofs without matching rounds are invalid and should never be created.

Suggested change
let hash1: Blake2bHash = proposal1.proposal.hash();
let hash2: Blake2bHash = proposal2.proposal.hash();
assert_eq!(proposal1.round, proposal2.round);
let hash1: Blake2bHash = proposal1.proposal.hash();
let hash2: Blake2bHash = proposal2.proposal.hash();

Copy link
Member Author

Choose a reason for hiding this comment

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

Not done for now because we currently don't do that for the creation of any equivocation proof structure. We could automatically call verify I guess and assert! that it verifies. But maybe we could also do that at the call sites?

primitives/block/src/equivocation_proof.rs Outdated Show resolved Hide resolved
They required data unrelated to the signed proposals. It now uses the
same signing infrastructure by factoring it out to `TendermintProposal`
in a common crate.

Fixes #2981.
The round in the proposal message is the relevant one.
This means that two different `TendermintProposal`s with the same
`MacroHeader` are now also considered a violation.
@hrxi hrxi force-pushed the hrxi/double_proposal_proof branch from 4f21297 to d0055b1 Compare October 25, 2024 13:11
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.

Double proposal proof signature verification generates the wrong data to be signed
2 participants