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

Blockchain Provider tree state integration #8747

Closed
Tracked by #8742
mattsse opened this issue Jun 11, 2024 · 0 comments · Fixed by #9574
Closed
Tracked by #8742

Blockchain Provider tree state integration #8747

mattsse opened this issue Jun 11, 2024 · 0 comments · Fixed by #9574
Assignees
Labels
A-blockchain-tree Related to sidechains, reorgs and pending blocks C-debt Refactor of code section that is hard to understand or maintain

Comments

@mattsse
Copy link
Collaborator

mattsse commented Jun 11, 2024

Blocked by #8745

The BlockchainProvider providers all provider trait impls and is responsible for fetching requested data such as blocks
Currently this supports access to the blockchaintree:

/// The blockchain tree instance.
tree: Arc<dyn TreeViewer>,

with #8745 we need to give it access to the in memory state as well.
we need to track:

  • highest block on disk
  • current head (in tree)
  • pending block (current head + 1, if we have the corresponding payload)

Ideally this is some kind of Arc<Rwlock where the internals track the height -> State and state includes block+receipts+state after the block.

this should be an object safe trait that gives access to the in memory blocks and state, the tree service will populate this type with the canonical chain after FCU and is effectively something like

struct InMemoryState {
  blocks: HashMap<Hash, Arc<State>>
  numbers: HashMap<u64, Hash>,
  pending: Option<State>,
}

very similar to what we have in anvil:

https://github.com/foundry-rs/foundry/blob/82ff8ee338818e6a6dc356e4c72ab72d31965375/crates/anvil/src/eth/backend/mem/storage.rs#L212-L230

TODO

  • scaffold trait and type similar to Treeviewer that can provide the range of the canonical chain that is currently stored in memory so the Blockchainprovider knows where to fetch things from
@mattsse mattsse added C-enhancement New feature or request A-blockchain-tree Related to sidechains, reorgs and pending blocks labels Jun 11, 2024
@emhane emhane added C-debt Refactor of code section that is hard to understand or maintain and removed C-enhancement New feature or request labels Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-blockchain-tree Related to sidechains, reorgs and pending blocks C-debt Refactor of code section that is hard to understand or maintain
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants