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

Keep execution payload during historical backfill when prune-payloads set to false #6766

Merged
merged 23 commits into from
Feb 7, 2025

Conversation

chong-he
Copy link
Member

@chong-he chong-he commented Jan 8, 2025

Issue Addressed

Proposed Changes

  • Keep execution payload during historical backfill when --prune-payloads false is set
  • Add a field in the historical backfill debug log to indicate if execution payload is kept
  • Add a test to check historical blocks has execution payload when `--prune-payloads false is set
  • Very minor typo correction that I notice when working on this

Additional Info

  • I have done manual testing that when the flag is set to false, we see that the number of keys returned:
    lighthouse db inspect --column exp --output sizes --datadir path is around the range of: head_slot - oldest_block_slot, so I think it works

Thank you @michaelsproul for the hints in testing

@chong-he chong-he added the work-in-progress PR is a work-in-progress label Jan 8, 2025
@chong-he chong-he changed the title Keep execution payload Keep execution payload during historical backfill when prune-payloads set to false Jan 8, 2025
@chong-he chong-he requested a review from jxs as a code owner January 15, 2025 01:27
@chong-he chong-he added ready-for-review The code is ready for review and removed work-in-progress PR is a work-in-progress labels Jan 17, 2025
@chong-he chong-he added the v7.0.0-beta.0 New release c. Q1 2025 label Jan 24, 2025
Copy link
Member

@michaelsproul michaelsproul left a comment

Choose a reason for hiding this comment

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

Looks good, just one suggested change to the test

@@ -2471,6 +2471,17 @@ async fn weak_subjectivity_sync_test(slots: Vec<Slot>, checkpoint_slot: Slot) {
.map(|s| s.beacon_block.clone())
.collect::<Vec<_>>();

// If prune_payloads is false, the execution payload should exist in historical blocks
if !beacon_chain.store.get_config().prune_payloads {
Copy link
Member

@michaelsproul michaelsproul Feb 4, 2025

Choose a reason for hiding this comment

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

I think we should remove this if, and make it so that these tests always this check

We can set prune_payloads: false in the default config here:

fn get_harness(
store: Arc<HotColdDB<E, LevelDB<E>, LevelDB<E>>>,
validator_count: usize,
) -> TestHarness {
// Most tests expect to retain historic states, so we use this as the default.
let chain_config = ChainConfig {
reconstruct_historic_states: true,
..ChainConfig::default()
};
get_harness_generic(store, validator_count, chain_config)
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in 42fb4d5, thank you for your help!

Setting prune_payloads default to false in the test makes the tests that calling check_chain_dump to fail:
https://github.com/sigp/lighthouse/actions/runs/13171847366/job/36763510649

From my understanding, this is because when prune_payloads is set to false, the execution payloads are kept for all slots in the test, not only after the split slot, so the second argument in assert_eq! is false.

if harness.chain.spec.bellatrix_fork_epoch.is_some() {
assert_eq!(
harness
.chain
.store
.execution_payload_exists(&checkpoint.beacon_block_root)
.unwrap(),
checkpoint.beacon_block.slot() >= split_slot,
"incorrect payload storage for block at slot {}: {:?}",
checkpoint.beacon_block.slot(),
checkpoint.beacon_block_root,
);

I make the assert_eq! to become assert! in 5db1b78 to have the tests pass, however it makes the tests "less robust", so not sure if there are better ways to do this?

@michaelsproul michaelsproul added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Feb 4, 2025
Copy link

mergify bot commented Feb 6, 2025

This pull request has merge conflicts. Could you please resolve them @chong-he? 🙏

@chong-he chong-he added ready-for-review The code is ready for review and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Feb 7, 2025
michaelsproul added a commit that referenced this pull request Feb 7, 2025
… set to false (#6766)

Squashed commit of the following:

commit 5db1b78
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Fri Feb 7 07:54:00 2025 +0800

    assert

commit 617abb0
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Thu Feb 6 23:31:13 2025 +0800

    remove split_slot

commit f97f50b
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Thu Feb 6 23:30:32 2025 +0800

    Update test

commit f791df1
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Thu Feb 6 22:25:05 2025 +0800

    test

commit b2abae9
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Thu Feb 6 15:11:33 2025 +0800

    Test

commit 42fb4d5
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Thu Feb 6 12:29:14 2025 +0800

    Fix test

commit 424d4c1
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Thu Feb 6 09:37:45 2025 +0800

    test

commit 833d4e2
Merge: e1f81ce 2193f6a
Author: chonghe <44791194+chong-he@users.noreply.github.com>
Date:   Thu Feb 6 09:31:11 2025 +0800

    Merge branch 'unstable' into keep-execution-payload

commit e1f81ce
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Thu Feb 6 09:18:02 2025 +0800

    test

commit beefb92
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Fri Jan 17 09:19:31 2025 +0800

    Add test

commit 2e2efa6
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Wed Jan 15 09:35:48 2025 +0800

    remove info

commit 7b5d5de
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Wed Jan 15 09:27:27 2025 +0800

    Even more simplified logging

commit 9492cab
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Mon Jan 13 11:30:26 2025 +0800

    Simplify logging

commit 0a61483
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Mon Jan 13 10:19:48 2025 +0800

    get to prune_paylods correctly

commit b86434a
Merge: c958809 c9747fb
Author: chonghe <44791194+chong-he@users.noreply.github.com>
Date:   Mon Jan 13 09:51:11 2025 +0800

    Merge branch 'unstable' into keep-execution-payload

commit c958809
Merge: 412e8e9 7c414cc
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Thu Jan 9 11:05:42 2025 +0800

    Merge remote-tracking branch 'lion/anchor_slot_pruning' into keep-execution-payload

commit 7c414cc
Author: Lion - dapplion <35266934+dapplion@users.noreply.github.com>
Date:   Thu Jan 9 09:06:45 2025 +0800

    Update beacon_node/store/src/hot_cold_store.rs

    Co-authored-by: Michael Sproul <micsproul@gmail.com>

commit 412e8e9
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Wed Jan 8 14:52:46 2025 +0800

    Add prune_payload in config.rs

commit a9c2f78
Merge: 9d85619 87b72de
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Wed Jan 8 11:40:16 2025 +0800

    Merge remote-tracking branch 'origin/unstable' into keep-execution-payload

commit 9d85619
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Fri Jan 3 09:41:06 2025 +0800

    add log

commit 016e58e
Author: Tan Chee Keong <tanck@sigmaprime.io>
Date:   Fri Jan 3 09:04:19 2025 +0800

    Add prune_payloads false

commit 791395a
Author: dapplion <35266934+dapplion@users.noreply.github.com>
Date:   Sat Dec 28 21:57:40 2024 +0800

    Use oldest_block_slot to break of pruning payloads
@michaelsproul michaelsproul added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Feb 7, 2025
mergify bot added a commit that referenced this pull request Feb 7, 2025
Copy link

mergify bot commented Feb 7, 2025

This pull request has been removed from the queue for the following reason: pull request manually updated.

The pull request #6766 has been manually updated

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.

If you want to requeue this pull request, you need to post a comment with the text: @mergifyio requeue

mergify bot added a commit that referenced this pull request Feb 7, 2025
mergify bot added a commit that referenced this pull request Feb 7, 2025
mergify bot added a commit that referenced this pull request Feb 7, 2025
@mergify mergify bot merged commit d6596db into sigp:unstable Feb 7, 2025
31 checks passed
@chong-he chong-he deleted the keep-execution-payload branch February 7, 2025 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge This PR is ready to merge. v7.0.0-beta.0 New release c. Q1 2025
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants