/block rosetta api is slow where there are spam contract interactions exists in a block. It happens in base and bsc. It will cause indexer timeout and paused network processing in the end.
Solution
The root cause is when populate transactions for a block we will need to call GetContractCurrency for each transaction and it takes time. For spam contract above ^ they should all be same so we could cache it instead.
Test in local as benchmark
Before: /block request takes 8 minutes for this bsc-testnet block
After: /block request takes 2 seconds for this bsc-testnet block
Fixes # .
Motivation
/block rosetta api is slow where there are spam contract interactions exists in a block. It happens in base and bsc. It will cause indexer timeout and paused network processing in the end.
Solution
The root cause is when populate transactions for a block we will need to call
GetContractCurrency
for each transaction and it takes time. For spam contract above ^ they should all be same so we could cache it instead.Test in local as benchmark
Before: /block request takes 8 minutes for this bsc-testnet block
After: /block request takes 2 seconds for this bsc-testnet block
Open questions