Skip to content

dind #21 (draft): daemon scaffold + preferences/capabilities (P4-1.1, P4-2.1/2.2) - #32

Draft
Santiagocetran wants to merge 40 commits into
InfiniteZeroFoundation:feat/din-sdkfrom
Santiagocetran:feat/din-daemon
Draft

dind #21 (draft): daemon scaffold + preferences/capabilities (P4-1.1, P4-2.1/2.2)#32
Santiagocetran wants to merge 40 commits into
InfiniteZeroFoundation:feat/din-sdkfrom
Santiagocetran:feat/din-daemon

Conversation

@Santiagocetran

@Santiagocetran Santiagocetran commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Draft / WIP — progress on #21, not merge-ready. Opened early to keep feature-branch work visible. Base is feat/din-sdk (the branch this stacks on), not develop.

What this contains

The P4-1.1 daemon scaffold plus the P4-2.1 / P4-2.2 local slice (task_220726_7 Part B).

P4-1.1 — daemon scaffold (dincli/dind/)

SDK-independent framework; no role automation / signing (that waits on the SDK contract):

  • CLI lifecycle: dind start | stop | status, all honoring --state-dir / DIN_DIND_STATE_DIR via a shared resolver. start refuses a live PID (exit 1); status is PID-based, enriched with /health.
  • Event loop + queue: scheduler loop (injectable stop_event/max_ticks); SQLite (WAL) job store (jobs + daemon_meta) with enqueue/claim/complete/fail/checkpoint + retention; heartbeat is a meta update.
  • Graceful SIGTERM/SIGINT: running → pending checkpoint, clean shutdown, PID removal.
  • HTTP /health (stdlib ThreadingHTTPServer); binds 127.0.0.1:8787 by default (DIN_DIND_HEALTH_HOST/PORT), records the bound address.
  • Structured JSON logging (T0.2d): JsonFormatter + idempotent configure_logging() on the dincli logger.
  • systemd/launchd unit examples; dind console script; container handoff (din-node Dockerfile CMDdind start, compose healthcheck on /health).

