Closed magicxyyz closed 5 months ago
Also - I'd like to have a test for our partial-archive-node config that will try at least some of these APIs.
There already is a system test on nitro side, that runs this partial-archive-node, stops it, restarts it and then checks if eth_getBalance
can be called for some blocks.
https://github.com/OffchainLabs/nitro/blob/a40f8f1e9ba0975452d3dc1da602f4e20142b608/system_tests/recreatestate_rpc_test.go#L429-L429
If needed, I can add some more specific tests for the changes, also in geth repo.
Also - I'd like to have a test for our partial-archive-node config that will try at least some of these APIs.
There already is a system test on nitro side, that runs this partial-archive-node, stops it, restarts it and then checks if
eth_getBalance
can be called for some blocks. https://github.com/OffchainLabs/nitro/blob/a40f8f1e9ba0975452d3dc1da602f4e20142b608/system_tests/recreatestate_rpc_test.go#L429-L429If needed, I can add some more specific tests for the changes, also in geth rep
As suggested, I added a specific test on nitro side for getting state for RPCs: https://github.com/OffchainLabs/nitro/blob/bb5c908d7c16e103130e2d80c7f5fc01e4dbef2e/system_tests/recreatestate_rpc_test.go#L514C1-L557
I am still doing some testing with nitro-testnode. I have to yet confirm that, but it seems that finalizers are not good solution.
This PR is addressing following issues:
hashdb
dirties cache if at all. It means that the state could potentially be garbage collected in another thread and further operations on state would fail. That is fine for normal archive node that keeps all the state and doesn't use dirties cache. It is also ok for a full node as we don't require it to keep all the state but only some recent, so RPCs are expected to fail when requesting too old state. However, that is an issue for "hybrid" node that persists only some states and keeps recent states in dirties cache - we expect it to always be able to process RPC for any state (to emulate normal archive node functionality).AdvanceStateUpToBlock
), which we use for some RPCs (e.g.eth_call
,etc_getBalance
), accumulated changes to state in oneStateDB
object, what may cause some issues i.a. excessive memory usage by caches insideStateDB
.This PR:
state.StateDB
eth.StateAtBlock
which is upstream implementation for recreation of state for tracers and should be a more robust solution