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

universe: update pushProofToFederation to make sure all servers are tried #528

Merged

Conversation

Roasbeef
Copy link
Member

In this commit, we fix a bug that would cause universe proof push to fail for all servers, if anyone of them was unreachable, or rejected the proof.

If we return err here, then eventually the context will be read by other goroutines, which is already cancelled at this point. This'll cause the push attempt to stop short.

We now long and return nil so the other goroutines will continue.

See #527 for more details.

@Roasbeef Roasbeef requested a review from ffranr September 21, 2023 23:37
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

log.Warnf("cannot push proof unable to connect "+
"to remote server(%v): %v", addr.HostStr(),
err)
return nil
}

_, err = remoteUniverseServer.RegisterIssuance(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that if we encounter and return an error at this point then the errgroup.Group of the fn.ParSlice function call below will cancel the context for all servers.

We should probably warn rather than return an error here also.

Copy link
Member

Choose a reason for hiding this comment

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

I think if you can't register a proof with an universe after being able to connect to that universe, I think that might warrant bubbling up the error. As that could point to something being actually wrong (as opposed to the server just being offline).

Copy link
Contributor

@ffranr ffranr Sep 25, 2023

Choose a reason for hiding this comment

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

An attacker might run a universe server that would accept a connection but maliciously returns a failure when attempting to submit proofs to it (perhaps for only certain coins etc). Which would interrupt a user's ability to register a proof with all other servers.

I think we should bubble up an error if we fail in any way for every universe server. I don't think fn.ParSlice (because of errgroup.Group) is the right way to go in the long term because it's fragile. But i think further changes belong in a different PR.

…ried

In this commit, we fix a bug that would cause universe proof push to
fail for all servers, if anyone of them was unreachable, or rejected the
proof.

If we return `err` here, then eventually the context will be read by
other goroutines, which is already cancelled at this point. This'll
cause the push attempt to stop short.

We now long and return `nil` so the other goroutines will continue.

See lightninglabs#527 for more
details.
@Roasbeef Roasbeef force-pushed the never-gonna-give-up-universe-push branch from da192f6 to 6444939 Compare September 25, 2023 02:38
@Roasbeef Roasbeef enabled auto-merge September 25, 2023 02:38
Copy link
Contributor

@ffranr ffranr left a comment

Choose a reason for hiding this comment

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

I think this is the most robust approach for now. We should probably add better error analysis across all attempts in a future PR. In other words, we should think about when to bubble up an error.

@Roasbeef Roasbeef added this pull request to the merge queue Sep 25, 2023
Merged via the queue into lightninglabs:main with commit e81e803 Sep 25, 2023
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.

3 participants