Skip to content

Fix the oracle's part of the minor findings from the 15 November performance review - #323

Merged
RunTimeAdmin merged 1 commit into
mainfrom
fix/perf-minor-oracle
Nov 15, 2026
Merged

RunTimeAdmin merged 1 commit into
mainfrom
fix/perf-minor-oracle

Conversation

@RunTimeAdmin

Copy link
Copy Markdown
Owner

The oracle's part of the minor findings from the 15 November performance review (the critical ones were #311, the moderate ones #316 to #319). Each fix has a test that fails on main, run against it before committing.

What changes

13. /health recounted every payment, and asked a down ERC-8004 feed on every request (store.js, external.js)

  • The count of payments with an outcome is kept per agent list. The store replaces a list on every change and never edits one, so a count cannot go stale, and /health sums one number an agent. 200 status reads over 50,000 payments took 441 ms; now a few.
  • A feed that could not be reached is asked again after 30 s at most for a caller that takes a cached answer (/health). The epoch, which takes none, still asks every time. A re-init asks at once.

15. An epoch's per-agent steps and the read routes read the chain's clock one round trip at a time (chain.js, index.js)

  • getLatestBlockTimestamp({ maxAgeMs }) reuses a reading up to 5 s old where a caller allows it: the per-agent steps of an epoch, /score and /evidence. Their margins are minutes. The readings at the start of an epoch stay fresh.

23. The signer sent provider error text, RPC URL included, to the publisher (signer.js)

  • A failed chain read is answered chain read failed. The node's words are logged shortened, with the RPC URL taken out (event-index.redact, as the watcher does).
  • The signer's provider gives a request 8 s, since a publisher waits on each signature.

24. The watcher read the checker's and the webhook's answers whole (watcher.js)

  • At most 1 MiB (log-spans.readAnswer, as the indexer reads). The checker's /divergence page is 100 records at most.

25. /attest, /flag, /flag/resolve and /link answered an error their checks did not expect with its raw message (http-helpers.js, index.js)

  • A body that could not be read is still answered in its own words: too large (413), too slow (408), invalid JSON (400, now coded bad_json). Anything else is answered bad request, and its message goes to the log only.

Not done

  • 14, trimming the caps with 1% slack: between trims each operator would hold up to 1% more payments than the caps, and two operators that trim at different moments would serve different evidence and roots. What it saves, a sort per credit, costs anything only at the caps.
  • 16, one log read for the held negatives of an agent: each held negative has its own block range and read progress, so grouping them is a redesign, and the review measured that it binds only near 100 held negatives.

Deploy

Both operators, when convenient. The signer and the watcher take 23 and 24 at their next deploy; every service copies oracle/*.js, so the modules this uses ship with them.

Tests

1,542 oracle tests: main had 1,535 (the documented 1,532 missed the tests #319 and #321 added), and this adds 7. README and whitepaper say 1,542. The full suite ran once locally; 43 tests failed there under load, while a forge suite ran beside it and the HTTP file's oracle missed its 21 s start window, and those six files then ran clean on their own (192 tests). New:

  • store.test.js: the outcome count follows a list that changes, and 200 status reads stay fast (441 ms on main).
  • external.test.js: an unreachable feed is asked again after 30 s for /health, at once for the epoch.
  • chain.test.js: a chain-clock reading is reused only where a caller allows it.
  • signer.test.js: a failed chain read is answered and logged without the RPC URL.
  • watcher.test.js: an answer over 1 MiB is refused (main accepts 2 MiB of valid JSON).
  • http-helpers.test.js: the reply rule, and invalid JSON keeping its own words.

🤖 Generated with Claude Code

…ormance review

- 13: /health sums an outcome count kept per agent list instead of recounting every payment, and asks an
  unreachable ERC-8004 feed again after 30 s at most, not on every request.
- 15: an epoch's per-agent steps, /score and /evidence reuse a chain-clock reading up to 5 s old.
- 23: the signer answers a failed chain read "chain read failed", logs the node's words without the RPC URL,
  and gives a request 8 s.
- 24: the watcher reads at most 1 MiB of the checker's or a webhook's answer.
- 25: /attest, /flag, /flag/resolve and /link answer an error their checks did not expect "bad request", and
  log its message.

Oracle tests: 1542.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RunTimeAdmin
RunTimeAdmin merged commit 3afc3e7 into main Nov 15, 2026
7 checks passed
@RunTimeAdmin
RunTimeAdmin deleted the fix/perf-minor-oracle branch November 15, 2026 23:45
RunTimeAdmin added a commit that referenced this pull request Nov 15, 2026
Main brought #323 and #327; the only conflicts were the oracle and SDK test counts in README and the whitepaper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RunTimeAdmin added a commit that referenced this pull request Nov 15, 2026
Main brought #323, #324, #325 and #327; the only conflict was the test-count paragraph in README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant