Skip to content

fix(event): correct fork rollback handling in solidity event maps#6718

Open
xxo1shine wants to merge 1 commit intotronprotocol:developfrom
xxo1shine:fix/event-removed-filter-solidity-maps-sync-1
Open

fix(event): correct fork rollback handling in solidity event maps#6718
xxo1shine wants to merge 1 commit intotronprotocol:developfrom
xxo1shine:fix/event-removed-filter-solidity-maps-sync-1

Conversation

@xxo1shine
Copy link
Copy Markdown
Collaborator

What does this PR do?

Fix two correctness bugs in event service rollback handling that cause solidity-side event/log triggers to either leak fork- removed entries or be lost during reorg.

When a block is rolled back during fork resolution, its contract triggers are marked removed=true. The solidity event pipeline depends on this flag plus an in-memory map (Args.getSolidityContractEventTriggerMap / getSolidityContractLogTriggerMap) keyed by block number. Two paths through this pipeline were broken:

  1. Removed triggers reached the solidity sink. ContractTriggerCapsule.processTrigger()
    only checked isSolidityEventTriggerEnable / isSolidityLogTriggerEnable, never the
    removed flag. Triggers from forked-out blocks were emitted as valid solidity events.

  2. Async enqueue raced with reorg cache clearing. Manager.postContractTrigger
    posted to a global triggerCapsuleQueue for async draining, but
    reOrgContractTrigger clears the in-memory cache synchronously. Capsules already
    in the queue could reference state that was about to be invalidated, leading to
    either lost events or stale cache reads.

  3. Solidity caches were not cleared on block-process failure or shutdown.
    getSolidityContract{Log,Event}TriggerMap entries are populated per block.
    If processBlock threw after population, or on node shutdown, those entries
    leaked.

Fixes #6678

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

@github-actions github-actions Bot requested a review from 0xbigapple April 28, 2026 10:21
…trigger processing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@xxo1shine xxo1shine force-pushed the fix/event-removed-filter-solidity-maps-sync-1 branch from 6102162 to 2831e35 Compare April 28, 2026 11:07
@halibobo1205 halibobo1205 added this to the GreatVoyage-v4.8.2 milestone Apr 28, 2026
@halibobo1205 halibobo1205 added the topic:event subscribe transaction trigger, block trigger, contract event, contract log label Apr 28, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]Event cache not cleared on reorg causing duplicate and inconsistent event delivery

2 participants