Commit Graph

119 Commits

Author SHA1 Message Date
ftocal 9198c129e1
Add environment to promethes metrics for api (#507) 2023-07-05 16:15:29 -03:00
agodnic 4ce2d1e329
Remove notional cache from the `api` component (#500)
### Summary

The `api` component was importing and initializing the notional cache, but not using it.

This pull request removes the unnecessary dependency.
2023-07-05 15:07:24 -03:00
agodnic 5aedf0247e
Fix issue in `txHash` search (#494)
### Description

Tracking issue: https://github.com/wormhole-foundation/wormhole-explorer/issues/493

Fix an issue in which transaction hash search was failing for VAAs that have the same `txHash`.
2023-07-04 09:58:21 -03:00
gipsh 78bd0cbd75
add prefix to chacheable and fix deploy (#479) 2023-06-29 15:54:45 -03:00
gipsh 2306d103d8
321 replace redis to elasticcache (#467)
* redis prefix support for caches

* fly support for prefix

* unit tests

* redis prefix for notional cache updater

* fix test

* fix tests

* use redis-prfix from config map
2023-06-28 15:04:36 -03:00
agodnic 98ae127278
[API] Expose emitter native addresses (#466)
### Description

Tracking issue: https://github.com/wormhole-foundation/wormhole-explorer/issues/451.

The Wormhole Scan UI needs to provide a link to the emitter address for each VAA.

This pull request adds a field containing decoded emitter addresses in the following endpoints:
* `GET /api/v1/transactions`: field `emitterNativeAddress`
* `GET /api/v1/vaas*`: field `emiterNativeAddr`
2023-06-28 14:54:51 -03:00
agodnic f7543a1054
Remove field `vaa.NativeTxHash` from JSON model (#462)
### Description

Remove the `NativeTxHash` from the JSON model returned by `GET /api/v1/vaas`. That field was never meant to be exposed to the API users.
2023-06-27 10:12:55 -03:00
agodnic 5663fed0c9
Fix transaction hash search for Aptos (#461)
### Description

Tracking issue: https://github.com/wormhole-foundation/wormhole-explorer/issues/430

In `GET /api/v1/vaas?txHash={hash}`, searching for Aptos VAAs by transaction hash was not working correctly. This pull request fixes the issue.
2023-06-27 10:12:32 -03:00
walker-16 737405054a
446 create prometheus metrics (#457)
* Add vaa metrics

* Add dummy metrics and observations metrics

* Add heartbeat, governorConfig, governorStatus metrics

* fix go.sum

* Add deploy en vars METRICS_ENABLED to fly component

Co-authored-by: ftocal <fert1335@gmail.com>

---------

Co-authored-by: Fernando Torres <fert1335@gmail.com>
2023-06-26 12:47:22 -03:00
agodnic 8b58196181
Fix transaction hash search for Sui (#448)
### Description

Tracking issue: https://github.com/wormhole-foundation/wormhole-explorer/issues/447

For Sui transaction hashes, calling `GET /api/v1/vaas?txHash={hash}` returned an HTTP status code of 400 and a message of `"MALFORMED TX HASH"`.

This pull request fixes the problem.
2023-06-22 10:32:17 -03:00
agodnic 317e411900
Fix tx hash parsing for Solana (#444)
### Description

Tracking issue: https://github.com/wormhole-foundation/wormhole-explorer/issues/434

Some Solana transaction hashes were failing to parse. This pull request fixes the issue.
2023-06-21 21:46:23 -03:00
ftocal d0cea55f2d
Add cache to dashboard endpoints (#441)
* Add cache to dashboard endpoints

* Code review updates
2023-06-21 17:00:29 -03:00
agodnic 532412077b
Fix `vaa.txHash` for Solana and Aptos (#443)
For Solana and Aptos, the transaction hash returned by `GET /api/v1/vaas` is incorrect (currently it's the value transmitted in the gossip network, which is not the real transaction hash).

This pull request replaces it with the real transaction hash.
2023-06-21 17:00:11 -03:00
gipsh 2c476dd696
update storage version and improve error log (#438)
Co-authored-by: gipsh <hernangips@OnoSendai-2.local>
2023-06-21 12:31:40 -03:00
gipsh 669a14cd62
update modules for api (#432)
update

Co-authored-by: Hernan Gips <hernangips@OnoSendai-2.local>
2023-06-21 10:56:51 -03:00
gipsh 32e67a5824
Use new custom storage for redis (#425)
* allow prefix for redis keys on rate limiter

* use storage module from lib

---------

Co-authored-by: Hernan Gips <hernangips@OnoSendai.local>
2023-06-20 12:25:04 -03:00
ftocal 69885aed0c
Fix intermittent failure in x-chain-activity endpoint (#420)
* Replace start_time and end_time query parameters with fixed ranges at the endpoint of the chain activity
Add InfluxDB tasks for enpdoint chain-activity for each timeSpan
Add cache for chain-activity endpoint

* Code review updates
2023-06-20 10:34:20 -03:00
gipsh b490be0f5d
fix api doc basepath (#423)
fix api doc basepath

Co-authored-by: Hernan Gips <hernangips@OnoSendai.local>
2023-06-18 13:17:22 -03:00
agodnic 3f823c51ac
Add support for Aptos in the `tx-tracker` service (#421)
### Description

This pull request adds support for Aptos in the `tx-tracker` service.

This will lead to improvements for the wormhole Scan UI:
1. The transaction hash that was being previously displayed for Aptos VAAs was incorrect. This pull request fixes the issue.
2. The sender addresses for Aptos VAAs will now become available for for the UI.
2023-06-16 17:47:28 -03:00
gipsh ba3d1d9e61
Vanilla rate limiter (#414)
* update doc

* api def update

* first commit

* support redis, allow for private ips

* add deployment vars

---------

Co-authored-by: Hernan Gips <hernangips@OnoSendai.local>
2023-06-15 23:22:47 -03:00
walker-16 97946d5a56
Issue [#446] remove duplicate data transaction history graph (#413) 2023-06-15 13:01:57 -03:00
ftocal 9381695d37
Fix txHash encoding by chain (#410)
Add txHash encondig backfiller
Handle txHash base58 encoding for solana in tx-tracker
Add temporary field _originTxHash in vaas and vaaIdTxHash collections by backup
Add cobra to fly backfiller

Co-authored-by: walker-16 <agpazos85@gmail.com>
2023-06-15 09:57:39 -03:00
agodnic 19743322e4
Retrieve sender address for each transaction (#408)
### Summary

Tracking issue: https://github.com/wormhole-foundation/wormhole-explorer/issues/404

The WormholeScan UI needs to display the sender address for each token bridge VAA. This pull request modifies the `tx-tracker` service to obtain that information for Solana and eight EVM chains.

The transaction sender will become accessible through the following endpoints:
* `GET /api/v1/global-tx/{chain}/{emitter}/{seq}`: field `originTx.from`.
* `GET /api/v1/transactions`: field `originAddress`.
In both cases, the field is nullable (i.e.: sometimes it may not be available due to eventual consistency or internal errors)
2023-06-14 17:46:53 -03:00
agodnic a0475ab17e
Add endpoint `GET /api/v1/transactions` (#388)
### Summary
Tracking issue: https://github.com/wormhole-foundation/wormhole-explorer/issues/385

This pull request implements a new endpoint, `GET /api/v1/transactions`, which will be consumed by the wormhole explorer UI.

The endpoint returns a paginated list of transactions, in which each element contains a brief overview of the transaction (ID, txHash, status, etc.).

It exposes offset-based pagination via the parameters `page` and `pageSize`. Also, results can be obtained for a specific address by using the `address` query parameter.

The response model looks like this:
```json
{
  "transactions": [
   {
    "id": "1/5ec18c34b47c63d17ab43b07b9b2319ea5ee2d163bce2e467000174e238c8e7f/12965",
    "timestamp": "2023-06-08T19:30:19Z",
    "txHash": "a302c4ab2d6b9a6003951d2e91f8fdbb83cfa20f6ffb588b95ef0290aab37066",
    "originChain": 1,
    "status": "ongoing"
  },
  {
    "id": "22/0000000000000000000000000000000000000000000000000000000000000001/18308",
    "timestamp": "2023-06-08T19:17:14Z",
    "txHash": "00000000000000000000000000000000000000000000000000000000000047e7",
    "originChain": 22,
    "destinationAddress": "0x00000000000000000000000067e8a40816a983fbe3294aaebd0cc2391815b86b",
    "destinationChain": 5,
    "tokenAmount": "0.12",
    "usdAmount": "0.12012",
    "symbol": "USDC",
    "status": "completed"
  },
  ...
  ]
}
```

### Limitations of the current implementation
1. Doesn't return the total number of results (this may result in a performance issue when we filter by address)
2. Can only filter by receiver address (we don't have sender information in the database yet)
2023-06-12 11:43:48 -03:00
ftocal b02d602b14
fix percentage for destinations when is notional (#389) 2023-06-08 10:38:34 -03:00
ftocal ec95642a9b
Fix vaa-count metric backfiller and Influx query for x-chain-activity endpoint (#382)
Fix vaa-count metric backfiller
Fix Influx query for x-chain-activity endpoint
2023-06-05 16:33:52 -03:00
Ben Guidarelli 6cbdf36b2c
Fix url param name (#370)
Fix URL parameter name in swagger documentation
2023-06-01 17:02:11 -03:00
gipsh a835a220fe
Update doc (#375)
* update doc

* api def update

* update swagger doc

* update deps
2023-06-01 16:46:24 -03:00
walker-16 c510df7948
Add endpoint to get token data by chainId and token_address (#365) 2023-05-31 10:29:16 -03:00
agodnic 9d33d82789
Add log messages on API startup (#361)
### Summary

Often times, the API service fails to start due to connectivity issues with other services (e.g.: redis).

Previously, no log information was being emitted, which made it hard to troubleshoot the exact reason for the service failing to start.

This pull request adds log messages when the service starts to make those cases easier to debug.
2023-05-30 11:37:10 -03:00
agodnic 9e2d3b445d
[API] Fix sorting order in observation endpoints (#357)
### Summary

This pull request fixes an issue in which all observation-related endpoints were returning results sorted by `id` (https://github.com/wormhole-foundation/wormhole-explorer/issues/358). The expected behavior is to sort results based on descending timestamp order instead.

Also, swagger docs were updated to document this behavior.
2023-05-30 11:35:30 -03:00
agodnic 37d6d42c19
Remove duplicated code in token database (#356)
### Summary

Tracking issue: https://github.com/wormhole-foundation/wormhole-explorer/issues/344

Before this pull request, there were two separate token databases (one being used by the InfluxDB backfiller, and another one in the `common/` module being used by the analytics service).

Having two different token databases resulted in inconsistencies, due to each of these databases containing different tokens.

This PR unifies those two databases into a single one, under the `common/` module.
2023-05-30 11:14:19 -03:00
agodnic 4aca29fe7d
Generate volume metrics for unknown tokens (#348)
### Summary
This pull request fixes an issue in which volume metrics were not being generated for unknown tokens (i.e.: tokens that are not present in our database).

Also, the function that generated volume metrics was modified in order to handle timestamp collisions.
2023-05-29 10:54:09 -03:00
walker-16 cb9532b5c1
Remove unused observation fields version and upadte docs (#355) 2023-05-29 10:53:52 -03:00
agodnic 69251f136d
[API] Run scorecard queries concurrently (#339)
### Summary

Before pull request, in `GET /api/v1/scorecards`, the queries for each scorecard were being executed sequentially. This PR changes the handler to run all those queries concurrently.

Tracking issue: https://github.com/wormhole-foundation/wormhole-explorer/issues/336
2023-05-23 14:50:19 -03:00
ftocal fe574754eb
Fix volume when the metric is notional (#341) 2023-05-23 11:40:54 -03:00
walker-16 878b201259
fix globalTransaction empty id issue (#337) 2023-05-22 17:30:21 -03:00
agodnic ce72cf7463
[API] Add 24h messages to `GET /api/v1/scorecards` (#326)
### Summary

Tracking issue: https://github.com/wormhole-foundation/wormhole-explorer/issues/320

This pull request adds the `24h_messages` field to the response in `GET /api/v1/scorecards`. This field indicates the total number of VAAs emitted in the last 24 hours, including messages from PythNet.

Also, the analytics component has been updated to generate a new metric for this purpose. There is a task that summarizes data every 5 minutes to speed up query times. The data is retained for 24 hours only. For this particular metric, writes to InfluxDB are being batched to improve performance.
2023-05-18 11:14:36 -03:00
walker-16 3a445da161
288 tvl (#327)
* get tvl from json api

* Add tvl scorecards

---------

Co-authored-by: gipsh <gipsh@MaasNeoTek>
2023-05-17 15:04:17 -03:00
agodnic d75062ae50
Fix inaccurate volume in `GET /api/v1/scorecards` (#312)
The endpoint `GET /api/v1/scorecards` was returning an inaccurate number for the volume metric. This pull request fixes the issue.

Additionally, the response model of `GET /api/v1/top-assets-by-volume` has been changed as specified by @raop155:
```
{
  "assets": [
    {
      "symbol": "USDCet",
      "tokenChain": 1,
      "tokenAddress": "000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "volume": "475173.83806883"
    }
  ]
}

```
2023-05-15 17:30:15 -03:00
walker-16 9d7484e97b
Add last-tx filter for valid configuration and fix doc (#319) 2023-05-15 16:59:54 -03:00
ftocal c2b94f6448
Add total tx count and total tx volume by portal bridge for scorecards (#314)
Co-authored-by: walker-16 <agpazos85@gmail.com>
2023-05-15 15:15:12 -03:00
agodnic c25ebcb6fc
New endpoint: top chain pairs by number of transfers (#307)
### Summary

Tracking issue: https://github.com/wormhole-foundation/wormhole-explorer/issues/275

This pull request implements the endpoint `GET /api/v1/top-chain-pairs-by-num-transfers`, which returns the chain pairs that have the most transfers.Internally, the endpoint uses data summarized daily to speed up query execution times.

This endpoint has a mandatory query parameter named timerange, which must be set to `7d`, `15d` or `30d`.
2023-05-12 13:05:18 -03:00
walker-16 25a675f99a
fix query from last-tx endpoint (#311)
Co-authored-by: ftocal <fert1335@gmail.com>
2023-05-12 10:54:29 -03:00
ftocal 12b39bea59
Add summarization data for tx_count endpoint (#296)
* Add summarization data for tx_count endpoint

Co-authored-by: walker-16 <agpazos85@gmail.com>

* Add new buckets in deployment

Co-authored-by: walker-16 <agpazos85@gmail.com>

---------

Co-authored-by: walker-16 <agpazos85@gmail.com>
2023-05-10 18:18:32 -03:00
agodnic a21f40ed55
Get top assets by volume (#302)
### Summary

Tracking issue: https://github.com/wormhole-foundation/wormhole-explorer/issues/276

This pull request implements the endpoint `GET /api/v1/top-assets-by-volume`, which returns the assets that have the highest volume. Internally, the endpoint uses data summarized daily to speed up query execution times.

This endpoint has a mandatory query parameter named `timerange`, which must be set to `7d`, `15d` or `30d`.
2023-05-10 17:39:18 -03:00
agodnic a31d59822d
Add definitions to token dictionary (#292)
### Summary

In order to compute volume metrics for each token, we need metadata about the token that is not present in the VAAs (e.g.: decimals, symbol).

That information is statically defined in `common/domain/tokenbridge.go`. This pull request adds the most relevant tokens (i.e.: the tokens that contribute the most volume) to the existing definitions. It is very likely that more token definitions will be added in the future as needed.

The token metadata that was previously defined in the `notional` package (symbols, coingecko IDs) was also moved to `common/domain/tokenbridge.go`. 

Tracking issue https://github.com/wormhole-foundation/wormhole-explorer/issues/281
2023-05-08 17:51:18 -03:00
agodnic d9d49ec919
Add 24h volume to scorecards (#274)
### Summary

This pull request adds volume metrics to influxdb. Also, it adds the 24h volume metric to `GET /api/v1/scorecards`.

Tracking issues: https://github.com/wormhole-foundation/wormhole-explorer/issues/221, https://github.com/wormhole-foundation/wormhole-explorer/issues/280

### Changes:
* The `parser` service no longer generates metrics for influxdb. All metrics-related code was removed from that service, that code was moved to the analytics service instead.
* New volume metrics were added to the analytics service.
* The notional cache was modified to use token names (i.e.: ticker symbols) as keys instead of chain IDs.
* The notional cache reader was moved to the `common/client/cache` package.
* A little bit of duplicated code between the cache reader and writer was removed.
* A 24h volume metric was added to `GET /api/v1/scorecards`.
* A dictionary that stores token metadata was added under `common/domain/tokenbridge.go`. More tokens will be added to it in the near future.
2023-05-04 20:17:03 -03:00
walker-16 fd51f0a819
Fix endpoint last-txs to fit portal explorer requirements (#286) 2023-05-03 14:01:55 -03:00
agodnic 69ff71d440
Sort the output of `GET /api/v1/vaas` by timestamp (#267)
### Summary

The output of `GET /api/v1/vaas` was not being correctly sorted. This pull request changes the behavior so that the output will be sorted by the `timestamp` field.

Additionally, duplicated code was removed in the VAA code that handles queries.

Also, there was an unused query parameter `sortBy` which was being exposed but not used. Hence it was removed.

Tracking issue: https://github.com/wormhole-foundation/wormhole-explorer/issues/233
2023-04-28 10:18:07 -03:00