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: add some fork choice values to BeaconChain. #609

Merged
merged 14 commits into from
Jan 19, 2024
Merged

Conversation

mpaulucci
Copy link
Collaborator

@mpaulucci mpaulucci commented Jan 11, 2024

We don't want to have to calculate the new head everytime it is requested since it's expensive. Let's store a "cache" (better names welcomed) that gets updated every time we get a new block.

Closes #572

@mpaulucci mpaulucci changed the title feat: Add some fork choice value to BeaconChain. feat: add some fork choice value to BeaconChain. Jan 11, 2024
@mpaulucci mpaulucci changed the title feat: add some fork choice value to BeaconChain. feat: add some fork choice values to BeaconChain. Jan 11, 2024
@mpaulucci mpaulucci marked this pull request as ready for review January 15, 2024 18:11
@mpaulucci mpaulucci requested a review from a team as a code owner January 15, 2024 18:11
Copy link
Collaborator

@MegaRedHand MegaRedHand left a comment

Choose a reason for hiding this comment

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

LGTM. I'll let @Arkenan have a final look.

Comment on lines +210 to +212
#✅ dialyzer: @ Run dialyzer (static analysis tool).
dialyzer:
mix dialyzer
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

lib/lambda_ethereum_consensus/fork_choice/fork_choice.ex Outdated Show resolved Hide resolved
MegaRedHand
MegaRedHand previously approved these changes Jan 18, 2024
Copy link
Collaborator

@MegaRedHand MegaRedHand 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
Collaborator

@Arkenan Arkenan left a comment

Choose a reason for hiding this comment

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

LGTM! I suggested a minor change, but otherwise, feel free to merge.

Comment on lines +22 to +27
Application.fetch_env!(
:lambda_ethereum_consensus,
__MODULE__
)[
:implementation
]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Application.fetch_env!(
:lambda_ethereum_consensus,
__MODULE__
)[
:implementation
]
Application.fetch_env!(
:lambda_ethereum_consensus,
__MODULE__
)
|> Map.fetch!(:implementation)

Copy link
Collaborator

@Arkenan Arkenan left a comment

Choose a reason for hiding this comment

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

LGTM after re-review and offline discussion.

@mpaulucci mpaulucci merged commit e395a07 into main Jan 19, 2024
10 checks passed
@mpaulucci mpaulucci deleted the fork-choice-cache branch January 19, 2024 15:53
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

Successfully merging this pull request may close these issues.

Optimize status response generation
3 participants