Peers only fetch a record again once its seq grows. `start_network` rebuilt
the served ENR from INITIAL_ENR_SEQ, so every boot served seq 2: behind the
copy peers cached during the previous run, which they then kept using, IP
and fork id included.
`start_network` now adds its entries to the record already in the shared
slot instead of rebuilding it, so the record keeps the seq the caller
started it at. ethrex starts it at the larger of the seq saved at shutdown
plus one and the current time in milliseconds. The saved seq covers a clock
that stepped back since a clean shutdown; the clock covers an abrupt exit,
which skips the save and leaves an older seq on disk.
Motivation
Peers only fetch our ENR again once its
seqgrows.start_networkrebuilt the served record fromINITIAL_ENR_SEQ, so every boot servedseq2. That is behind the copy peers cached during the previous run, so they kept serving our old IP and fork id.Stacked on #7488, which made the shared slot the only copy of the served record. Shutdown already saves that record to
node_config.json.Description
start_networkadds theethandsnapentries to the record already in the slot (oneseqbump) instead of rebuilding it. The record keeps theseqthe caller started it at.get_local_node_recordstarts it atmax(saved seq + 1, now in ms):seqabove what peers sawseq+ 1, unless the clock is already past itdocker restart -t 0): no shutdown saveseq+ 1This is the scheme geth uses (
localSeq): the storedseq, defaulting to the current time in ms. A first boot now starts at a time in ms instead of seconds.Restart test (local hoodi node,
admin_nodeInforead after each start):seqnode_config.jsonafterwardseqset to 10^13The
seqserved never decreased, including after the SIGKILL and with the savedseqahead of the clock.Checklist
STORE_SCHEMA_VERSION(crates/storage/lib.rs) if the PR includes breaking changes to theStorerequiring a re-sync.