nethermind icon indicating copy to clipboard operation
nethermind copied to clipboard

fix(discovery): add eth forkid to self ENR via IForkInfo

Open Galoretka opened this issue 4 months ago • 5 comments

Reason: The ENR should include the Ethereum fork ID (per devp2p eth enr entry) so peers can detect compatibility and avoid connecting across incompatible forks. This TODO was missing, reducing interoperability.

Goal: Advertise the correct fork hash and next fork block in ENR to improve peer discovery accuracy and protocol compliance.

Changes:

  • Injected IForkInfo and IBlockTree into NodeRecordProvider.
  • Computed the current fork id from the best header (fallbacks to genesis/known number).
  • Added EthEntry with forkHash and nextBlock before signing the ENR.

Galoretka avatar Aug 18 '25 11:08 Galoretka

It's critical to increment EnrSequence also with every update

flcl42 avatar Sep 01 '25 12:09 flcl42

It's critical to increment EnrSequence also with every update

simple timestamp would be fine I guess

flcl42 avatar Oct 30 '25 13:10 flcl42

It's critical to increment EnrSequence also with every update

simple timestamp would be fine I guess

ok

Galoretka avatar Oct 30 '25 19:10 Galoretka

Previous code was fine in part of forkid. I mean we need to increment selfNodeRecord.EnrSequence if the record is changed in any way. selfNodeRecord.EnrSequence can have current milliseconds as new value

flcl42 avatar Oct 31 '25 08:10 flcl42

Previous code was fine in part of forkid. I mean we need to increment selfNodeRecord.EnrSequence if the record is changed in any way. selfNodeRecord.EnrSequence can have current milliseconds as new value

fixed, sorry for misunderstanding

Galoretka avatar Nov 02 '25 19:11 Galoretka