Skip to content

Disposable internal-testnet rig: deploy contract surface to anvil (Docker + WireGuard) #793

Closed as not planned

Description

@alpergundogdu

Goal

Stand up the full deCDN contract surface on a VPS so the team can test
internally, using anvil. Keep it simple and fully isolated from the
production (Sepolia/mainnet) deploy path so it can be scrapped in one move.

Approach

No new Solidity. Reuse the already-tested anvil recipe from
crates/node/tests/anvil_settlement_e2e.rs:

  1. Deploy the test-only test/mocks/MintableUSDC.sol (6-decimal USDC stand-in).
  2. Run the production script/DeployProtocol.s.sol against it (real Token,
    CapacityBond, FeeRouter, PaymentChannel, SlashJudge, SlashAppeal,
    ContentBlacklist, PublisherRegistry, OriginAssignment, DecdnGovernor,
    TimelockController, Ed25519Verifier).

Everything lives under a new, deletable contracts/local/ directory:

  • docker-compose.yml — anvil with persistent state, bound to the WireGuard
    interface only (never 0.0.0.0).
  • deploy.sh — mock USDC + production deploy script wrapper (host forge).
  • .env.example, .gitignore, README.md (full runbook).

Constraints honored

  • Zero impact on the production audit surface: no .sol under src//script/,
    so forge build/aderyn/slither/gas-snapshot and the TestnetFaucet boundary
    gate are untouched.
  • Deploy manifest uses a chain id in the gitignored 3133769x range.
  • TIMELOCK_DELAY defaulted to the 1h floor so governance ops stay tractable.

Security

anvil's RPC is unauthenticated and ships well-known dev keys + anvil_* cheat
methods. The rig binds the port to the WireGuard IP and documents that Docker
bypasses host firewalls (bind-IP is the real control).

Open follow-up: iroh relay

The node builds its iroh endpoint with presets::N0 (public number0 relays +
DNS discovery) and does not consume network.relay_url today
(build_endpoint in crates/node/src/runtime/mod.rs; field is warn_ignored
on reload). So a self-hosted relay is not usable without a small
endpoint-builder change. For a first internal test, nodes either use the public
n0 relays (outbound internet) or dial directly over the wg mesh. A commented,
opt-in relay service is stubbed in the compose file for when that change
lands. Tracking the endpoint change as a separate follow-up.

Activity

  1. added
    kind:test
    on Jun 3, 2026
  2. github-actions commented on Jun 3, 2026

    @github-actions

    🎯 Triage report

    This is a well-scoped infrastructure task to create a disposable internal testnet rig (contracts/local/) that deploys the full contract surface against an anvil node via Docker + WireGuard. It reuses the existing anvil_settlement_e2e.rs deploy pattern and deliberately touches zero production Solidity — the audit surface, CI gates (aderyn/slither/forge build), and the src//script/ boundary are all untouched. The iroh relay limitation is honestly documented with a clear follow-up path.

    📊 Assessment

    Dimension Value Reasoning
    Type Task Infrastructure / devops setup work, not a bug or feature request
    Labels technical, testing, poc-blocking Infra/tooling work (technical), enables internal integration testing (testing), needed to exercise the full PoC contract surface before Sepolia (poc-blocking)
    Coding agent Suitable Requirements are fully specified: directory layout, exact files, content constraints, security posture, and the iroh-relay follow-up is scoped out. Deliverable is contracts/local/{docker-compose.yml,deploy.sh,.env.example,.gitignore,README.md} with no Solidity changes.
    💡 Notes and suggestions

    Checklist of deliverables:

    • contracts/local/docker-compose.yml — anvil with state persistence, port bound to WireGuard IP only (not 0.0.0.0)
    • contracts/local/deploy.sh — invokes forge script script/DeployProtocol.s.sol after deploying test/mocks/MintableUSDC.sol; sets chain-id in the 3133769x gitignored range
    • contracts/local/.env.example — documents required env vars (deployer key, WireGuard IP, ports)
    • contracts/local/.gitignore — ignores .env, anvil state files, any generated broadcast artifacts
    • contracts/local/README.md — full runbook: prereqs, how to start/stop/reset, how to connect a node binary, WireGuard note, Docker firewall bypass warning

    Key implementation details to get right:

    • TIMELOCK_DELAY must be ≥ 1 h (the floor set in the governance contracts) to keep governance calls tractable but not instant.
    • Chain ID must not collide with mainnet (1), Sepolia (11155111), or Arbitrum Sepolia (421614). The 3133769x family is safe — pick a specific value and document it.
    • anvil --host <wg_ip> is the correct bind flag; double-check that compose ports: uses <wg_ip>:<port>:8545 not 0.0.0.0.
    • The deploy script should capture the broadcast output and write a contracts/local/addresses.json (gitignored) so node config can reference deployed addresses.
    • Add the relay service in compose as a commented block per the issue, pointing at the iroh-relay image, so the follow-up PR is a one-liner uncomment.

    Validation steps:

    1. docker compose up -d → anvil reachable at `(redacted)
    2. bash deploy.sh → all 13 contracts deployed, addresses.json written
    3. cast call (DecdnGovernor) "token()(address)" returns the TOKEN address
    4. docker compose down -v && docker compose up -d && bash deploy.sh — clean-state re-deploy works

    Generated by Agentic Triage for issue #793 · sonnet46 508.1K · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:testprio:medium

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions