Skip to content

Panic if inclusion proof is failed in MMD verifiers #175

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

Merged
merged 1 commit into from
Mar 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions internal/hammer/loadtest/workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,37 +348,26 @@ func (v *MMDVerifier) Run(ctx context.Context) {
Hash: checkpoint.Hash,
}, v.tracker.TileFetcher)
if err != nil {
v.errChan <- fmt.Errorf("failed to create proof builder: %w", err)
leafMMD = nil
continue
panic(fmt.Sprintf("Failed to create proof builder: %v", err))
}
}

// TODO: Exit gracefully with error code when the following logic hits
// any error.
// Panic if the following logic hits any error.
ip, err := proofBuilder.InclusionProof(ctx, leafMMD.index)
if err != nil {
v.errChan <- fmt.Errorf("failed to create inclusion proof: %w", err)
leafMMD = nil
continue
panic(fmt.Sprintf("Failed to create inclusion proof: %v", err))
}
certs, err := x509.ParseCertificates(leafMMD.leaf)
if err != nil {
v.errChan <- fmt.Errorf("failed to parse certificates: %w", err)
leafMMD = nil
continue
panic(fmt.Sprintf("Failed to parse certificates: %v", err))
}
entry, err := entryFromChain(certs, false, leafMMD.timestamp)
if err != nil {
v.errChan <- fmt.Errorf("failed to create entry from chain: %w", err)
leafMMD = nil
continue
panic(fmt.Sprintf("Failed to create entry from chain: %v", err))
}
leafHash := entry.MerkleLeafHash(leafMMD.index)
if err := proof.VerifyInclusion(rfc6962.DefaultHasher, leafMMD.index, checkpoint.Size, leafHash, ip, checkpoint.Hash); err != nil {
v.errChan <- fmt.Errorf("failed to verify inclusion proof: %w", err)
leafMMD = nil
continue
panic(fmt.Sprintf("Failed to verify inclusion proof: %v", err))
}

leafMMD = nil
Expand Down
Loading