Skip to content

test(integration): run a complete GI on the foundry contracts (task_061026_21 Part D) - #313

Open
umermjd11 wants to merge 11 commits into
InfiniteZeroFoundation:developfrom
umermjd11:feat/task-061026-21-full-gi-suite
Open

umermjd11 wants to merge 11 commits into
InfiniteZeroFoundation:developfrom
umermjd11:feat/task-061026-21-full-gi-suite

Conversation

@umermjd11

@umermjd11 umermjd11 commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

task_061026_21 Part D, PR 3: the tests/dincli integration suite runs one complete GI on the foundry contracts. Spec: Developer/tasks/task_061026_21.md. Tracking: Discussion #231.

Depends on #314. test_02 asserts that deploy sets the DinToken on both task contracts, and startGI/reward claims need it. Merge #314 first. This branch merges cleanly with it.

Suite changes

  • Toolchain (ffadd66): ARTIFACT_BASE points at foundry/out. managed_services always runs forge build, and runs npx hardhat compile only when PLATFORM_DEPLOY_TOOLCHAIN=hardhat. The dump-abi tests write to DIN_TEMP/abis, so the suite no longer rewrites dincli/abis/.
  • Phase 1 assertions (f9ba87c): checks the four proxyAdmin* keys and their proxy_admin_* din_info mapping.
  • Demo wallets (71816f6): phases 2–4 switch wallets with connect-demo-wallet.
  • Complete GI walk (630fd7e): test_04_gi.py funds the reward pool, then walks registration and auditor encryption keys, LMS, seeds and test data, evaluation with reveal, T1/T2 with reveal, and slashing to GIended. It asserts the state by name after every phase. It then claims and withdraws for a client, an auditor and an aggregator (checking the DIN balance rises) and runs release-slots. It also includes the negative check that an aggregator can't register as an auditor.
  • Default artifact seeding (444e185): the published default_manifest CID has no IPFS provider any more (Filebase: "no providers found"; public gateways 429), and isolated runs use an offline Kubo node anyway. A session fixture adds the reference model (cache_model_0/, cid_services/, bundled ABIs) to the isolated node and points the run's din_info default_* keys at the resulting CIDs. Isolated mode only.
  • Silent skips fail (00ca516): evaluate, aggregate and reveal print a line and exit 0 when they skip a batch. The GI walk now fails on those lines, and on an assigned LM with no commit to reveal.
  • Docs (b212bd5): tests/dincli/NOTES.md and the dincli testing guide describe the forge build, the seeding fixture, and the state after each step.

dincli fixes the full GI needed (beyond the spec)

These bugs only show up when several roles share one machine or when the GI runs past evaluation, so the suite was the first thing to reach them.

  • Per-wallet commit caches (25eb036): auditor and aggregator commit/reveal caches were one shared file per (GI, batch), so several demo wallets on one machine overwrote each other's salts. They now live under audits/commits/<address>/ and aggregations/commits/<address>/. The loaders fall back to the old shared path, so commits made before upgrading still reveal.
  • Register exit codes (def4273): auditor register and aggregator register exited 0 when the transaction reverted (e.g. TA_DualRoleNotAllowed) or stake was too low. They now exit 1.
  • Test-data decrypt (4d55943): auditor lms-evaluation evaluate rebuilt the raw test-data CID from "0x" + digest, and get_cid_from_bytes32 prepends 1220, so fromhex failed on every batch. No auditor committed a score and lms-evaluation close reverted with TC_FailedToFinalizeEvaluation. It now passes the bare digest, and get_cid_from_bytes32 also accepts a 0x prefix.
  • add-default-test-data reads the dataset CID from din_info default_test_dataset, with the old hard-coded CID as fallback (part of 444e185).

Test results

  • pytest -m "not integration": 854 passed, 186 deselected.

  • Local isolated full GI (DIN_TEST_ISOLATED=1 pytest tests/dincli/ -v -x -m integration --tb=short, this branch merged with feat(dincli): deploy sets DinToken and defaults --model-id (task_061026_21 Part C, Deploy) #314, at 4d55943):

    ================= 186 passed, 1 warning in 1729.07s (0:28:49) ==================
    

    From the command logs: 27 audit scores committed and 27 revealed, 9 T1 and 3 T2 aggregations committed and revealed, and no skipped batches. That run didn't yet include 00ca516 (stricter assertions) or b212bd5 (docs). From those logs, nothing in it would have tripped the new checks.

Not in this PR

  • .github/workflows/full-gi.yml still installs hardhat deps and runs npx hardhat compile before the suite. The suite no longer needs it unless PLATFORM_DEPLOY_TOOLCHAIN=hardhat. I left the workflow alone, and it hasn't been run on a hosted runner with these changes.

🤖 Generated with Claude Code

umermjd11 and others added 4 commits November 3, 2026 14:43
b49c843 made DeployPlatform.s.sol record one ProxyAdmin per proxy
(proxyAdminToken, proxyAdminCoordinator, ...) instead of a single
proxyAdmin key, but tests/dincli/test_01_platform.py still read
deployments["proxyAdmin"]. The Integration (full GI) job has failed at
test_deploy_platform_via_script on every run since it was added.

Check the four per-proxy keys both deploy scripts write, and that
import-deployments maps each into its proxy_admin_* din_info key. The
unused state["proxy_admin_address"] is dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since d321c2a split demo accounts out of connect-wallet, connect-wallet
refuses demo wallets, so phases 2-4 failed at their first wallet switch.
test_01 already uses connect-demo-wallet. Local isolated run: phase 2
passes in full (19 passed), then phase 3 stops on the unseeded offline
IPFS defaults.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… tracked files

task_061026_21 Part D (toolchain slice):
- ARTIFACT_BASE points at foundry/out (same X.sol/X.json layout).
- managed_services always runs forge build; npx hardhat compile only
  when PLATFORM_DEPLOY_TOOLCHAIN=hardhat.
- The six dump-abi tests write to DIN_TEMP/abis via --output instead of
  --official, so the suite never rewrites dincli/abis/.
- Artifact-missing skips point at forge build.

Phase 1 (test_01_platform.py) passes 8/8 in isolated mode on anvil + Kubo,
with no tracked-file changes afterwards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
umermjd11 and others added 2 commits November 5, 2026 21:12
The commit-then-reveal caches were keyed by (GI, batch, LM) only, under
the shared <model dir>. An audit batch has several auditors and a T1/T2
batch several aggregators; when they run from one machine (one cache dir,
e.g. `--demokey` in the tests/dincli harness), the last committer
overwrote the others' salts, and their reveals then failed the commit
hash (TA_RevealHashMismatch for auditors) and were slashed as missed.

The caches are now commits/<address>/... The loaders fall back to the old
shared path, so a commit made before upgrading can still be revealed.

Found while extending the full-GI suite to the reveal phases
(task_061026_21 Part D).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… every phase

task_061026_21 Part D, Decision 3. test_04_gi.py now:
- funds GI 1 (model owner buys DIN, `rewards deposit`) before `gi start`;
- registers each auditor's encryption key, and checks an aggregator can't
  also register as an auditor (task_061026_20 Part B, InfiniteZeroFoundation#180);
- adds the seed and test-data states: `auditor lock-seed` (AuditSeedLocked),
  `create-testdataset --submit` (AuditTestDataAssigned), `aggregator
  lock-seed` (AggSeedLocked);
- adds the three reveal windows: `start-reveal` + per-validator reveal for
  LMS evaluation, T1 and T2; then `T2 set-score`;
- asserts the GI state by name after every phase. `_gi_state` now parses
  "Global iteration state: <name>" (it used to return the first non-markup
  line, i.e. the contract-address banner). The end state is GIended by name
  and ordinal 28, with no `or "23"` fallback;
- claims and withdraws GI 1's reward for one client, one auditor and one
  aggregator, checking each DIN balance rises, then `gi release-slots`.

test_02: the deploys leave --model-id to its default and check that DinToken
was set on both contracts (needs InfiniteZeroFoundation#314). The deployed address is taken from
the "deployed at" line, not the first 0x… line (the stake address).

conftest: COLUMNS=250 for dincli subprocesses, so Rich doesn't wrap the
lines the suite matches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
umermjd11 and others added 5 commits November 5, 2026 21:42
…el's defaults

Phase 3 stopped at `model-owner task cache-default-artifacts`: isolated
runs use an offline, empty Kubo node, so din_info's default_* CIDs can't
be fetched. Nor can they from the network: no provider serves
default_manifest (bafybeiacrj…; ipfs.filebase.io: "no providers found",
Nov 5 2026), and several repo copies of the reference services have
changed since the defaults were pinned.

The new seeded_default_artifacts session fixture (isolated mode only)
adds the repo's reference MNIST model to the isolated node:
- cache_model_0 services, per-role requirements and test dataset, and the
  bundled dincli/abis task-contract ABIs (cache_model_0/abis predates the
  richer GI states);
- a manifest built from cache_model_0/manifest.json with those CIDs;
- the cid_services distribute_mnist files, which reproduce their pinned CIDs.
It then points this run's din_info default_* entries at them. It runs
after din_info_backup, so the tracked din_info.json is restored unpatched.

dincli: `add-default-test-data --default-test-data` takes the CID from
din_info's `default_test_dataset` when set, falling back to the published
default, so the harness can seed it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`auditor register` and `aggregator register` sent the tx with
exit_on_failure=False and ignored the result, so a refused registration
(a revert such as TA_DualRoleNotAllowed) or too little stake exited 0.
Scripts, and the full-GI suite's dual-role check, couldn't tell a refusal
from success. Both now exit 1 on a failed tx, an exception, or
insufficient stake; "already registered" still exits 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`lms-evaluation evaluate` rebuilt the raw test-data CID with
get_cid_from_bytes32("0x" + digest), and get_cid_from_bytes32 prepends
"1220" to its input, so fromhex() got "12200x..." and raised. Every
auditor skipped its batch, nothing was committed, and
`lms-evaluation close` reverted with TC_FailedToFinalizeEvaluation.

Pass the bare digest, and let get_cid_from_bytes32 accept a 0x prefix
so no other caller can hit the same error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ps its work

These commands report a skipped batch (failed decrypt, failed tx, no
local commit) with a printed line but still exit 0, so a GI where no
auditor committed a score passed every evaluate and reveal step and only
failed later at `lms-evaluation close`. Assert on those lines instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ding

The dincli testing guide and tests/dincli/NOTES.md still described the
hardhat-era suite that stopped after test_01. Describe what runs now:
forge builds, the default-artifact seeding fixture, the GI state after
each step, and the full walk to GIended with reward claim/withdraw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@umermjd11
umermjd11 marked this pull request as ready for review November 7, 2026 12:10
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