-
Notifications
You must be signed in to change notification settings - Fork 10
Conversation
The error message changed in libp2p and we no longer get this nice error message. String matching is a bad practice so just removing it, as we validate CID and codec already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as long as things pass with the upstream tests as well.
@@ -202,12 +202,12 @@ func (ns *mpns) resolveOnceAsync(ctx context.Context, name string, options opts. | |||
|
|||
// CIDs in IPNS are expected to have libp2p-key multicodec | |||
// We ease the transition by returning a more meaningful error with a valid CID | |||
if err != nil && err.Error() == "can't convert CID of type protobuf to a peer ID" { | |||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks right.
Just playing this out though, if there is a DNSLink name that is a CIDv1 with a codec other than libp2p-key it previously would've worked as long as the codec wasn't dag-pb but now always fails. To be fair, the realm of TLD DNSLinks (i.e. foo
not foo.bar
or foo.bar.baz
) has a bunch of sketchy areas anyway and is uncommon so I'm not too concerned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, in some sense we had a bug before and this fixed it. Now, we always prioritize CIDs over DNSLink names, so if someone tries to squat Handshake TLD that looks like a valid CID, it won't work.
* update go-libp2p to v0.19.0 * chore: go-namesys v0.5.0 * refactor(config): cleanup relay handling * docs(config): document updated defaults * fix(tests): panic during sharness * fix: t0160-resolve.sh See ipfs/go-namesys#32 * fix: t0182-circuit-relay.sh * test: transport encryption Old tests were no longer working because go-libp2p 0.19 removed the undocumented 'ls' pseudoprotocol. This replaces these tests with handshake attempt (name is echoed back on OK or 'na' is returned when protocol is not available) for tls and noise variants + adds explicit test that safeguards us against enabling plaintext by default by a mistake. * fix: ./t0182-circuit-relay.sh test is flaky, for now we just restart the testbed when we get NO_RESERVATION error * refactor: AutoRelayFeeder with exp. backoff It starts at feeding peers ever 15s, then backs off each time until it is done once an hour Should be acceptable until we have smarter mechanism in go-lib2p 0.20 * feat(AutoRelay): prioritize Peering.Peers This ensures we feed trusted Peering.Peers in addition to any peers discovered over DHT. * docs(CHANGELOG): document breaking changes Co-authored-by: Marcin Rataj <[email protected]> Co-authored-by: Gus Eggert <[email protected]>
* update go-libp2p to v0.19.0 * chore: go-namesys v0.5.0 * refactor(config): cleanup relay handling * docs(config): document updated defaults * fix(tests): panic during sharness * fix: t0160-resolve.sh See ipfs/go-namesys#32 * fix: t0182-circuit-relay.sh * test: transport encryption Old tests were no longer working because go-libp2p 0.19 removed the undocumented 'ls' pseudoprotocol. This replaces these tests with handshake attempt (name is echoed back on OK or 'na' is returned when protocol is not available) for tls and noise variants + adds explicit test that safeguards us against enabling plaintext by default by a mistake. * fix: ./t0182-circuit-relay.sh test is flaky, for now we just restart the testbed when we get NO_RESERVATION error * refactor: AutoRelayFeeder with exp. backoff It starts at feeding peers ever 15s, then backs off each time until it is done once an hour Should be acceptable until we have smarter mechanism in go-lib2p 0.20 * feat(AutoRelay): prioritize Peering.Peers This ensures we feed trusted Peering.Peers in addition to any peers discovered over DHT. * docs(CHANGELOG): document breaking changes Co-authored-by: Marcin Rataj <[email protected]> Co-authored-by: Gus Eggert <[email protected]>
This PR fixes regression detected by failure in
t0160-resolve.sh
sharness test in ipfs/kubo#8868 (where we test go-libp2p 0.19)go-libp2p-core/peer
(go-libp2p 0.19)