-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
feat: snapshot apis for EIP-4881 #400
Conversation
Performance Report✔️ no performance regression detected Full benchmark results
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks super amazing 👍
i think we will now be saving the DepositTree
in db by the finalized gindex nodes and then values post that?
now instead of saving all roots, we'll just save serialized snapshot periodically. Something like: const treeSnapshot = depositRootTree.toSnapshot(depositCount);
const depositSnapshot = {
finalized: treeSnapshot.finalized,
depositRoot: treeSnapshot.root,
depositCount: treeSnapshot.count,
executionBlockHash,
executionBlockHeight,
};
db.put(executionBlockHeight, depositSnapshot); upon restart we download snapshot from const depositRootTree = DepositDataRootPartialList.toPartialViewDU({
finalized: snapshot.finalized,
root: snapshot.depositRoot,
count: snapshot.depositCount,
}); then the partial tree grows from there similar to the current full tree |
Motivation
Implement snapshot apis for eip-4881
Description
PartialListCompositeType
type along with ViewDU (and no View since we lacks a lot of methods there and dont maintain it anymore)toPartialViewDU()
api as the entry pointtoSnapshot, fromSnapshot
apisDepositDataRootPartialList = new PartialListCompositeType(Root, 2 ** DEPOSIT_CONTRACT_TREE_DEPTH);
depositRootTree = DepositDataRootPartialList.toPartialViewDU(snapshot)
Closes #293
a candidate to replace #377
TODOs