wormhole-explorer/tx-tracker
Mariano 6ab6824d82
[1520] Retrieve the feeUSD from coingecko in tx-tracker [WIP] (#1541)
* start implementing retrieving the feeUSD from coingecko

* add missing pricesApi in the initialization of tx-tracker service

* add missing initialization

* add missing cfg for coingecko properties

* fix solana in url

* replace coingecko api call with notional redis client

* add native token list in commons

* add decimal places

* change feeUSD to Raw.GasPrice

* add check for mainnet

* replace with sdk const for more coupling

* replace pricesApi with notionalCache

* undo changes on pricesApi

* undo more stuff

* remove lines

* remove unused timestamp

* remove unused props

* remove

* fix indent

* fix import

* change

* add cache configs

* change token_address to native

* fixes

* fix BNB coingeckoID

* fix polygon coingecko_id

* change to lowercase

* adjust type FeeDoc in operations endpoint

* change Blast native token

* pr review changes

* code-review fixes

* comment wormchain

* rename var

* add comment to wormchain gas token map entry
2024-07-15 15:43:53 -03:00
..
chains [1520] Retrieve the feeUSD from coingecko in tx-tracker [WIP] (#1541) 2024-07-15 15:43:53 -03:00
cmd [1520] Retrieve the feeUSD from coingecko in tx-tracker [WIP] (#1541) 2024-07-15 15:43:53 -03:00
config [1520] Retrieve the feeUSD from coingecko in tx-tracker [WIP] (#1541) 2024-07-15 15:43:53 -03:00
consumer [1520] Retrieve the feeUSD from coingecko in tx-tracker [WIP] (#1541) 2024-07-15 15:43:53 -03:00
http [1520] Retrieve the feeUSD from coingecko in tx-tracker [WIP] (#1541) 2024-07-15 15:43:53 -03:00
internal/metrics Add vaa processing speed metrics in fly, analytics, parser and tx-tracker (#1531) 2024-07-03 11:23:54 -03:00
queue 1284 enhance operations endpoint to include gas costs in origin and destination chains (#1516) 2024-07-03 14:48:27 -03:00
.gitignore Add support to sepolia chains (#1001) 2024-01-22 11:01:18 -03:00
Dockerfile Add backfiller for tx-tracker (#1132) 2024-02-20 09:58:37 -03:00
Makefile Add backfiller for tx-tracker (#1132) 2024-02-20 09:58:37 -03:00
README.md Fix [api] get transactions by address and add mongo query monitor (#707) 2023-09-25 16:50:16 -03:00
go.mod 1284 enhance operations endpoint to include gas costs in origin and destination chains (#1516) 2024-07-03 14:48:27 -03:00
go.sum 1284 enhance operations endpoint to include gas costs in origin and destination chains (#1516) 2024-07-03 14:48:27 -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.

Localstack configuration

Config sns topic

aws --profile localstack --endpoint-url=http://localhost:4566 sns create-topic --name vaas-pipeline.fifo --attributes FifoTopic=true,ContentBasedDeduplication=false

Config SQS FIFO with dead letter queue localstack

aws --profile localstack --endpoint-url=http://localhost:4566 sqs create-queue --queue-name=wormhole-vaa-tx-tracker-dlq-queue.fifo --attributes "FifoQueue=true"

aws --profile localstack --endpoint-url=http://localhost:4566 sqs create-queue --queue-name=wormhole-vaa-tx-tracker-queue.fifo --attributes FifoQueue=true,MessageRetentionPeriod=3600,ReceiveMessageWaitTimeSeconds=5,VisibilityTimeout=20,RedrivePolicy=""{\"deadLetterTargetArn\":\"arn:aws:sqs:us-east-1:000000000000:wormhole-vaa-tx-tracker-dlq-queue.fifo\",\"maxReceiveCount\":\"2\"}""

Subscribe SQS FIFO to vaas-pipeline.fifo topic

aws --profile localstack --endpoint-url=http://localhost:4566 sns subscribe --topic-arn arn:aws:sns:us-east-1:000000000000:vaas-pipeline.fifo --protocol sqs --notification-endpoint http://localhost:4566/000000000000/wormhole-vaa-tx-tracker-queue.fifo

Check message in the dead letter queue localstack

aws --profile localstack --endpoint-url=http://localhost:4566 sqs receive-message --queue-url=http://localhost:4566/000000000000/wormhole-vaa-tx-tracker-dlq-queue.fifo