bnb-chain / bsc

A BNB Smart Chain client based on the go-ethereum fork
GNU Lesser General Public License v3.0
2.71k stars 1.56k forks source link

we have a requirement to trace historical transactions within a week, but we encountered the following error #2563

Closed sn00wman closed 2 months ago

sn00wman commented 3 months ago

Hello, we have a requirement to trace historical transactions within a week, but we encountered the following error.

image

We are using the default pruning configuration with the following startup command.

image

After consulting ChatGPT, we got the response that lowering the pruning block number indirectly increases the amount of retained state data.

By looking at the source code, we found that it might be possible to break through this limitation by modifying the defaultTraceReexec variable. We are concerned about potential issues this change might cause.

image

For instance, if the current block height is N, and we want to trace block N-1000, with the pruning configuration set to 2000, and we change defaultTraceReexec from 128 to 2000, will the trace results be consistent with the real state?

MatusKysel commented 3 months ago

Hey @sn00wman the idea of Reexec is that you can configure how many blocks your node can re-execute to be able trace block/trx on some specific state. So in theory it should work, if your latest state is N - 2000 and reexec set to 2000 and block to be traced let's say N-1000, your node will be able to trace it, but it will require to re-execute 999 blocks + one for tracking to be able to get correct result. Also check debug_getAccessibleStates this will show you available states