Skip to content

Match evidence roots through one pair memo, and ask the RPC its chain once - #317

Merged
RunTimeAdmin merged 3 commits into
mainfrom
fix/sdk-root-match-memo
Nov 15, 2026
Merged

RunTimeAdmin merged 3 commits into
mainfrom
fix/sdk-root-match-memo

Conversation

@RunTimeAdmin

Copy link
Copy Markdown
Owner

The SDK's part of findings 5 and 7 from the 15 November performance review. The oracle, contract and site parts are separate PRs.

What changes

5. sigvara_verify_evidence called a busy agent's root "not reproduced" (evidence.ts, mcp.ts)

  • To bound what a hostile oracle could cost, the tool tried fewer settlement cut-offs as a list grew: five at 2,000 payments. A root ten payments behind its list was then reported "not reproduced", a wrong answer that hits the busiest agents.
  • matchEvidenceRoot now hashes every tree it tries through one memo of pairs, skips a cut-off that counts the same payments as the one before, and takes hashBudget (pairs hashed, after which no further cut-off is tried, though the first always is) and memo (shared by matches over one list).
  • The MCP tool tries up to 64 cut-offs again within 20,000 hashes, and its finalized and pending matches share one memo. A list ordered so its trees share little still stops at the budget, and the result says so.
2,000 payments, root 10 behind Result Hashes Time
Before, as the tool ran it (5 cut-offs) not reproduced 11,984 477 ms
Before, unbounded (64 cut-offs) reproduced 23,933 831 ms
Now reproduced 2,064 about 78 ms

7. Every wave of reads carried an eth_chainId (verifier.ts, mcp.ts)

  • The verifier builds its provider with staticNetwork and asks the node its chain once, before the first read. Before, ethers asked with every wave: 21 to 29% of the SDK's calls.
  • A first sigvara_check_agent makes 14 calls, one of them eth_chainId, where it made 18 with five; later calls ask none.
  • New behaviour: a verifier given a chainId refuses every read from an RPC serving another chain, with a NETWORK_ERROR naming both. Before, only the MCP server compared. A failed ask is asked again on the next read.
  • New public getRpcChainId(), which the MCP server's chain check now uses, so the two checks are one call. rpcChainId moved to the verifier and is still exported from dist/mcp.
  • The SDK already set a request timeout (timeoutMs, 30 s); unchanged.

CHANGELOG.md has an 1.0.0-alpha.21 entry; package.json is not bumped, so nothing is published by merging.

Tests

385 SDK tests: 376 pass and 9 skip (README and whitepaper updated); build and typecheck pass. New: the ten-behind match through the MCP tool, the budget on a list that matches nothing, memo growth and sharing, eth_chainId counted during sigvara_check_agent, and the verifier asking once, again after a failure, and refusing another chain. The first two counting tests fail on main (reproduced: false; 8 eth_chainId where 1 is expected).

Not changed: the tool still builds rebuiltRoot and the proof layers without the memo, two more trees per call.

🤖 Generated with Claude Code

RunTimeAdmin and others added 3 commits November 15, 2026 15:42
matchEvidenceRoot hashes every tree it tries through one memo of pairs, skips a cut-off that counts the same payments as the one before, and stops at a budget of pairs actually hashed. sigvara_verify_evidence tries 64 cut-offs again within 20,000 hashes, so a finalized root ten payments behind a list of 2,000 is reproduced, after 2,064 hashes, where the old bound gave up after 11,984. The verifier's provider uses staticNetwork and asks eth_chainId once, before its first read, refusing a node on another chain: a first sigvara_check_agent makes 14 calls, one of them eth_chainId, where it made 18 with five. 376 SDK tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main brought #316, whose test counts share a README paragraph with this branch's. The version moves in
package.json, the lockfile and server.json; the README's "use alpha.20" lines follow once alpha.21 is on npm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RunTimeAdmin

Copy link
Copy Markdown
Owner Author

Refreshed by merging main (#316) and bumping the SDK to 1.0.0-alpha.21 in package.json, the lockfile and server.json. The refresh commit carries [skip ci]: every job passed on 56be686, main's part was tested on #316, the only conflict was the README test-count paragraph, and the two SDK test files that read the version files pass locally (60 tests).

@RunTimeAdmin
RunTimeAdmin merged commit 9eeb53c into main Nov 15, 2026
2 checks passed
@RunTimeAdmin
RunTimeAdmin deleted the fix/sdk-root-match-memo branch November 15, 2026 21:57
RunTimeAdmin added a commit that referenced this pull request Nov 15, 2026
Main brought #316 and #317, whose test counts share a README and whitepaper line with this branch's. chain.js merged
without a conflict (#316 changed comments only); its tests and the docs check pass on the merged tree.

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