dind #21 (draft): daemon scaffold — lifecycle, job queue, /health, JSON logging (P4-1.1)#32
Draft
Santiagocetran wants to merge 13 commits into
Draft
Conversation
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>
…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>
…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>
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.
Draft / WIP — progress on #21, not merge-ready. Opening early to keep feature-branch work visible. Base is
feat/din-sdk(the branch this stacks on), notdevelop.What this contains — the P4-1.1 daemon scaffold
New
dincli/dind/package (SDK-independent framework; no role automation — that waits on the SDK contract):dind start | stop | status, all honoring--state-dir/DIN_DIND_STATE_DIRvia a shared resolver.startrefuses a live PID (exit 1);statusis PID-based, enriched with/healthwhen reachable.stop_event/max_ticks); SQLite (WAL) job store (jobs+daemon_meta) with enqueue/claim/complete/fail/checkpoint and retention from day one; heartbeat is a meta update, not a queue row.running → pendingcheckpoint, clean shutdown, PID removal./health(stdlibThreadingHTTPServer) + resource summary; binds127.0.0.1:8787by default (DIN_DIND_HEALTH_HOST/PORT), records the bound address.JsonFormatter+ idempotentconfigure_logging()on thedinclilogger (propagate=False, explicit INFO default) so daemon lifecycle logs emit regardless of import order.systemd/launchdunit examples;dindconsole script +package-data.din-nodeDockerfileCMD→dind start, composehealthcheckon/health.Carries forward the P3-T0.2a/c/d patterns (SIGTERM,
/health, JSON logging) — which did not exist in code, so they're established here.Verification
dindtests + adindimport-boundary test asserting the daemon imports nodincli.cli.*).dind start→/healthreturns JSON →statusshows healthy → double-start refused (exit 1) →dind stopclean shutdown (PID removed); daemon stdout is valid line-delimited JSON across the full lifecycle.Scope / boundaries
dincli/sdkordincli/clifiles modified — purely additive, sofeat/din-daemonstays a clean superset offeat/din-sdk(trivial rebase once the SDK lands)./healthRPC-reachable + wallet checks are TODO (need role wiring).dindarchitecture doc) isn't written yet, so these architecture choices (SQLite state, threaded loop, stdlib health, JSON logging) are proposed and effectively seed it — happy to adjust to the spec.