testinprod-io / op-erigon

Optimism implementation on the efficiency frontier
https://op-erigon.testinprod.io
GNU Lesser General Public License v3.0
87 stars 15 forks source link

Increasing the rpc.maxgetproofrewindblockcount.limit to 300K makes the request hang indefinitely #198

Closed Spich3000 closed 5 months ago

Spich3000 commented 5 months ago

Hi team! We are facing a problem with a requested block on OP Sepolia archive

The bug:

  1. Increasing the "rpc.maxgetproofrewindblockcount.limit" to 300K to avoid this error:

{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"requested block is too old, block must be within 100000 blocks of the head block number (currently 13752981)"}}

  1. The request is taking too long and I did not get a response:

curl 'http://localhost:8545' -X POST -d '{"jsonrpc":"2.0","method":"eth_getProof","params":["0x4200000000000000000000000000000000000016",["0x4beb7ab3335c0adfd683dc6fb54aad7817b2c2f7465bde5c3a5653f4427de637"],"0xCF6FB4"],"id":1}' -H "Content-Type: application/json" | jq % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 186 0 0 0 186 0 0 --:--:-- 0:05:04 --:--:-- 0

Can this parameter (rpc.maxgetproofrewindblockcount.limit) be extended to receive this request and have it complete in time? Any help would be appreciated.

pcw109550 commented 5 months ago

What erigon does to serve getProof request for old blocks is to rewind the state. This means the node is trying to rewind large amounts of blocks, and reconstruct the merkle patricia trie, which is very very computationally intensive. This is the nature of erigon, and there is no workaround. Thats the reason why rpc.maxgetproofrewindblockcount.limit exists, to avoid DoSing the node. If you want old proofs, you may use other node software implementations like op-geth.

Spich3000 commented 5 months ago

@pcw109550, Thank you for the explanation. Appreciate your help!