Add finalizer component to TXM
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
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.
Quality Gate passed
Issues
12 New issues
1 Fixed issue
0 Accepted issues
Measures
0 Security Hotspots
87.0% Coverage on New Code
6.9% Duplication on New Code