chainlink icon indicating copy to clipboard operation
chainlink copied to clipboard

Add finalizer component to TXM

Open amit-momin opened this issue 1 year ago • 1 comments

Description

Implements a finalizer component that regularly checks confirmed transactions on new heads if they are considered finalized and marks them if they are. The finality validation uses the checks below

  • Is the tx's receipt block num older or equal to the latest finalized head
  • Does the tx's receipt block hash match the block hash in the cached longest chain
  • If the receipt is older than the cached longest chain history, check using BlockByHash

Note

  • To account for finality violations, the Confirmer has the ability to unmark a transaction as finalized if it finds the receipt hash missing in the longest chain

Ticket: https://smartcontract-it.atlassian.net/browse/BCI-3486

Requires:

  • https://github.com/smartcontractkit/chainlink/pull/13040
  • https://github.com/smartcontractkit/chainlink/pull/13048

amit-momin avatar Jun 20 '24 17:06 amit-momin

Finalizer is an execution-heavy component and can potentially use a large amount of resources. At the same time, finality is rather slow and comes in batches. Instead of listening for new heads from the Head Tracker we should use its API to fetch the latest chain and the finalized block based on an interval. Even if we set the interval to something like 1 minute, we barely lose any functionality and we get a huge reduction in CPU & Memory usage compared to consuming 2sec updates from Head Tracker's subscription.

dimriou avatar Jul 12 '24 11:07 dimriou