Skip to content

fix(jsonrpc): post log/block filters for reorg-applied blocks#6819

Open
0xbigapple wants to merge 1 commit into
tronprotocol:release_v4.8.2from
0xbigapple:fix/reorg-jsonrpc-logsfilter
Open

fix(jsonrpc): post log/block filters for reorg-applied blocks#6819
0xbigapple wants to merge 1 commit into
tronprotocol:release_v4.8.2from
0xbigapple:fix/reorg-jsonrpc-logsfilter

Conversation

@0xbigapple
Copy link
Copy Markdown
Collaborator

@0xbigapple 0xbigapple commented Jun 4, 2026

What does this PR do?

Adds reApplyLogsFilter(List<KhaosBlock>), invoked after switchFork has fully applied the new branch (oldest-first), mirroring blockTrigger's jsonrpc FULL handling so reorg'd blocks reach the FULL stream like the normal extend path.

Why are these changes required?

On a reorg, pushBlock calls switchFork() and returns early, never reaching blockTrigger() — the only place that posts the "added" FULL filters (postBlockFilter / postLogsFilter(block, false, false)). The rollback side withdraws the orphaned branch's logs (reOrgLogsFilter, removed=true), but nothing re-posts the new branch's logs: withdraw old, never add new, violating reorg semantics.

So dApps using eth_newFilter + eth_getFilterChanges miss every log in blocks applied via switchFork.

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

  • Failed-rollback (switch-back) path — new branch's logs not re-posted; out of scope, known limitations
  • Event-plugin block/transaction triggers — not posted on the reorg path; out of scope, known limitations

Extra details

@github-actions github-actions Bot requested a review from bladehan1 June 4, 2026 06:20
@lvs0075 lvs0075 added this to the GreatVoyage-v4.8.2 milestone Jun 4, 2026
@halibobo1205 halibobo1205 added topic:json-rpc topic:event subscribe transaction trigger, block trigger, contract event, contract log labels Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:event subscribe transaction trigger, block trigger, contract event, contract log topic:json-rpc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants