migalabs / armiarma

Armiarma is a Libp2p open-network crawler with a current focus on Ethereum's CL network
https://monitoreth.io
MIT License
36 stars 13 forks source link

ForkDigest command based on Slot #67

Open tdahar opened 7 months ago

tdahar commented 7 months ago

Motivation

The Ethereum Ecosystem is showing interest in the peers that are online in the distributed network. However, the peer-to-peer network is open to anyone to use it, so nodes running different chains could overlap. We use the ForkDigest to differentiate which chain a node follows: mainnet, prater, sepolia... Not only that, the ForkDigest is a result of computing the genesis of the chain with the current fork version, so we could even detect which fork the node is following. See more details here:

Description

As ForkDigest is computed from the genesis root and the current fork version, it would be very nice to have a command to know which fork_digest represents a network (mainnet, goerli, sepolia...) in a specific fork version (Altair, Capella...). Armiarma already computes this for the current head of a given node, but it would be awesome to do this with past forks, in order to check if there are nodes in the network left behind in a previous fork.

For this, it would be nice to have a small command that could receive two parameters:

Then, the tool could request the Genesis and the fork version at the given slot, then output the fork_digest. Example: ./eth-crawler fork_digest http://localhost:5052 2375711

The given slot is the last slot of the first epoch in Altair.

cortze commented 7 months ago

hey @tdahar , this is a really cool idea! To give some context on the crawler, there is already this functionality that can request all the necessary info from a local beacon node to later compose the fork_digest.

https://github.com/migalabs/armiarma/blob/1f69e0663a8be349b16f412174ef3d43872a28c4/pkg/networks/ethereum/remoteendpoint/utils.go#L17

So it seems to be a pretty straight forward implementation