Repository navigation
Fix the oracle's part of the moderate findings from the 15 November performance review - #318
Merged
Merged
Conversation
…erformance review - 5: a checker's audit shares one memo of pair hashes across the trees of every cut-off it tries, skips a cut-off that counts the same payments, and lets other work run between trees. - 6: /attest writes that arrive within 100 ms share one save, each answered after a save that holds it. New counter sigvara_oracle_state_saves_total. - 7: one provider factory (rpc-provider.js) for the oracle and its services: a 30 s deadline, no retries inside ethers, and the chain fixed so ethers stops asking eth_chainId with every read. - 8: /attest refuses a replayed settlement before any chain read, and a forged signature from a payer with no code after one. - 9: /evidence builds its body a slice at a time from a kept tree, shares a build in flight, serves pages with ?offset=&limit=, and does not cache an agent with no payments. - 10: unbonded agents are read again within a day, a share each epoch, not all in one. - 12: an /outcomes page indexes each agent's outcomes once instead of searching per entry. Oracle tests: 1532. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Refreshed by merging main (#316, #317). The refresh commit carries [skip ci]: every job passed on 141e62d, main's parts were tested on their own PRs, the only conflicts were the test-count lines in README and the whitepaper, and chain.js (where #316 changed comments) merged cleanly; rpc-provider.test.js and chain.test.js (65 tests) and check-docs pass on the merged tree. |
RunTimeAdmin
added a commit
that referenced
this pull request
Nov 16, 2026
… [skip ci] (#329) #318 stopped ethers retrying an HTTP 429 inside each read, leaving retries to readWithBackoff: four tries over 3.5 s. The checker's node answers a burst with HTTP 429 and -32005, and since the deploy the checker has left 2 to 4 agents unread each hourly epoch. A rate-limit refusal is now tried up to 7 times, the wait doubling to at most 8 s and jittered, about 24 s at most; every other failure keeps four tries. isRateLimited moves to read-retry.js, unchanged, so readWithBackoff can ask it. The keeper's process tests load a shim that cuts long waits, so a run that fails only after the whole schedule does not stretch the test. Oracle tests: 1545 (the documented 1544 counted a failed test file as a test). 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.
The oracle's part of the eight moderate findings from the 15 November performance review (the four critical ones were #311). Each fix has a test that fails on main, run against it before committing. The contract, SDK and site parts are separate PRs.
What changes
5. A checker's audit built a whole Merkle tree for every cut-off (
evidence-as-of.js,merkle.js)evidenceAsOfis now async).6. Every accepted /attest saved the whole state on its own (
index.js,metrics.js)/flag,/flag/resolveand/linkkeep their own save: their replies are remembered for a retry, which must not land between a change and its save.sigvara_oracle_state_saves_total. Five concurrent attestations took five saves; now one.7. Chain reads had no deadline, ethers retried a 429 for minutes, and every wave of reads carried an eth_chainId (
rpc-provider.js, used bychain.js,external.js,keeper.js,publisher.js,signer.js,watcher.js)readWithBackoff's attempts), and the chain fixed, so ethers stops asking eth_chainId before every wave.chain.getChainIdbefore every epoch, andexternal.refreshChainId, which now sends eth_chainId itself instead ofgetNetwork().readWithBackoff, since ethers no longer retries them.8. /attest read the chain six to nine times before refusing a replay or a forged signature (
index.js)9. /evidence was one body per agent, built on the event loop (
index.js,merkle.js,response-cache.js)merkle.treeOf, then 256 payments a slice), with other requests answered in between. The bytes are what one JSON.stringify gave.?offset=N&limit=M(M up to 1,000) serves part of the list with its proofs, plusnext. Without them the whole body is served, so the SDK and every verifier written before this keep working. Nothing in the repo pages yet.?summary=1. It was for the simulation page, which turned out to read every payment's fields for its replay, not a count.10. Every unbonded agent was read again in one epoch once a day (
bond-watch.js)12. Each /outcomes page cost its size times the agent's events (
store.js)Deploy
Tests
The full suite ran once locally (Windows, Node 22): 1,531 tests, with 5 failures in older tests that still called
evidenceAsOfsynchronously or expected the old answers. Those were updated and their files run clean, so the count is 1,532 with the test added after; README and whitepaper say 1,532. Updated tests:payment-chain-outcomes.test.jssigns the unmined hash it posts: a signature made for another payment is now refused at once (400) instead of being told "not yet" (503).http.test.js: an agent with no payments is not cached; the keying check moved to an agent with payments.New:
store.test.js: an outcomes page indexed once.attest.test.js: a replay refused before the payment is read; attestations that arrive together share a save.payer-outcome.test.js: a forged signature refused before the payment is read.rpc-provider.test.js: no eth_chainId with each read, one try on a 429, a deadline.evidence-as-of.test.js: shared pairs across cut-offs (counted hashes), and other work runs between trees.evidence-body.test.js: the sliced body is JSON.stringify's bytes, pages put together are the whole list, bad page values are refused, an empty agent is not cached.merkle.test.jsandresponse-cache.test.js:treeOfyields and keeps its tree; a build in flight is shared, and a stale one is not kept.write-spend.test.js: unbonded agents are read 10 an hourly epoch, earliest first.🤖 Generated with Claude Code