P4-2.1 / P4-2.2 — preferences + capability detection (Part B, this task)

  • dincli/dind/preferences.pyPreferences dataclass (domain, risk_tolerance, min_expected_reward, privacy_constraints) + JSON load/save (defaults on missing/empty file), stored at StateDirs.preferences_path. Commands: dind preferences show and dind preferences set (partial updates — unset flags leave stored values untouched; risk-tolerance validated).
  • dincli/dind/capabilities.pyCapabilitySummary + detect_capabilities(): CPU count/speed, RAM (via os.sysconf + /proc/meminfono new dependency), disk, best-effort GPU (nvidia-smi//dev/nvidia*), and bare socket reachability probes for RPC/IPFS (endpoints resolved via sdk.config; default https→443/http→80; None when unconfigured — not a live RPC call). Pure score_capabilities() / compatible_with() for later task-matching. Command: dind capabilities (JSON).
  • /health resources now uses a shared resource_snapshot() (CPU+disk+RAM) — removes the duplicated disk logic and deliberately keeps GPU/network probes off the frequently-polled path (the full detect backs dind capabilities only).

Verification

  • 213 passed (dind + sdk unit suites): scaffold + 27 new preferences/capabilities tests (network-hermetic; a guard asserts a /health poll runs no socket probe) + the dind import-boundary test (daemon imports no dincli.cli.*).
  • Not run here (external toolchains, pre-existing): contract-integration suite (tests/dincli/*, needs Hardhat/Foundry) and the Torch DP test.
  • Branch synced onto feat/din-sdk (which carries develop + the SDK state/serialize work).

Scope / boundaries

  • dincli/sdk and dincli/cli are only consumed, not modified here beyond the sync — purely additive daemon work.
  • Deferred — the wallet/session/tx keystone (SDK wallet.py/session.py/SignerProvider §2, tx.send() §5b): the dedicated next task, flagged for @umeradl's review given the signing sensitivity. So dind still does no signing / on-chain submission; /health RPC-reachable + wallet checks beyond the bare probe stay TODO pending role wiring.
  • Further out (P4-3.x+): task discovery/recommendation, role automation, event listening.
  • P3-DOC7 (the dind architecture doc) isn't written yet — these choices (SQLite state, threaded loop, stdlib health, JSON logging, local preferences/capabilities) effectively seed it; happy to adjust to spec.

umeradl and others added 15 commits July 8, 2026 21:05
Documentation/ now describes only what exists in code on develop
(not the live Sepolia deployment), split by audience:
- public/ — participant-facing: setup, cli-reference (was common.md),
  getting-started, manifest, services, roles/, workflows/, guides/
- technical/ — internal: contracts/ (per-contract refs), mechanisms/,
  services/, testing/, upgradable-contracts/, ARCHITECTURE.md
  (placeholder moved from Developer/, lands via P3-DOC1)

Developer/ holds forward-looking material:
- design/ (new) — MECHANISM_DESIGN.md, suggested-staking-mechanism.md
  (moved from Documentation/technical/mechanisms — it specifies planned
  behavior, not current), feasibility-report.md
- proposals/ (was tooling/) — proposals for tools not yet built
- issues/, tasks/, discussion/, rejected-ideas/ unchanged

Also:
- Rewrote both index READMEs with the placement rule and layout
- Added "where does a new doc go" + graduation rule (shipped designs get
  rewritten as current-state in Documentation/technical/, not moved)
- Fixed all repo-internal links to moved files (CLAUDE.md, README.md,
  Developer/*, dincli/docker/node/README.md) and repaired relative links
  inside moved files; fixed dead blob/main GitHub URLs to blob/develop
- Added DevNet 2.0 mechanism design doc (design/MECHANISM_DESIGN.md)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…nnect-wallet fixes + OWS spike

Squash of three commits from the PR InfiniteZeroFoundation#16 review branch (634ce1e, 5cd1a9b,
6905808):

- list-accounts source tag: [..] was parsed by Rich as a markup tag and
  dropped; use (..) so imported/created/legacy renders. Docker node README:
  .session is a file, not a directory (review bugs InfiniteZeroFoundation#1, InfiniteZeroFoundation#6).
- connect-wallet: confirm before overwriting an existing named keystore
  (--yes/-y to bypass, mirrors send-eth), never encrypt a new keystore with
  a stale in-memory cached password, and parse .env once per unlock instead
  of per _get_password call (review items InfiniteZeroFoundation#2, InfiniteZeroFoundation#3, InfiniteZeroFoundation#5). Adds 7 tests.
- OWS delegation feasibility spike (Developer/discussion/
  ows-delegation-feasibility.md): hands-on verification that OWS signs an
  EVM tx without exposing the key; scoped-policy delegation remains
  unproven/follow-up. Corrects wallet-setup.md's broken OWS
  export-keystore flow.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Cherry-picked from PR InfiniteZeroFoundation#28, relocated from Documentation/public/guides/
to Developer/proposals/: this documents research into a storage
provider dincli does not yet integrate (no FOC/filecoin-pin adapter
exists in ipfs.py), so per Developer/README.md's placement rule it
belongs with forward-looking tooling material, not with docs of what
already exists on develop.

Replaces the Storacha guide (PR InfiniteZeroFoundation#26, closed) as the storage
recommendation for Discussion InfiniteZeroFoundation#18: Storacha's infrastructure (console,
API host, and both storacha.link/w3s.link retrieval gateways) is down
as of this research -- Cloudflare Error 1000 on the apex domain,
NXDOMAIN on console/API subdomains, gateways redirecting into the
broken root. Not a frontend-only issue.

Covers Filecoin Pin (the filecoin-pin CLI/library, built on FOC's
Synapse SDK) in the same three-part structure as the Storacha guide:
Web setup, CLI upload/retrieve, and authentication -- wallet keys and
the Session Key delegation model, which turns out to be a much closer
parallel to Storacha's UCAN delegation than raw-key-or-nothing.

Fact-checked against the filecoin-pin GitHub repo directly (README,
CLI source in src/commands/, documentation/retrieval.md and
content-routing-faq.md) rather than docs.filecoin.io, which 404'd on
the CLI walkthrough page during this research. Caught and corrected
one safety-critical error from an earlier research pass: the CLI
defaults to Mainnet (real funds), not Calibration testnet as
initially assumed.
Discussion InfiniteZeroFoundation#18 hands-on testing ruled out both providers this doc
recommended: Lighthouse retrieval is payment-gated (fails the
"readers pay nothing" requirement), and Storacha's infrastructure is
down/deprecated. Point at the new Filecoin Onchain Cloud proposal
(Developer/proposals/filecoin-onchain-cloud.md) instead of leaving a
stale recommendation for the next reader to walk into.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…n guide (relocated)

Manually merged PR InfiniteZeroFoundation#28 by Similoluwa
Abidoye. Content unchanged from the PR except relocation from
Documentation/public/guides/ to Developer/proposals/: FOC/filecoin-pin
is not integrated into dincli (no code changed here, ipfs.py still
only supports env/filebase/custom), so per Developer/README.md's
placement rule this is forward-looking research material, not
documentation of what exists on develop.

Also updates Developer/discussion/add-filecoin-support.md, which
previously recommended Lighthouse and Storacha as the best
Filecoin-backed providers -- both since ruled out by this same
research (Discussion InfiniteZeroFoundation#18) -- so it no longer contradicts the new
proposal doc.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
InfiniteZeroFoundation#20)

v0.3 proposal for the dincli/sdk/ extraction: five design principles, the
JSON envelope contract, DinError taxonomy with reserved tx/rpc subcodes,
non-interactive DinSession/SignerProvider, plan/apply (three-phase for
CID-producing ops) confirmation model, richer TxReceiptInfo, and backward-
compat guarantees. Candidate seed for P3-DOC7. Incorporates two rounds of
code-audit against real call sites.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…niteZeroFoundation#22)

Manually merges the Part 1 deliverable of task_060726_4 from
Similoluwa Abidoye (@Abidoyesimze, PR InfiniteZeroFoundation#22, branch security/foundry-src-review).

The 7 contracts in foundry/src/ are byte-identical between the audit's
pinned commit (d136ff3) and current develop, so the findings and line
references apply as-is to the live contracts.

- Documentation/technical/audits/foundry-src-security-review.md
  (relocated from the PR's Developer/audits/ path)
- foundry/test/SecurityFindings.t.sol — 9 PoC/verification tests, all
  passing (forge test --match-contract SecurityFindingsTest).

Findings: 0 Critical, 4 High, 4 Medium, 8 Low/Informational.
Open follow-ups tracked on PR InfiniteZeroFoundation#22: severity of H-1/H-2 (candidate for
Critical) and a measured spec-scale gas number for H-1.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…h real forge measurements

Follow-up to PR InfiniteZeroFoundation#22 review feedback:

1. Severity: H-1 (Sybil-cheap gas-DoS) and H-2 (zero-CID sentinel
   collision) elevated to Critical (now C-1/C-2). Both permanently
   brick a Global Iteration on non-upgradeable contracts with no
   recovery path, and both are cheap (C-1) or free (C-2) for a single
   unprivileged participant to trigger. Remaining High findings
   renumbered H-1/H-2; no finding content changed, only labels.

2. Gas number: added test_gas_finalizeEvaluation_and_slashAuditors_atScale,
   measuring real forge gas at two registrant scales (10 and 30
   batches at demo params) and deriving the real marginal per-batch
   and per-(auditor,model)-pair cost from the slope between them.
   Params.auditorsPerBatch/modelsPerBatch has no setter, so literal
   spec-scale batch *internals* can't be deployed without modifying
   the contract (out of scope) -- the report is explicit that the
   final spec-scale projection layers a structural extrapolation on
   top of real measured data, not a second measurement, and that the
   slashAuditors number is a measured floor (its early-break behavior
   under an all-Sybil, zero-vote attack undermeasures the function's
   true worst case).

   Result: 223.5M gas (finalizeEvaluation) / 169.5M gas floor
   (slashAuditors) projected at full spec scale -- 5.6x-7.5x over
   Optimism's ~30M block limit, corroborating and quantifying the
   original estimate rather than changing its conclusion.

10/10 tests passing in SecurityFindingsTest. Reproduced the
maintainer's UpgradeValidation.t.sol FFI/npx failure independently in
a second environment -- confirmed not related to this report's PoCs.
…ary test (InfiniteZeroFoundation#20)

First clean-seed extraction for the SDK layer:
- dincli/sdk/cid.py: moved verbatim from services/cid_utils (zero cli deps);
  services/cid_utils.py kept as a back-compat re-export shim (13 importers).
- dincli/sdk/errors.py: DinError hierarchy + reserved tx/rpc subcodes +
  allowlist-oriented sanitize_details (proposal §4/§4a).
- tests/test_sdk_boundary.py: fresh-subprocess import-boundary test enforcing
  'sdk imports no typer/rich/dincli.cli', plus error/sanitizer unit tests.

runtime/ipfs/contracts deferred to the loaders step: they import cli.utils/log
at module load, so moving them now would fail the boundary test until
config/manifest/web3/log are extracted. Unit suite green (76 passed, 1 skipped).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…iteZeroFoundation#20)

Move the dependency-root loader cluster out of dincli/cli into dincli/sdk,
leaving the old paths as re-export shims:
- sdk/config.py: config/env/network/IPFS-config resolution + constants +
  IPFSConfig; console.print -> logger; logging.getLogger("dincli") directly
  (no sdk.log import -> no config<->log cycle).
- sdk/log.py: logger + quiet _read_log_level() bootstrap (no missing-config
  warning at import).
- sdk/web3.py: get_w3 (ConnectionError kept; # TODO(sdk-keystones)).
- cli/utils.py: re-exports placed above the wallet constants they feed;
  wallet/keystore/manifest/tx code stays.
- cli/log.py: re-exports logger + stdlib logging (dincli.cli.context needs both).
Tests: add test_sdk_config.py (17) + test_sdk_web3.py (2); migrate
test_connect_wallet's config-file patch to sdk.config.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…n-seed (InfiniteZeroFoundation#20)

- sdk/ipfs.py: 3-provider upload/retrieve from services/ipfs; imports
  redirected to sdk.config/sdk.log/sdk.cid; progress prints -> logger;
  # TODO(sdk-keystones): IpfsError.
- sdk/contracts.py: ABIs + get_contract_instance; lazy get_w3 from sdk.web3.
- services/ipfs.py, cli/contract_utils.py: re-export shims.
- tests/test_ipfs_config.py: migrate config-file + ipfs-global patches to
  sdk.config / sdk.ipfs (re-export does not redirect a moved fn's globals).

The dincli/sdk package now holds a dependency-clean foundation
(cid, errors, config, log, web3, ipfs, contracts); the import-boundary test
enforces no typer/rich/dincli.cli imports across all of it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Target architecture for the full stack — DAO/platform/task contracts,
indexer, SDK, dincli/dind, IPFS layer, din-node/worker — with layered
Mermaid + ASCII diagrams, key flows, and P4 dependency order. Links the
live diagram on mermaidviewer.com and indexes the doc in Developer/README.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…SON logging (P4-1.1) (InfiniteZeroFoundation#21)

New dincli/dind/ package (SDK-independent P4-1.1 framework; no role automation):
- CLI lifecycle: dind start | stop | status, all honoring --state-dir /
  DIN_DIND_STATE_DIR via a shared resolver (config.py); start refuses a live PID
  (exit 1), status is PID-based and enriched with /health when reachable.
- Event loop (daemon.py) with injectable stop_event/max_ticks; heartbeat is a
  daemon_meta update (not a queue row). SQLite (WAL) job store (state.py):
  jobs + daemon_meta, enqueue/claim/complete/fail/checkpoint, retention from
  day one. Graceful SIGTERM/SIGINT (signals.py): running -> pending checkpoint,
  clean shutdown, PID removal.
- HTTP /health (health.py, stdlib ThreadingHTTPServer) with resource summary;
  binds 127.0.0.1:8787 by default (DIN_DIND_HEALTH_HOST/PORT), records the bound
  address in daemon_meta.
- Structured JSON logging (logging.py): JsonFormatter + idempotent
  configure_logging() attached to the "dincli" logger with propagate=False and
  an explicit INFO-default level (via _resolve_log_level, mirroring sdk/log.py)
  so daemon INFO lifecycle logs emit regardless of import order.
- systemd/launchd unit examples (examples/); pyproject: dind console script +
  package-data for examples.

No dincli/sdk or dincli/cli files modified — purely additive, keeps
feat/din-daemon a clean superset of feat/din-sdk. Tests: 40 dind tests
(config/process/boundary/state/daemon/health/logging), full suite 137 passed /
1 skipped; end-to-end start/health/stop verified.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…niteZeroFoundation#21)

Wire the din-node container to run dind as its main process now that the daemon
exists (the pre-marked handoff points):
- Dockerfile: CMD -> ["dind", "start"] (was sleep infinity).
- docker-compose.yml: command -> dind start; add a healthcheck hitting
  /health so Docker auto-restarts an unhealthy daemon (T0.2c).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Santiagocetran Santiagocetran mentioned this pull request Jul 14, 2026
7 tasks
@umeradl umeradl added the Draft label Jul 14, 2026
robertocarlous and others added 3 commits July 15, 2026 17:52
…proxies (PR InfiniteZeroFoundation#13)

Land the platform-upgradeable work from PR InfiniteZeroFoundation#13:
- DinCoordinator, DinToken, DinValidatorStake, DINModelRegistry converted
  to initializer-based transparent-proxy implementations
- V2 stub implementations under hardhat/contracts/upgrade/ with upgrade
  test suites under hardhat/test/
- deploy-platform.ts / upgrade-platform.ts scripts plus shared
  deploy/{constants,helpers,types}.ts and test/helpers/platform.ts
- MockSlasher test mock, hardhat-upgrades tooling deps, updated
  DinCoordinator/DinToken ABIs
- .gitignore: stop ignoring hardhat/scripts and hardhat/test so the
  deploy/upgrade tooling is tracked on develop

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…) with dincli harness, docs, wallet split

Follow-up integration on top of the PR InfiniteZeroFoundation#13 contract work:
- dincli test harness (tests/dincli/) updated to deploy the platform via
  the interim deploy-platform.ts script + import-deployments flow;
  hardhat/deployments/localhost.json and din_info.json tracked for it
- dincli: register-wallet/connect-wallet split follow-ups in
  cli/{context,core,system,utils}.py and main.py; regenerated
  DINModelRegistry/DinValidatorStake ABIs
- Documentation/technical/contracts/hardhat/: per-file docs for the new
  deploy/upgrade tooling, V2 contracts, and test suites (with coverage
  gaps); refreshed platform contract docs for the proxy conversion
- Documentation/technical/testing/: new docs for dintoken, ipfs-config,
  cache-client-dp, connect-wallet test suites; testing-guide and
  containerization-guide updates
- Documentation/public/: wallet-setup, keystore-migration, setup,
  getting-started, cli-reference, model-workflow updated for the wallet
  split and upgradeable deployment
- Developer/issues/dincli-native-proxy-deployment.md: backlog Option C
  (native dincli proxy deployment); retire technical/ARCHITECTURE.md

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… the loader tier (InfiniteZeroFoundation#20)

Move the manifest / din_info functions and ServiceRuntimeContext into
dincli/sdk, leaving the old paths as backward-compat shims:
- sdk/manifest.py: load_din_info, save_din_info, load_cid_services,
  download_manifest, get_model_info, get_manifest, get_manifest_path,
  get_manifest_key, is_ethereum_address; patchable DIN_INFO_PATH /
  CID_SERVICES_PATH constants; logging.getLogger("dincli") directly (no
  sdk.log import -> no cycle). Presentation stripped: cache_manifest's
  negative-id guard -> ValidationError; the info-block printing lifted out
  into a pure get_model_info returning data; the freshness warning ->
  logger.warning.
- sdk/runtime.py: ServiceRuntimeContext + build_service_runtime_context,
  import repointed to sdk.manifest.
- cli/utils.py: re-exports (above the wrapper); cache_manifest is now a thin
  CLI wrapper composing download_manifest + get_model_info + console.print and
  mapping ValidationError -> typer.Exit(1) (main.py has no DinError handler),
  reproducing the original info output verbatim.
- services/runtime.py: re-export shim.

Completes the SDK loader tier (cid, errors, config, log, web3, ipfs,
contracts, manifest, runtime). No sdk<->cli cycle; import-boundary test now
covers manifest+runtime. Tests: +22 (test_sdk_manifest), suite 117 passed /
1 skipped; behavior parity + tests/dincli import integrity verified.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Santiagocetran Santiagocetran mentioned this pull request Jul 16, 2026
6 tasks
umeradl and others added 9 commits July 17, 2026 20:27
…/home/azureuser

constants.py now resolves everything from the repo checkout, home
directory, or environment: repo root via __file__, venvs via
~/my_venvs/<name>, npx via the newest ~/.nvm/versions/node/*/bin/npx,
scratch dir ~/tempdir/dincli. All resolutions are overridable via env
vars (PYDIN_PYTHON, TORCHENV_PYTHON, TORCHENV_SITE_PACKAGES, NPX_BIN,
IPFS_BIN, DIN_TEST_TMPDIR), read from the real environment first and
then the repo-root .env. conftest.py and test_04_gi.py consume the
shared constants instead of their own literals.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ences

Rewrite all 101 remaining /home/azureuser occurrences across 17 files
in Documentation/ and Developer/:

- markdown links to repo files become relative links (GitHub-navigable)
- shell/repo paths use the /path/to/devnet placeholder
- venv and scratch paths use ~/my_venvs/... and ~/tempdir/dincli/
- HR profile pointers in migrate_to_foundy.md use ~/projects/HR/...
- DIN_STATE_DIR example uses /home/<user>/.din-node; drop a stray
  duplicate mkdir line in containerization-guide.md

Also repoint references to the six per-model service files
(client/aggregator/auditor/model/scoring/modelowner.py) from
dincli/services/ to cache_model_0/services/ — they moved there when
services became per-model — and retarget the proposed contribution.py
module to cache_model_0/services/ for consistency.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Working summary of Abraham Nash's DIN white paper (Jun 2026) with a
gap/alignment checklist mapping paper mechanisms to DevNet status,
feeding the P3 mechanism-design push.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…acking into docs

- design/p3-design-plan.md: coordination page for the P3 mechanism-design
  push — mechanism -> design sources -> GitHub issue map (issues 36-43),
  open-decision -> discussion map (discussions 44-46), white-paper gap
  routing, definition of done
- ROADMAP.md: P3 status note (delayed pending designs; P4 active in
  parallel; dates not binding)
- MECHANISM_DESIGN.md, README.md: cross-references

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… (PR InfiniteZeroFoundation#35)

Original work by Robert (@robertocarlous, PR InfiniteZeroFoundation#35, branch
feature/foundry-platform-deployments, head 45dcda1), implementing issue
InfiniteZeroFoundation#34: DeployPlatform.s.sol, UpgradePlatform.s.sol, four V2 upgrade stubs
(DinTokenV2, DinCoordinatorV2, DinValidatorStakeV2, DINModelRegistryV2),
the forge test suite (DeployPlatform.t.sol), dincli's
`system import-deployments --foundry` flag, and the
foundry.toml/package.json/.gitignore changes needed to run them.

Three blocking bugs found in local verification, fixed here:
- DeployPlatform.s.sol: vm.writeJson has no parent dir on a fresh clone
  (foundry/deployments/ is gitignored and not committed) — call
  vm.createDir before vm.writeJson.
- All four V2 stubs: a plain `//` comment sat between the two `///`
  NatSpec lines, splitting the doc block so `@custom:oz-upgrades-from`
  never reached solc — UpgradePlatform.s.sol failed upgrades-core
  validation for every contract. Moved the `//` explanation above the
  NatSpec block so the `///` lines stay contiguous.
- Both scripts' own documented "Usage (from repo root)" command didn't
  compile (foundry.toml/remappings.txt live in foundry/, not repo
  root) — changed the usage comments to `cd foundry && forge script ...`.

Verified end-to-end: forge test (40/40 passing), and both scripts run
against a local chain (deploy -> deployments JSON -> dincli system
import-deployments --foundry -> upgrade, version() == 2 through the
proxy for all four contracts).

Co-Authored-By: umeradl <umermajeed.cto@gmail.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… harness

tests/dincli/ can now deploy the platform contracts via either the new
forge script from PR InfiniteZeroFoundation#35 or the existing hardhat script, selected by
PLATFORM_DEPLOY_TOOLCHAIN (tests/dincli/constants.py; default "foundry",
matching `dincli system import-deployments`'s own default). Overridable
via env var / .env for anyone who wants to keep exercising the hardhat
path.

- constants.py: FOUNDRY_DIR, FORGE_BIN, PLATFORM_DEPLOY_TOOLCHAIN,
  HARDHAT_DEV_ACCOUNT_0; DEPLOYMENTS_FILE now resolves under whichever
  toolchain's deployments/ dir.
- test_01_platform.py: test_deploy_platform_via_script branches on the
  toolchain (forge script vs hardhat run); test_import_deployments_into_din_info
  keeps passing an explicit --file since import-deployments' own
  --foundry/--hardhat default-path resolution is relative to cwd, and
  the harness's cwd is the isolated DIN_TEMP scratch dir, not the repo
  root.
- conftest.py: managed_services now starts the matching chain backend
  (Anvil via foundry/anvil.sh for "foundry", the existing Hardhat node
  for "hardhat" — both on chain-id 1337) and runs `forge build` when
  the foundry toolchain is active; `npx hardhat compile` still always
  runs since task-level contract deploys and dump-abi tests need
  hardhat's ABIs/bytecode regardless of which toolchain deployed the
  platform.

Verified: full tests/dincli/test_01_platform.py (8/8) under both
toolchains, and test_01 through test_03 (35/35) end-to-end under the
new foundry default.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Two follow-up fixes to files landed in b40fe2e (PR InfiniteZeroFoundation#35 foundry
platform deploy/upgrade parity):

- foundry/test/DeployPlatform.t.sol: the DinCoordinatorV2/
  DinValidatorStakeV2/DINModelRegistryV2 imports sat mid-file, after
  the MockTaskContract definition — moved them up next to the
  DinTokenV2 import at the top, with the rest of the imports.
- foundry/script/DeployPlatform.s.sol: added a `forge clean` step to
  the documented "Usage (from repo root)" comment, right after
  starting anvil. Without it, deploying then testing back-to-back
  after a recompile can hit upgrades-core's stale build-info bug
  ("Found multiple contracts with name ...") — reproduced again while
  re-verifying this change; `forge clean` resolves it.

Also ran `forge fmt` over both files (line-wrapping only, no logic
changes).

Re-verified: forge clean && forge test — 40/40 passing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds staking-design.md and tokenomics-design.md, and updates the
mechanism design, staking mechanism, and P3 plan docs to reflect them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ions

Records outcomes from Abraham's Slack sync (2026-07-21) against the open
decisions tracked in MECHANISM_DESIGN §9, staking-design.md §5, and
tokenomics-design.md §6: slashed-stake destination (50/50 burn/treasury),
depositAndMint cap/retirement, emission decay with MAX_SUPPLY left open,
dual-source burn policy, delegation/tombstoning scope, and the white-paper
InfiniteZeroFoundation#46 alignment items. Fee denomination is resolved as a DIN/ETH split
(protocol fees in DIN, validator network fees in ETH), not the DIN-only
recommendation these docs previously carried.

GitHub Discussions InfiniteZeroFoundation#44/InfiniteZeroFoundation#45/InfiniteZeroFoundation#46 themselves are not yet updated to reflect
this — noted in p3-design-plan.md so the "resolved" checkbox isn't marked
done prematurely.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
umeradl and others added 13 commits July 21, 2026 09:26
…iteZeroFoundation#37/InfiniteZeroFoundation#42/InfiniteZeroFoundation#43)

Scopes a 5-day platform-contract task combining the now-resolved staking,
tokenomics, and fees/treasury designs: new DinTreasury and DinFeeRouter
contracts, DinToken.burn(), DinCoordinator mint-cap/faucet-retirement/
treasury-routing, DinValidatorStake governable params + real jailing, and
a DIN-denominated fee path alongside DINModelRegistry's existing ETH fees.
Includes the exact deployment/wiring order and test plan.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…nfiniteZeroFoundation#39/InfiniteZeroFoundation#40/InfiniteZeroFoundation#41/InfiniteZeroFoundation#38)

Adds task_210726_6 (scoring validation, commit-reveal auditing, encrypted
test-data distribution, per-GI reward engine bootstrap) plus a prior-work
reference doc mapping BlockFlow/2CP/Shapley-value-data-valuation/IPFS onto
the task's scoring and auditing mechanisms.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…capabilities task (issues InfiniteZeroFoundation#20/InfiniteZeroFoundation#21)

Co-Authored-By: umeradl <umermajeed.cto@gmail.com>
OZ v5 TransparentUpgradeableProxy deploys one ProxyAdmin per proxy.
The previous script read the admin from the token proxy only and wrote
a single proxyAdmin key, leaving the other three addresses unrecorded.

Now reads getAdminAddress for each of the four proxies and writes
proxyAdminToken, proxyAdminCoordinator, proxyAdminStake, and
proxyAdminRegistry into foundry/deployments/<network>.json.
Same fix as the Foundry script: read the ProxyAdmin address for each
proxy individually and write proxyAdminToken, proxyAdminCoordinator,
proxyAdminStake, and proxyAdminRegistry into the deployments JSON.
PlatformAddresses type updated to match.
Update _DEPLOYMENTS_TO_DIN_INFO to map the four proxyAdmin* keys
(proxyAdminToken, proxyAdminCoordinator, proxyAdminStake,
proxyAdminRegistry) to their corresponding proxy_admin_* keys in
din_info.json, replacing the single proxyAdmin → proxy_admin mapping.
…proxy-admin-addresses

Fix/proxy admin addresses
…severity-and-gas-followups

audit(foundry): elevate H-1/H-2 to Critical, add real gas measurements
# Conflicts:
#	tests/test_connect_wallet.py
… validate predicates (InfiniteZeroFoundation#20)

Move GIstateToDes/GIstateToStr/GIstatestrToIndex and their backing data
(states, stateDescription, GIstate_to_index) verbatim from cli/utils.py into a
pure dincli/sdk/state.py; utils.py now re-exports them as a shim (same pattern as
the ipfs/runtime waves) so existing call sites keep working unchanged.

Add a GIState IntEnum (0-based, matching the Solidity enum ordinals) and two
validate_* predicates lifted from DinContext's GI-state guards
(validate_gi_state_equals / validate_gi_state_at_least), raising the SDK's
ValidationError instead of printing + typer.Exit. The two context.py guards now
delegate the decision to these predicates while keeping identical console output
and exit codes (no CLI behavior change).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…eroFoundation#20)

Implement to_envelope() + a metadata-driven JSON encoder per proposal §3: the
{status, data, error, meta} envelope with schema_version/sdk_version, and the
encoder rules — uint256_string -> decimal string, omit, small-int passthrough,
bytes/HexBytes -> 0x hex, address -> checksummed, enum -> name, Decimal -> string,
and None -> null (except tagged omit). Extend the import-boundary test to assert
state and serialize import clean of typer/rich/dincli.cli.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…2.2) (InfiniteZeroFoundation#21)

Part B of task_220726_7 — local-only daemon config + hardware introspection.

Preferences (P4-2.1):
- dincli/dind/preferences.py: Preferences dataclass (domain, risk_tolerance,
  min_expected_reward, privacy_constraints) + load/save JSON helpers that return
  defaults on a missing or empty/whitespace file. Stored at StateDirs.preferences_path
  (state_dir/preferences.json), reusing the existing path helper.
- `dind preferences show` / `set` — partial updates (unset flags leave stored values
  untouched), risk-tolerance validation.

Capabilities (P4-2.2, hardware/local slice):
- dincli/dind/capabilities.py: CapabilitySummary + detect_capabilities() — CPU
  count/speed, RAM via os.sysconf + /proc/meminfo (no new dependency), disk, best-effort
  GPU, and bare socket reachability probes for RPC/IPFS (endpoints via sdk.config,
  default https->443/http->80, None when unconfigured). Pure score_capabilities() /
  compatible_with() for later task-matching.
- `dind capabilities` command; both new command groups resolve --state-dir first.
- Factor the shared resource_snapshot() (CPU+disk+RAM, fast/local) into /health's
  resources block — removes duplicated disk logic and keeps GPU/network probes off
  the frequently-polled path.

Tests: test_dind_preferences.py, test_dind_capabilities.py (network-hermetic),
test_dind_health.py extended (new fields + a guard that a poll runs no socket probe).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Santiagocetran Santiagocetran changed the title dind #21 (draft): daemon scaffold — lifecycle, job queue, /health, JSON logging (P4-1.1) dind #21 (draft): daemon scaffold + preferences/capabilities (P4-1.1, P4-2.1/2.2) Jul 23, 2026
@umeradl umeradl added this to the Devnet 3.0 P4 milestone Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants