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

feat: add ErrPeerIDMismatch error type to replace ad-hoc errors #2451

Merged
merged 4 commits into from
Aug 25, 2023

Conversation

aschmahmann
Copy link
Collaborator

partially resolves #2449.

This PR mostly works. However, it doesn't work with QUIC because QUIC encapsulates the error string instead of exposing it via unwrapping in https://github.com/quic-go/quic-go/blob/f3a0ce1599732cb56b958c2f0903074b62a7e9bf/internal/handshake/crypto_setup.go#L643.

Could add additional tests (or move over the ones from vole) if we're happy with this PR.

@marten-seemann is making a change to quic-go to allow inspection of the inner error inside the transport error reasonable?

@marten-seemann
Copy link
Contributor

@marten-seemann is making a change to quic-go to allow inspection of the inner error inside the transport error reasonable?

Would this be resolved by quic-go/quic-go#3730 (comment) (i.e. by returning / wrapping the error returned by crypto/tls)?

Copy link
Contributor

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

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

This looks very clean.

Before merging I'd like to:

  1. Figure out what to do with QUIC.
  2. Add a transport integration test for this.

go.mod Outdated Show resolved Hide resolved
@MarcoPolo
Copy link
Collaborator

Thanks @aschmahmann! This is a nice addition

@aschmahmann
Copy link
Collaborator Author

Seems like the quic-go branch from the linked PR doesn't work with Go 1.21 and that when that's updated things should pass here.

@marten-seemann
Copy link
Contributor

Seems like the quic-go branch from the linked PR doesn't work with Go 1.21 and that when that's updated things should pass here.

Yay, that's the last-minute breaking change Go 1.21 introduced again: golang/go@a915b999c9.

I rebased the quic-go PR and updated the dependency here, and now tests are passing. I'll take this as confirmation that quic-go/quic-go#4015 is the right way to go and will go ahead and merge that PR. Will ship in the v0.38 release later this month.

Copy link
Collaborator

@MarcoPolo MarcoPolo left a comment

Choose a reason for hiding this comment

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

lgtm, minus one little thing

// Try connecting with the bogus peer ID
if err := testHost.Connect(ctx, *ai); err != nil {
// Extract the actual peer ID from the error
newPeerId, err := extractPeerIDFromError(err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we assert the error returned has the correct values for expected and actual. I can see this being missed by accident silently.

go.mod Outdated Show resolved Hide resolved
p2p/security/tls/transport_test.go Show resolved Hide resolved
p2p/security/noise/handshake.go Show resolved Hide resolved
p2p/transport/webtransport/transport_test.go Outdated Show resolved Hide resolved
@marten-seemann
Copy link
Contributor

#2506 was merged. I'll be taking over this PR to make sure we can include it in the v0.31 release. Hope you don't mind.

@marten-seemann marten-seemann mentioned this pull request Aug 25, 2023
23 tasks
@marten-seemann marten-seemann merged commit 4005fe6 into master Aug 25, 2023
11 checks passed
@aschmahmann
Copy link
Collaborator Author

I'll be taking over this PR to make sure we can include it in the v0.31 release. Hope you don't mind.

Definitely don't mind. Thanks for pushing this over the finish line (and doing the associated quic-go PR)🙏.

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.

Expose enough information to enable connecting to multiaddrs without a peerID
3 participants