Repository navigation
Phase 11: experimental ML pipeline for phishing-transaction classification (shadow mode) - #1
Open
Apostal322 wants to merge 92 commits into
Open
Apostal322 wants to merge 92 commits into
Apostal322 wants to merge 92 commits into
Conversation
Experimental, optional 'ml' extra (scikit-learn, LightGBM, pandas, pandera, openpyxl); core install unchanged. - sources: three public label sets pinned to commits with SHA-256 (PTXPhish NDSS'25, Poison-Hunter CCS'24, Forta). The two without a license are fetched locally on request, never redistributed. - labels: PTXPhish's wide sheet parsed into one pandera-validated row per transaction; address lists parsed for the data card only. - collect: deterministic stratified sample; budgeted, resumable chain collection (tx, receipt, sender nonce and target code at the previous block) with a hard cap on total RPC attempts, recorded after every transaction. - features: point-in-time transaction features; block number and raw identifiers never used as features. - dataset/splits: validated table with input-hash manifest; study window where both classes occur; time-ordered splits; per-account purge with hubs from training rows only. - train/report: trivial, rule and learned baselines (LR, RF, LightGBM), selection on validation log loss, test scored once, bootstrap CIs, promotion gate, run ledger, hash-pinned model card, ML_EVALUATION.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Shadow scoring (CRYPTOGUARD_ML_SHADOW=shadow, off by default): POST /api/v1/ml/transactions/score and GET /api/v1/ml/status; 409 feature_disabled when off, 503 ml_unavailable without the extra or a promoted model; only a transaction hash is accepted; never findings. CLI: ml promote / score / monitor. - Registry: promotion only if the run's gate passed; the pickled model loads only when its SHA-256 matches its model card. - Monitoring: population stability index of shadow-scored features against per-bin training shares (ties handled). - Splits: hubs are now a curated public-infrastructure registry only. The degree-based rule let a scam contract with many victims count as public infrastructure, so its later victims reached the test split (caught by a new leakage regression test). Over-linking only costs evaluation rows; under-linking leaks. - Gate: requires closing half of the validation AP gap to 1.0 (the first version, +0.05 AP, was unsatisfiable above a 0.95 baseline); model and hyperparameter selection by validation log loss (AP saturates). - Collector: request ledger written after every transaction. - Tests: features (point in time), labels, source integrity, sampling, split leakage, collector cap/resume, deterministic training smoke run, registry refusals, PSI, API opt-in and findings isolation; CI installs the ml extra from the wheel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ML.md: verified contents, label-quality findings and licenses of the three sources; collection budget and its accounting; features, study window, splits and purge; models and gate; results of run 20261029T055343Z-41bb2f56 with failure modes (plain token transfers are the blind spot, complementary to the wallet-history poisoning detector); measured runtime, memory and reproducibility; decisions revised after seeing data; limitations. - ML_EVALUATION.md generated by that run. - README, CHANGELOG, SECURITY (pickle loading), .env.example. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Defects found by the audit, each with regression tests: - Scoring skipped chain verification (raw client): now verify_chain() and mainnet only, the chain the model was trained on. - A mined transaction without a receipt was scored as 'failed, no logs': now status incomplete, never scored or checkpointed as done. - The API scored with a model that had no untouched-holdout evidence: approval levels research_only / shadow_approved; the API needs the latter, promotion to it needs a passed untouched holdout in the card. - Request budget counted attempts after the fact (an interrupted run lost its count; concurrent collectors could overspend): every HTTP attempt now reserves a unit first in a locked, atomically replaced, fail-closed ledger; cut-off checkpoint tails are repaired. A thread race test found and fixed a Windows lock error. - Registry trusted a path from registry.json: validated run ids inside the runs root, card schema, size limit, library-version check. LightGBM models are now stored as LightGBM text (no pickle). - Bootstrap resampled rows although PTXPhish rows cluster by account: intervals now resample account groups. Runs store per-row predictions and are keyed on table and split hashes. - Monitoring: outcomes, latency, score distribution, schema mismatches, bounded log reads. New: ml/audit.py (cryptoguard ml audit: recomputed metrics, Wilson and cluster intervals, prevalence arithmetic, fixed-hyperparameter shortcut experiments, hub-policy sensitivity, duplicates, calibration, errors) and ml/history.py (point-in-time wallet-history features with an explicit zero-versus-unknown contract; infrastructure, no accuracy claim). Scoring is bounded (one at a time, 30 s timeout) and labelled as an uncalibrated ranking score, post-inclusion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ML_GENERALIZATION_AUDIT.md: reproduction, label provenance (benign = about 60 prominent accounts; phishing expanded from 101 reports), sample accounting, holdout timeline (the test split was viewed before the gate, selection metric and hub rule were revised: a development benchmark), leakage, temporal boundary (post-inclusion), shortcut experiments, cluster-bootstrap uncertainty (FPR 7/43 from 12 senders, 0.043 to 0.364), base-rate arithmetic (precision 0.057 at 1%), errors, wallet-history design, calibration, security fixes, budget, next dataset and experiment. - ML_AUDIT_TABLES.md generated by audit b90137901e25 (deterministic: a second run gave the same id). - docs/ml/baseline-phase11.json: frozen baseline with dataset, config and model hashes, versions, metrics and reproductions; LightGBM text form scores identical to the pickle on the real rows. - ML.md, README, CHANGELOG, SECURITY: status and corrections; Phase 11 history kept and marked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pilot used 2,636 of its 3,000-request cap on eth.drpc.org. It found: - 0 confirmed payments to the attacker in 52 resolved Poison-Hunter rows (Wilson 95% upper bound 0.069); - about 1,500-2,500 requests per ordinary wallet-week (extrapolated from three 1-day recordings); - drpc's free plan limits eth_getLogs to under 250 blocks; - throughput of about 4 requests/s. Option B is not viable as costed. Raw pilot data stays local in the git-ignored data/ml/pilot/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ledger's lock file was treated as stale after 60 s. Two processes waiting on a crashed holder could both break it, and both would then hold the lock. Changes: - use an OS file lock (msvcrt/flock), which the OS releases when the holder dies; - fsync each reservation before the atomic replace; - make threads of one process queue on a blocking in-process lock, so none starves while polling under load. New mock-only tests cover: - two processes sharing a cap; - a process killed while holding the lock; - a live holder (times out, the lock is not broken); - a zero budget; - rate limits and timeouts; - the cap reached during retries; - five async workers; - a truncated ledger file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PSI fixes: - Reference bins put a value equal to a decile edge in the upper bin, so a mostly-constant feature fell into one bin and a 0 to 40 shift gave PSI 0. New references use closed="left". Phase 11 cards keep their original binning, so they show no false drift. - An empty batch gave a large PSI; it now gives None. - NaN values were binned silently; they are now excluded and reported as missing_share. Task isolation: model cards record a task identifier, and the transaction scorer refuses cards for any other task. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds task poisoning-attempt/1, kept separate from the PTXPhish transaction classifier: - events: the event schema, victim-event identity, campaign groups (public infrastructure exempt), grouped temporal splits, label tiers that keep weak, verified and conflicting labels apart, outcome records separate from labels, quality gates and a deterministic manifest; - poison_hunter: typed parser with field provenance; failing rows are quarantined with reasons, never dropped; - pilot: versioned pilot records. Fixes the pilot data loss: the post-processing read a non-existent 'transactions' field. A schema mismatch now raises instead of reading as zero, and legacy lines migrate with lost values set to None; - payments: offline payment verification. A loss needs a reviewed token, a successful receipt and a matching log; otherwise the result is unresolved; - candidates: structural candidate generation, independent of the detector, plus point-in-time event features; - review: score-free review packets and append-only label import; - planner: collection cost planning that never collects; - poisoning_report: the offline report. New CLI commands: ml poisoning-report and ml plan-collection. No RPC calls anywhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ML_PILOT_AUDIT.md: the pilot reconstructed from its raw outputs. The request accounting matches the ledger exactly (2,636). The 0.069 payment bound is corrected to a conditional bound on the 52 least active rows. The data-loss root cause is recorded, with what was recovered and what was lost. - ML_POISONING_DATASET.md: task definition, event schema, label tiers, Poison-Hunter field provenance, and the quarantined row. - ML_RESEARCH_PLAN.md: issue register, candidate-generation results, collection cost model, external sources (none downloaded) and the next experiment. - ML_POISONING_TABLES.md: generated by `ml poisoning-report`. - The proposal, ML.md and CHANGELOG are corrected and updated. Verification: - ruff, format and mypy (107 files) clean; - ML suites: 97 passed; - full backend suite: 527 passed and 1 failed. The failure was a thread-starvation timeout in the ledger test, fixed in 4928030; that file then passed 19/19. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The outer tracemalloc measurement in build() was reset by the nested measurements in candidate generation and replay(), so the report showed 0.0 MiB. Per-window generation memory, measured correctly, stays in the JSON report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Parse Tsuchiya et al.'s payoff_transfers_ethereum.csv (KiltHub DOI 10.1184/R1/29212703.v1, CC BY-NC-ND 4.0) with a typed, quarantining schema and join it against the Poison-Hunter rows, their pilot outcomes and the replay incidents. The file stays local and is pinned by hash in ml/tsuchiya.py rather than ml/sources.py, so fetch-sources never downloads it unasked. Only aggregates and line numbers are reported. Results (0 RPC requests): no complete-coverage pilot row is contradicted; 76 of the 97 unchecked rows fall in the file's coverage with no payoff to their lookalike; one victim (line 74) paid a competing lookalike of the same address; one row's lookalike (line 87) was paid by another victim. Labels are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tsuchiya et al.'s payoff amounts come from a PostgreSQL real (float4), which holds integers exactly only up to 2^24 base units (about 16.8 USDT). Phase 11.2 used the float64 limit and reported 41 inexact amounts; 1,644 of 1,738 are approximations. Each payoff now keeps the verbatim source text, a precision class, a human amount only for tokens with known decimals, the source's USD valuation unchanged, a stable payoff_id (chain, tx, token, payer, recipient) and file provenance (tsuchiya-payoff/2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ml fetch-file: verified, resumable download of one approved, pinned file (206 + matching Content-Range to resume, 200 restarts, size/MD5/ SHA-256/gzip checks before rename, disk reserve). No default caller. - ml scan-archive: streaming reader for Tsuchiya et al.'s PostgreSQL dump. Never executes SQL; whitelisted statements, schema and COPY column checks, bounded lines, typed rows with counted rejections, exact distinct counts with bounded memory (spill buckets), a target subset in SQLite renamed only after a complete pass; killed-run leftovers (including the SQLite journal) are cleared first. Real archive: 34,905,969 rows, 0 malformed, all ten publisher counts reproduced, peak RSS 287 MiB, two passes identical. - ml cross-dataset-report: match levels for Poison-Hunter rows, payoff-to-attempt linkage, separate attempt/victim/address/campaign outcomes, temporal categories, tie-aware competing-lookalike comparison, decision gates, and a local review queue (packets v2 with competing lookalikes and payment evidence; no labels assigned). - Candidate rules are shared through candidates.transfer_methods so the archive evaluation uses the generator's own logic. - ml bench-archive: seeded synthetic scaling benchmark. 0 RPC requests. Third-party data stays in the git-ignored data/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ML_CROSS_DATASET_VALIDATION.md documents provenance, licence, the actual archive format, the streaming parser, performance, record counts, Poison-Hunter and payoff overlap, outcome levels, competing lookalikes, temporal handling, selection bias, rule dependence, label quality, decision gates (no supervised benchmark is possible yet), audit issues 13-20 and the next experiment. Existing ML docs, the proposal, the changelog and the README point to it; earlier conclusions are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`cryptoguard ml freeze-review-sample` draws, once and before any review, a stratified sample of the payoff-linked review packets: one representative per campaign group (victim, lookalike, planting tx, imitated address), strata subtype x year x rival lookalike, fixed subtype quotas (60 in all) split proportionally with at least one per cell, keyed SHA-256 ranking, ordered reserves, design weights. Writes a blinded reviewer sheet, a separate unblinding key and a manifest with a selection hash; refuses to re-draw once frozen. Offline, 0 RPC requests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Records the frozen review-sample/1 draw (60 of 1,469 packets, 15 strata, one per campaign group) with SHA-256 commitments for the input queue, selection, reviewer sheet, unblinding key and manifest, made before any review. Adds the review protocol and pre-specified analysis plan. The sample files themselves stay local (CC BY-NC-ND derived addresses). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
verify_frozen checks the five committed hashes (raw bytes, plus the selection hash recomputed from the manifest) and never writes. The design audit recomputes groups, strata, allocation, exact inclusion probabilities and weights from the queue, explains the 1,401 versus 1,395 group count (exploratory links without the imitated address), and adds a stratified estimator with collapsed-strata variance, design-effect Wilson intervals, nonresponse bounds and attempt-level bounds. Corrects the year-boundary comment (values unchanged). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Structured decisions with evidence and exposure fields; a hash-chained, atomically written reviewer store with finalization; a loopback-only review app (session token, Host check, strict CSP) that serves only the blinded sheet; per-reviewer packages; replacements in frozen reserve order; kappa (undefined, never 0) and Gwet's AC1; and an unblinding gate with no override and a key-access log. Commands: cryptoguard ml review verify|audit|package|serve|status|replace|unblind. Offline, 0 RPC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Versioned benchmark manifest, the ten readiness criteria (built on events.quality_gates), and a guard that refuses training events sharing an event, wallet, lookalike or planting tx with the reviewed holdout; development use is recorded permanently. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…k readiness Amendment 1 was written before any review and leaves the frozen sample unchanged: campaign-level primary estimand, design-based intervals (the 0.94/0.86 figures assumed simple random sampling; all-confirmed design bound 0.929), collapse rule, structured evidence and exposure. Adds the reviewer guide, maintainer checklist and negative-data collection plan (not authorized). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cohort.py generalizes the frozen-sample design (one representative per group, stratified keyed-hash selection, reserves, hash-committed manifest) with its own version, seed and directory per cohort; the Phase 11.4 sample is untouched. Reviewer packages name no cohort: the server identifies it by the sheet hash, so a cohort's purpose never reaches reviewers. Sheet v2 adds a neutral description, a coverage note and pre-cutoff context, rendered as text only. Unblinding takes the cohort, reads both key formats and adds an all-reviewers-legitimate estimand; subgroup names come from the manifest design. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…valuation contract candidates/2: a counterparty counts as chosen only with a verified wallet signature (candidates/1 also used unknown-signer transfers), and generation is one pass instead of one history scan per transfer; identical output on all 13 recorded windows. Adds the archive's uncategorized-row extraction (two streaming passes, never executes SQL), the hard-negative pool with structural categories (every item unlabeled_candidate), a contamination screen against every local known positive with match levels and statuses, typed campaign grouping that never links through common tokens, coarsened exact matching with balance diagnostics, source-separability diagnostics, a benchmark data contract and metrics that refuse unverified negatives, a data inventory, and the hard-negative-study command. Offline, 0 RPC requests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the inventory Commits the five hashes of hard-negative-candidates/1 (frozen at c68d3a4, clean tree, before any review) to review_sample.COHORTS so verify, package, serve and unblind recognise it; the Phase 11.4 sample's hashes are unchanged. The inventory no longer lists __pycache__ files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ted tables Documents the offline hard-negative pool (8,877 unlabeled candidates), the contamination screen (42% of the archive's uncategorized rows overlap known attacks), matching and source-separability results (value alone separates the frames), the frozen 35-item cohort and its first, superseded draw, and the readiness gates. ML_POISONING_TABLES.md is regenerated with candidates/2: only the commit line changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When other writers kept SQLite locked past the driver's busy timeout, LeaseStore.acquire let a raw OperationalError escape: indistinguishable from a crash (HTTP 500), and the most plausible way a contender exits non-zero under heavy I/O. It now raises LeaseBusyError (503, retryable); 'held' still returns None and at most one owner wins. The contention test reports each child's outcome or exception and asserts safety (never two owners) separately from liveness; a deterministic test holds a write lock and checks the busy path. The original flake was not reproduced in 16 rounds under CPU and fsync-heavy disk load. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hort, label policy evidence.py builds deterministic pre-cutoff packets from local data only (sheet in, never the key; no flags, intended address or payoffs; no similarity computed so reviewers identify the counterparty themselves); the review app serves them only when their hash is registered. Amendment-2 decisions record later-payment and third-party-label exposure, offline-panel use, reason codes and evidence citations. Adds a synthetic training cohort, sessions that expire, submission checks and a key-free agreement report, the label policy (seven statuses, strict binary eligibility), an inactive pre-registered experiment spec, FPR power planning, both cohorts as one protected holdout, and source identifiers refused as features. candidates/2 now buckets chosen counterparties by suffix (exact): 10,000 transfers in 0.13 s instead of 13 s, identical output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dust planting (17 approved RPC requests) The paid lookalike's only pre-theft transaction (nonce 0) was a plain native transfer of 1e12 wei to the victim at block 21,890,540, 357 blocks (4,320 s) before the theft and before both fake-token plantings. observation/1 does not record inbound native ETH, so the Phase 12.3 miss is a confirmed recorder omission. In an in-memory reconstruction with that one record, C1 flags the paid address (lookalike_in, affix 4+6 to the reference) 357 blocks early; C0 does not. The record was found by an outcome-directed query: a development-case regression, not validation. The frozen fixture and the Phase 12.3 result are unchanged. Ledger: 1 failed request (outbound connectivity down) + 16 on the one restart; receipt skipped to stay within the cap of 17. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… RPC) - native_inbound: read_receipts; observation/2 now observes the status of every nonzero inbound instead of inferring it from an exact sum (which a reverted inbound plus an equal internal credit would fool). - Adversarial locator tests (12, incl. a seeded randomized oracle). - C2 safeguards: native candidates require a lookalike of the wallet's own reference (zero-value / stranger native transfers alone never become candidates); one candidate per lookalike with an event count. C1 unchanged (coverage measurement). Production detector untouched. - replay record-window: outcome-blind recording from wallet, chain, window and collection settings only; never overwrites; needs a cap. - Pre-register the blind observation/2 replay of the Stage 2a window (verification V1-V5 fixed in advance; cap 2,500 requested, not approved). The frozen fixture and the original C0 miss are unchanged. - 909 passed, 4 deselected; ruff and mypy clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… requests) replay record-window, given only the victim, chain and block window, recorded the Stage 2a window with observation/2 and independently found the native dust planting (0xf4530315..., block 21,890,540, index 150, 1e12 wei, receipt status read). C0 = the 2 fake-token lookalikes (identical to C0 on the frozen fixture); C1 adds exactly the paid address 357 blocks (4,320 s) before the theft; C2 keeps it; production detector output identical. Development-case regression, not validation. The frozen fixture and original C0 miss are unchanged. Ledger: 596 on a first attempt stopped by a provider rate limit (no fixture written) + 703 on the one permitted restart. Decision (ML_OBSERVATION_COMPLETENESS.md section 35): observation/2 is sufficient for offline research within its scope; production use needs untouched blind incidents, a C2 volume study and an approved detector change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e ranking) Frozen before any outcome of the new tasks. Archive ranking questions are answered by citing Phase 12.1 (its test split is used) plus exploratory development-split analyses; the primary ML test is a new self-supervised proxy task (next planting mechanism from the planting prefix) with frequency and Markov baselines, a fixed logistic regression, the 12.1 temporal group split, log loss and a group-bootstrap CI. Wallet-centric work: point-in-time candidate feature schema with value/status pairs, an offline shadow ranking, robustness and cost tests. PU and wallet self-supervised learning are audited, not forced. 0 RPC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…shadow ranking (no RPC) Committed before the outcome-based run (protocol 12.5, 16586a5). - ml/candidate_research.py: episode cache (protected wallets and every frozen-overlap episode removed; 12.1 groups and temporal split), the primary proxy task planting-mechanism-next/1 (prefix of strictly earlier blocks; global, victim-prefix and Markov baselines; fixed multinomial logistic regression; log loss; group-bootstrap CI), the RQ2 exploratory semantic-channel ranking on the development split, the H3a MAD-recency equivalence, wallet-centric coverage/volume, robustness transforms, development-case ranks and a synthetic flood. - ml/candidate_features.py: poisoning-candidate-features/1 with (value, status) pairs, never zero for unobserved; offline shadow ranking poisoning-candidate-ranking/1 (B4 order; B3/B5/B6 alongside; research CLI only). - CLI: ml candidate-research, ml candidate-ranking. - Tests: 14 with hand-written oracles (proxy rows and same-block rule, baselines, single-class refusal, metrics, bootstrap, tie-averaged top-1, MAD equivalence, end-to-end C0/C1/C2 + features + ranking, point-in-time metamorphic checks, missingness, flood bound, robustness never adds candidates). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…an fixed) The Phase 12.5 study found candidate_features rebuilding every observation per candidate: 424 s to rank 1,000 flood candidates over 11,000 observations. A per-window context (observations, party and signer indexes, references) is now built once. Outputs are identical on both Level I cases, the blind observation/2 recording and a 2,200-event flood; the full flood now ranks in 0.27 s. Regression test counts the observation builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h (no RPC) ML_CANDIDATE_DISCOVERY_RESEARCH.md: data audit (P1-P5, never pooled), protected exclusions, C0/C1/C2 coverage and volume, the pre-registered proxy test (H8 not supported: logistic log loss 1.945 vs 0.200 for victim-prefix frequency under strong temporal covariate shift; post-hoc diagnostic), RQ2 semantic channel (no gain, -0.009 [-0.022, 0.005]), H3a analytic equivalence, robustness (signer loss removes all spoofed candidates), cost, PU and self-supervised feasibility, decision gates, and the next experiment. 924 passed, 4 deselected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…enance) Frozen before the evidence model exists and before any H2-H7 measurement. Records the development audit (outgoing signer coverage 18/18 on eligible recordings; the 12.5 signer-loss result came from masking) and the deterministic recovery rule R-SIG (an outgoing event whose transaction is absent from the wallet's complete signed set was not signed by a code-less wallet; 18/18 consistent with looked-up signers). Hypotheses H1-H7, evidence levels, the ordering and summary contract. No learned ranking model: no valid labels. 0 RPC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…G), bounded summary Committed before the Phase 12.6 measurements (protocol c060ccc). Research only; C0/C1/C2 and their published outputs are unchanged. - ml/candidate_evidence.py (candidate-evidence/1): one group per (chain, victim, lookalike) keeping every distinct evidence record in chain order with typed provenance (signer status, event sender and recipient, emitter, receipt). Rule R-SIG: an outgoing event whose transaction is in the wallet's complete signed set was signed by the wallet; absent from it (code-less wallet) it was not - the signer's address is never guessed. Non-probabilistic levels (directly verified, supported, partially supported); unknowns lower support and are listed, never raise suspicion; unknown token identity is never "untrusted"; unknown-signer outgoing lookalikes are kept as partially supported, never called spoofs. Order: level, affix strength (costly to forge), latest planting, address. Bounded summary discloses totals, truncation and hidden identities; nothing is deleted. - ml/reliability_study.py + `ml reliability-study`: R-SIG consistency, S1-S5 masking with unsafe-inference counts (C1 vs evidence model), deduplication, 12 adversarial scenarios, spam stability of orderings, development-split robust proxy features, 10-10,000 scaling. - Tests: 27 with hand-written oracles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ance (no RPC) ML_CANDIDATE_RELIABILITY.md: signer-provenance audit (outgoing signer coverage 18/18; the 12.5 result came from masking), R-SIG recovery (18/18 consistent; 0 candidates lost with all signers masked), confirmed defects (C2 dropped evidence records; no signer recovery; C1 calls an unknown token untrusted), evidence groups, S1-S5 masking (0 unsafe inferences vs 5 for C1), 12 adversarial scenarios, H5 negative (support first loses to similarity under cheap verified spam), exploratory robust proxy features, linear scaling, production-readiness decisions. 950 passed, 1 failed (load-sensitive lease test; passes 3/3 alone). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ministic lease test candidate-evidence/2 (research only, detector unchanged): - absence_guard: R-SIG infers "not signed by the wallet" only for a complete, count-consistent, nonce-contiguous signed set of an account whose code is 0x at every sample up to the cutoff (no EIP-7702 designator, no contract code); legacy fixtures must document the nonce bisection. Otherwise the signer stays unknown. - A looked-up signer that contradicts the signed set is "conflicting": never a reference, never a spoof. - Not signed is not unauthorized: a value-moving foreign-signed transfer is foreign_initiated_out with authorization unknown (allowance, permit, delegation or fabricated log); only zero-value ones are spoofed_out. - Presentation order reads no support level (affix, recency, address); the pre-registered support-first order is kept as evidence_order_key for H5. - Bounded summary (no hidden-identity list), digest-checked page() and group_records() offset/limit access. reliability-study/2: signer guard matrix, real-window authorization audit, separation checks, 10,000-event adversarial suite, summary scaling to 100,000. Lease test: distinct child exit codes, explicit-clock expiry probes instead of a conditional wall-clock check, a bounded join that kills a hung child, and a new expiry-boundary test (no instant with two owners). Amendment: docs/ml/amendment-12.6.1.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… pages, lease test (no RPC) ML_CANDIDATE_RELIABILITY.md sections 30-39 with the measured run on 5a5e876 (reliability-study/2, 92 s, 623 MiB peak, 0 RPC): 20-condition signer guard matrix, real-window authorization audit (6 value-moving foreign events no longer called spoofs; R-SIG 18/18), bounded summary 6.8 KB at 1k/10k/100k, separation of support from order, H5 preserved, 10,000-event adversarial suite, lease-test investigation. In-place notes mark the 12.6 statements this corrects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t top-K, LTR) Threat model with an explicit work-factor model (2^(4(p+s)) key trials per reference), identifiability limits L1-L4, baselines B0-B7, the proposed work-weighted group-discounted selector P1 (lambda = 4 bits fixed a priori), ablations, negative controls, a 16-family synthetic grid (m in 0..10,000, K in 1..50, 10 seeds), hypotheses H1-H6 with decision criteria, and a learning-to-rank study confined to the 12.1 development split. Frozen before any selector, benchmark or LTR code exists. RPC budget 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…chmark - adversarial_ranking: baselines B0-B6 and negative controls, and the proposed work-weighted group-discounted selector P1 (priority = 4*affix - lambda*j per reference bucket, keyed-hash ties, no time, no support level, no oracle) with its ablations and a provable displacement bound independent of decoy count. select() returns a labelled permutation (method id + config hash). - candidate_evidence: EvidenceResult carries its order and config hash; the digest covers them; summary/page report them and each item's reference bucket and bucket size. The default order and contract are otherwise unchanged. - adversarial_benchmark: the 16 pre-registered families (m 0..10,000, K 1..50, 10 seeds), Exposure@K, TGC@K, displacement, attack cost, H1-H4 checks, negative controls, the 12.1 development-split LTR study (test split dropped before features), development cases, performance, resource preflight. - CLI: cryptoguard ml adversarial-ranking. Committed before the measured run (protocol 12.7). 0 RPC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pre-registered negative controls flagged two design biases in the grid: oldest-first (NC-revrec) scored 0.986 because targets are always older than their decoys, and mechanism round-robin (B3) scored 0.839 because targets mostly use a different mechanism from their decoys. posthoc_checks() varies those choices as an adaptive attacker would (older decoys, decoys sharing the target's mechanism, the target on each of the five references, a target address that does not sort first) and reruns H4 with 200 seeds. Labelled post hoc and exploratory; the pre-registered results are unchanged. `cryptoguard ml adversarial-ranking --posthoc` writes posthoc-checks.json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Debugging the measured run showed a design flaw in the registered P1: ties between bucket leaders use the member's keyed hash, and a flooded bucket's leader is the minimum of many hashes, so a lone target loses almost every tie (rank 5 of 5 tied leaders in 10 of 10 seeds at m >= 100 in F7). P1b breaks those ties with a keyed hash of the bucket, which does not depend on bucket size. P1 stays exactly as registered and reproducible; P1b is a labelled post-hoc amendment evaluated on the same grid. Test pins both behaviours. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st top-K (no RPC) ML_ADVERSARIAL_RANKING.md (35 sections and gate table). Registered results from 7ac195f, reproduced exactly at 0968ff8: H1 supported (P1 0.773 vs B0 0.525 mean Exposure@K, >= B0 in 16/16 families), H2 0/480 cells, bound 0 violations, H3 confirmed, H4 tolerance not met at 10 seeds (200-seed post-hoc check matches K/(m+1)). Negative controls exposed attacker-controllable design biases (oldest-first, mechanism round-robin -> 0.111 post hoc); P1 unaffected. Post-hoc P1b fixes a tie rule that favoured flooded buckets (0.813). LTR on the 12.1 development split learns recency: no gain over recency, -0.169 adversarially (gate G FAIL). Independent validation BLOCKED BY DATA. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI #50 failed in the backend type check on Ubuntu: ctypes.windll does not exist in Linux typeshed. A sys.platform == "win32" guard is understood by mypy on every platform; checked locally with mypy for Windows and --platform linux. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ealed manifest Protocol 12.7.1 (falsification of P1b): frozen selectors (adversarial_ranking.py sha256 2c0e65ae..., P1b config 8b3795e363aad678; verify_frozen refuses anything else), an independent debiased generator (random addresses, references assigned by the pipeline's _match, shuffled populations, oracle outside the groups; balanced age and mechanism relations; 10 families incl. an exchangeable null control), the sealed manifest (7,200 scenarios, 5,079,472 candidates, sha256 2e294aeb...), template-cluster bootstrap, the pre-registered H1 classification, a bounded adaptive attacker (48 attacks x 3 budgets, K1 public / K2 secret seed) and a counterexample search with the 12.7 theorem's invariants. Committed before any selector has run on the sealed scenarios. `cryptoguard ml adaptive-validation [--manifest-only]`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… RPC) ML_ADAPTIVE_RANKING_VALIDATION.md (35 sections, gates). Sealed primary run on d98a636 (manifest 2e294aeb... reproduced; 7,200 scenarios; run once): paired P1b - B0 = -0.018 [-0.031, -0.004] over 225 templates, so the pre-registered classification is "not supported after debiasing". P1b gains under other-group floods (+0.14) and on reference-group exposure (+0.032 [0.024, 0.041]) and loses under own-group equal floods (-0.12); reference round-robin B4 edges it. Adaptive attacker: 10 equal-tier own-group lookalikes displace the target under every method (H2 not supported). The 12.7 theorem holds (0 breaks in 20,000 trials). The 12.7 report gains a pointer to this result; its text is unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
…adiness) Vocabulary and a five-dimension label ontology with evidence rules, the case and collector contracts (outcomes sealed separately), data-quality severities, per-mechanism observation eligibility, independence criteria, the blind flow with a run-once ledger, task populations and denominators (T1-T9; end-to-end TopK counts generation failures as misses), the failure taxonomy, the frozen baseline registry (P1b comparison-only), group splits and leakage checks, paired sample-size planning, the offline development analyses D1-D5 and the public-repository safety scan. Frozen before any harness code exists. RPC 0. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ng, repo safety scan Protocol 12.8, research only (detector untouched): - benchmark_contract: five-dimension label ontology with evidence rules, case and sealed-outcome records, a collector request type that cannot carry an answer, data-quality issues with severities, per-mechanism observation eligibility and independence checks against development artifacts. - benchmark_eval: predict() without an outcome parameter, an outcome vault that opens only after sealing, a run-once ledger that records refused reruns, T1-T7 scoring with one failure class per case, metrics with explicit denominators (end-to-end TopK counts generation failures as misses; FPR refused without verified negatives), group splits, leakage audit and the frozen baseline registry (P1b comparison-only). - power: exact paired sign-test power and incident planning from stated assumptions (no hard-coded sample size). - repo_safety: tracked-file and history scan that reports names and counts only. - benchmark_readiness: inventory, window eligibility, leads, development regression, missingness sensitivity and the archive tie analysis. - CLI: cryptoguard ml benchmark-readiness, cryptoguard ml benchmark-power. Committed before the measured run. 0 RPC. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ch paths; lead event dates Labelling only: three provenance prefixes were unregistered, and a lead's event date is now read from its case id when present. No scoring logic changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
ML_INDEPENDENT_BENCHMARK_READINESS.md (35 sections, gates G1-G13). Measured on 332dbfd (identical to 3b512d7): 16 local windows, 0 independent incidents, 0 verified negatives, 0 reviewer submissions, no all-mechanisms window; blind development regression (not validation) classifies the known miss as observation_unsupported; archive development split: the paid lookalike is the newest among similarity-tied rivals in 79.0% of 423 episodes vs 33.5% by chance (+0.454 [0.412, 0.495]). No model trained. Public-repository scan clean over 412 files and 112 commits; one reviewer-blinding risk documented. Readiness: ready after new observation recordings and additional verified labels; generalization evidence BLOCKED BY DATA. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…on, pilot gate) Exposure channels and deterministic levels R0-R3/RU (R4 only from reviewer evidence), artifact roles, cohort dispositions and the prospective reviewer workflow with declarations; bounded public discovery (20 searches, 30 page reads, verbatim identifiers, no explorer access), eligibility rules, hash-ordered pilot selection (one per cluster, cap 10), anchor + record jobs with caps (5 + 2,500 per window), a separate approval record, the frozen B0-vs-B4 comparison with reference-group exposure, and pilot stop rules S1-S6. Frozen before the audit, the search and any classification. RPC 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d protocol Protocol 12.9 Part I. `ml/review_blinding.py` audits the two frozen review cohorts: - Identifiers come from the blinded sheets only; the unblinding keys are hashed, never parsed. - Channels: tracked files at HEAD, every line added in git history (with its first date), truncated prefixes, and documented provenance. - Matches get artifact roles (outcome / context / neutral), which set the levels R0/R1/R2/R3/RU. - R4 is assigned only from a reviewer declaration. - Per-item mappings are written to the git-ignored research directory only. Prospective workflow: - whitelisted task payloads checked for outcome-bearing keys or wording; - opaque task ids; - ReviewerDeclaration (yes / no / unknown, never defaulted); - review_exposure, adjudication_readiness and a guidance screen. docs/ml/reviewer-blinding-protocol.md holds the neutral reviewer guidance, the declaration form and the cohort dispositions (aggregates only). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…T5g (no RPC) Protocol 12.9 Parts II-III. `ml/incident_acquisition.py`: - Lead schema: verbatim identifiers must be full, truncated ones keep their ellipsis, and a role is recorded only when stated. - Identifiers live in a local vault. The public registry carries salted SHA-256 commitments and refuses any identifier, full or truncated. - Development-overlap search over fixtures, registries, campaign expansion, archive extracts (indexed sqlite lookups), review packets, cohort sheets, kits and research outputs; unblinding keys are never opened. - Union-find clusters; first-match eligibility rules; hash-ordered pilot selection with one lead per cluster, capped at 10. - Anchor and record jobs, with only CollectorRequest fields reaching the collector. - Budget caps (2,505 per window). - ApprovalRecord / check_approval bound to the manifest hash and caps; general encouragement is refused. - Pilot stop rules S1-S6. No network import and no runner. benchmark_eval: - T5g reference-group exposure, reported apart from T4; - the bucket map is kept outside the prediction digest, so 12.8 ledgers stay valid. CLI: `cryptoguard ml review-blinding` and `cryptoguard ml incident-acquisition [--write-public]`. Registry docs/ml/incident-benchmark/acquisition-12.9.json: 17 leads, 0 ready for recording, 5 needing identifiers, 12 rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…acquisition (no RPC) - tests/test_ml_blinding_acquisition.py: 42 offline synthetic tests covering exposure levels, history dates, payload leaks, declarations, adjudication, eligibility rule order, duplicates and campaigns, pilot determinism, the overlap search, collector fields, caps, approval specificity, stop rules, the absence of network code and runners, identifier-free public files, and T5g. - ML_INDEPENDENT_INCIDENT_ACQUISITION.md: 35 sections and gates G1-G14. - Cohort A is 60 x R3 (external). - Cohort B is 4 x R3, 30 x R2 and 1 x R1. - Reviewer exposure is unknown: no kit was sent. - 0 of 17 leads are ready for recording, so no RPC approval is requested. - Independent validation is BLOCKED BY DATA. - CHANGELOG entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The registry is written as bytes, so regenerating it on Windows leaves the tracked file byte-identical. Content unchanged. Co-Authored-By: Claude Opus 5.5 <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.
Adds an optional, experimental ML subsystem (
src/cryptoguard/ml/,mlextra). It is shadow mode only: scores are returned for review and monitored for drift, never written as findings, and off by default. Core install and existing findings are unchanged (a new test asserts identical snapshot findings with ML shadow on and off).Full data card, method and decision log:
ML.md. Generated results:ML_EVALUATION.md.Data
Leakage controls
Results (test set: 129 phishing, 43 benign)
Limitations and failure modes (please read before relying on it)
transfer()calls. Telling them apart needs wallet history, which is exactly what CryptoGuard's poisoning detector uses, so the two are complementary.Verification
mlextra from the wheel. CI results are on this PR.mainandv0.1.0are unchanged. No release, no public visibility change.Phase 11.1 update: generalization audit and hardening (
c11e5fb,9e1bf6e)Decision: research-only; independent data required. The model is reproducible and its metrics are computed correctly, but the benchmark cannot establish generalization. The API no longer scores with it. Details:
ML_GENERALIZATION_AUDIT.md; generated tables:ML_AUDIT_TABLES.md; frozen baseline:docs/ml/baseline-phase11.json. No RPC requests were made in this phase.Reproduction
ml buildandml trainreproduced every model's metrics and a byte-identical model file.What the audit found
transferFromappears in 445 phishing rows and 1 benign row.Defects fixed, with tests
incomplete.research_only/shadow_approved) now gate it.New
cryptoguard ml audit.Verification
9e1bf6eare on this PR.Next: collect a dataset of outgoing payments from ordinary wallets, with histories and a holdout frozen in advance. The cost estimate is in audit section 16, and it needs a new RPC budget decision.
Phase 11.2 update: wallet-centric poisoning research platform
No new RPC requests were made in this phase. The remaining 364 requests of the pilot cap are unused. No model was trained for the new task: its label gate fails (0 verified positives, 0 verified negatives).
Defects fixed
fixture.transactions; the field iswallet_transactions. A broadexcepthid the error, and three completed recordings were lost. Pilot records are now typed and versioned (ml/pilot.py). A schema mismatch raises instead of reading as zero. Lost values migrate as unknown: request counts and signed-transaction counts were recovered from the log, payment counts were not.ML_PILOT_AUDIT.md.task, and the scorer refuses other tasks.New (
src/cryptoguard/ml/)events.py: the poisoning event schema, with victim-event identity, campaign groups (public infrastructure exempt), grouped temporal splits, label tiers that keep weak, verified and conflicting labels apart, outcome records separate from labels, quality gates and a deterministic manifest.poison_hunter.py: typed parser with field provenance.to; 2+1 hex characters of similarity).payments.py: offline payment verifier. It requires a reviewed token, a successful receipt and a matching Transfer log; otherwise the result isunresolved. Fake tokens and spoofedtransferFromare never counted as losses.candidates.py: structural candidate generator, independent of the detector, plus point-in-time event features. Tests cover future events, same-block ordering, input order and unknown history.review.py: export and import of review packets. Packets carry no model score, and label history is kept.planner.pyandcryptoguard ml plan-collection: cost estimates that never collect.cryptoguard ml poisoning-report: regenerates every number from local artifacts.Offline results (
ML_POISONING_TABLES.md)Verification
Phase 11.2 follow-up: cross-check with Tsuchiya et al. payoffs (
2a78397)Downloaded with approval:
payoff_transfers_ethereum.csvonly (KiltHub DOI 10.1184/R1/29212703.v1, CC BY-NC-ND 4.0, 482,397 bytes; MD5 matches KiltHub's). It stays local and is never committed. 0 RPC requests.ml/tsuchiya.py: a typed parser that quarantines bad rows. The hash is pinned there rather than inml/sources.py, sofetch-sourcesnever downloads it unasked.ml poisoning-reportruns it whenever the file is present.affix_matchon every row.Phase 11.3: large-scale dataset integration and cross-dataset validation (
800e682..76acf7e)The 2.32 GB attempt archive, README and notebook were downloaded with approval (KiltHub 10.1184/R1/29212703.v1, CC BY-NC-ND 4.0). Size and MD5 match the published values, SHA-256 is pinned, and the gzip CRC was verified. They stay local and are never committed. 0 RPC requests. No model trained.
Ingestion (
ml/fetch.py,ml/tsuchiya_archive.py)CREATE DATABASE,\connect, one table and one COPY block. It is streamed and never executed.Reconciliation (
ml/reconcile.py,ml/cross_dataset.py)Defects fixed
Decision gates
Verification
gpu/slow), 0 failed.Docs:
ML_CROSS_DATASET_VALIDATION.md, generatedML_CROSS_DATASET_TABLES.md, and updates toML.md,ML_POISONING_DATASET.md,ML_PILOT_AUDIT.md,ML_RESEARCH_PLAN.md, the proposal,CHANGELOG.mdandREADME.md.Frozen review sample (
a273f8a,84ac3c0)cryptoguard ml freeze-review-sampledrew, once and before any review, 60 of the 1,469 payoff-linked packets.transferFrom24, dust 9, zero-value 3.ML_CROSS_DATASET_VALIDATION.md§26. The protocol and pre-specified analysis plan are indocs/ml/review-protocol.md.Phase 11.4: independent annotation and benchmark validation (
5f0fc80..59c8207)Status: review-ready; no human decision exists yet. 0 RPC requests. No model trained.
Frozen sample
cryptoguard ml review audit) passes every check: unique items, one per campaign and per victim, strata partition, allocation reproduced, reserve order, exact weights summing to 1,395.Protocol amendment 1 (written before any review; sample unchanged)
Workflow (
cryptoguard ml review package|serve|status|replace|unblind)Benchmark readiness
Verification
gpu/slow), 0 failed.Docs:
ML_ANNOTATION_AUDIT.md,ML_BENCHMARK_READINESS.md,docs/ml/reviewer-guide.md, protocol amendment 1, and updates to the validation, plan, ML, README and CHANGELOG docs.Blocked on people: two distinct human reviewers (not model sessions) must review the 60 items.
Phase 11.5: offline hard-negative discovery and benchmark contract (
6287f4e..9887446)Status: offline groundwork done. 8,877 unlabeled candidates; a second 35-item cohort is frozen; no human review yet. 0 RPC requests, 0 downloads, no model trained.
Candidate generator (
candidates/2)Hard-negative pool (
ml hard-negative-extract,ml hard-negative-study)unlabeled_candidate, with structural categories A-H.Contamination screen
insufficient_information.Typed grouping: never links events through USDT, USDC, DAI or routers. It always links through counterfeit tokens, shared signers and lookalikes.
Matching and separability
Second cohort (
hard-negative-candidates/1)c68d3a4, with hashes registered.Evaluation contract (
ml/evaluation.py)None.Readiness gates: A and J pass, B passes for implemented features, E passes as identified but not resolved. C, D, F and H are blocked by missing evidence, G fails, I is not yet evaluated. Supervised training is not justified.
Verification
Docs:
ML_HARD_NEGATIVE_STUDY.md, generatedML_HARD_NEGATIVE_TABLES.md, readiness gates inML_BENCHMARK_READINESS.md§8, and updates to the annotation audit, plan, ML docs, README and CHANGELOG.Blocked on people: two human reviewers for both cohorts (60 + 35 items, about 16 reviewer-hours, no RPC).
Phase 11.6: human validation readiness (
3774c70..4fc9d94)State: REVIEW_READY: HUMAN ANNOTATION PENDING. 0 finalized human submissions, 0 of 95 real items reviewed, 190 planned decisions. 0 RPC requests, 0 downloads, no model trained.
Integrity
Evidence packets (
ml review build-evidence, protocol amendment 2)240ba9band registered by hash. Cohort A: 60/60 candidate transfers found, median 22 earlier wallet rows. Cohort B: 19 archive items have no local history.Review app
Annotation quality
review check-submissionreports every problem in a submission.review agreementneeds no key: kappa (undefined, never 0), AC1 and per-reviewer rates.Benchmark
Reliability
OperationalError. It now raises a retryableLeaseBusyError, with diagnostic and deterministic tests.candidates/2suffix bucketing (exact): 10,000 transfers in 0.13 s instead of 13 s, identical output.Gates:
Verification
Docs:
ML_HUMAN_VALIDATION_READINESS.md,docs/ml/reviewer-handoff.md(invitation draft, eligibility, workload assumption, maintainer checklist), protocol amendment 2, and the updated reviewer guide.Next: two independent human reviewers do the training package, then both cohorts. No new data, RPC or authorization needed.
Phase 11.7: evidence completion and review hardening (
1d6f2a0..3a2f94b)State unchanged: REVIEW_READY: HUMAN ANNOTATION PENDING. 0 finalized human submissions, 0 of 95 items reviewed. 0 RPC requests, 0 downloads, no model trained.
Evidence
Diagnostics (label-free, aggregate)
candidates/2re-emits 6 of 1,409 source positives (0.4%), or 51 (3.6%) with an optimistic signer assumption. Its main planting rule needs the signer.Statistics: exact FPR bounds by sample size. 35 negatives cannot show FPR below about 8%; a 1% claim needs about 300 effectively independent negatives.
Hardening
Content-Length(a negative one read until the client closed) and foreignOrigins.candidates/2, an end-to-end synthetic review workflow with failure injection, and a corrupt lease database.Reproducibility
ml verify-researchreports every source, derived file, frozen cohort and evidence set as PASS. Human review and experiment activation are BLOCKED.docs/ml/experiment-spec.json, with fairness rules, label stages and a source-proxy-free ablation.Gates:
Verification: locally, ruff, format and mypy clean (138 files); 776 passed, 4 deselected, 0 failed.
Docs:
ML_EVIDENCE_COMPLETION.md, protocol amendment 3, and updates to the reviewer guide and handoff.Next: two independent human reviewers. Optionally, approve the small signer and receipt request first.
Next experiment: independent review of a stratified sample (about 60) of the payoff-linked review packets, plus matched legitimate look-alike negatives. The negatives need victims' wallet histories, which means a new, separately approved RPC cap sized with
ml plan-collection. Details:ML_CROSS_DATASET_VALIDATION.md§25.Phase 12.1: temporal and graph signals for lookalike prioritization
Commits:
999794aprotocol →12f09a1code and pre-outcome fixes →b552c2d→3153dcfreport.The study was pre-registered in
docs/ml/protocol-12.1.md. Fixes and deviations are indocs/ml/protocol-12.1-deviations.md; F1, F2, D1 and D2 were committed and pushed before any outcome was computed.Task: retrospective and payoff-conditioned. For 1,068 victims who later paid one of k ≥ 2 source-flagged lookalikes, rank the candidates at the block before the payoff, using only point-in-time data. This is not detection: no precision, FPR, recall or AP is estimated.
Primary results (test split, 428 episodes, 427 groups; top-1 against the unchanged production similarity score B0, 0.300; random 0.199):
Checks:
Fixed:
Cost: archive pass 58 min at 344 MiB; study 2 h 16 min at 744 MiB. The 2-minute experiment budget was overrun (D3) because of graph lookups on a shared HDD. 0 RPC requests, no downloads.
Validation: ruff, format and mypy clean (140 files); 816 passed, 4 deselected. CI on
12f09a1failed only at Format; the fix is inb552c2d.Report:
ML_TEMPORAL_GRAPH_RESEARCH.md. Nothing is integrated, the production detector is unchanged, and no warning is suppressed.Next experiment (not started): pre-register recency-first ordering of lookalike warnings on a population not used here.
Phase 12.2: is recency a source-selection artifact?
Commits:
03f1c1dprotocol (frozen before any 12.2 outcome) →623b36dpreload and analysis code (committed before it ran) →ff9f2e3→c0e1012report.Status: every archive result re-examines the episodes whose outcomes Phase 12.1 saw. These are retrospective sensitivity analyses, not independent validation. No untouched outcome population exists locally: the independence gate is blocked by data. Top-1 is retrospective ranking among source-flagged candidates; it is not precision, recall, FPR or a prevented loss.
H3: recorded incidents (descriptive)withdrawn, see Phase 12.3Experimental ranker
ml/warning_rank.py(poisoning-warning-rank/1):Performance:
1dbc763f7058f8c4).Validation:
ml verify-research, with 0 human submissions.detectors/,services/orrisk/.Deviation D1: H2 was not repeated without the 1 overlap episode. Its effect is at most 0.001.
Next experiment (not started): pre-register recency on the 13,683 unconfirmed archive payoffs. They were never examined and never confirmed. It needs two offline passes (about 2 hours), with no RPC.
Phase 12.2 addendum: the source's unconfirmed payoffs
Commits:
8590366protocol (frozen before either pass) →89998d5code (committed before any U row existed) →b3f66aeresults.Phase 12.3: independent incident benchmark (data-limited)
Commits:
f0e4dc1audit and protocol (frozen before discovery) →57273fdbenchmark code (committed before it ran) →f3477f5cohort-exclusion fix →c9e328ereport.runcomputes only the casesverifyadmitted.cryptoguard ml incident-benchmark verify / run / report. It is offline and protocol-bound, rejects oracle candidate lists, and is tested end to end on a synthetic incident.verify-research, with 0 submissions;Incident recording: Stage 0 (
61ad1af) and Stage 1 pilot (0aa1892)replay record,sample-backgroundandrecord-backgroundhad no total request cap. They now reserve every attempt, retries included, in the durable ledger. They require--ledgerand--cap, and fail closed with no partial fixture.replay locate,ml incident-benchmark prepare, and Level I bookkeeping with an on-chain identifier check.eth.drpc.org, with no restart. The 1,525 left over do not carry over.95a7740.mypy srcclean (145 files);61ad1afand0aa1892passed (9 of 9 jobs).Incident recording: Stage 1 audit and Stage 2 preparation (
95a7740, no RPC)0aa1892passed (9 of 9 jobs).Incident recording: Stage 2 Step 0 (
fdffc05, no RPC)replay find-transfers: under the ledger and cap; finds UTC-day block bounds by header-timestamp bisection; reads receipts of the first 10 matches.ml incident-benchmark resolve;verifyandpreparemergecandidates.jsonandstage2-resolved.json.mypy srcclean; 866 passed, 4 deselected. CI passed on95a7740.Incident recording: Stage 2a result (
72cfaf3, 1,433 of an approved 6,000 RPC requests)post_incident_only). The theft recipient's first record in the window is the theft itself, while two other lookalikes of the same reference address were warned before the harm.eth_getLogswas rejected twice (72 + 441 requests), so the stop rule made it not evaluable: RPC. No third attempt and no other endpoint were used.mypy srcclean; 867 passed, 4 deselected. CI passed onfdffc05.Phase 12.4: observation completeness and candidate discovery (
3a79b74..53ddd95, 0 RPC)Commits: protocol frozen first (
3a79b74), then the implementation committed before the study (3917957), then the report (53ddd95). Report.The Stage 2a miss: cause not identifiable from local data. The paid address appears only in the theft records.
observation/1never observed inbound native ETH, zero-value native, internal transfers or ERC-1155.Transferlogs it had fetched, without keeping their counts.observation/2, opt-in (replay record --observation 2):complete/partial/not_collected/unsupported/ …Existing fixtures keep their bytes and hashes.
Shadow
poisoning-candidate-discovery/1:Latent defect:
wallet-history/1reported unobserved inbound activity as zeros (109 values). Fixed in the versionedwallet-history/2-scoped; no published number used them.Hypotheses:
/2window exists; there C1 = C0);Unchanged: the detector, its findings, OP0/OP1 and C0. The frozen cohorts and both Level I results are unchanged.
Validation:
mypy srcclean (149 files);Study: 0.17 s, peak RSS 68 MiB, 0 RPC, 0 downloads.
Q1 (
99f553b, 2 approved RPC requests): the paid address's nonce was 0 before the window and 1 before the theft.Q1b (
d9ca60c, 17 approved RPC requests: 1 failed while outbound connectivity was down, 16 on the one restart; receipt skipped at the cap): the miss is explained.observation/1omission (inbound native ETH).Next (not approved):
observation/2re-recording of this window (about 1,100 requests), to show the wallet-centric path finds the same transfer blindly;Phase 12.4 final validation of observation/2 (
368f652, 0 RPC)observation/2now reads a receipt for every nonzero inbound.replay record-window: outcome-blind recording from the wallet, chain and block window only.observation/2replay (c090814, 1,299 of an approved 2,500 RPC requests):observation/2is sufficient for offline research within its scope: nonzero native inbound to wallets without code./2background windows, and a separately approved detector change.Phase 12.5: ML-driven candidate discovery and evidence-aware ranking (
16586a5..82d54a3, 0 RPC)Commits: protocol frozen first (
16586a5), code committed before the outcome run (0dd8a23), a performance fix with identical outputs (8fbc3a1), then the report. Report.poisoning-candidate-features/1, with value/status pairs that are never zero for unobserved data, and an offline shadow rankingpoisoning-candidate-ranking/1, research CLI only.mypy srcclean; 924 passed, 4 deselected. The study reruns in 27 s at 336 MiB peak RSS. The frozen cohorts are unchanged.observation/2incident windows, with a cap of about 15,000 RPC requests.Phase 12.6: candidate reliability and signer provenance (
c060ccc..f4caf5a, 0 RPC)Commits: protocol frozen first (
c060ccc), code committed before the measured run (8e59c9d), then the report. Report.candidate-evidence/1(research):mypy srcclean;Phase 12.6.1: signer-recovery safety, bounded summaries, research reliability (
5a5e876..5e37788, 0 RPC)Commits: code, tests and amendment (
5a5e876), then the report (§30–§39). The study was run on5a5e876itself: 92 s, 623 MiB peak.foreign_initiated_outwithauthorization = unknown; only zero-value ones arespoofed_out.absence_guard: the inference requires a complete, count-consistent, nonce-contiguous signed set, and code0xat every sample up to the cutoff (no EIP-7702 designator or contract code). Otherwise the signer stays unknown.page()andgroup_records()reach all evidence; nothing is deleted.mypy srcare clean;uv buildand the artifact inspection are OK;Phase 12.7: adversarial candidate exposure and robust top-K selection (
9263dba..073019c, 0 RPC)Commits: protocol frozen first (
9263dba), code committed before the measured run (7ac195f), then post-hoc checks (541c2d2), the post-hoc P1b fix (0968ff8) and the report. The rerun at0968ff8reproduces every registered number exactly.4·affix − 4·jper victim-reference bucket, with keyed-hash ties. It never reads time, the support level or the oracle.mypy srcare clean;ctypes.windllis absent from Linux typeshed). Fixed in073019cwith asys.platformguard; CI #51 (run 42616989227) passed 9 of 9 jobs.🤖 Generated with Claude Code