Skip to content

feat(config): add a private devnet network ([proxy] network = "devnet") - #28

Open
cafebedouin wants to merge 1 commit into
mwaddip:mainfrom
cafebedouin:devnet-network
Open

cafebedouin wants to merge 1 commit into
mwaddip:mainfrom
cafebedouin:devnet-network

Conversation

@cafebedouin

Copy link
Copy Markdown

Prepared with Claude (Anthropic, Claude Fable 5.1) for cafebedouin; the tests and the mixed-implementation run below were executed on this branch head.

Add a private devnet network ([proxy] network = "devnet") for multi-node testing

Observed: Network has two variants, mainnet and testnet, with magic, genesis boxes, chain and voting parameters compiled in (p2p/src/types.rs, chain/src/config.rs, src/main.rs).

Change: a third variant, devnet: the profile of a Scala networkType = "devnet60" node with fixed difficulty, the one the mixed Scala/Rust devnet of arkadianet/ergo (scripts/devnet-mixed/genesis.conf, ChainSpec::devnet()) also runs. Magic [7,7,7,7], protocol v4 from genesis with the sub-blocks parameter, testnet genesis boxes, digest and address prefix, difficulty pinned at 1 by a 1 << 25 epoch, a 20 s block interval, testnet's re-emission rules and v2-activation height (unreachable, as on testnet). A Scala node, an arkadianet node and this node can then share one wire (the run below pairs this node with the Scala node). A configurable magic for devnet is a separate, stacked pull request.

Invariant kept: every touched match gains a Devnet arm (or folds Devnet into the Testnet arm) and no Mainnet or Testnet value changes. Falsifier: a public network resolving to a devnet value.

Recommended: merge as is; the network is inert unless configured.

Executed: cargo test -p enr-p2p, cargo test -p enr-chain --lib devnet, cargo test -p ergo-node-rust --bin ergo-node-rust devnet (all pass, captured after the last amend). rustfmt --check clean on the touched files (the workspace as a whole is not fmt-clean before this change). Not run: the full workspace suite, clippy, other platforms.

Evidence: ERGO-NODE-RUST-FOLLOW: PASS (A=6.0.6 B=0.8.2 followed=yes maxlag=12 SAME@40 SAME@40 topology=ok): this node, built at this commit (sha256 4dec759e98e7adbe7562b14df05991ab287ae10186e2ea44e879b42594a07524), dialled an ergo v6.0.6 node mining on the devnet parameters and followed it: same header at height 1, same UTXO state root at an equal height once the miner paused, each node listing the other.

To reproduce without the bench that ran it
  1. Run ergo v6.0.6 with arkadianet/ergo's scripts/devnet-mixed/genesis.conf settings (ergo.networkType = "devnet60", magic [7, 7, 7, 7]), ergo.node.mining = true, offlineGeneration = true, useExternalMiner = false, a slow internalMinerPollingInterval (2 s: one block per poll at difficulty 1), scorex.network.allowLocal = true.
  2. Run this node with [proxy] network = "devnet", one [listen.*] entry, [outbound] seed_peers naming the Scala node's P2P address, an [identity] block (agent_name, peer_name, protocol_version; required on every network), [node] state_type = "utxo", blocks_to_keep = -1.
  3. Let the Scala node mine 40 blocks, stop it (restart with mining off), wait.
  4. Check: both nodes' /info report the same fullHeight, headersHeight and stateRoot; /blocks/at/1 returns the same id on both; each node's /peers/connected lists the other. Without this branch, step 2 fails at config load on network = "devnet".

…t"`)

A third `Network` variant for isolated multi-node testing: magic [7,7,7,7],
protocol v4 from genesis with the sub-blocks parameter, testnet genesis
boxes and digest, difficulty pinned at 1 by an unreachable difficulty and
voting epoch (1 << 25 blocks), a 20 s block interval, the v2 activation
height and re-emission rules of testnet (neither reachable), and the
testnet address prefix. The profile is a Scala `networkType = "devnet60"`
node with those overrides (the mixed Scala/Rust devnet of arkadianet/ergo,
`scripts/devnet-mixed/genesis.conf`, runs the same one), so a Scala node,
an arkadianet node and this node share one wire.

Mainnet and testnet behaviour is unchanged: every touched match adds a
`Devnet` arm and the existing arms keep their values. Tests cover the
magic and its TOML name, the chain, voting and re-emission parameters, the
launch parameters, and that the devnet genesis boxes reproduce the testnet
state digest. The example config, the manpage, the operator guide, the
facts contracts (config, journal events, p2p node, p2p routing, mining),
the changelog and the wire-format magic table name the new network.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

1 participant