Reduce idle RPC usage#1440
Open
Jurij89 wants to merge 1 commit into
Open
Conversation
e2c3412 to
53f98b0
Compare
53f98b0 to
97fbbff
Compare
97fbbff to
76acdd8
Compare
76acdd8 to
4c6d4d7
Compare
4c6d4d7 to
36e2874
Compare
36e2874 to
1a1828e
Compare
1a1828e to
615fa99
Compare
615fa99 to
36a6397
Compare
36a6397 to
c2aaa9b
Compare
c2aaa9b to
a170194
Compare
a170194 to
c232660
Compare
c232660 to
130dd5a
Compare
63fb8e2 to
2dba6cb
Compare
2dba6cb to
008a791
Compare
e201ee9 to
89b725f
Compare
89b725f to
1078681
Compare
3ab82e3 to
31db89d
Compare
31db89d to
9352a60
Compare
2ec1364 to
b4ed271
Compare
This was referenced Jul 5, 2026
1c82860 to
0e81242
Compare
0e81242 to
07473e4
Compare
10 tasks
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.
Summary
eth_chainIdvalidation, eliminating repeated steady-state chain-id detection while still catching wrong-chain or unavailable RPC endpoints.ChainEventLaneRunnerowns cadence, cursor persistence, lazy lane restoration, and conservative legacy cursor compatibility.TtlValueCacheretains bounded positive values,KeyedSingleFlightcoalesces in-flight work with stale-write guards, PCA reverse-agent authorization is single-flight only for publish-critical freshness, and PCA write paths centralize post-success invalidation.devnet/rpc-quiet-windowsuite for idlerpc_usagebudget validation.Expected RPC impact
The investigation baseline from the Base mainnet node was
62,820counted raw RPCs over about 218.5 minutes, or roughly288calls/minute. The largest steady-state contributors wereeth_getLogs(26,819, about123/minute),eth_chainId(16,777, about77/minute), andeth_call(15,079, about69/minute).Expected quiet-window behavior after this PR:
eth_chainId: near-zero steady-state calls for numeric EVM chain configs after one validation per endpoint; the devnet budget is<=5/minute, a ~93% reduction versus the Base average and ~98% versus the observed 333/minute peak window.eth_getLogs: most idle 12s ticks return beforegetBlockNumber; only due lanes scan, and context graph discovery moves to a slower independent cadence. The devnet budget is<=20/minute, an ~84% reduction versus the Base average and ~91% versus the observed 215/minute peak window.<=120calls/minute per idle daemon, at least ~58% below the Base average before accounting for workload-specificeth_callcache wins.eth_call: exact reduction is workload-dependent, but duplicate identity/PCA reads collapse to one in-flight request per key and short TTL window; RPC failures are not cached.The Gnosis sample remains useful failover evidence, but its malformed hosts were an intentional failover test rather than the expected production baseline.
Scope note
This PR does not change random-sampling-specific code or the random sampling prover/bind implementation. Random sampling may indirectly benefit from shared chain-adapter provider behavior, but its core challenge/proof flow and random-sampling RPC logic are not intentionally modified here.
Related
Follow-up issues intentionally left out of this PR to avoid late churn:
Files changed
packages/chain/src/rpc-usage.tspackages/chain/src/evm-adapter-base.tspackages/chain/src/keyed-ttl-single-flight-cache.tsTtlValueCacheandKeyedSingleFlightprimitives with non-storing zero-TTL semantics and epoch-guarded in-flight invalidationpackages/chain/src/evm-adapter-identity.tspackages/chain/src/evm-adapter-conviction.tspackages/publisher/src/chain-event-lane-runner.tspackages/publisher/src/chain-event-poller.tspackages/chain/test/*,packages/publisher/test/*devnet/rpc-quiet-window/*,devnet/suites.json,package.json,pnpm-*Note: investigation/planning artifacts remain local under ignored
agent-docs/for this Codex run, but are intentionally not part of the repository diff.Test plan
pnpm --filter @origintrail-official/dkg-core --filter @origintrail-official/dkg-storage --filter @origintrail-official/dkg-chain --filter @origintrail-official/dkg-publisher run buildpnpm --dir packages/chain exec vitest run --config vitest.unit.config.ts test/keyed-ttl-single-flight-cache.unit.test.ts test/rpc-usage.unit.test.ts test/evm-adapter.unit.test.ts test/evm-adapter-pca-rpc.unit.test.ts test/evm-adapter-op-wallet.unit.test.ts --reporter dotpnpm --dir packages/publisher exec vitest run test/chain-event-poller-v10-only.test.ts test/chain-event-poller-ka-registered.test.ts test/chain-event-poller-ka-created.test.ts test/chain-event-poller-extra.test.ts --reporter dotpnpm test:devnet:manifest -- --reporter dotpnpm exec vitest run --config devnet/rpc-quiet-window/vitest.config.ts -t "parses the committed" --reporter dotBura: cli,Kosava: node-ui e2e, andTornado: core + storage + chainRPC_QUIET_WINDOW_MS=185000 pnpm test:devnet:rpc-quiet-windowon an idle publisher-enabled devnetDKG_HOME, the prepared funded config bundle, and sanitizedrpc_usageevidence