Skip to content

gossip: ignore retransmitter signatures when comparing duplicate shreds#2673

Merged
mergify[bot] merged 3 commits intoanza-xyz:masterfrom
AshwinSekar:duplicate-proof-ignore-retransmitter-sig
Aug 22, 2024
Merged

gossip: ignore retransmitter signatures when comparing duplicate shreds#2673
mergify[bot] merged 3 commits intoanza-xyz:masterfrom
AshwinSekar:duplicate-proof-ignore-retransmitter-sig

Conversation

@AshwinSekar
Copy link
Copy Markdown

Problem

#1271 ignores the retransmitter signature when comparing shreds in order to generate a duplicate proof.

We need to do the same when verifying a duplicate proof received from gossip.

Summary of Changes

Ignore retransmitter signature when verifying a duplicate proof received through gossip

@AshwinSekar AshwinSekar marked this pull request as draft August 20, 2024 16:50
@AshwinSekar AshwinSekar force-pushed the duplicate-proof-ignore-retransmitter-sig branch 2 times, most recently from b0eaa56 to d132a18 Compare August 20, 2024 16:59
}

#[test]
fn test_retransmitter_signature_invalid() {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Verified that this test fails with the previous payload comparison logic

Comment thread gossip/src/duplicate_shred.rs Outdated
@AshwinSekar AshwinSekar marked this pull request as ready for review August 20, 2024 17:27
@mergify
Copy link
Copy Markdown

mergify Bot commented Aug 20, 2024

Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis.

@AshwinSekar AshwinSekar force-pushed the duplicate-proof-ignore-retransmitter-sig branch from d132a18 to 43de34f Compare August 20, 2024 22:18
behzadnouri
behzadnouri previously approved these changes Aug 22, 2024
Copy link
Copy Markdown

@behzadnouri behzadnouri left a comment

Choose a reason for hiding this comment

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

lgtm, minor comments.

Comment thread ledger/src/shred/merkle.rs Outdated
}

fn retransmitter_signature_offset(&self) -> Result<usize, Error> {
pub(crate) fn retransmitter_signature_offset(&self) -> Result<usize, Error> {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pub(super) instead pub(crate).

Comment thread ledger/src/shred.rs
/// Returns true if the other shred has the same ShredId, i.e. (slot, index,
/// shred-type), but different payload.
/// Retransmitter's signature is ignored when comparing payloads.
pub fn is_shred_duplicate(&self, other: &Shred) -> bool {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Probably need some unit tests for this function too.
But it can be done later if we want to release and fix testnet first.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Got it, i'll add a unit test in a follow up PR #2697.
Will aim to get this backported for tomorrow's testnet release.

Comment thread ledger/src/shred.rs Outdated
}
}

#[cfg_attr(feature = "dev-context-only-utils", qualifiers(pub))]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The point of avoiding pub is that we can change this function api or behavior without the external code breaking.
If some tests in another crate is going to break then it is already a lost cause.
So I don't see much value in using dev-context here; you can just make the function pub.

Copy link
Copy Markdown

@behzadnouri behzadnouri left a comment

Choose a reason for hiding this comment

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

lgtm

@AshwinSekar AshwinSekar added the automerge automerge Merge this Pull Request automatically once CI passes label Aug 22, 2024
@mergify mergify Bot merged commit ff87ed9 into anza-xyz:master Aug 22, 2024
mergify Bot pushed a commit that referenced this pull request Aug 22, 2024
…ds (#2673)

* gossip: ignore retransmitter signatures when comparing duplicate shreds

* pr feedback: compare rest of payload instead of setting sig

* pr feedback: remove dcou, pub(super)

(cherry picked from commit ff87ed9)

# Conflicts:
#	ledger/src/shred.rs
@AshwinSekar AshwinSekar deleted the duplicate-proof-ignore-retransmitter-sig branch August 22, 2024 16:35
AshwinSekar added a commit that referenced this pull request Aug 23, 2024
…e shreds (backport of #2673) (#2699)

* gossip: ignore retransmitter signatures when comparing duplicate shreds (#2673)

* gossip: ignore retransmitter signatures when comparing duplicate shreds

* pr feedback: compare rest of payload instead of setting sig

* pr feedback: remove dcou, pub(super)

(cherry picked from commit ff87ed9)

# Conflicts:
#	ledger/src/shred.rs

* fix conflicts

---------

Co-authored-by: Ashwin Sekar <ashwin@anza.xyz>
Co-authored-by: Ashwin Sekar <ashwin@solana.com>
ray-kast pushed a commit to abklabs/agave that referenced this pull request Nov 27, 2024
…ds (anza-xyz#2673)

* gossip: ignore retransmitter signatures when comparing duplicate shreds

* pr feedback: compare rest of payload instead of setting sig

* pr feedback: remove dcou, pub(super)
nibty added a commit to x1-labs/tachyon that referenced this pull request Dec 24, 2024
nibty added a commit to x1-labs/tachyon that referenced this pull request Dec 31, 2024
…mparing duplicate shreds (backport of anza-xyz#2673) (anza-xyz#2699)""

This reverts commit 260f39c.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge automerge Merge this Pull Request automatically once CI passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants