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

check the da cache and the attester cache in responding to RPC requests #5138

Merged
merged 8 commits into from
Feb 19, 2024

Conversation

realbigsean
Copy link
Member

@realbigsean realbigsean commented Jan 29, 2024

Issue Addressed

Resolves #5093

Proposed Changes

  • Check the DA cache then the attester cache in responding to block by range requests
  • This does not currently check if a block exists in the DA cache's overflow to disk, I'm sort of thinking that's overkill. But can add it in. I decided to use the processing_cache because this includes payloads we haven't verified. This is technically correct according to the spec

@realbigsean realbigsean added ready-for-review The code is ready for review deneb labels Jan 29, 2024
@realbigsean realbigsean added the v5.0.0 Q1 2024 label Jan 31, 2024
@@ -45,7 +46,7 @@ pub struct ProcessingComponents<E: EthSpec> {
/// Blobs required for a block can only be known if we have seen the block. So `Some` here
/// means we've seen it, a `None` means we haven't. The `kzg_commitments` value helps us figure
/// out whether incoming blobs actually match the block.
pub block_commitments: Option<KzgCommitments<E>>,
pub block: Option<Arc<SignedBeaconBlock<E>>>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is now retaining full blocks, might be good to add a metric to track processing_cache size in case it ever leaks

Copy link
Member Author

Choose a reason for hiding this comment

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

good idea!

Copy link
Member Author

Choose a reason for hiding this comment

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

added a few more metrics related metrics as well 0cf408f

@@ -1141,10 +1141,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
>,
Copy link
Member

Choose a reason for hiding this comment

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

should probably rename this function get_blocks_checking_caches or something along these lines.. perhaps we should come up with a unified way of referring to these two caches.. idk if we'd just call them "early caches" or something..

Copy link
Member Author

Choose a reason for hiding this comment

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

@realbigsean
Copy link
Member Author

Ok feedback so far has been addressed

@@ -19,7 +19,7 @@ use types::{
};

#[derive(PartialEq)]
pub enum CheckEarlyAttesterCache {
pub enum CheckCaches {
Copy link
Member

Choose a reason for hiding this comment

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

nit: why not use bool?

Copy link
Member Author

Choose a reason for hiding this comment

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

We usually try to use enums over bools when we need to pass something into a function. If you end up with two bools as params it can be ambiguous

paulhauner added a commit that referenced this pull request Feb 18, 2024
…ts (#5138)

Squashed commit of the following:

commit a6144f6
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Thu Feb 15 15:48:07 2024 -0500

    Revert "make rustup update run on the runners"

    This reverts commit d097e9b.

commit d097e9b
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Thu Feb 15 15:16:08 2024 -0500

    make rustup update run on the runners

commit 1be438e
Merge: 597e05f 256d904
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Wed Feb 14 21:55:45 2024 -0500

    Merge branch 'unstable' of https://github.com/sigp/lighthouse into check-da-cache-in-rpc-response

commit 597e05f
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Wed Feb 14 21:54:44 2024 -0500

    rename early attester cache method

commit 0cf408f
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Wed Feb 14 21:53:47 2024 -0500

    add da cache metrics

commit 2f6cf41
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Mon Jan 29 18:31:32 2024 -0500

    update comment

commit 0512420
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Mon Jan 29 18:25:15 2024 -0500

    use the processing cache instead

commit 66b911f
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Mon Jan 29 15:52:42 2024 -0500

    check the da cache and the attester cache in responding to RPC requests
@paulhauner paulhauner mentioned this pull request Feb 18, 2024
paulhauner added a commit that referenced this pull request Feb 18, 2024
…ts (#5138)

Squashed commit of the following:

commit a6144f6
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Thu Feb 15 15:48:07 2024 -0500

    Revert "make rustup update run on the runners"

    This reverts commit d097e9b.

commit d097e9b
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Thu Feb 15 15:16:08 2024 -0500

    make rustup update run on the runners

commit 1be438e
Merge: 597e05f 256d904
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Wed Feb 14 21:55:45 2024 -0500

    Merge branch 'unstable' of https://github.com/sigp/lighthouse into check-da-cache-in-rpc-response

commit 597e05f
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Wed Feb 14 21:54:44 2024 -0500

    rename early attester cache method

commit 0cf408f
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Wed Feb 14 21:53:47 2024 -0500

    add da cache metrics

commit 2f6cf41
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Mon Jan 29 18:31:32 2024 -0500

    update comment

commit 0512420
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Mon Jan 29 18:25:15 2024 -0500

    use the processing cache instead

commit 66b911f
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Mon Jan 29 15:52:42 2024 -0500

    check the da cache and the attester cache in responding to RPC requests
paulhauner added a commit that referenced this pull request Feb 18, 2024
…ts (#5138)

Squashed commit of the following:

commit a6144f6
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Thu Feb 15 15:48:07 2024 -0500

    Revert "make rustup update run on the runners"

    This reverts commit d097e9b.

commit d097e9b
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Thu Feb 15 15:16:08 2024 -0500

    make rustup update run on the runners

commit 1be438e
Merge: 597e05f 256d904
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Wed Feb 14 21:55:45 2024 -0500

    Merge branch 'unstable' of https://github.com/sigp/lighthouse into check-da-cache-in-rpc-response

commit 597e05f
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Wed Feb 14 21:54:44 2024 -0500

    rename early attester cache method

commit 0cf408f
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Wed Feb 14 21:53:47 2024 -0500

    add da cache metrics

commit 2f6cf41
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Mon Jan 29 18:31:32 2024 -0500

    update comment

commit 0512420
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Mon Jan 29 18:25:15 2024 -0500

    use the processing cache instead

commit 66b911f
Author: realbigsean <seananderson33@GMAIL.com>
Date:   Mon Jan 29 15:52:42 2024 -0500

    check the da cache and the attester cache in responding to RPC requests
Copy link
Member

@jimmygchen jimmygchen left a comment

Choose a reason for hiding this comment

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

LGTM!
So we're now serving blocks as soon as it passes gossip validation and cached in da cache, which I think is spec compliant 👍

@jimmygchen jimmygchen added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Feb 18, 2024
@paulhauner
Copy link
Member

@Mergifyio queue

Copy link

mergify bot commented Feb 19, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at f214729

mergify bot added a commit that referenced this pull request Feb 19, 2024
@mergify mergify bot merged commit f214729 into sigp:unstable Feb 19, 2024
29 checks passed
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deneb ready-for-merge This PR is ready to merge. v5.0.0 Q1 2024
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants