Skip to content

Claimer: migrate claim event monitoring from ChunkedFilterLogs to ethutil.FindTransitions #727

@vfusco

Description

@vfusco

Context / Problem

The claimer service monitors on-chain consensus events to submit claims and track their acceptance for authority/quorum apps.

Today, it detects events using the legacy ChunkedFilterLogs approach (topic-based log filtering). Other services (e.g. evmreader) already use the newer ethutil.FindTransitions mechanism, which performs an efficient divide-and-conquer search based on monotonic counters queried via view functions.

We want to migrate the claimer’s monitoring for both claim events to FindTransitions for consistency, simpler querying, and better performance characteristics.

Monitored events:

  • ClaimSubmitted
  • ClaimAccepted

Proposed change

Replace ChunkedFilterLogs-based monitoring for the monitored claim events with ethutil.FindTransitions, using monotonic event counters exposed by the consensus contract.

Implementation approach (high level):

  • For each monitored event, use a corresponding on-chain counter view function as the transition oracle.
  • Implement a TransitionQueryFn that returns the counter value at a block.
  • Implement an OnHitFn that, for each detected transition block, fetches the concrete event(s) for that block/range and emits them in chronological order.
  • Preserve existing start/end block semantics and ordering guarantees.

Deliverables

  • Migrate ClaimSubmitted monitoring to ethutil.FindTransitions.
  • Migrate ClaimAccepted monitoring to ethutil.FindTransitions.
  • Ensure claimer no longer relies on ChunkedFilterLogs for these two monitored events.
  • Update claimer tests to cover the new transition-based logic for both events:
    • no transitions
    • single transition
    • multiple transitions (including multiple events in the same block)
    • boundary case at startBlock (use of prevValue)
    • error propagation from the transition oracle and from log/event fetching

Acceptance criteria (applies to both ClaimSubmitted and ClaimAccepted)

  • Monitoring uses ethutil.FindTransitions (no ChunkedFilterLogs for these events).
  • Given a block range containing N occurrences of the event, the claimer detects exactly those N events and processes them in chronological order.
  • Correctly handles transitions exactly at startBlock (no off-by-one; prevValue is used appropriately).
  • Correctly handles blocks with multiple occurrences of the same event (no missed events).
  • Correctly handles empty ranges (no transitions) without errors and without producing events.
  • On invalid oracle responses or RPC errors, the claimer returns a clear error (and does not silently skip ranges).

Tests:

  • make test passes.
  • Claimer test suite includes coverage for both events across the scenarios listed above.

Note

getNumberOfAcceptedClaims() is already available. The equivalent submitted-claims counter (getNumberOfSubmittedClaims()) may land shortly; structure the implementation so adding/wiring the submitted-claims counter is a small change once it exists.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions