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

We need access to a worldstate image of the last 128 blocks with bonsai #4199

Closed
matkt opened this issue Jul 29, 2022 · 1 comment
Closed
Assignees

Comments

@matkt
Copy link
Contributor

matkt commented Jul 29, 2022

With bonsai we have the worldstate of the head and tries logs to be able to rollback or rollforward the worldstate to an old/recent block. This technique with trielogs works very well in the case of reorgs but has limitations.

In particular with the snapsync as a server we must be able to provide the nodes of the worldstate of the last 128 blocks. If we have to rollback after every request it will be a lot of work for the node and risks impacting the stability of the node.

To avoid this it will be preferable to keep an image of the last 128 blocks and rocksdb's snapshot feature might help to do this

http://rocksdb.org/blog/2015/11/10/use-checkpoints-for-efficient-snapshots.html

This feature can also help make bonsai more stable. If we detect worldstate corruption for some reason (crash or bug). We could go back and take the worldstate of block head-1 and resume synchronization from this one

Example :

  • 1 : the node tries to import block h+1
  • 2 : stateroot mismatch or other issue detected
  • 3 : besu take the worldstate image of block h-1 and try again to import block h
  • 4: the database is fixed thanks to the new import
  • 5: we import block h+1 again
@garyschulte
Copy link
Contributor

garyschulte commented Aug 10, 2022

As we discussed, a persistent snapshot (Checkpoint) seems like a viable source to rollback to whereas a collection of n (e.g. 128) in-memory snapshot-transaction-based worldstates is likely a more suitable mechanism for snapsync server.

see https://github.com/garyschulte/besu/tree/feature/bonsai-isolation (re-pushed and rebased off of main) and specifically:

RocksDbColumnarKeyValueStorage.takeSnapshot()
RocksDbColumnarKeyValueSnapshot

@jflo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants