Skip to content

Fix panic when updating proofs #254

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 5 commits into from
Jun 7, 2025
Merged

Conversation

n8maninger
Copy link
Member

Don't panic when attempting to update proofs and return an error instead.

@Copilot Copilot AI review requested due to automatic review settings June 7, 2025 18:14
@github-project-automation github-project-automation bot moved this to In Progress in Sia Jun 7, 2025
Copilot

This comment was marked as outdated.

@n8maninger n8maninger requested a review from Copilot June 7, 2025 18:39
@n8maninger n8maninger moved this from In Progress to In Review in Sia Jun 7, 2025
Copilot

This comment was marked as outdated.

@n8maninger n8maninger requested a review from Copilot June 7, 2025 18:42
Copilot

This comment was marked as outdated.

@n8maninger n8maninger requested a review from Copilot June 7, 2025 18:43
Copilot

This comment was marked as outdated.

@n8maninger n8maninger requested a review from Copilot June 7, 2025 18:47
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a panic when updating element proofs by modifying the update flow in Manager and improving the test utility for proof updates. Key changes include the introduction of a non-panicking error handling mechanism in updateV2TransactionProofs, additions to test utilities to support proof updates without panicking, and updating error messages with ErrInvalidElementProof.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
testutil/proofs.go Adds an in‑memory state store for testing proof updates; contains a goroutine that still panics on error.
chain/pool_test.go Updates pool transaction tests to use the new element state store and verifies error handling for invalid proofs.
chain/manager.go Modifies updateV2TransactionProofs to catch panics and return a descriptive error instead.
.changeset/fixed_a_panic_when_attempting_to_update_element_proofs.md Documents the change in error handling for element proof updates.

@n8maninger n8maninger merged commit 8c78c12 into master Jun 7, 2025
11 checks passed
@n8maninger n8maninger deleted the nate/proof-update-panic branch June 7, 2025 18:49
@github-project-automation github-project-automation bot moved this from In Review to Done in Sia Jun 7, 2025
@n8maninger
Copy link
Member Author

@lukechampine @ChrisSchinnerl @peterjan merging this to put out a hot fix, but please still review

switch panicErr := panicErr.(type) {
case string, fmt.Stringer, error:
err = fmt.Errorf("proof update from %q to %q failed at %q with panic %q: %w", from, to, index, panicErr, ErrInvalidElementProof)
default:
Copy link
Member

Choose a reason for hiding this comment

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

We're not logging panicErr at all in the default case, would it no be better to log failed at %q with panic %#v: %w to ensure we're not needlessly dropping any debug context?

@lukechampine lukechampine mentioned this pull request Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants