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

feat: support getting withdrawal proof on pbss #74

Merged
merged 4 commits into from
Apr 15, 2024
Merged

Conversation

joeylichang
Copy link
Contributor

@joeylichang joeylichang commented Mar 25, 2024

Description

This PR proposes a solution that makes it possible to obtain proof of withdrawal in PBSS.

nodebufferlist 15 12 28

NodeBufferList consists of a NodeCache list and a BaseNodeBuffer. A NodeCache is used to store the diffLayers committed. The diffLayers in one NodeCache is limited to 1800. When a NodeCache is full, another new NodeCache is initialized and placed at the top of the list. In the background, the NodeCache from the end of the list is regularly inserted into the BaseNodeBuffer. When the BaseNodeBuffer reaches 256M, it will be flushed to the backend database. There are at least two NodeCaches in the list, which ensure that there are at least 3600 diffLayers in the memory.

Rationale

PBSS can only support the world state of the recent last 129 (128 difflayers + 1 disklayer) blocks’ state data; while getting withdrawal proof needs the world state of the last block divisible by 3600, which MUST be kept.

Example

If you want to use nodebufferlist, you can use the --pathdb.nodebuffer list flag.

--pathdb.nodebuffer is set type of trienodebuffer to cache trie nodes in disklayer('list', 'sync', or 'async'), which default is async. async is double nodebuffer for flushing db in background. sync is the community’s native nodebuffer, which block flushing db.

--pathdb.sync flag is deleted.

Changes

Notable changes:

  • trie/triedb/pathdb/nodebufferlist.go: the implement of NodeBufferList.
  • trie/triedb/pathdb/database.go: implicitly built-in withdrawal proof reader.

@joeylichang joeylichang added the wontfix This will not be worked on label Mar 25, 2024
@joeylichang joeylichang force-pushed the pbss_wp branch 8 times, most recently from 4dff2fd to ffbfda8 Compare March 26, 2024 04:12
@joeylichang joeylichang changed the title [WIP] feat: support get withdrawal proof on pathdb feat: support get withdrawal proof on pathdb Mar 26, 2024
@joeylichang joeylichang added enhancement New feature or request and removed wontfix This will not be worked on labels Mar 26, 2024
@joeylichang joeylichang changed the title feat: support get withdrawal proof on pathdb feat: support getting withdrawal proof in pbss Mar 26, 2024
@joeylichang joeylichang force-pushed the pbss_wp branch 4 times, most recently from e53be06 to 17caa0e Compare March 29, 2024 04:08
@bnb-chain bnb-chain deleted a comment from welkin22 Mar 29, 2024
@joeylichang joeylichang force-pushed the pbss_wp branch 4 times, most recently from 0f73d36 to 789c943 Compare April 2, 2024 01:17
krish-nr
krish-nr previously approved these changes Apr 7, 2024
will-2012
will-2012 previously approved these changes Apr 8, 2024
@joeylichang joeylichang changed the title feat: support getting withdrawal proof in pbss feat: support getting withdrawal proof on pbss Apr 10, 2024
trie/triedb/pathdb/nodebufferlist.go Show resolved Hide resolved
trie/triedb/pathdb/nodebufferlist.go Show resolved Hide resolved
cmd/utils/flags.go Show resolved Hide resolved
cmd/utils/flags.go Show resolved Hide resolved
Copy link
Collaborator

@owen-reorg owen-reorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@welkin22 welkin22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@owen-reorg owen-reorg merged commit 0b1f3ed into develop Apr 15, 2024
1 check passed
@sysvm sysvm deleted the pbss_wp branch July 29, 2024 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants