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

removes trailing bytes before de-duplicating shreds #4769

Merged

Conversation

behzadnouri
Copy link

@behzadnouri behzadnouri commented Feb 4, 2025

Problem

For backward compatibility we need to allow trailing bytes in the packet after the shred payload.

The extra bytes are truncated in Shred{Code,Data}::from_payload:
https://github.com/anza-xyz/agave/blob/744482070/ledger/src/shred/merkle.rs#L513
https://github.com/anza-xyz/agave/blob/744482070/ledger/src/shred/merkle.rs#L574

but that happens late after shred deduper which might allow duplicate shreds to pass through.

Summary of Changes

The commit updates shred::wire::get_shred{,_mut} to remove trailing bytes and excludes them from the deduper.

@behzadnouri behzadnouri force-pushed the shred-dedup-exclude-trailing-bytes branch from af315ae to 70a8df5 Compare February 4, 2025 13:24
@behzadnouri behzadnouri changed the title removes trailing bytes from return value of shred::wire::get_shred{,_mut} removes trailing bytes before de-duplicating shreds Feb 4, 2025
@behzadnouri behzadnouri force-pushed the shred-dedup-exclude-trailing-bytes branch 2 times, most recently from c64f351 to 6a701a6 Compare February 4, 2025 14:32
For backward compatibility we need to allow trailing bytes in the
packet after the shred payload.

The extra bytes are truncated in Shred{Code,Data}::from_payload:
https://github.com/anza-xyz/agave/blob/744482070/ledger/src/shred/merkle.rs#L513
https://github.com/anza-xyz/agave/blob/744482070/ledger/src/shred/merkle.rs#L574

but that happens late after shred deduper which might allow duplicate
shreds to pass through.

The commit updates shred::wire::get_shred{,_mut} to remove trailing
bytes and excludes them from the deduper.
@behzadnouri behzadnouri force-pushed the shred-dedup-exclude-trailing-bytes branch from 6a701a6 to a4fd832 Compare February 4, 2025 20:50
turbine/src/sigverify_shreds.rs Show resolved Hide resolved
ledger/src/shred/wire.rs Show resolved Hide resolved
ledger/src/shred/wire.rs Show resolved Hide resolved
@behzadnouri behzadnouri requested a review from steviez February 5, 2025 23:29
ledger/src/shred/wire.rs Show resolved Hide resolved
@behzadnouri behzadnouri merged commit a3be625 into anza-xyz:master Feb 5, 2025
66 checks passed
@behzadnouri behzadnouri deleted the shred-dedup-exclude-trailing-bytes branch February 5, 2025 23:49
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.

2 participants