Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mising operations of Aristo: handle sidechain in memory #2260

Open
jangko opened this issue May 31, 2024 · 0 comments
Open

Mising operations of Aristo: handle sidechain in memory #2260

jangko opened this issue May 31, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@jangko
Copy link
Contributor

jangko commented May 31, 2024

Copied from discord discussion:

One of the test case in test_blockchain_json doing something like this:

nimbus-eth1/tests/fixtures/eth_tests/BlockchainTests/TransitionTests/bcHomesteadToDao/DaoTransactions.json
(several other failing test cases also doing similar things)

Genesis-D1-D2-D3-D4-D5X-H1-H2-H3-H4-H5X-D5-D6-D7-D8-...-D14

where D is default chain, and H is side chain. Block with a 'X' is an invalid block. When executing block H1, there is an error message like this because H1 request for genesis stateRoot but cannot find it anymore.

Error: unhandled exception: AccountLedger.init(): RootNotFound(Aristo, ctx=ctx/newColFn(), error=GenericError)

comments from @arnetheduck :
This is something we should be able to support with the pure in-memory option - ie as long as D4 is the finalization point, it's supported, but that also means that only D4 has been written to disk.

so it sounds like it's a set of operations that we need are not captured in the current API design, but for the sake of argument, here's how it can be done (based on what I've seen in persistBlocks at least:

when processing D1, we open transaction T1
then for D2..D15, we open T1.2..T1.15 - ie we never commit T1 - this is the state in which persistBlocks is iterating over the blocks we give it
in this state, we can still process forks because we've not committed T1 and we have all the "diff" layers in memory

Let's say that D4 is finalized. A naive way to implement this is:
roll back all transactions including T1
re-play D1..D4 and commit that
re-play D5..D15 and the remaining branches without committing them

then when D8 is finalized, repeat - this time, H1 is not replayed, because it forks off a finalized section of the graph

@jangko jangko added the bug Something isn't working label Jun 4, 2024
@jangko jangko self-assigned this Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant