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

verifies that the signatures are the same when recovering Merkle shreds #4343

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

behzadnouri
Copy link

Problem

  • The leader signs the Merkle root of the erasure batch and shreds within the same erasure batch have the same Merkle root.
  • So we need to verify that the signatures are the same, otherwise the erasure batch is invalid.

Summary of Changes

The commit verifies that the signatures are the same when recovering Merkle shreds.

The leader signs the Merkle root and shreds in the same erasure batch
have the same Merkle root. So the signatures are the same or shreds are
not from the same erasure batch.
@@ -956,6 +961,9 @@ pub(super) fn recover(
.map(Shred::merkle_node)
.collect::<Result<_, _>>()?;
let tree = make_merkle_tree(nodes);
// The attched signature verfies only if we obtain the same Merkle root.
// Because shreds obtained from turbine or repair are sig-verified, this
// also means that we don't need to verify signatures for recovered shreds.
if tree.last() != Some(&merkle_root) {
return Err(Error::InvalidMerkleRoot);

Choose a reason for hiding this comment

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

Now that we compare signatures is this clause impossible?
Not saying we should remove it, just want to understand the edge cases

Copy link
Author

Choose a reason for hiding this comment

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

That is a good question.
I don't think it is possible but I cannot prove it.

@behzadnouri behzadnouri merged commit 125429b into anza-xyz:master Jan 8, 2025
39 of 40 checks passed
@behzadnouri behzadnouri deleted the verify-shred-signature branch January 8, 2025 18:42
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