wormhole-explorer/tx-tracker
agodnic 802fc00434
Add documentation for the `tx-tracker` service (#642)
### Description

This pull request adds a README.md file explaining how the `tx-tracker` service works.
2023-08-18 10:33:36 -03:00
..
chains `tx-tracker`: add support for the "Base" blockchain (#568) 2023-07-20 16:37:21 -03:00
cmd Remove duplicated code: MongoDB connection handling (#590) 2023-08-07 16:05:08 -03:00
config `tx-tracker`: add support for the "Base" blockchain (#568) 2023-07-20 16:37:21 -03:00
consumer add metrics to tx-tracker (#556) 2023-07-19 09:04:41 -03:00
http/infrastructure add metrics to tx-tracker (#556) 2023-07-19 09:04:41 -03:00
internal/metrics add metrics to tx-tracker (#556) 2023-07-19 09:04:41 -03:00
queue add metrics to tx-tracker (#556) 2023-07-19 09:04:41 -03:00
.gitignore [tx-tracker / api] Avoid duplicating data (#256) 2023-04-25 15:34:29 -03:00
Dockerfile.tx-tracker-backfiller [TX TRACKER] Add backfiller for source transactions (#194) 2023-03-20 16:36:19 -03:00
Dockerfile.tx-tracker-service [TX TRACKER] Add backfiller for source transactions (#194) 2023-03-20 16:36:19 -03:00
Makefile [tx-tracker / api] Avoid duplicating data (#256) 2023-04-25 15:34:29 -03:00
README.md Add documentation for the `tx-tracker` service (#642) 2023-08-18 10:33:36 -03:00
go.mod add metrics to tx-tracker (#556) 2023-07-19 09:04:41 -03:00
go.sum add metrics to tx-tracker (#556) 2023-07-19 09:04:41 -03:00

README.md

tx-tracker service

The purpose of this service is to fetch, for each VAA, the metadata of associated to the transaction that generated it.

Data flow

This service is consumes new VAAs from an SQS queue.

For most chains, the VAA includes a txHash field that identifies the transaction that generated the VAA (for the particular case of Solana and Aptos, the value of this field is more like an indirect pointer to the transaction).

The service uses the value of this txHash field to query the associated chain's node RPC service, obtaining the transaction's metadata (e.g.: the sender's address).

This data is persisted in MongoDB the globalTransaction collection, as in the originTx object.

Retry logic

Sometimes, fetching tx metadata from a node fails, e.g.:

  1. The VAA was emitted with a low consistency level and the tx was not confirmed.
  2. The particular node we're querying is down or we've reached a request limit.

When this happens, the service will retry until both these conditions are met:

  • At least 10 minutes have passed since the VAA was emitted (this mitigates problem 1)
  • At least 4 retries have been made (this mitigates problem 2)

This service processes VAAs in a sequential order, there is no concurrency.

Backfiller

In the cmd/backfiller directory, there is a backfiller program that can be used to:

  • Fill gaps in processing (e.g. due to downtime)
  • Reprocess old records (e.g. overwrite them, this can be useful to apply database model changes)

The backfiller processes VAAs between two input dates.

VAAs will be iterated in a descending timestamp order, that is, newer VAAs are processed first. The rationale behind this is that old VAAs are not as relevant as recent ones.