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

Each run uses a different self=enode:https://, so cannot be added to Geth trusted-peers list #587

Closed
jlokier opened this issue Apr 20, 2021 · 5 comments

Comments

@jlokier
Copy link
Contributor

jlokier commented Apr 20, 2021

Geth has a trusted-peers list, where peers are recognised by enode:https:// URL. You add to this list from the Geth JavaScript console with admin.addTrustedPeer("enode:https://...@ip:port"), or in the file <datadir>/trusted-nodes.json.

Geth accepts connections from trusted peers even when they would go over the maximum peer count. It means peers Geth is always willing to serve.

Naturally this is very helpful when you want to connect to your own Geth node for syncing Nimbus, and the Geth node is already well-connected with other peers.

Unfortunately Nimbus-eth1 uses a different enode:https:// URL each time it starts, defeating the point of the trusted-peers list. It's possible to add to the list after Nimbus has started, but Nimbus won't try connecting again after it's been rejected, so that doesn't work either.

There is a file called IDENTITY which is set and retained across runs, but it's not used for the enode:https:// URL.

@jlokier
Copy link
Contributor Author

jlokier commented May 4, 2021

I have a good pragmatic workaround using the --nodekey option. The test script run-nimbus-sync reads the nodekey from a location equivalent to where Geth stores its nodekey, and passes it to Nimbus.

Keeping this issue open as it would still be good to automate this in Nimbus itself.

@arnetheduck
Copy link
Member

by default, the node id should be fresh for every startup, but for special cases one will indeed need to persist the network key and reuse it - see eth2 as well which does the same for its libp2p identity with the --netkey-file option

@jlokier
Copy link
Contributor Author

jlokier commented May 5, 2021

That's interesting. Geth takes the opposite view - once you've started, it retains the same node id so you keep your peer reputation and can act as a static or trusted node. I found the Geth method more convenient. Is there a particular reason for using a new id each startup?

@KonradStaniec
Copy link
Contributor

One reason for using new id on each startup is to avoid tracking of particular node i.e when ip of the node changes and node id stays the same it is easy to conclude that particular node changed location. I remember seeing and issue in geth issues list about introducing some node id rotation strategy but I am not sure if it got merged.

@arnetheduck
Copy link
Member

I found the Geth method more convenient. Is there a particular reason for using a new id each startup?

in eth2 in particular, the node id reveals some information about the validators behind it - any trustbased system should also have a built-in notion of decay (ie trusted before != trusted now) - the exception here is when you explicitly select to trust certain nodes, though in that case it might make sense to introduce some other form of token than the node id (for example if you run N nodes, they should all connect to each other)

jangko added a commit that referenced this issue Jul 27, 2022
jangko added a commit that referenced this issue Jul 28, 2022
jangko added a commit that referenced this issue Jul 28, 2022
jangko added a commit that referenced this issue Jul 29, 2022
@jangko jangko closed this as completed in a5d4759 Jul 30, 2022
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

No branches or pull requests

3 participants