From 1d6198ebea96700c4352891e323c25e2d5c695f1 Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Thu, 19 Sep 2024 13:35:42 -0300 Subject: [PATCH 1/4] chore: use hathorplay node to deploy nano testnet explorer service (#348) --- .github/workflows/deploy-reusable.yml | 4 ++-- .github/workflows/deploy.yml | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-reusable.yml b/.github/workflows/deploy-reusable.yml index 5f401b6..aa0ef6c 100644 --- a/.github/workflows/deploy-reusable.yml +++ b/.github/workflows/deploy-reusable.yml @@ -119,8 +119,8 @@ jobs: parse-json-secrets: true # This step recovers the artifact that is generated in the `deploy.yml` workflow - name: Download node modules - # https://github.com/actions/download-artifact/releases/tag/v3.0.2 - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a + # https://github.com/actions/download-artifact/releases/tag/v4.1.8 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 with: name: node_modules - name: Unpack node modules diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 85a84b3..104e592 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -59,7 +59,8 @@ jobs: run: | tar -cvf node_modules.tar ./node_modules - name: Upload node modules - uses: actions/upload-artifact@v2 + # https://github.com/actions/upload-artifact/releases/tag/v4.3.4 + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b with: name: node_modules path: node_modules.tar @@ -136,7 +137,7 @@ jobs: serverless_stage: nano # XXX: Some env vars come from the secret https://eu-central-1.console.aws.amazon.com/secretsmanager/secret?name=ExplorerService%2Fnano-testnet®ion=eu-central-1 api_port: 3001 - hathor_core_url: https://node1.nano-testnet.hathor.network + hathor_core_url: https://hathorplay.nano-testnet.hathor.network hathor_nodes: https://node1.nano-testnet.hathor.network redis_key_prefix: hathor-explorer-service-nano-testnet redis_port: 6379 From 5e04b58739a63918b7a8c0e8ace46bae74645d1d Mon Sep 17 00:00:00 2001 From: Luis Helder Date: Mon, 23 Sep 2024 18:03:17 -0300 Subject: [PATCH 2/4] fix: Dev environment Redis DB (#349) --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 104e592..73df2d0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -84,7 +84,7 @@ jobs: hathor_nodes: https://node1.testnet.hathor.network,https://node.explorer.testnet.hathor.network redis_key_prefix: hathor-explorer-service-dev redis_port: 6379 - redis_db: 0 + redis_db: 1 metadata_bucket: hathor-explorer-metadata-dev cors_allowed_regex: .* elastic_index: dev-token From 19ed286aed498c5f0dc99ca4a864dd5a5c09a243 Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Wed, 23 Oct 2024 18:15:29 -0300 Subject: [PATCH 3/4] feat: truncate children in tx detail API to return at most 100 elements (#350) --- common/configuration.py | 3 +++ handlers/node_api.py | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/common/configuration.py b/common/configuration.py index 2a2b555..a888d4b 100644 --- a/common/configuration.py +++ b/common/configuration.py @@ -110,3 +110,6 @@ def default(cls) -> "LogRenderer": HEALTHCHECK_REDIS_ENABLED = config( "HEALTHCHECK_REDIS_ENABLED", default=False, cast=bool ) + +# API configuration +MAX_TX_CHILDREN = config("MAX_TX_CHILDREN", default=100) diff --git a/handlers/node_api.py b/handlers/node_api.py index 26de3b7..d3ea646 100644 --- a/handlers/node_api.py +++ b/handlers/node_api.py @@ -3,6 +3,7 @@ from aws_lambda_context import LambdaContext +from common.configuration import MAX_TX_CHILDREN from common.errors import ApiError from usecases.node_api import NodeApi from utils.wrappers.aws.api_gateway import ApiGateway, ApiGatewayEvent @@ -176,6 +177,12 @@ def get_transaction( if id is None: raise ApiError("invalid_parameters") response = node_api.get_transaction(id) + # It does not make sense to show in the explorer thousands of children. + # The full node will continue returning the correct data but in the explorer + # service we will truncate it and return only the latest MAX_TX_CHILDREN to show in the UI + # (it might even be more than we should, maybe we should paginate in the future) + if response is not None and "meta" in response and "children" in response["meta"]: + response["meta"]["children"] = response["meta"]["children"][-MAX_TX_CHILDREN:] return { "statusCode": 200, From c9aa61596d041cfdc7b7c5388ddfcf67a5d0dcc7 Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Wed, 23 Oct 2024 19:41:13 -0300 Subject: [PATCH 4/4] chore: bump to v0.18.2 (#351) --- package-lock.json | 4 ++-- package.json | 2 +- pyproject.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 617d922..54dfcd3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "hathor-explorer-service", - "version": "0.18.1", + "version": "0.18.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "hathor-explorer-service", - "version": "0.18.1", + "version": "0.18.2", "license": "MIT", "dependencies": { "@apidevtools/swagger-cli": "^4.0.4", diff --git a/package.json b/package.json index c5522fe..737faf7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hathor-explorer-service", - "version": "0.18.1", + "version": "0.18.2", "description": "Hathor Explorer Service Serverless deps", "dependencies": { "@apidevtools/swagger-cli": "^4.0.4", diff --git a/pyproject.toml b/pyproject.toml index 4e5a0d6..991c044 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "hathor-explorer-service" -version = "0.18.1" +version = "0.18.2" description = "" authors = ["Hathor Labs "] license = "MIT"