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

identify: be more careful about the addresses we store #577

Merged
merged 2 commits into from
Apr 8, 2019

Conversation

Stebalien
Copy link
Member

@Stebalien Stebalien commented Apr 5, 2019

  1. Never record addresses we observe. Only store addresses if a peer tells us to. This could make dialing back a bit harder but should give nodes more control over the addresses they care to advertise.
  2. Only record reported observed addresses if they match the transports of some address we're already advertising. For example, we should only advertise relay addresses if we're already advertising other relay addresses.

Note: I don't believe this is related to #575 but, IMO, it's still a good idea.

We still tell the remote host about the observed addr but we don't store it.
That way, we give them a chance to decide if they want to actually use and
advertise it.

Ideally, we'd distinguish between local information and signed routing
information but we don't do that yet.

This should reduce the address explosion issue where peers learn about
multiple (bad) observed addresses for the same peer. It should also give peers
more control over how they can be dialed.
if !HasConsistentTransport(maddr, ids.Host.Addrs()) {
log.Debugf("ignoring observed multiaddr that doesn't match the transports of any addresses we're announcing", c.RemoteMultiaddr())
return
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we care about the expansion of relay addrs we are advertising? Some of them maybe transient, because we happened to connect to some relay in order to talk to another NATed peer. But this is not a relay we are keeping connected because we selected it (and soon RESERVE capacity), but rather it's an incidental connection.

To be more specific here: If we are NATed/relayed and we connect to another NATed/relayed host, we will end up adding the other peer's relay into our observed address set and end up advertising that together with our primary relay connections.

Copy link
Member Author

Choose a reason for hiding this comment

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

IMO, we should just get better at pushing updates. I actually like automatically discovering new relays like this as it helps spread the load a bit.

In the meantime, you're probably right. We don't want to advertise these addresses. Luckily, the default relay address filter should filter out all those addresses at the next layer up.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I have big hopes with that patch.
The issue with using the random relays we happened to be connected is that these connections are not expected to be stable.
It's great that we are spreading the load though.

@vyzo
Copy link
Contributor

vyzo commented Apr 8, 2019

@whyrusleeping thoughts here? This is a subtle little change that may have pervasive effects.

lmaddrs = append(lmaddrs, c.RemoteMultiaddr())
}
// NOTE: Do not add `c.RemoteMultiaddr()` to the peerstore if the remote
// peer doesn't tell us to do so. Otherwise, we'll advertise it.
Copy link
Member Author

Choose a reason for hiding this comment

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

@whyrusleeping

Proposal: Don't even record the remote peer's address in the peerstore if they aren't advertising it.
Rational: If we record it, we'll share it. I'm worried this is causing us to gossip bad ephemeral addresses around the network. I'm still seeing some addr-splosion peers.

Objections?

Copy link
Contributor

Choose a reason for hiding this comment

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

SGTM.

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a good idea, though I hope we're not forgetting the reason we added these in the first place.

I can't think of any good reason to be doing this right now, but let's make sure that the rationale for this decision is well documented (including what happens when we advertise these addresses without the authors consent)

Copy link
Member Author

Choose a reason for hiding this comment

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

I've extended the comment with more rational so we don't run into this situation again.

…announcing

This is should prevent us from, e.g., announcing relay addresses _just_ because
a peer tells us we're reachable through a relay.
@Stebalien Stebalien merged commit 9fbcf24 into master Apr 8, 2019
@ghost ghost removed the status/in-progress In progress label Apr 8, 2019
@Stebalien Stebalien deleted the fix/only-reported-addrs branch April 8, 2019 17:20
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.

3 participants