Skip to content

fix: ecdsa background tasks should be infallible#2133

Merged
gilcu3 merged 2 commits intomainfrom
2122-generate-presignatures-for-domain-0--task-is-fallible
Feb 17, 2026
Merged

fix: ecdsa background tasks should be infallible#2133
gilcu3 merged 2 commits intomainfrom
2122-generate-presignatures-for-domain-0--task-is-fallible

Conversation

@gilcu3
Copy link
Contributor

@gilcu3 gilcu3 commented Feb 17, 2026

Closes #2122

I took the chance to fix triple generation as well.

@gilcu3 gilcu3 linked an issue Feb 17, 2026 that may be closed by this pull request
@gilcu3 gilcu3 changed the title fix: background tasks should be infallible fix: ecdsa background tasks should be infallible Feb 17, 2026
@claude
Copy link

claude bot commented Feb 17, 2026

Code Review

Clean, correct change. Making background triple/presignature generation tasks infallible is the right approach -- these are infinite loops spawned into tracking::spawn, and having them return anyhow::Result was misleading since the ? on new_channel_for_task would silently kill the entire background generation loop on a transient channel error. Now errors are logged and the loop continues, which is the correct resilience behavior for background tasks.

Minor non-blocking observations:

  1. In triple.rs:120, participants.clone() is unnecessary since participants is not used after the match. The original code passed participants by value. Not worth a follow-up.

  2. In presign.rs, when new_channel_for_task fails after triple_store.take_owned().await (line 101), the consumed triples are lost -- but this is strictly better than the old behavior where the ? would also lose the triples AND kill the entire presignature generation loop permanently.

Approved.

@gilcu3
Copy link
Contributor Author

gilcu3 commented Feb 17, 2026

@claude review

In presign.rs, when new_channel_for_task fails after triple_store.take_owned().await (line 101), the consumed triples are lost -- but this is strictly better than the old behavior where the ? would also lose the triples AND kill the entire presignature generation loop permanently.

you are right about this, might be something worth thinking about in the future

@claude
Copy link

claude bot commented Feb 17, 2026

No critical issues found beyond what the previous review already identified. The change correctly converts infinite background loops from fallible to infallible, preventing transient channel errors from permanently killing triple/presignature generation. Error handling via continue is the right resilience pattern here.

✅ Approved

@gilcu3 gilcu3 enabled auto-merge February 17, 2026 13:33
let channel = match client.new_channel_for_task(task_id, participants.clone()) {
Ok(channel) => channel,
Err(err) => {
tracing::warn!(
Copy link
Contributor

Choose a reason for hiding this comment

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

Given that this was an error we exited on earlier, how severe is it? Should it be an error log instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think as we are continuing execution anyway, a warning is more appropriate.

On a more general note, if we begin really seeing this in the logs a full revamp might be necessary here, as technically it should be a pretty infrequent behavior

Copy link
Collaborator

Choose a reason for hiding this comment

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

Generally speaking we should not use Error logs unless something unexpected happens imo. Network connection drops are expected during normal operations and should therefore be warnings as I see it.

Copy link
Contributor

@DSharifi DSharifi left a comment

Choose a reason for hiding this comment

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

Thanks!

@gilcu3 gilcu3 added this pull request to the merge queue Feb 17, 2026
Copy link
Contributor

@kevindeforth kevindeforth left a comment

Choose a reason for hiding this comment

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

nice, thank you!

Merged via the queue into main with commit a3b55e1 Feb 17, 2026
9 checks passed
@gilcu3 gilcu3 deleted the 2122-generate-presignatures-for-domain-0--task-is-fallible branch February 17, 2026 14:00
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.

-generate presignatures for domain 0- task is fallible

4 participants