You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Task: Foundry Platform Deploy/Upgrade Parity — scripts, tests, and deployments export for dincli
Status: Open Type: Standalone task (work from a fork) Repo:https://github.com/InfiniteZeroFoundation/DevNet (base branch: develop) Roadmap ref: P2 open item (Foundry migration — partially done, Hardhat remains active for deployment tooling) · P3-PR13 (Upgradeable Platform Contracts) · P3-6.1 (dincli CLI-Level Test Harness)
1. Project Summary
DIN (InfiniteZero) is a federated-learning network coordinated by Solidity contracts on Optimism Sepolia, operated through dincli, a Python/Typer CLI. The four platform-level contracts (DinCoordinator, DinToken, DinValidatorStake, DINModelRegistry) were converted to the Transparent Proxy upgrade pattern in PR #13, which is now merged into develop (see issue #33).
The Hardhat tree gained full deployment tooling with that merge: hardhat/scripts/deploy-platform.ts deploys the platform behind proxies and writes hardhat/deployments/<network>.json, which dincli system import-deployments reads to configure the CLI. The tests/dincli/ end-to-end harness (P3-6.1) runs against a platform deployed this way.
The Foundry tree has none of this: foundry/src/ however holds upgradeable contract versions (likely exact copies of hardhat ones) and foundry/script/ contains no deploy scripts. Per the roadmap, the Foundry migration is an open P2 item — this task closes the platform-deployment part of that gap so a local platform can be deployed with forge script, imported into dincli, and validated with the harness.
2. Setup
# Fork https://github.com/InfiniteZeroFoundation/DevNet and clone your fork
git clone https://github.com/<your-fork>/DevNet
cd DevNet
git checkout develop && git pull
# Fork point: pin your branch to this exact commit on develop# (the PR #13 merge + harness integration — the hardhat tooling you are mirroring)
git checkout 91db47945a2f54fda45946798a5a7813bc742c31
git checkout -b feature/foundry-platform-deployments
# Baseline: everything must build and pass before you startcd foundry && forge build && forge testcd ../hardhat && npx hardhat compile && npx hardhat test
Read before writing anything:
hardhat/scripts/deploy-platform.ts, hardhat/scripts/upgrade-platform.ts, and hardhat/deploy/{constants,helpers,types}.ts — the tooling this task mirrors.
Documentation/technical/contracts/hardhat/ — per-file docs for the above, including wiring order and known coverage gaps.
dincli system import-deployments in dincli/cli/system.py — the consumer of the deployments JSON.
Documentation/technical/testing/dincli-testing-guide.md — how to run the tests/dincli/ harness.
3. Scope
3.1 Upgradeable contracts in foundry/src/
Bring the four platform contracts in foundry/src/ in line with the initializer-based transparent-proxy implementations now in hardhat/contracts/ (including the V2 stub implementations from hardhat/contracts/upgrade/ for upgrade testing).
3.2 Deploy script
foundry/script/DeployPlatform.s.sol: deploy the four platform contracts behind transparent proxies on a local anvil chain (started via ./foundry/anvil.sh), wire them together in the same order as deploy-platform.ts, and write a deployments JSON with the exact schema of hardhat/deployments/localhost.json:
foundry/script/UpgradePlatform.s.sol: counterpart to hardhat/scripts/upgrade-platform.ts, upgrading a deployed proxy to a V2 implementation.
3.4 Forge tests
Mirror the hardhat suites in foundry/test/: proxy deployment wiring, initializer / re-initialization protection (_disableInitializers() verified at runtime, not just in source), and state preservation across V2 upgrades — equivalents of hardhat/test/*.upgrade.test.ts and hardhat/test/DinValidatorStake.test.ts.
3.5 dincli import path
Extend dincli system import-deployments so the Foundry output is a first-class source — the JSON schema is identical, so this should mostly be default-path resolution (the current default is hardhat-only, with dincli network local mapped to hardhat localhost). Document the Foundry flow next to the hardhat one.
3.6 Harness verification
End-to-end proof: anvil up → forge script DeployPlatform → dincli system import-deployments --file foundry/deployments/localhost.json → run the tests/dincli/ harness and confirm it passes against the Foundry-deployed platform. Include the harness run output (or a summary of it) in the PR description.
4. Deliverables Checklist
foundry/src/ platform contracts match the upgradeable versions in hardhat/contracts/ (plus V2 stubs)
foundry/script/DeployPlatform.s.sol deploys behind transparent proxies and writes foundry/deployments/localhost.json in the hardhat schema
foundry/script/UpgradePlatform.s.sol upgrade path works against a deployed platform
Forge test suites mirroring the hardhat deploy/upgrade tests, all passing (forge test)
dincli system import-deployments accepts the Foundry deployments file; flow documented
tests/dincli/ harness passes against a Foundry-deployed platform on anvil
Existing hardhat flow untouched and still passing (npx hardhat test)
5. Submission
Fork develop at commit 91db47945a2f54fda45946798a5a7813bc742c31 (branch feature/foundry-platform-deployments, per §2).
PR description: what was mirrored vs. deliberately done differently from the hardhat tooling, the harness verification result, and anything you'd do differently with more time.
6. References
Developer/ROADMAP.md — P2 open item: "Foundry migration (partially done — Foundry test suite exists at foundry/; Hardhat remains active for deployment and verification tooling)"; P3-PR13 (Upgradeable Platform Contracts); P3-6.1 (dincli CLI-Level Test Harness)
Task: Foundry Platform Deploy/Upgrade Parity — scripts, tests, and deployments export for dincli
Status: Open
Type: Standalone task (work from a fork)
Repo: https://github.com/InfiniteZeroFoundation/DevNet (base branch:
develop)Roadmap ref: P2 open item (Foundry migration — partially done, Hardhat remains active for deployment tooling) · P3-PR13 (Upgradeable Platform Contracts) · P3-6.1 (dincli CLI-Level Test Harness)
1. Project Summary
DIN (InfiniteZero) is a federated-learning network coordinated by Solidity contracts on Optimism Sepolia, operated through
dincli, a Python/Typer CLI. The four platform-level contracts (DinCoordinator,DinToken,DinValidatorStake,DINModelRegistry) were converted to the Transparent Proxy upgrade pattern in PR #13, which is now merged intodevelop(see issue #33).The Hardhat tree gained full deployment tooling with that merge:
hardhat/scripts/deploy-platform.tsdeploys the platform behind proxies and writeshardhat/deployments/<network>.json, whichdincli system import-deploymentsreads to configure the CLI. Thetests/dincli/end-to-end harness (P3-6.1) runs against a platform deployed this way.The Foundry tree has none of this:
foundry/src/however holds upgradeable contract versions (likely exact copies of hardhat ones) andfoundry/script/contains no deploy scripts. Per the roadmap, the Foundry migration is an open P2 item — this task closes the platform-deployment part of that gap so a local platform can be deployed withforge script, imported into dincli, and validated with the harness.2. Setup
Read before writing anything:
hardhat/scripts/deploy-platform.ts,hardhat/scripts/upgrade-platform.ts, andhardhat/deploy/{constants,helpers,types}.ts— the tooling this task mirrors.Documentation/technical/contracts/hardhat/— per-file docs for the above, including wiring order and known coverage gaps.dincli system import-deploymentsindincli/cli/system.py— the consumer of the deployments JSON.Documentation/technical/testing/dincli-testing-guide.md— how to run thetests/dincli/harness.3. Scope
3.1 Upgradeable contracts in
foundry/src/Bring the four platform contracts in
foundry/src/in line with the initializer-based transparent-proxy implementations now inhardhat/contracts/(including the V2 stub implementations fromhardhat/contracts/upgrade/for upgrade testing).3.2 Deploy script
foundry/script/DeployPlatform.s.sol: deploy the four platform contracts behind transparent proxies on a local anvil chain (started via./foundry/anvil.sh), wire them together in the same order asdeploy-platform.ts, and write a deployments JSON with the exact schema ofhardhat/deployments/localhost.json:{ "dinToken": "0x...", "dinCoordinator": "0x...", "dinValidatorStake": "0x...", "dinModelRegistry": "0x...", "proxyAdmin": "0x..." }Suggested output path:
foundry/deployments/localhost.json.3.3 Upgrade script
foundry/script/UpgradePlatform.s.sol: counterpart tohardhat/scripts/upgrade-platform.ts, upgrading a deployed proxy to a V2 implementation.3.4 Forge tests
Mirror the hardhat suites in
foundry/test/: proxy deployment wiring, initializer / re-initialization protection (_disableInitializers()verified at runtime, not just in source), and state preservation across V2 upgrades — equivalents ofhardhat/test/*.upgrade.test.tsandhardhat/test/DinValidatorStake.test.ts.3.5 dincli import path
Extend
dincli system import-deploymentsso the Foundry output is a first-class source — the JSON schema is identical, so this should mostly be default-path resolution (the current default is hardhat-only, with dincli networklocalmapped to hardhatlocalhost). Document the Foundry flow next to the hardhat one.3.6 Harness verification
End-to-end proof: anvil up →
forge script DeployPlatform→dincli system import-deployments --file foundry/deployments/localhost.json→ run thetests/dincli/harness and confirm it passes against the Foundry-deployed platform. Include the harness run output (or a summary of it) in the PR description.4. Deliverables Checklist
foundry/src/platform contracts match the upgradeable versions inhardhat/contracts/(plus V2 stubs)foundry/script/DeployPlatform.s.soldeploys behind transparent proxies and writesfoundry/deployments/localhost.jsonin the hardhat schemafoundry/script/UpgradePlatform.s.solupgrade path works against a deployed platformforge test)dincli system import-deploymentsaccepts the Foundry deployments file; flow documentedtests/dincli/harness passes against a Foundry-deployed platform on anvilnpx hardhat test)5. Submission
developat commit91db47945a2f54fda45946798a5a7813bc742c31(branchfeature/foundry-platform-deployments, per §2).developon https://github.com/InfiniteZeroFoundation/DevNet.6. References
Developer/ROADMAP.md— P2 open item: "Foundry migration (partially done — Foundry test suite exists atfoundry/; Hardhat remains active for deployment and verification tooling)"; P3-PR13 (Upgradeable Platform Contracts); P3-6.1 (dincli CLI-Level Test Harness)7a3efc3,91db479)Developer/issues/dincli-native-proxy-deployment.md— related deferred work: native in-dincli proxy deployment (Option C); this task keeps the script + import-deployments flowDocumentation/technical/contracts/hardhat/— docs for the tooling being mirrored