chore: Resolves bootnode loading issues when bootnodes are defined at… #130
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR enhances bootnode discovery so the server can load bootnodes from more sources without requiring schema changes to the genesis type Bootnodes.
What changed
mainnetNetworkandtestnetNetworkconstantsMotivation
Previously, when using
--chain testnet, embedded bootnodes weren’t picked up if they were defined at the top level of the genesis JSON (rather than underparams.bootnodes). This caused the server to fail with “no bootnodes found” even though bootnodes were present in the config. This PR resolves that gap by supporting both common schemas. Additionally, it now auto-generates a bootnode.json on the first run if bootnode.json is not present, ensuring consistent bootnode persistence across runsBehavior details
params.bootnodesare present, they are loaded.bootnodesexist in the genesis, they are merged in:bootnode.jsonexists (next to custom genesis, in CWD, or in--data-dir), itsnode.p2p.staticNodesentries are merged in.--bootnodesis provided, it must be geth-style (node.p2p.staticNodes); these entries are merged in.Backward compatibility
params.bootnodescontinue to work unchanged.--bootnodesexpects geth-style JSON. The previously discussed flat{ "bootnodes": [...] }schema is not required or supported for the flag to match the user’s preference.Examples
{ "name": "...", "genesis": { ... }, "params": { ... }, "bootnodes": ["/ip4/…/tcp/…/p2p/…"] }--bootnodesfile:{ "node": { "p2p": { "staticNodes": [ "/ip4/…/tcp/…/p2p/…" ] } } }Testing
--chain testnetonly; confirm embedded top-level bootnodes are picked up.--chain custom:/path/genesis.jsonwhere genesis has top-levelbootnodes; confirm picked up.bootnode.jsonadjacent to genesis and also in CWD or--data-dir; confirm they’re discovered.--bootnodes /abs/path/bootnode.jsonin geth-style; confirm loaded.Notes