From 7fd6799b20939ac9c8e159a17c54bbe1ba7b3f02 Mon Sep 17 00:00:00 2001 From: RunTimeAdmin <248247024+RunTimeAdmin@users.noreply.github.com> Date: Sun, 15 Nov 2026 19:25:23 -0600 Subject: [PATCH] Read an HTTP 429 that ethers gave up on as a rate limit ethers, allowed one try by rpc-provider.js, reports a 429 as "exceeded maximum retry limit", and the 429 is left only in the status of the response it escalated. isRateLimited read the short message alone, so the checker's node, which answers a burst with a 429, still got four quick tries: its first epoch on #329 left 2 agents unread with exactly that error. It now reads the escalated status, and the words ethers uses. A test drives a real 429 through the provider. Oracle tests: 1546. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- docs/whitepaper.md | 2 +- oracle/read-retry.js | 10 +++++++++- oracle/rpc-provider.test.js | 21 +++++++++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 90423f8..ac281c4 100644 --- a/README.md +++ b/README.md @@ -601,7 +601,7 @@ Everything below runs offline, with no deployed contracts, except three fork sui | Suite | Count | Command | |---|---|---| | Contracts: unit, fuzz, E2E, upgrade, deploy-script, handover and 22 invariants | 815 | `forge test` | -| Oracle | 1545 | `cd oracle && node --test` | +| Oracle | 1546 | `cd oracle && node --test` | | SDK | 392 | `cd packages/sdk && npx vitest run` | Counts are individual tests, so each of the 22 invariants counts once. The contracts were counted on 15 November 2026, the SDK on 15 November and the oracle on 15 November. Without a fork URL, 803 of the contract tests run and 12 skip. Run after `npm run build`, 383 of the SDK's 392 pass and 9 skip: the 8 integration tests, which need a live deployment, and one check that runs only in CI. Without a build, the 9 built-package tests skip too. Vitest strips types without checking them, so `npm run typecheck` in `packages/sdk` checks the tests against the SDK's types as well as the sources. [`scripts/mutation`](scripts/mutation/README.md) holds the harnesses that measure whether these tests would catch a deliberate break in the contracts or deploy scripts. diff --git a/docs/whitepaper.md b/docs/whitepaper.md index d57ec91..5d15357 100644 --- a/docs/whitepaper.md +++ b/docs/whitepaper.md @@ -635,7 +635,7 @@ apply to a fresh deployment, not to the testnet. **Test coverage**, as of 15 November 2026: 815 contract tests across 36 Foundry test files including fuzz and invariant tests (the two slash drill suites fork Arc testnet themselves, and -the twelve in `SplitAuthorityFork` skip without `--fork-url`), 1545 oracle tests and 392 in the SDK (9 skip +the twelve in `SplitAuthorityFork` skip without `--fork-url`), 1546 oracle tests and 392 in the SDK (9 skip outside CI and without a live deployment; every test that runs passes). CI runs Foundry, the oracle and SDK suites, and Slither static analysis on every push, plus a documentation check that fails when the site states something the contracts do not. diff --git a/oracle/read-retry.js b/oracle/read-retry.js index b12b5b9..11e04f5 100644 --- a/oracle/read-retry.js +++ b/oracle/read-retry.js @@ -64,12 +64,20 @@ function isTransientReadError(err) { * -32005 is the JSON-RPC code providers use for this. ethers wraps it in "could not * coalesce error" with the original nested inside, so the string match is doing real work * and is not just belt and braces. + * + * An HTTP 429 arrives in other words. ethers retries one itself until its attempts run out, + * and rpc-provider.js allows one, so the error says "exceeded maximum retry limit", and the + * 429 survives only in the status of the response ethers escalated ("CLIENT ESCALATED SERVER + * ERROR (429 Too Many Requests; ...)"). Read only the short message, it looked like any + * other server error, and the checker's node, which answers a burst with a 429, kept the + * short schedule (16 November 2026). */ function isRateLimited(err) { if (!err) return false; const nested = err.error || err.info?.error || {}; if (nested.code === -32005 || err.code === -32005) return true; - return /rate limit|429|too many requests/i.test( + if (/\b429\b|too many requests/i.test(String(err.response?.statusMessage ?? ''))) return true; + return /rate limit|429|too many requests|exceeded maximum retry limit/i.test( String(err.shortMessage || err.message || '') ); } diff --git a/oracle/rpc-provider.test.js b/oracle/rpc-provider.test.js index 4139359..65862da 100644 --- a/oracle/rpc-provider.test.js +++ b/oracle/rpc-provider.test.js @@ -86,3 +86,24 @@ test('a request with no answer gives up at its deadline', async () => { } assert.ok(Date.now() - started < 5_000); }); + +// A real HTTP 429 through the provider. ethers, allowed one try, reports it as "exceeded maximum retry limit", and the +// 429 is left only in the status of the response it escalated, so a check of the short message alone missed it and the +// checker's node, which answers a burst with a 429, got four quick tries instead of the rate limit's schedule. +test('a read refused with HTTP 429 is tried on the rate limit\'s schedule', async () => { + const { readWithBackoff, isRateLimited, RATE_LIMIT_ATTEMPTS } = require('./read-retry'); + const p = rpcProvider(await url, CHAIN_ID); + asked.length = 0; + mode = 'throttle'; + let seen; + try { + await assert.rejects(readWithBackoff('x', () => p.send('eth_blockNumber', []), 4, undefined, { pause: async () => {} }), (err) => { + seen = err; + return true; + }); + } finally { + mode = 'answer'; + } + assert.equal(isRateLimited(seen), true, `${seen.shortMessage}: read as a rate limit`); + assert.equal(count('eth_blockNumber'), RATE_LIMIT_ATTEMPTS, 'tried as often as the rate limit allows'); +});