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

perf: use the Store struct to save states and checkpoint states in memory #1253

Merged
merged 19 commits into from
Aug 16, 2024

Conversation

Arkenan
Copy link
Collaborator

@Arkenan Arkenan commented Aug 5, 2024

This PR starts using the store again for quick memory access to states and checkpoint states, as they are pretty big objects, slow for db interaction.

Changes:

  • Added get and put for states by root.
  • Added get for checkpoint states.
  • Modified handlers to use the store.
  • Removed state prefetches, as they are no longer necessary.
  • Removed fetching pre-state (big time consumer) in state transition.
  • Added the store in Libp2p port genserver state.
  • Added the store in the pending blocks calls and in all response callbacks.

closes #1248

@Arkenan Arkenan changed the title [WIP] Use the Store struct to save states and checkpoint states in memory perf: use the Store struct to save states and checkpoint states in memory Aug 5, 2024
@Arkenan Arkenan marked this pull request as ready for review August 9, 2024 16:18
@Arkenan Arkenan requested a review from a team as a code owner August 9, 2024 16:18
Copy link
Contributor

@avilagaston9 avilagaston9 left a comment

Choose a reason for hiding this comment

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

Awesome work! LGTM. Just a few nit comments.

lib/lambda_ethereum_consensus/fork_choice/handlers.ex Outdated Show resolved Hide resolved
lib/lambda_ethereum_consensus/p2p/gossip/blob_sidecar.ex Outdated Show resolved Hide resolved
lib/types/store.ex Outdated Show resolved Hide resolved
Copy link
Collaborator

@rodrigo-o rodrigo-o left a comment

Choose a reason for hiding this comment

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

I was halfway the whole PR, but leave some small comments for now.

lib/lambda_ethereum_consensus/p2p/gossip/handler.ex Outdated Show resolved Hide resolved
lib/lambda_ethereum_consensus/store/checkpoint_states.ex Outdated Show resolved Hide resolved
@Arkenan Arkenan merged commit 84ee168 into main Aug 16, 2024
13 checks passed
@Arkenan Arkenan deleted the state-to-memory branch August 16, 2024 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Checkpoint states and pre-states should be in-memory in the store
3 participants