-
Notifications
You must be signed in to change notification settings - Fork 73
Description
Context / Problem
At first startup the EVM-reader issues an eth_getLogs
filter-log scan from the block where the InputBox contract was deployed all the way to the latest L1 block.
For a brand-new dApp this huge fromBlock … toBlock
range contains hundreds of thousands of empty blocks, so the node burns JSON-RPC quota and spends minutes waiting for results even though no relevant logs exist.
Suggested Solution
-
Fast “probe-and-decide” flow
Let
current
= latest L1 block,
appDeploy
= dApp contract deployment block,
inputDeploy
= InputBox deployment block.Step A – probe
current
- Call
eth_getLogs
for this dApp only atcurrent
.- No inputs: set
last_checked_block = current
and finish (zero-cost start). - Some inputs: continue to Step B.
- No inputs: set
Step B – probe
appDeploy − 1
- Call
eth_getLogs
at blockappDeploy − 1
.- No inputs: sync the shorter range
[appDeploy … current]
. - Some inputs: fall back to the full scan
[inputDeploy … current]
.
- No inputs: sync the shorter range
The optimisation costs at most two extra RPC calls.
- Call
-
State & restart safety
Persistlast_checked_block
in the DB so restarts reuse the determined range.
Acceptance Criteria
# | Scenario | Expected result |
---|---|---|
1 | Brand-new dApp, no inputs | Sync finishes after ≤ 2 RPC calls; node ready in < 2 s. |
2 | Inputs only after deploy | Scans [appDeploy … latest] ; RPC/time drop ≥ 80 %. |
3 | Inputs before deploy | Falls back to full scan; behaviour identical to current. |
This optimisation slashes first-run synchronisation time and RPC usage for new applications while preserving correctness for existing ones.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status