Pool count from gateway - #1647
Open
stefangutica wants to merge 20 commits into
Open
stefangutica wants to merge 20 commits into
stefangutica wants to merge 20 commits into
Conversation
…fo ttls in warmer
|
k6 load testing comparison.
Legend: Avg - Average Response Time, Max - Maximum Response Time, 90 - 90th Percentile, 95 - 95th Percentile |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
stefangutica
marked this pull request as draft
September 29, 2026 12:01
stefangutica
marked this pull request as ready for review
September 30, 2026 09:33
radumojic
approved these changes
Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reasoning
/pool/countdownloaded the whole pool from the gateway and returned its length, so it failed whenever the pool response exceeded the 2MB limit the API sets for it./poolreturned a generic error, so the FE could not tell it apart from any other failure, and the pool was downloaded again, up to the limit, on every request.Proposed Changes
getTransactionPoolreturnsnullwhen the response exceeds the size limit. Any other error still throws.getTransactionPoolCountsums the per-shard counts fromtransaction/pool/count.nullundertxpool(explicitcacheNullable: true), so it is not downloaded again until the value expires./pool/countstill counts the pool, so it matches what/poollists. Whenever the pool cannot be read, too large or for any other reason, it returns the total from the gateway, cached undertxpool:countfor 1s, whatever the filters./pooland/pool/:txhashhave two kinds of errors:503with{ "statusCode": 503, "code": "transaction_pool_too_large", "message": "The transaction pool is too large to be displayed" }when the pool is too large, documented in Swagger;500for any other failure, as before.poolUpdatenow carries astatus:success,tooLargeorinternalServerError.poolisnullunless the status issuccess.poolCountis the total from the gateway when the pool cannot be read, ornullwhen the count fails as well.nulland also refreshes the total count from the gateway, withtransactionPoolWarmer.ttlInSeconds, as before.How to test
pool.spec.ts: counts, null cache, gateway fallback for too large and for other failures, pool with filters failing when too large;pool.too.large.spec.ts: 503/500 responses, websocket statuses, price per unit;cache.warmer.pool.spec.ts: warming;gateway.pool.count.spec.ts: size limit, other errors, count sum.ApiService: a 1MB pool is returned, a 3MB pool is detected as too large, and an unreachable gateway still throws./pooland/pool/:txhashanswer 503 and/pool/countanswers 200 with the gateway total. With any other failure,/pooland/pool/:txhashanswer 500.transaction/pool/countexists from mx-chain-proxy-go#520 on; mainnet and testnet gateways don't have it yet at the time of writing.