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..73df2d0 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 @@ -83,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 @@ -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 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, 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"