@jinn-network/client 0.1.6-canary.8de60fc6 → 0.1.6-canary.8e4348ef
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/deployments/deployment-jinn-mvi-l1-sepolia-fast.json +23 -4
- package/deployments/deployment-jinn-mvi-l1-sepolia.json +23 -4
- package/deployments/deployment-jinn-mvi-l2-baseSepolia.json +5 -4
- package/dist/adapters/mech/adapter.d.ts +27 -1
- package/dist/adapters/mech/adapter.js +190 -38
- package/dist/adapters/mech/adapter.js.map +1 -1
- package/dist/adapters/mech/contracts.d.ts +17 -4
- package/dist/adapters/mech/contracts.js +8 -2
- package/dist/adapters/mech/contracts.js.map +1 -1
- package/dist/adapters/mech/safe-revert.d.ts +20 -0
- package/dist/adapters/mech/safe-revert.js +12 -4
- package/dist/adapters/mech/safe-revert.js.map +1 -1
- package/dist/adapters/mech/safe.d.ts +5 -1
- package/dist/adapters/mech/safe.js +27 -8
- package/dist/adapters/mech/safe.js.map +1 -1
- package/dist/adapters/mech/verdict-code.d.ts +1 -0
- package/dist/adapters/mech/verdict-code.js +18 -0
- package/dist/adapters/mech/verdict-code.js.map +1 -1
- package/dist/api/admin-endpoint.d.ts +15 -3
- package/dist/api/admin-endpoint.js +24 -2
- package/dist/api/admin-endpoint.js.map +1 -1
- package/dist/api/bootstrap-endpoint.js +49 -0
- package/dist/api/bootstrap-endpoint.js.map +1 -1
- package/dist/api/codex-doctor-endpoint.d.ts +73 -0
- package/dist/api/codex-doctor-endpoint.js +177 -0
- package/dist/api/codex-doctor-endpoint.js.map +1 -0
- package/dist/api/discovery-endpoint.d.ts +1 -0
- package/dist/api/discovery-endpoint.js +26 -0
- package/dist/api/discovery-endpoint.js.map +1 -1
- package/dist/api/fleet-build.d.ts +1 -0
- package/dist/api/fleet-build.js +2 -1
- package/dist/api/fleet-build.js.map +1 -1
- package/dist/api/gather-status.d.ts +11 -0
- package/dist/api/gather-status.js +400 -4
- package/dist/api/gather-status.js.map +1 -1
- package/dist/api/hermes-doctor-endpoint.d.ts +30 -0
- package/dist/api/hermes-doctor-endpoint.js +44 -5
- package/dist/api/hermes-doctor-endpoint.js.map +1 -1
- package/dist/api/launcher-status.d.ts +21 -16
- package/dist/api/launcher-status.js +2 -1
- package/dist/api/launcher-status.js.map +1 -1
- package/dist/api/portfolio-v0-build.d.ts +10 -0
- package/dist/api/portfolio-v0-build.js +24 -5
- package/dist/api/portfolio-v0-build.js.map +1 -1
- package/dist/api/prediction-v1-build.d.ts +10 -0
- package/dist/api/prediction-v1-build.js +7 -1
- package/dist/api/prediction-v1-build.js.map +1 -1
- package/dist/api/server.d.ts +31 -1
- package/dist/api/server.js +68 -1
- package/dist/api/server.js.map +1 -1
- package/dist/api/setup-endpoints.d.ts +16 -0
- package/dist/api/setup-endpoints.js +78 -4
- package/dist/api/setup-endpoints.js.map +1 -1
- package/dist/api/setup-retry-endpoint.d.ts +19 -0
- package/dist/api/setup-retry-endpoint.js +32 -0
- package/dist/api/setup-retry-endpoint.js.map +1 -0
- package/dist/api/solvernets-endpoints.d.ts +8 -0
- package/dist/api/solvernets-endpoints.js +71 -43
- package/dist/api/solvernets-endpoints.js.map +1 -1
- package/dist/api/status-build.d.ts +72 -0
- package/dist/api/status-build.js +73 -18
- package/dist/api/status-build.js.map +1 -1
- package/dist/api/task-run-routing.d.ts +7 -0
- package/dist/api/task-run-routing.js +12 -0
- package/dist/api/task-run-routing.js.map +1 -0
- package/dist/api/task-runs-build.d.ts +21 -0
- package/dist/api/task-runs-build.js +14 -1
- package/dist/api/task-runs-build.js.map +1 -1
- package/dist/build-info.json +4 -4
- package/dist/build-meta.json +1 -1
- package/dist/chain-read-errors.d.ts +10 -0
- package/dist/chain-read-errors.js +15 -0
- package/dist/chain-read-errors.js.map +1 -1
- package/dist/cli/commands/auth.js +1 -1
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/create.js +3 -2
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts +2 -0
- package/dist/cli/commands/doctor.js +2 -0
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/rewards.js +11 -7
- package/dist/cli/commands/rewards.js.map +1 -1
- package/dist/cli/commands/solver-nets.js +24 -9
- package/dist/cli/commands/solver-nets.js.map +1 -1
- package/dist/cli/commands/status.js +1 -1
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/update.d.ts +10 -0
- package/dist/cli/commands/update.js +36 -0
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/introspection-context.js +5 -0
- package/dist/cli/introspection-context.js.map +1 -1
- package/dist/cli/task-native-readiness.d.ts +3 -1
- package/dist/cli/task-native-readiness.js +28 -6
- package/dist/cli/task-native-readiness.js.map +1 -1
- package/dist/config.d.ts +66 -5
- package/dist/config.js +81 -12
- package/dist/config.js.map +1 -1
- package/dist/daemon/checkpoint-loop.d.ts +48 -0
- package/dist/daemon/checkpoint-loop.js +76 -0
- package/dist/daemon/checkpoint-loop.js.map +1 -0
- package/dist/daemon/creator.d.ts +1 -1
- package/dist/daemon/creator.js +7 -3
- package/dist/daemon/creator.js.map +1 -1
- package/dist/daemon/daemon.d.ts +19 -0
- package/dist/daemon/daemon.js +68 -1
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/eviction-loop.d.ts +40 -0
- package/dist/daemon/eviction-loop.js +67 -0
- package/dist/daemon/eviction-loop.js.map +1 -0
- package/dist/daemon/jinn-claim-loop-wiring.d.ts +33 -0
- package/dist/daemon/jinn-claim-loop-wiring.js +40 -0
- package/dist/daemon/jinn-claim-loop-wiring.js.map +1 -0
- package/dist/daemon/jinn-claim-loop.d.ts +24 -17
- package/dist/daemon/jinn-claim-loop.js +77 -23
- package/dist/daemon/jinn-claim-loop.js.map +1 -1
- package/dist/daemon/skip-log-dedup.d.ts +69 -0
- package/dist/daemon/skip-log-dedup.js +106 -0
- package/dist/daemon/skip-log-dedup.js.map +1 -0
- package/dist/dashboard/assets/index-BUlE8F3Y.js +330 -0
- package/dist/dashboard/assets/index-blqc7eqq.css +32 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/discovery/http.js +114 -0
- package/dist/discovery/http.js.map +1 -1
- package/dist/discovery/onchain.d.ts +5 -0
- package/dist/discovery/onchain.js +407 -15
- package/dist/discovery/onchain.js.map +1 -1
- package/dist/discovery/types.d.ts +45 -1
- package/dist/discovery/types.js +8 -10
- package/dist/discovery/types.js.map +1 -1
- package/dist/discovery/with-fallback.js +3 -0
- package/dist/discovery/with-fallback.js.map +1 -1
- package/dist/earning/bootstrap.d.ts +59 -0
- package/dist/earning/bootstrap.js +146 -41
- package/dist/earning/bootstrap.js.map +1 -1
- package/dist/earning/contracts.d.ts +14 -0
- package/dist/earning/contracts.js +17 -5
- package/dist/earning/contracts.js.map +1 -1
- package/dist/earning/funding-plan.js.map +1 -1
- package/dist/earning/jinn-rewards.d.ts +46 -0
- package/dist/earning/jinn-rewards.js +32 -0
- package/dist/earning/jinn-rewards.js.map +1 -1
- package/dist/earning/safe-adapter.d.ts +2 -0
- package/dist/earning/safe-adapter.js +26 -12
- package/dist/earning/safe-adapter.js.map +1 -1
- package/dist/earning/store.d.ts +8 -0
- package/dist/earning/store.js.map +1 -1
- package/dist/earning/testnet-setup-migration.d.ts +12 -0
- package/dist/earning/testnet-setup-migration.js +27 -1
- package/dist/earning/testnet-setup-migration.js.map +1 -1
- package/dist/earning/types.d.ts +15 -0
- package/dist/erc8004/reputation.d.ts +8 -0
- package/dist/erc8004/reputation.js +22 -3
- package/dist/erc8004/reputation.js.map +1 -1
- package/dist/harnesses/cost-estimates.d.ts +145 -0
- package/dist/harnesses/cost-estimates.js +297 -0
- package/dist/harnesses/cost-estimates.js.map +1 -0
- package/dist/harnesses/engine/engine.d.ts +72 -0
- package/dist/harnesses/engine/engine.js +94 -8
- package/dist/harnesses/engine/engine.js.map +1 -1
- package/dist/harnesses/engine/persistence.d.ts +26 -1
- package/dist/harnesses/engine/persistence.js +47 -3
- package/dist/harnesses/engine/persistence.js.map +1 -1
- package/dist/harnesses/engine/work-dir-reaper.d.ts +65 -0
- package/dist/harnesses/engine/work-dir-reaper.js +100 -0
- package/dist/harnesses/engine/work-dir-reaper.js.map +1 -0
- package/dist/harnesses/impls/hermes-agent/harness.d.ts +7 -1
- package/dist/harnesses/impls/hermes-agent/harness.js +21 -4
- package/dist/harnesses/impls/hermes-agent/harness.js.map +1 -1
- package/dist/harnesses/impls/index.d.ts +5 -0
- package/dist/harnesses/impls/index.js +11 -0
- package/dist/harnesses/impls/index.js.map +1 -1
- package/dist/harnesses/impls/learner/harness.d.ts +38 -4
- package/dist/harnesses/impls/learner/harness.js +96 -2
- package/dist/harnesses/impls/learner/harness.js.map +1 -1
- package/dist/harnesses/impls/learner/plugin-path.d.ts +0 -13
- package/dist/harnesses/impls/learner/plugin-path.js +35 -15
- package/dist/harnesses/impls/learner/plugin-path.js.map +1 -1
- package/dist/harnesses/impls/learner/types.d.ts +11 -0
- package/dist/harnesses/impls/stub.d.ts +58 -0
- package/dist/harnesses/impls/stub.js +89 -0
- package/dist/harnesses/impls/stub.js.map +1 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.d.ts +53 -50
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js +109 -93
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js.map +1 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.d.ts +12 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js +121 -7
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js.map +1 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.d.ts +15 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js +54 -4
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js.map +1 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.d.ts +6 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js +1 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js.map +1 -1
- package/dist/harnesses/readiness-registry.js +9 -1
- package/dist/harnesses/readiness-registry.js.map +1 -1
- package/dist/main.js +352 -79
- package/dist/main.js.map +1 -1
- package/dist/observability/emit-event.d.ts +1 -1
- package/dist/observability/emit-event.js.map +1 -1
- package/dist/operator-errors.d.ts +7 -0
- package/dist/operator-errors.js +13 -1
- package/dist/operator-errors.js.map +1 -1
- package/dist/plugins/learner/.claude-plugin/plugin.json +9 -0
- package/dist/plugins/learner/.codex-plugin/plugin.json +39 -0
- package/dist/plugins/learner/AGENTS.md +40 -0
- package/dist/plugins/learner/CLAUDE.md +33 -0
- package/dist/plugins/learner/README.md +59 -0
- package/dist/plugins/learner/hooks/hooks.json +16 -0
- package/dist/plugins/learner/hooks/session-start +38 -0
- package/dist/plugins/learner/skills/learn/SKILL.md +412 -0
- package/dist/plugins/learner/skills/learn/analyst-prompt.md +68 -0
- package/dist/plugins/learner/skills/learn/consolidator-prompt.md +94 -0
- package/dist/plugins/learner/skills/learn/explorer-prompt.md +53 -0
- package/dist/plugins/learner/skills/learn/planner-prompt.md +87 -0
- package/dist/plugins/learner/skills/learn/promoter-prompt.md +113 -0
- package/dist/plugins/learner/skills/learn/step-worker-prompt.md +47 -0
- package/dist/plugins/learner/skills/learn/strategist-prompt.md +85 -0
- package/dist/restart-daemon.d.ts +8 -0
- package/dist/restart-daemon.js +1 -1
- package/dist/restart-daemon.js.map +1 -1
- package/dist/setup/halt-mode.d.ts +14 -0
- package/dist/setup/halt-mode.js +17 -0
- package/dist/setup/halt-mode.js.map +1 -0
- package/dist/solver-nets/prediction-operator-ux.js +43 -3
- package/dist/solver-nets/prediction-operator-ux.js.map +1 -1
- package/dist/solver-nets/registry.d.ts +1 -0
- package/dist/solver-nets/registry.js +1 -1
- package/dist/solver-nets/registry.js.map +1 -1
- package/dist/solver-types/_swe-rebench-v2-pool-cache.d.ts +58 -0
- package/dist/solver-types/_swe-rebench-v2-pool-cache.js +87 -0
- package/dist/solver-types/_swe-rebench-v2-pool-cache.js.map +1 -0
- package/dist/solver-types/_swe-rebench-v2-substrate.d.ts +1 -0
- package/dist/solver-types/_swe-rebench-v2-substrate.js +10 -0
- package/dist/solver-types/_swe-rebench-v2-substrate.js.map +1 -1
- package/dist/solver-types/_swe-rebench-v2-validated-pool.d.ts +65 -0
- package/dist/solver-types/_swe-rebench-v2-validated-pool.js +243 -26
- package/dist/solver-types/_swe-rebench-v2-validated-pool.js.map +1 -1
- package/dist/solver-types/swe-rebench-v2-auto.d.ts +22 -7
- package/dist/solver-types/swe-rebench-v2-auto.js +45 -20
- package/dist/solver-types/swe-rebench-v2-auto.js.map +1 -1
- package/dist/solver-types/swe-rebench-v2.d.ts +13 -2
- package/dist/solver-types/swe-rebench-v2.js +233 -94
- package/dist/solver-types/swe-rebench-v2.js.map +1 -1
- package/dist/solvernets/daemon-init.d.ts +10 -2
- package/dist/solvernets/daemon-init.js +22 -2
- package/dist/solvernets/daemon-init.js.map +1 -1
- package/dist/solvernets/launched-record-dispatcher.js +35 -7
- package/dist/solvernets/launched-record-dispatcher.js.map +1 -1
- package/dist/solvernets/store.d.ts +5 -0
- package/dist/solvernets/store.js +1 -0
- package/dist/solvernets/store.js.map +1 -1
- package/dist/store/store.d.ts +15 -0
- package/dist/store/store.js +118 -3
- package/dist/store/store.js.map +1 -1
- package/dist/tasks/sources.d.ts +18 -1
- package/dist/tasks/sources.js +33 -5
- package/dist/tasks/sources.js.map +1 -1
- package/dist/tx-retry.d.ts +151 -19
- package/dist/tx-retry.js +286 -32
- package/dist/tx-retry.js.map +1 -1
- package/dist/types/payloads/prediction-apy-v0.d.ts +5 -5
- package/dist/types/payloads/prediction-v0.d.ts +5 -5
- package/dist/util/extract-tx-hash.d.ts +14 -0
- package/dist/util/extract-tx-hash.js +19 -0
- package/dist/util/extract-tx-hash.js.map +1 -0
- package/dist/vendor/@jinn-network/sdk/dist/contracts.js +1 -1
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/manifest-schema.d.ts +3 -0
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/manifest-schema.js +1 -0
- package/package.json +29 -12
- package/dist/dashboard/assets/index-C2Oplf23.js +0 -140
- package/dist/dashboard/assets/index-DOlzFN8a.css +0 -32
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
### Embedded agent surface hidden by default (issue #326)
|
|
6
|
+
|
|
7
|
+
- **The embedded Claude agent chat surface no longer renders in the operator
|
|
8
|
+
app by default.** The right-rail agent panel (running mode) and the
|
|
9
|
+
"Ask Claude" panel (onboarding) are hidden. The 2026-05-19 v0.1.6 dogfood
|
|
10
|
+
found the surface isn't robust enough for first-time operators — it is the
|
|
11
|
+
only daemon-side surface that strictly requires Claude auth, and its
|
|
12
|
+
action-authority / plugin-scope shape is still in design (#177 / #178).
|
|
13
|
+
- **Feature flag: `JINN_ENABLE_EMBEDDED_AGENT`.** Set
|
|
14
|
+
`JINN_ENABLE_EMBEDDED_AGENT=1` (also accepts `true`) to re-enable the
|
|
15
|
+
surface for development. Default is off. When off, the daemon does not
|
|
16
|
+
mount the `/api/agent/ws` bridge and the SPA renders no agent panel; when
|
|
17
|
+
on, the dev-time path works end-to-end as before. (Issue #367: the SPA now
|
|
18
|
+
reads this flag through the injected `window.__JINN_FEATURES__`, the same
|
|
19
|
+
channel as the plug-in builder UI flag — no behaviour change for operators.)
|
|
20
|
+
- **Claude-Code-as-a-solver-harness is unaffected.** Operators can still pick
|
|
21
|
+
Claude Code as their SolverNet harness — that path is independent of the
|
|
22
|
+
embedded chat surface and its WebSocket bridge.
|
|
23
|
+
|
|
24
|
+
### Operator app
|
|
25
|
+
|
|
26
|
+
- **Plug-in builder UI surfaces hidden by default (issue #327).** The `/build`
|
|
27
|
+
route and the Build top-tab no longer appear in the operator app. Hitting
|
|
28
|
+
`/build` by direct URL redirects to `/overview`. The plug-in substrate stays
|
|
29
|
+
fully live — `jinn solver-plugins publish` / `revoke`, the Ponder indexer,
|
|
30
|
+
the Discovery API endpoints, and the `client/docs/build/` tree are
|
|
31
|
+
unchanged, so direct-CLI builders following the docs are not blocked. The
|
|
32
|
+
surfaces are gated to keep the operator-app first-run UX focused; they will
|
|
33
|
+
be re-promoted once that UX is solid and plug-in indexing is end-to-end
|
|
34
|
+
populated. Set `JINN_ENABLE_PLUGIN_BUILDER_UI=1` on the daemon to re-enable
|
|
35
|
+
the full builder surface for development and design work — the daemon injects
|
|
36
|
+
the flag into the SPA via `window.__JINN_FEATURES__`.
|
|
37
|
+
|
|
5
38
|
### SWE-rebench v2 admission
|
|
6
39
|
|
|
7
40
|
- **Admission semantics bumped from `'2'` → `'3'`.** Operators running the
|
|
@@ -20,8 +20,13 @@
|
|
|
20
20
|
},
|
|
21
21
|
"messenger": {
|
|
22
22
|
"mode": "mock",
|
|
23
|
-
"address": "
|
|
24
|
-
"owner": "
|
|
23
|
+
"address": "0xd229A2C20333B747675090Ce38B8a1Fb2dafe6AC",
|
|
24
|
+
"owner": "0x15e78734481bD31F6e183dad05225505a45ACd07",
|
|
25
|
+
"previousAddress": "0x30E2f1A5691a999053A54e8DAf9496CD7ccF2DFD",
|
|
26
|
+
"rotatedAt": "2026-05-20T17:14:48.591Z",
|
|
27
|
+
"deployTxHash": "0x44c0fc6f92e1c8247304dceb195b8cfa1ae114a79e7a6ce1305e4305de45b9af",
|
|
28
|
+
"setMessengerTxHash": "0x13313c9cc29ae9d7ce1e13ca78472359fdb6213b5d1d936d73f89ca051867c00",
|
|
29
|
+
"rotationBlockNumber": 10886858
|
|
25
30
|
},
|
|
26
31
|
"handover": {
|
|
27
32
|
"renounceAdmin": false
|
|
@@ -31,6 +36,20 @@
|
|
|
31
36
|
"TimelockController": "0x5CE9c7E24f0509490a91a1cD285DDFF70A9C058D",
|
|
32
37
|
"JinnGovernor": "0xbbc43A1B5AC699de09577dAE4A1007a3bA704D9E",
|
|
33
38
|
"JinnDistributor": "0xaC9CD847660d05e77D82A3684aFC4EbFd94fBfe6",
|
|
34
|
-
"Messenger": "
|
|
35
|
-
|
|
39
|
+
"Messenger": "0xd229A2C20333B747675090Ce38B8a1Fb2dafe6AC",
|
|
40
|
+
"MockMessenger": "0xd229A2C20333B747675090Ce38B8a1Fb2dafe6AC"
|
|
41
|
+
},
|
|
42
|
+
"rotations": [
|
|
43
|
+
{
|
|
44
|
+
"type": "mock-messenger",
|
|
45
|
+
"previousMessenger": "0x30E2f1A5691a999053A54e8DAf9496CD7ccF2DFD",
|
|
46
|
+
"newMessenger": "0xd229A2C20333B747675090Ce38B8a1Fb2dafe6AC",
|
|
47
|
+
"owner": "0x15e78734481bD31F6e183dad05225505a45ACd07",
|
|
48
|
+
"distributor": "0xaC9CD847660d05e77D82A3684aFC4EbFd94fBfe6",
|
|
49
|
+
"deployTxHash": "0x44c0fc6f92e1c8247304dceb195b8cfa1ae114a79e7a6ce1305e4305de45b9af",
|
|
50
|
+
"setMessengerTxHash": "0x13313c9cc29ae9d7ce1e13ca78472359fdb6213b5d1d936d73f89ca051867c00",
|
|
51
|
+
"blockNumber": 10886858,
|
|
52
|
+
"rotatedAt": "2026-05-20T17:14:48.591Z"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
36
55
|
}
|
|
@@ -20,8 +20,13 @@
|
|
|
20
20
|
},
|
|
21
21
|
"messenger": {
|
|
22
22
|
"mode": "mock",
|
|
23
|
-
"address": "
|
|
24
|
-
"owner": "
|
|
23
|
+
"address": "0xd229A2C20333B747675090Ce38B8a1Fb2dafe6AC",
|
|
24
|
+
"owner": "0x15e78734481bD31F6e183dad05225505a45ACd07",
|
|
25
|
+
"previousAddress": "0x30E2f1A5691a999053A54e8DAf9496CD7ccF2DFD",
|
|
26
|
+
"rotatedAt": "2026-05-20T17:14:48.591Z",
|
|
27
|
+
"deployTxHash": "0x44c0fc6f92e1c8247304dceb195b8cfa1ae114a79e7a6ce1305e4305de45b9af",
|
|
28
|
+
"setMessengerTxHash": "0x13313c9cc29ae9d7ce1e13ca78472359fdb6213b5d1d936d73f89ca051867c00",
|
|
29
|
+
"rotationBlockNumber": 10886858
|
|
25
30
|
},
|
|
26
31
|
"handover": {
|
|
27
32
|
"renounceAdmin": false
|
|
@@ -31,6 +36,20 @@
|
|
|
31
36
|
"TimelockController": "0x5CE9c7E24f0509490a91a1cD285DDFF70A9C058D",
|
|
32
37
|
"JinnGovernor": "0xbbc43A1B5AC699de09577dAE4A1007a3bA704D9E",
|
|
33
38
|
"JinnDistributor": "0xaC9CD847660d05e77D82A3684aFC4EbFd94fBfe6",
|
|
34
|
-
"Messenger": "
|
|
35
|
-
|
|
39
|
+
"Messenger": "0xd229A2C20333B747675090Ce38B8a1Fb2dafe6AC",
|
|
40
|
+
"MockMessenger": "0xd229A2C20333B747675090Ce38B8a1Fb2dafe6AC"
|
|
41
|
+
},
|
|
42
|
+
"rotations": [
|
|
43
|
+
{
|
|
44
|
+
"type": "mock-messenger",
|
|
45
|
+
"previousMessenger": "0x30E2f1A5691a999053A54e8DAf9496CD7ccF2DFD",
|
|
46
|
+
"newMessenger": "0xd229A2C20333B747675090Ce38B8a1Fb2dafe6AC",
|
|
47
|
+
"owner": "0x15e78734481bD31F6e183dad05225505a45ACd07",
|
|
48
|
+
"distributor": "0xaC9CD847660d05e77D82A3684aFC4EbFd94fBfe6",
|
|
49
|
+
"deployTxHash": "0x44c0fc6f92e1c8247304dceb195b8cfa1ae114a79e7a6ce1305e4305de45b9af",
|
|
50
|
+
"setMessengerTxHash": "0x13313c9cc29ae9d7ce1e13ca78472359fdb6213b5d1d936d73f89ca051867c00",
|
|
51
|
+
"blockNumber": 10886858,
|
|
52
|
+
"rotatedAt": "2026-05-20T17:14:48.591Z"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
36
55
|
}
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
"network": "baseSepolia",
|
|
3
3
|
"chainId": 84532,
|
|
4
4
|
"deployer": "0x15e78734481bD31F6e183dad05225505a45ACd07",
|
|
5
|
-
"deployedAt": "2026-
|
|
5
|
+
"deployedAt": "2026-05-20T15:23:10.000Z",
|
|
6
|
+
"deployBlock": 41761151,
|
|
7
|
+
"txHash": "0x97524384c024a2bcfe11b3699bad53e8533bc25f43e64101ce1e0e4170491f9b",
|
|
6
8
|
"contracts": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"JinnRouterV2": "0x13dae57a54A7DF862113BcA8Ee2fd3dEf6a6A94A",
|
|
9
|
+
"TaskClaimEmitter": "0xF60055534E377F4020eEA80356C0643E02f4f307",
|
|
10
|
+
"TaskActivityCheckerV3": "0x0e1B5f264F4FAdcFAA950fb00c58d9A39C040f70",
|
|
10
11
|
"ServiceRegistry": "0x31D3202d8744B16A120117A053459DDFAE93c855"
|
|
11
12
|
}
|
|
12
13
|
}
|
|
@@ -51,6 +51,9 @@ export declare class MechAdapter implements ExecutionAdapter {
|
|
|
51
51
|
private persistPendingEvaluationSolutions;
|
|
52
52
|
private rememberPendingEvaluationSolution;
|
|
53
53
|
private forgetPendingEvaluationSolution;
|
|
54
|
+
private clearPendingDeliveryRecoveryState;
|
|
55
|
+
private recoveryDeliveryExpirySeconds;
|
|
56
|
+
private shouldSkipExpiredRecoveryDelivery;
|
|
54
57
|
postTask(state: Task): Promise<PostedTask>;
|
|
55
58
|
private signTaskDocument;
|
|
56
59
|
private contractPolicyForTask;
|
|
@@ -58,6 +61,17 @@ export declare class MechAdapter implements ExecutionAdapter {
|
|
|
58
61
|
private restorationAnnouncementForTaskId;
|
|
59
62
|
private restorationAnnouncementFromDigest;
|
|
60
63
|
private discoverSubgraphRestorationTasks;
|
|
64
|
+
/**
|
|
65
|
+
* Look up the Deliver-event envelope CID for a pending evaluation solution.
|
|
66
|
+
*
|
|
67
|
+
* Returns `null` when the Deliver event is not present in the configured
|
|
68
|
+
* lookback window. This is a terminal signal for the caller — re-running the
|
|
69
|
+
* same lookup later is deterministically futile when `solution.blockNumber`
|
|
70
|
+
* is set (toBlock is fixed at the SolutionDeliveryClaimed block), and is
|
|
71
|
+
* monotonically less likely to find the event when toBlock follows chain head
|
|
72
|
+
* (the window slides forward, away from any older Deliver event). Callers
|
|
73
|
+
* should prune the pending solution on `null` rather than retry — see #553.
|
|
74
|
+
*/
|
|
61
75
|
private deliveryEnvelopeCidForSolution;
|
|
62
76
|
private evaluationAnnouncementForSolution;
|
|
63
77
|
private retryPendingEvaluationSolutions;
|
|
@@ -74,8 +88,20 @@ export declare class MechAdapter implements ExecutionAdapter {
|
|
|
74
88
|
}>;
|
|
75
89
|
submitSolutionDelivery(requestId: RequestId, solutionDigest: Hex): Promise<void>;
|
|
76
90
|
submitVerdictDelivery(requestId: RequestId, verdictDigest: Hex, verdictCode: VerdictCode): Promise<void>;
|
|
77
|
-
private
|
|
91
|
+
private deliveryClaimForDelivery;
|
|
78
92
|
private ensureDeliveryClaimed;
|
|
93
|
+
/**
|
|
94
|
+
* Paginate `getLogs` over `[deliveryBlockCursor+1, currentBlock]` chunked by
|
|
95
|
+
* `DEFAULT_ROUTER_LOG_CHUNK_BLOCKS` to honor RPC provider block-range limits
|
|
96
|
+
* (Tenderly base-sepolia caps at 100k; sepolia.base.org ~1k). Advances +
|
|
97
|
+
* persists `deliveryBlockCursor` per chunk so a mid-scan RPC failure on a
|
|
98
|
+
* later chunk does not strand the cursor at the pre-poll value (#552).
|
|
99
|
+
*
|
|
100
|
+
* Yields each chunk's decoded Deliver entries so the consumer can process
|
|
101
|
+
* them with the live "current block" context (needed for the recovery-
|
|
102
|
+
* delivery timestamp cache).
|
|
103
|
+
*/
|
|
104
|
+
private scanDeliveryLogChunks;
|
|
79
105
|
watchForDeliveries(): AsyncIterable<DeliveredResult>;
|
|
80
106
|
stop(): Promise<void>;
|
|
81
107
|
}
|
|
@@ -6,8 +6,10 @@ import { PermanentError, parseTask } from '../../types/index.js';
|
|
|
6
6
|
import { createClients } from './safe.js';
|
|
7
7
|
import { buildResultPayload, uploadToIpfs, cidToDigestHex, fetchFromIpfs, fetchSignedTaskFromIpfs, fetchSignedEnvelopeFromIpfs, } from './ipfs.js';
|
|
8
8
|
import { canonicalJson } from '../../harnesses/engine/canonical-json.js';
|
|
9
|
-
import { SignedEnvelopeSchema } from '../../types/envelope.js';
|
|
9
|
+
import { normalizeEnvelopeRole, SignedEnvelopeSchema } from '../../types/envelope.js';
|
|
10
10
|
import { submitTask, claimTask as claimTaskOnchain, claimEvaluation as claimEvaluationOnchain, claimDelivery, getMechDeliveryRate, getTimeoutBounds, decodeTaskCreatedLogs, decodeSolutionDeliveryClaimedLogs, decodeDeliverLogs, findLatestDeliveryDataHexForRequest, getMarketplaceRequestDeliveryMech, getTaskCidDigest, callDeliverToMarketplace, canClaimTask, canClaimEvaluation, } from './contracts.js';
|
|
11
|
+
import { isNonRecoverableInnerRevert } from './safe-revert.js';
|
|
12
|
+
import { verdictCodeFromValue } from './verdict-code.js';
|
|
11
13
|
import { manifestDigestForCid } from './digest.js';
|
|
12
14
|
import { withRecoverableRetry } from '../../tx-retry.js';
|
|
13
15
|
import { formatRpcError } from '../../rpc-error-context.js';
|
|
@@ -16,6 +18,28 @@ import { signTaskV1 } from '../../tasks/signing.js';
|
|
|
16
18
|
const ROUTER_REQUEST_CURSOR_CONFIG_KEY = 'mech_router_request_block_cursor_v1';
|
|
17
19
|
const PENDING_EVALUATION_SOLUTIONS_CONFIG_KEY = 'mech_pending_evaluation_solutions_v1';
|
|
18
20
|
const DEFAULT_MECH_DELIVER_BACKFILL_LOOKBACK_BLOCKS = 100000n;
|
|
21
|
+
/** Yield to the event loop every N evaluation opportunities so a large retry
|
|
22
|
+
* backlog can't starve the HTTP API mid-cycle. */
|
|
23
|
+
const EVALUATION_RETRY_YIELD_EVERY = 10;
|
|
24
|
+
/**
|
|
25
|
+
* Decide whether a `canClaimEvaluation` failure means the opportunity can NEVER
|
|
26
|
+
* become claimable (terminal, prune it) versus one that could still clear later
|
|
27
|
+
* (transient, keep retrying).
|
|
28
|
+
*
|
|
29
|
+
* Classification is done on the *structured* `revertName` decoded straight from
|
|
30
|
+
* the inner revert data — not by regex-unformatting the operator-facing `reason`
|
|
31
|
+
* string. The format→regex round-trip was fragile: an arg value containing a
|
|
32
|
+
* `(` corrupted the strip, and the `flattenErrorMessage` fallback produced
|
|
33
|
+
* arbitrary text the regex mangled, silently mis-classifying opportunities.
|
|
34
|
+
*
|
|
35
|
+
* A false-keep (re-checking a dead opportunity) only costs one more RPC; a
|
|
36
|
+
* false-prune (dropping a still-claimable opportunity) loses real work — so
|
|
37
|
+
* when in doubt we keep. Anything without a known non-recoverable revert name
|
|
38
|
+
* is treated as transient.
|
|
39
|
+
*/
|
|
40
|
+
function isTerminalEvaluationReason(revertName) {
|
|
41
|
+
return isNonRecoverableInnerRevert(revertName);
|
|
42
|
+
}
|
|
19
43
|
const DEFAULT_ROUTER_LOG_CHUNK_BLOCKS = 9999n;
|
|
20
44
|
/**
|
|
21
45
|
* Floor block for the on-chain TaskCreated backlog scan, per chain.
|
|
@@ -236,6 +260,35 @@ export class MechAdapter {
|
|
|
236
260
|
return;
|
|
237
261
|
this.persistPendingEvaluationSolutions();
|
|
238
262
|
}
|
|
263
|
+
clearPendingDeliveryRecoveryState(requestId) {
|
|
264
|
+
this.originalStates.delete(requestId);
|
|
265
|
+
this.pendingEvaluations.delete(requestId);
|
|
266
|
+
this.requestKinds.delete(requestId);
|
|
267
|
+
}
|
|
268
|
+
recoveryDeliveryExpirySeconds(requestId) {
|
|
269
|
+
const task = this.originalStates.get(requestId) ?? this.pendingEvaluations.get(requestId);
|
|
270
|
+
const claimPolicy = task?.claimPolicy ?? DEFAULT_MECH_CLAIM_POLICY;
|
|
271
|
+
const normalizeTsToSeconds = (value) => {
|
|
272
|
+
if (value == null)
|
|
273
|
+
return undefined;
|
|
274
|
+
return value > 10_000_000_000 ? Math.floor(value / 1000) : value;
|
|
275
|
+
};
|
|
276
|
+
const submissionDeadlineSeconds = normalizeTsToSeconds(claimPolicy.submissionDeadlineTs);
|
|
277
|
+
if (submissionDeadlineSeconds != null)
|
|
278
|
+
return submissionDeadlineSeconds;
|
|
279
|
+
const claimWindowEndSeconds = normalizeTsToSeconds(claimPolicy.claimWindowEndTs ?? task?.window?.endTs);
|
|
280
|
+
if (claimWindowEndSeconds == null)
|
|
281
|
+
return undefined;
|
|
282
|
+
return claimWindowEndSeconds + claimPolicy.claimLeaseTtlSeconds;
|
|
283
|
+
}
|
|
284
|
+
shouldSkipExpiredRecoveryDelivery(requestId, currentChainTimestampSeconds, recoveryExpirySeconds) {
|
|
285
|
+
if (currentChainTimestampSeconds <= recoveryExpirySeconds)
|
|
286
|
+
return false;
|
|
287
|
+
console.error(`[mech] skipping recovery delivery for ${requestId}: ` +
|
|
288
|
+
`submission deadline expired at ${new Date(recoveryExpirySeconds * 1000).toISOString()}`);
|
|
289
|
+
this.clearPendingDeliveryRecoveryState(requestId);
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
239
292
|
async postTask(state) {
|
|
240
293
|
const restorationState = {
|
|
241
294
|
...state,
|
|
@@ -478,6 +531,17 @@ export class MechAdapter {
|
|
|
478
531
|
}
|
|
479
532
|
}
|
|
480
533
|
}
|
|
534
|
+
/**
|
|
535
|
+
* Look up the Deliver-event envelope CID for a pending evaluation solution.
|
|
536
|
+
*
|
|
537
|
+
* Returns `null` when the Deliver event is not present in the configured
|
|
538
|
+
* lookback window. This is a terminal signal for the caller — re-running the
|
|
539
|
+
* same lookup later is deterministically futile when `solution.blockNumber`
|
|
540
|
+
* is set (toBlock is fixed at the SolutionDeliveryClaimed block), and is
|
|
541
|
+
* monotonically less likely to find the event when toBlock follows chain head
|
|
542
|
+
* (the window slides forward, away from any older Deliver event). Callers
|
|
543
|
+
* should prune the pending solution on `null` rather than retry — see #553.
|
|
544
|
+
*/
|
|
481
545
|
async deliveryEnvelopeCidForSolution(solution) {
|
|
482
546
|
const deliveryMech = await getMarketplaceRequestDeliveryMech(this.publicClient, this.config.mechMarketplaceAddress, solution.requestId);
|
|
483
547
|
const toBlock = solution.blockNumber != null
|
|
@@ -488,8 +552,7 @@ export class MechAdapter {
|
|
|
488
552
|
const fromBlock = toBlock > lookback ? toBlock - lookback : 0n;
|
|
489
553
|
const deliveryDataHex = await findLatestDeliveryDataHexForRequest(this.publicClient, deliveryMech, solution.requestId, fromBlock, toBlock);
|
|
490
554
|
if (!deliveryDataHex) {
|
|
491
|
-
|
|
492
|
-
`between blocks ${fromBlock} and ${toBlock}`);
|
|
555
|
+
return null;
|
|
493
556
|
}
|
|
494
557
|
const digest = deliveryDataHex.startsWith('0x') ? deliveryDataHex.slice(2) : deliveryDataHex;
|
|
495
558
|
return `f01551220${digest}`;
|
|
@@ -500,14 +563,34 @@ export class MechAdapter {
|
|
|
500
563
|
this.forgetPendingEvaluationSolution(solution.requestId);
|
|
501
564
|
return undefined;
|
|
502
565
|
}
|
|
503
|
-
|
|
566
|
+
// Cheap claimability gate FIRST — before the restoration lookup + IPFS
|
|
567
|
+
// fetch. A backlog of terminal opportunities (finalized / evaluation
|
|
568
|
+
// deadline passed / max verdicts reached) must not pay the expensive
|
|
569
|
+
// restoration-announcement cost on every poll cycle. Terminal reasons are
|
|
570
|
+
// pruned from the working set so the loop never re-scans on-chain history;
|
|
571
|
+
// transient reasons are left in place to be retried next cycle.
|
|
504
572
|
const claimable = await canClaimEvaluation(this.publicClient, this.config.safeAddress, this.config.routerAddress, solution.taskId, solution.attemptIndex, this.config.mechContractAddress);
|
|
505
573
|
if (!claimable.ok) {
|
|
506
|
-
|
|
507
|
-
|
|
574
|
+
const terminal = isTerminalEvaluationReason(claimable.revertName);
|
|
575
|
+
console.log(`[mech] skipping evaluation opportunity ${solution.requestId} for task ${solution.taskId}/${solution.attemptIndex}: ${claimable.reason}` +
|
|
576
|
+
(terminal ? ' (terminal — pruned)' : ' (transient — will retry)'));
|
|
577
|
+
if (terminal) {
|
|
578
|
+
this.forgetPendingEvaluationSolution(solution.requestId);
|
|
579
|
+
}
|
|
508
580
|
return undefined;
|
|
509
581
|
}
|
|
582
|
+
const restoration = await this.restorationAnnouncementForTaskId(solution.taskId);
|
|
510
583
|
const solutionEnvelopeCid = await this.deliveryEnvelopeCidForSolution(solution);
|
|
584
|
+
if (solutionEnvelopeCid == null) {
|
|
585
|
+
// #553: Deliver event is not within the configured lookback window. A
|
|
586
|
+
// retry with the same toBlock cannot reach an older event, so this is
|
|
587
|
+
// terminal — prune so the loop never re-pays the canClaimEvaluation +
|
|
588
|
+
// restoration lookup cost on a deterministically-failing opportunity.
|
|
589
|
+
console.log(`[mech] pruning evaluation opportunity ${solution.requestId} for task ${solution.taskId}/${solution.attemptIndex}: ` +
|
|
590
|
+
`no Deliver event found within configured lookback (terminal — pruned)`);
|
|
591
|
+
this.forgetPendingEvaluationSolution(solution.requestId);
|
|
592
|
+
return undefined;
|
|
593
|
+
}
|
|
511
594
|
const resultPayload = await fetchFromIpfs(this.config.ipfsGatewayUrl, solutionEnvelopeCid);
|
|
512
595
|
const resultData = resultPayload.data ?? JSON.stringify(resultPayload);
|
|
513
596
|
const evaluationTask = this.buildEvaluationTask({
|
|
@@ -535,15 +618,21 @@ export class MechAdapter {
|
|
|
535
618
|
return announcement;
|
|
536
619
|
}
|
|
537
620
|
async *retryPendingEvaluationSolutions() {
|
|
621
|
+
let processed = 0;
|
|
538
622
|
for (const [requestId, solution] of Array.from(this.pendingEvaluationSolutions)) {
|
|
623
|
+
// Yield to the event loop periodically so a large backlog of pending
|
|
624
|
+
// evaluation solutions can't starve the HTTP API mid-cycle.
|
|
625
|
+
if (processed > 0 && processed % EVALUATION_RETRY_YIELD_EVERY === 0) {
|
|
626
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
627
|
+
}
|
|
628
|
+
processed++;
|
|
539
629
|
try {
|
|
540
630
|
const announcement = await this.evaluationAnnouncementForSolution(solution);
|
|
541
631
|
if (announcement) {
|
|
542
632
|
yield announcement;
|
|
543
633
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
}
|
|
634
|
+
// No announcement does NOT mean "forget" — pruning is owned by
|
|
635
|
+
// evaluationAnnouncementForSolution, which only removes terminal cases.
|
|
547
636
|
}
|
|
548
637
|
catch (err) {
|
|
549
638
|
console.error(`[mech] evaluation opportunity retry failed for ${requestId}:`, err);
|
|
@@ -676,9 +765,13 @@ export class MechAdapter {
|
|
|
676
765
|
async submitVerdictDelivery(requestId, verdictDigest, verdictCode) {
|
|
677
766
|
await claimDelivery(this.publicClient, this.walletClient, this.config.safeAddress, this.config.routerAddress, requestId, { variant: 'v3', kind: 'verdict', evidenceHash: verdictDigest, verdictCode }, this.config.evictionRecovery);
|
|
678
767
|
}
|
|
679
|
-
async
|
|
768
|
+
async deliveryClaimForDelivery(requestId, deliveryDataHex) {
|
|
769
|
+
const fallbackKind = this.requestKinds.get(requestId) ?? 'solution';
|
|
680
770
|
if (this.config.routerClaimDeliveryVariant !== 'v2' && this.config.routerClaimDeliveryVariant !== 'v3') {
|
|
681
|
-
return
|
|
771
|
+
return {
|
|
772
|
+
evidenceHash: undefined,
|
|
773
|
+
kind: fallbackKind,
|
|
774
|
+
};
|
|
682
775
|
}
|
|
683
776
|
const deliveryDigest = deliveryDataHex.startsWith('0x')
|
|
684
777
|
? deliveryDataHex.slice(2)
|
|
@@ -686,11 +779,6 @@ export class MechAdapter {
|
|
|
686
779
|
const envelopeCid = `f01551220${deliveryDigest}`;
|
|
687
780
|
const rawEnvelope = await fetchSignedEnvelopeFromIpfs(this.config.ipfsGatewayUrl, envelopeCid);
|
|
688
781
|
const parsed = SignedEnvelopeSchema.parse(rawEnvelope);
|
|
689
|
-
// Strip signature to recompute the hash over the unsigned body.
|
|
690
|
-
//
|
|
691
|
-
// Important: compute over the fetched wire object, not over the parsed
|
|
692
|
-
// schema result. The schema normalizes some nested objects and may strip
|
|
693
|
-
// extension metadata that was present when the envelope was signed.
|
|
694
782
|
const rawSigned = rawEnvelope;
|
|
695
783
|
const { signature: _rawSignature, ...unsignedBody } = rawSigned;
|
|
696
784
|
const signature = parsed.signature;
|
|
@@ -699,22 +787,36 @@ export class MechAdapter {
|
|
|
699
787
|
if (recomputed !== signature.hash) {
|
|
700
788
|
throw new Error(`recomputed hash ${recomputed} !== envelope.signature.hash ${signature.hash}`);
|
|
701
789
|
}
|
|
702
|
-
|
|
790
|
+
const role = normalizeEnvelopeRole(parsed.role);
|
|
791
|
+
if (role === 'capture') {
|
|
792
|
+
throw new Error(`unsupported delivery envelope role=capture for requestId ${requestId}`);
|
|
793
|
+
}
|
|
794
|
+
const kind = role === 'verdict' ? 'verdict' : 'solution';
|
|
795
|
+
const payload = rawSigned['payload'];
|
|
796
|
+
const rawVerdict = payload != null && typeof payload === 'object'
|
|
797
|
+
? payload['verdict']
|
|
798
|
+
: undefined;
|
|
799
|
+
return {
|
|
800
|
+
evidenceHash: recomputed,
|
|
801
|
+
kind,
|
|
802
|
+
verdictCode: kind === 'verdict' ? verdictCodeFromValue(rawVerdict) : undefined,
|
|
803
|
+
};
|
|
703
804
|
}
|
|
704
805
|
async ensureDeliveryClaimed(requestId, deliveryDataHex) {
|
|
705
|
-
let
|
|
806
|
+
let claimOptions;
|
|
706
807
|
try {
|
|
707
|
-
|
|
808
|
+
claimOptions = await this.deliveryClaimForDelivery(requestId, deliveryDataHex);
|
|
708
809
|
}
|
|
709
810
|
catch (err) {
|
|
710
|
-
console.error(`[mech]
|
|
811
|
+
console.error(`[mech] delivery claim metadata derivation failed for ${requestId} — skipping claim, will retry on next loop:`, err);
|
|
711
812
|
return 'retry';
|
|
712
813
|
}
|
|
713
814
|
try {
|
|
714
815
|
await claimDelivery(this.publicClient, this.walletClient, this.config.safeAddress, this.config.routerAddress, requestId, {
|
|
715
816
|
variant: this.config.routerClaimDeliveryVariant,
|
|
716
|
-
kind:
|
|
717
|
-
evidenceHash,
|
|
817
|
+
kind: claimOptions.kind,
|
|
818
|
+
evidenceHash: claimOptions.evidenceHash,
|
|
819
|
+
verdictCode: claimOptions.verdictCode,
|
|
718
820
|
}, this.config.evictionRecovery);
|
|
719
821
|
return 'claimed';
|
|
720
822
|
}
|
|
@@ -731,19 +833,49 @@ export class MechAdapter {
|
|
|
731
833
|
return 'retry';
|
|
732
834
|
}
|
|
733
835
|
}
|
|
836
|
+
/**
|
|
837
|
+
* Paginate `getLogs` over `[deliveryBlockCursor+1, currentBlock]` chunked by
|
|
838
|
+
* `DEFAULT_ROUTER_LOG_CHUNK_BLOCKS` to honor RPC provider block-range limits
|
|
839
|
+
* (Tenderly base-sepolia caps at 100k; sepolia.base.org ~1k). Advances +
|
|
840
|
+
* persists `deliveryBlockCursor` per chunk so a mid-scan RPC failure on a
|
|
841
|
+
* later chunk does not strand the cursor at the pre-poll value (#552).
|
|
842
|
+
*
|
|
843
|
+
* Yields each chunk's decoded Deliver entries so the consumer can process
|
|
844
|
+
* them with the live "current block" context (needed for the recovery-
|
|
845
|
+
* delivery timestamp cache).
|
|
846
|
+
*/
|
|
847
|
+
async *scanDeliveryLogChunks(currentBlock) {
|
|
848
|
+
while (currentBlock > this.deliveryBlockCursor) {
|
|
849
|
+
const chunkStart = this.deliveryBlockCursor + 1n;
|
|
850
|
+
const chunkEnd = chunkStart + DEFAULT_ROUTER_LOG_CHUNK_BLOCKS > currentBlock
|
|
851
|
+
? currentBlock
|
|
852
|
+
: chunkStart + DEFAULT_ROUTER_LOG_CHUNK_BLOCKS;
|
|
853
|
+
const logs = await this.publicClient.getLogs({
|
|
854
|
+
address: this.config.mechContractAddress,
|
|
855
|
+
fromBlock: chunkStart,
|
|
856
|
+
toBlock: chunkEnd,
|
|
857
|
+
});
|
|
858
|
+
// Advance + persist BEFORE yielding so partial progress is durable even
|
|
859
|
+
// if a downstream throw escapes back through the for-await consumer.
|
|
860
|
+
this.deliveryBlockCursor = chunkEnd;
|
|
861
|
+
if (this.store) {
|
|
862
|
+
this.store.setLastProcessedBlock(this.deliveryBlockCursor);
|
|
863
|
+
}
|
|
864
|
+
yield decodeDeliverLogs(logs);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
734
867
|
async *watchForDeliveries() {
|
|
735
868
|
while (!this.stopped) {
|
|
736
869
|
try {
|
|
737
870
|
const currentBlock = await this.publicClient.getBlockNumber();
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
const
|
|
746
|
-
for (const { requestId, deliveryDataHex, mechAddress } of decoded) {
|
|
871
|
+
// Caches scoped to the whole poll iteration: the "current block"
|
|
872
|
+
// reference does not change across chunks.
|
|
873
|
+
const blockTimestampSecondsByNumber = new Map();
|
|
874
|
+
let currentBlockTimestampSeconds;
|
|
875
|
+
for await (const decoded of this.scanDeliveryLogChunks(currentBlock)) {
|
|
876
|
+
if (this.stopped)
|
|
877
|
+
break;
|
|
878
|
+
for (const { requestId, deliveryDataHex, mechAddress, blockNumber } of decoded) {
|
|
747
879
|
// Two concerns, independent:
|
|
748
880
|
// (a) Did this Safe DELIVER this? → claim it (counter credit goes to msg.sender)
|
|
749
881
|
// The Deliver event's mechAddress is mechServiceMultisig (the Safe that owns
|
|
@@ -753,6 +885,30 @@ export class MechAdapter {
|
|
|
753
885
|
const iCreatedRestoration = this.pendingEvaluations.has(requestId);
|
|
754
886
|
if (!iDelivered && !iCreatedRestoration)
|
|
755
887
|
continue;
|
|
888
|
+
if (iCreatedRestoration) {
|
|
889
|
+
const recoveryExpirySeconds = this.recoveryDeliveryExpirySeconds(requestId);
|
|
890
|
+
if (recoveryExpirySeconds != null) {
|
|
891
|
+
let deliveryTimestampSeconds;
|
|
892
|
+
if (blockNumber != null) {
|
|
893
|
+
deliveryTimestampSeconds = blockTimestampSecondsByNumber.get(blockNumber);
|
|
894
|
+
if (deliveryTimestampSeconds == null) {
|
|
895
|
+
const deliveryBlockData = await this.publicClient.getBlock({ blockNumber });
|
|
896
|
+
deliveryTimestampSeconds = Number(deliveryBlockData.timestamp);
|
|
897
|
+
blockTimestampSecondsByNumber.set(blockNumber, deliveryTimestampSeconds);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
else {
|
|
901
|
+
if (currentBlockTimestampSeconds == null) {
|
|
902
|
+
const currentBlockData = await this.publicClient.getBlock({ blockNumber: currentBlock });
|
|
903
|
+
currentBlockTimestampSeconds = Number(currentBlockData.timestamp);
|
|
904
|
+
}
|
|
905
|
+
deliveryTimestampSeconds = currentBlockTimestampSeconds;
|
|
906
|
+
}
|
|
907
|
+
if (this.shouldSkipExpiredRecoveryDelivery(requestId, deliveryTimestampSeconds, recoveryExpirySeconds)) {
|
|
908
|
+
continue;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
756
912
|
// (a) Deliverer-side claim path: if this Safe delivered the request,
|
|
757
913
|
// claim it first so router counters credit the deliverer.
|
|
758
914
|
let deliveryClaimStatus;
|
|
@@ -788,9 +944,7 @@ export class MechAdapter {
|
|
|
788
944
|
deliveryMechAddress: mechAddress,
|
|
789
945
|
};
|
|
790
946
|
// Clean up after yielding
|
|
791
|
-
this.
|
|
792
|
-
this.pendingEvaluations.delete(requestId);
|
|
793
|
-
this.requestKinds.delete(requestId);
|
|
947
|
+
this.clearPendingDeliveryRecoveryState(requestId);
|
|
794
948
|
}
|
|
795
949
|
catch (err) {
|
|
796
950
|
console.error(`[mech] Failed to parse delivery ${requestId}:`, err);
|
|
@@ -807,10 +961,8 @@ export class MechAdapter {
|
|
|
807
961
|
fromBlock: this.deliveryBlockCursor + 1n,
|
|
808
962
|
}));
|
|
809
963
|
}
|
|
810
|
-
//
|
|
811
|
-
|
|
812
|
-
this.store.setLastProcessedBlock(this.deliveryBlockCursor);
|
|
813
|
-
}
|
|
964
|
+
// Cursor persistence is per-chunk inside the loop above (#552). A poll
|
|
965
|
+
// that did no chunked work has no progress to persist.
|
|
814
966
|
await new Promise(r => setTimeout(r, this.config.pollIntervalMs));
|
|
815
967
|
}
|
|
816
968
|
}
|