Repository navigation
feat: per-network configuration with named devnets and no hard-coded contract ids - #11
Merged
Merged
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (64)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…contract ids
forge-core gains a network module: Network is testnet, mainnet or Devnet { name, dapi_addresses, quorum_base_url }. Contract ids come only from forge-contracts/deployments/<key>.json, embedded by a build script that globs the directory, with a FORGE_REGISTRY_CONTRACT_ID / config / git-config override. A network with no deployment fails with Error::NotDeployed instead of using testnet ids, and create_repo refuses before paying for a contract.
dg gets --network devnet, --devnet-name and --dapi-addresses (plus config.toml keys); git-remote-dash reads dash.network / dash.devnetName / dash.dapiAddresses; forge-relay and forge-import take the same flags. dg doctor reports the network, the registry id and its source.
forge-web resolves the network from NEXT_PUBLIC_NETWORK / NEXT_PUBLIC_DEVNET_NAME / NEXT_PUBLIC_DAPI_ADDRESSES and the bundled deployment files, shows a network badge in the header on every non-mainnet build, and renders a not-deployed state rather than querying another network. Adds the devnet-moutai deployment skeleton.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…WORK constant Drop the unused registry owner id, parse each deployment file once, add Deployment::registry(), and replace repeated NETWORKS[DEFAULT_NETWORK] lookups in forge-web with ACTIVE_NETWORK. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ution
Parse the v2 record deploy-v2.mjs writes into devnet-moutai.json and expose it as v2: Option<ForgeIds{core, collab, group}> on Deployment and NetworkTarget (Rust) and NETWORKS[n].v2 (TS). Ids count only when both contracts are registered and the group is recorded, so an in-flight deploy is not a deployment. Tests read the expected ids from the file on disk.
Also restore the two fixes the dropped merge commit carried: parse_id's doc comment, and the BUILDING.md note on what devnet-moutai.json records.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Trust copy names the network by its key (devnet-moutai). QUORUM_KEY_ENDPOINT is built from a pure quorumEndpoint(config) helper, tested for devnet. forge-web honors NEXT_PUBLIC_QUORUM_URL (parity with DASH_FORGE_QUORUM_URL). A deployment file without top-level dapiAddresses falls back to v2.devnet.addresses in both Rust and TS. Drop stale 'skeleton' wording. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
PastaPastaPasta
force-pushed
the
feat/per-network-config
branch
from
September 25, 2026 11:17
1cd356c to
3c91f36
Compare
This was referenced Sep 26, 2026
This was referenced Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Every client assumed testnet. Contract ids were written by hand in
forge-web/lib/constants.tsand in forge-core, so pointing a build at mainnet or a devnet did not fail cleanly. Mainnet hadnullplaceholders that surfaced as generic errors. A devnet could not be selected at all. A network with no registry could quietly fall back to testnet ids. Now that the forge-v2 contracts are registered on devnet moutai, the clients need a single, per-network place to read those ids from before the forge-v2 client migration can start.What changed
One source of truth for contract ids:
forge-contracts/deployments/<key>.json(testnet,mainnet,devnet-<name>).build.rsglobs the directory and embeds every file, so committing a new deployment file needs no code change. forge-web imports each file inlib/deployments.ts, and a test fails if a file on disk is missing from that map.Error::NotDeployed/NotDeployedError, never to another network's ids.create_reporefuses before paying for a contract whose listing could never be published.FORGE_REGISTRY_CONTRACT_ID, configregistry_contract_id, and git configdash.registryContractId(Rust);NEXT_PUBLIC_REGISTRY_CONTRACT_ID(web).dg doctorreports which source won.Named devnets.
Networkistestnet,mainnetorDevnet { name, dapi_addresses, quorum_base_url }.dg,forge-relayandforge-importtake--network devnet --devnet-name <name> [--dapi-addresses ...], with config keys andDASH_FORGE_*env vars. git-remote-dash readsdash.network,dash.devnetNameanddash.dapiAddresses. Settings layer field-wise, and each layer falls back to the deployment file. Fordgthe order is flags > config file > env. For git-remote-dash it is env (set bydgfor its child) > git config. For forge-relay it is flags > config file > env.devnet-<name>.json. When the file has no top-leveldapiAddresses, the addresses fall back again to thev2.devnet.addressesthatdeploy-v2.mjsrecorded (Rust and TS). The quorum URL defaults toquorums.<name>.networks.dash.org. forge-web can override it withNEXT_PUBLIC_QUORUM_URL, matchingDASH_FORGE_QUORUM_URL.NEXT_PUBLIC_NETWORK=devnet NEXT_PUBLIC_DEVNET_NAME=moutaiand connects with a trusted evo-sdk devnet context. Every non-mainnet build shows a network badge in the header. When no registry is deployed, the web renders a not-deployed state instead of querying.forge-v2 ids are exposed for the upcoming client migration:
Deployment::v2andNetworkTarget::v2areOption<ForgeIds { core, collab, group }>.NETWORKS[n].v2isForgeIds | null, viaforgeV2Ids()inlib/deployments.ts.forgeCoreandforgeCollabhavestatus: "registered"andcontractGroupIdis recorded. A deploy still broadcasting is not a deployment. Rust and TS apply the same rule and test it.v2yet. That is the next PR.devnet-moutai.jsonnow carries both the top-level client fields (network,devnetName,dapiAddresses,registry: null) and master'sv2record verbatim: forgeCoreGdZY…, forgeCollabCbsaT6…,forgeCollabSuperseded,schemaHash.deploy-v2.mjsread-modify-writes the whole object, so it keeps the client fields.Rebase onto master (forge-v2 contracts, FORGE_RULES_V2, #6, #8, #10, #12). Conflicts resolved:
lib/repo/tokens.ts: kept fix(web): show only what was verified; label actions for what they do #6'stokenHistoryCached/currentHoldings/readViewerHoldings. Applied this branch's network-independentreadTokenHistory(sdk, repo), because TokenHistory is a system contract. Defaults now useDEFAULT_NETWORK.lib/repo/writes.ts: fix(web): show only what was verified; label actions for what they do #6'sregistryIdFor(network)(star/follow lookups) now usesrequireRegistryContractId, so a missing registry produces the actionable not-deployed error.app/page.tsx: kept fix(web): show only what was verified; label actions for what they do #6's connection-trust ledger and this branch's not-deployed gating.lib/constants.ts: hand-writtenNETWORKSreplaced by the resolved one. fix(web): show only what was verified; label actions for what they do #6'sQUORUM_KEY_ENDPOINTis kept. It is now built from a purequorumEndpoint(config)helper and gains adevnetentry, the same URLservice.tshands evo-sdk, so the trust panel names the endpoint really in use. Trust copy names the network by its key (devnet-moutai). Dropped the unusedTESTNET_REGISTRY_OWNER.crates/forge-core/src/platform.rs(fix: make the Testnet Nightly green and trustworthy #10): kept fix: make the Testnet Nightly green and trustworthy #10'sMAX_READ_ATTEMPTS, DAPI connect timeout and retries; the localNetworkenum becomes this branch'spub use crate::network::{Network, ...}.crates/git-remote-dash/src/helper.rs(fix: make the Testnet Nightly green and trustworthy #10): kept fix: make the Testnet Nightly green and trustworthy #10's frozen-token pre-check and its tests. Replacednetwork_from_envwith this branch'snetwork_target()/resolve_network(env > git config > deployment), and merged both test sets.default_platform_uri, which fix: make the Testnet Nightly green and trustworthy #10 removed, stays removed.crates/git-remote-dash/src/helper.rs(feat: git push stores packs on your own storage (S3 SigV4, IPFS, Platform) with N-of-M replication #12, BYO storage): kept feat: git push stores packs on your own storage (S3 SigV4, IPFS, Platform) with N-of-M replication #12'sremotefield,Helper::new(url, remote), and its storage and repack imports. The network still comes fromnetwork_target(). feat: git push stores packs on your own storage (S3 SigV4, IPFS, Platform) with N-of-M replication #12's storage defaults (storage-defaults.json, public IPFS gateways) and profiles do not depend on the network. Itsdg storageandreseedpaths connect through the already-resolvedNetworkTarget, so nothing there assumes testnet.app-header.tsx,app/settings/page.tsx,repo/settings-content.tsx(fix: make the Testnet Nightly green and trustworthy #10's WCAG text shade): the hand-rolled network chips becomeNetworkBadge. The badge's dash text now uses the AA shades (text-dash-600 dark:text-dash-400), and the header keepshidden sm:inline.parse_iddoc comment, and the BUILDING.md note on whatdevnet-moutai.jsonrecords.Verification
cargo fmt --all -- --checkcargo clippy --locked --workspace --all-targets -- -D warningscargo test --locked --workspacepnpm typecheck/pnpm lintpnpm testpnpm build(default testnet)NEXT_PUBLIC_NETWORK=devnet NEXT_PUBLIC_DEVNET_NAME=moutai pnpm builddevnet-moutai.jsonparses in Rust with the expectedv2ids (read from the file on disk)moutai_exposes_its_forge_v2_ids_from_the_deployment_filedevnet-moutai.jsonparses in TS with the expectedv2idsconstants.test.ts›exposes the forge-v2 ids devnet-moutai.json recordsv2records yield no ids (Rust and TS)a_partial_v2_record_is_not_a_deployment,forgeV2Idssuitev2.devnet.addresses(Rust and TS)dapi_addresses_fall_back_to_the_v2_devnet_record,recordedDapiAddressessuiteNEXT_PUBLIC_QUORUM_URLoverridequorumEndpointsuitegit range-diffof the replayed commits against the originalsNot verified live
dg, git-remote-dash or forge-relay command was run against devnet moutai, and none was run against testnet from this branch. Resolution is covered by unit tests only.quorums.moutai.networks.dash.orgwere not checked live.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes