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

chains Merkle shreds in broadcast fake shreds #35061

Merged

Conversation

behzadnouri
Copy link
Contributor

@behzadnouri behzadnouri commented Feb 2, 2024

Problem

Use chained Merkle shreds in turbine/src/broadcast_stage/broadcast_fake_shreds_run.rs.

Summary of Changes

Chains Merkle shreds in broadcast fake shreds.

Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Attention: 69 lines in your changes are missing coverage. Please review.

Comparison is base (9935c2b) 81.6% compared to head (075dedd) 81.6%.
Report is 18 commits behind head on master.

❗ Current head 075dedd differs from pull request most recent head b7d8cee. Consider uploading reports for the commit b7d8cee to get more accurate results

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #35061    +/-   ##
========================================
  Coverage    81.6%    81.6%            
========================================
  Files         830      830            
  Lines      224947   225053   +106     
========================================
+ Hits       183676   183763    +87     
- Misses      41271    41290    +19     

@behzadnouri behzadnouri force-pushed the chained-merkle-root-fake-shreds branch 4 times, most recently from 06bee56 to 075dedd Compare February 5, 2024 16:56
carllin
carllin previously approved these changes Feb 6, 2024
Some(index) => {
let shred = blockstore
.get_data_shred(bank.slot(), u64::from(index))
.unwrap()
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use expect here?

.expect("Blockstore Error")
.expect("Shred not present")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The 1st unwrap will print the BlockstoreError if it fails.
The 2nd unwrap will print called Option::unwrap() on a None value, indicating there was no shred.
Given that this code is only invoked in tests I think that is already sufficient here.

bank.parent_slot(),
blockstore,
)
.unwrap(),
Copy link
Contributor

Choose a reason for hiding this comment

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

We have some nice error handling in get_chained_merkle_root but attempt to just unwrap it here. Maybe add an expect or something? Is there any way to fail gracefully in the event we can't get the chained merkle root?

Copy link
Contributor Author

@behzadnouri behzadnouri Feb 6, 2024

Choose a reason for hiding this comment

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

Maybe add an expect or something?

The unwrap will actually print the error. That is why I am adding those new error types, which are descriptive of what went wrong. So not sure if expect will add much more here. This is code is also invoked only in tests.

Is there any way to fail gracefully in the event we can't get the chained merkle root?

This code is only invoked in tests and if it fails we want to get a loud panic so to debug root cause.

Copy link
Contributor

@bw-solana bw-solana left a comment

Choose a reason for hiding this comment

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

Looks fine to me. Curious if we could do more to handle any potential error cases

@behzadnouri behzadnouri merged commit 8d0ca9d into solana-labs:master Feb 6, 2024
35 checks passed
@behzadnouri behzadnouri deleted the chained-merkle-root-fake-shreds branch February 6, 2024 20:02
@behzadnouri behzadnouri added v1.16 PRs that should be backported to v1.16 v1.18 PRs that should be backported to v1.18 and removed v1.16 PRs that should be backported to v1.16 labels Feb 20, 2024
Copy link
Contributor

mergify bot commented Feb 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.

mergify bot pushed a commit that referenced this pull request Feb 20, 2024
The commit migrates
    turbine/src/broadcast_stage/broadcast_fake_shreds_run.rs
to use chained Merkle shreds variant.

(cherry picked from commit 8d0ca9d)
mergify bot added a commit that referenced this pull request Feb 20, 2024
) (#35253)

chains Merkle shreds in broadcast fake shreds (#35061)

The commit migrates
    turbine/src/broadcast_stage/broadcast_fake_shreds_run.rs
to use chained Merkle shreds variant.

(cherry picked from commit 8d0ca9d)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1.18 PRs that should be backported to v1.18
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants