Skip to content

#6853 Adding store tests for data column pruning #7228

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

Open
wants to merge 7 commits into
base: unstable
Choose a base branch
from

Conversation

SunnysidedJ
Copy link

Issue Addressed

#6853 Update store tests to cover data column pruning

Proposed Changes

Created a helper function check_data_column_existence which is a copy of check_blob_existence but checking data columns instead.
The helper function is then used to check whether data columns are also pruned when blobs are pruned if PeerDAS is enabled.

Additional Info

.

@@ -3205,6 +3210,9 @@ async fn deneb_prune_blobs_no_finalization() {
Some(deneb_fork_slot)
);
check_blob_existence(&harness, Slot::new(0), harness.head_slot(), true);
Copy link
Member

Choose a reason for hiding this comment

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

You might have already noticed, this test runs multiple times on CI for all forks.

The code that reads FORK_NAME from env var is here:

/// Return a `ChainSpec` suitable for test usage.
///
/// If the `fork_from_env` feature is enabled, read the fork to use from the FORK_NAME environment
/// variable. Otherwise use the default spec.
pub fn test_spec<E: EthSpec>() -> ChainSpec {
let mut spec = if cfg!(feature = "fork_from_env") {
let fork_name = std::env::var(FORK_NAME_ENV_VAR).unwrap_or_else(|e| {
panic!(
"{} env var must be defined when using fork_from_env: {:?}",
FORK_NAME_ENV_VAR, e
)
});
let fork = ForkName::from_str(fork_name.as_str()).unwrap();
fork.make_genesis_spec(E::default_spec())

So this assertion would fail when FORK_NAME=fulu, because we don't store any blobs from since the Fulu fork. I think it might be cleaner to start a separate test that verifies data column pruning instead of having to add conditions on every assertion.

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, I thought we still keep the blobs in Fulu. Changes have been made respectively. Is there a reason that we no longer keep blobs? Is it to save the storage?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that's one of the reasons - but also it's no longer useful to the CL from Fulu.

  • The network form of blobs on the beacon chain is DataColumnSidecar, we'll stop using BlobSidecar on p2p from Fulu slots.
  • Another reason is fullnodes will no longer have blobs, but just samples (DataColumns)

@@ -3337,6 +3348,9 @@ async fn deneb_prune_blobs_margin_test(margin: u64) {
Some(deneb_fork_slot)
);
check_blob_existence(&harness, Slot::new(1), harness.head_slot(), true);
if check_data_columns {
check_data_column_existence(&harness, Slot::new(1), harness.head_slot(), true);
}
Copy link
Member

Choose a reason for hiding this comment

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

Same as above, when FORK_NAME=fulu, check_blob_existence would fail already before hitting this line.

@jimmygchen
Copy link
Member

Thanks for the PR @SunnysidedJ !

Please see my comments above and let me know if it's unclear or if you have any questions!

@jimmygchen jimmygchen added waiting-on-author The reviewer has suggested changes and awaits thier implementation. das Data Availability Sampling labels Apr 1, 2025
@SunnysidedJ
Copy link
Author

Major changes:

  • Separated tests for data column pruning.
  • Blob pruning tests only run on Deneb while column ones only run on Fulu with PeerDAS enabled.
  • Found that fork_boundary test is not working (see inline comments).


// Finalize to epoch 5.
// Finalize to epoch 5 (Deneb).
harness
Copy link
Author

Choose a reason for hiding this comment

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

Returns a stack overflow here. Seems like using the spec with customization is not working properly. I think we need a separate issue for this. Any thoughts?

Copy link
Author

Choose a reason for hiding this comment

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

(The test fails at the unstable branch as well)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah this has been a known issue for a while, so these tests are always run with --release. This is because the c-kzg library forces us to initialise a blob-sized array. I think either moving to rust-eth-kzg or perhaps updating to the latest c-kzg library would resolve this (I haven't checked)

Copy link
Author

@SunnysidedJ SunnysidedJ Apr 4, 2025

Choose a reason for hiding this comment

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

I see. I will try running them either on Windows or Linux machine for the completion of this task for now

Copy link
Member

Choose a reason for hiding this comment

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

This should work on macOS if you run with --release or you can run the debug test with this env var: RUST_MIN_STACK=4194304 (setting a higher minimum stack size)

@@ -3282,6 +3290,56 @@ async fn deneb_prune_blobs_fork_boundary() {
assert_eq!(store.get_blob_info().oldest_blob_slot, Some(pruned_slot));
check_blob_existence(&harness, Slot::new(0), pruned_slot - 1, false);
check_blob_existence(&harness, pruned_slot, harness.head_slot(), true);

// Finalize to epoch 11 (Fulu)
Copy link
Author

Choose a reason for hiding this comment

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

Added a logic to test that blobs get removed once we reach Fulu fork, but couldn't test it due to the stack overflow issue above

Copy link
Member

Choose a reason for hiding this comment

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

ah yeah, could you run it with --release, unfortunately we haven't been able to tackle that issue yet.

let num_blocks = E::slots_per_epoch() * 7;

// Finalize to epoch 5.
harness
Copy link
Author

Choose a reason for hiding this comment

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

The same issue as above

@SunnysidedJ SunnysidedJ requested a review from jimmygchen April 2, 2025 19:47
@SunnysidedJ
Copy link
Author

When I enable Fulu and try blob pruning, the blobs aren't pruned correctly. It'd be appreciated if you could have a look on the commit that reproduces the problem: SunnysidedJ@6217cf9

Copy link

mergify bot commented May 19, 2025

Some required checks have failed. Could you please take a look @SunnysidedJ? 🙏

Copy link

mergify bot commented May 19, 2025

Hi @SunnysidedJ, this pull request has been closed automatically due to 30 days of inactivity. If you’d like to continue working on it, feel free to reopen at any time.

@mergify mergify bot closed this May 19, 2025
@mergify mergify bot added the stale Stale PRs that have been inactive and is now outdated label May 19, 2025
@eserilev
Copy link
Member

I'm going to take a look at the fulu blob pruning test issues

@eserilev eserilev reopened this May 22, 2025
@eserilev eserilev added ready-for-review The code is ready for review and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. stale Stale PRs that have been inactive and is now outdated labels May 22, 2025
@eserilev
Copy link
Member

The test is now passing. The reason it was failing was two fold:

  • we werent advancing the slot clock before extending the chain
  • we tried to fork from deneb directly to fulu

I've added an intermediary step to fork to electra and run some checks there. Not sure if theres any additional checks we want to make in this test.

Copy link

mergify bot commented May 22, 2025

Some required checks have failed. Could you please take a look @SunnysidedJ? 🙏

@mergify mergify bot 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 May 22, 2025
@eserilev
Copy link
Member

ah still need to fix one other test, working on that now

@eserilev
Copy link
Member

a634758 we werent updating data column info after pruning.

Copy link

mergify bot commented May 23, 2025

All required checks have passed and there are no merge conflicts. This pull request may now be ready for another review.

@mergify mergify bot 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 May 23, 2025
Copy link
Author

@SunnysidedJ SunnysidedJ left a comment

Choose a reason for hiding this comment

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

Sorry, I have been busy with other things and couldn't take much attention to this PR. Thank you for taking a deeper look and unblocking some of the issues I faced with the test cases. Please let me know if you have worked further since last commit and if this needs to be done with priority so that I can clearly understand the status. I will continue working on this whenever I'm available!

harness
.extend_chain(
blocks_to_fulu as usize,
blocks_to_electra as usize,
Copy link
Author

Choose a reason for hiding this comment

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

Shouldn't this be 13 (7 + 6 epochs in total)?

Copy link
Member

Choose a reason for hiding this comment

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

yes the chain was extended to epoch 13, but the finalized epoch is at 11, I've added some comments here:
06431e4 to make things a bit clearer

// Fulu fork epoch
let oldest_slot = fulu_fork_epoch.start_slot(E::slots_per_epoch());
// Blobs should not exist
check_blob_existence(&harness, oldest_slot, harness.head_slot(), false);
Copy link
Author

Choose a reason for hiding this comment

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

Need to also check that blobs don't exist from Slot 0

check_blob_existence(&harness, pruned_slot, electra_first_slot - 1, true);
// Check that blobs exist from electra to the current head
check_blob_existence(&harness, electra_first_slot, harness.head_slot(), true);
// Finalize to epoch 15 (Fulu)
Copy link
Author

Choose a reason for hiding this comment

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

to 17?

Copy link
Member

Choose a reason for hiding this comment

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

weve extended the chain to 17 but finalized epoch 15 (added some comments for clarity)

// Blobs should not exist
check_blob_existence(&harness, oldest_slot, harness.head_slot(), false);
// Data columns should exist
check_data_column_existence(&harness, oldest_slot, harness.head_slot(), true);
Copy link
Author

Choose a reason for hiding this comment

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

Need to also check that columns don't exist from Slot 0

let oldest_slot = data_availability_boundary.start_slot(E::slots_per_epoch());
assert_eq!(store.get_blob_info().oldest_blob_slot, Some(oldest_slot));
// Blobs should exist
check_blob_existence(&harness, oldest_slot, harness.head_slot(), true);
Copy link
Author

Choose a reason for hiding this comment

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

Need to also check that blobs don't exist from Slot 0

Copy link
Author

Choose a reason for hiding this comment

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

Pulled the changes and I'm looking into why Slot 40 exists when I call check_blob_existence(&harness, Slot::new(0), oldest_slot - 1, false)

@eserilev eserilev 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 May 27, 2025
Copy link

mergify bot commented May 27, 2025

All required checks have passed and there are no merge conflicts. This pull request may now be ready for another review.

@mergify mergify bot 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 May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
das Data Availability Sampling ready-for-review The code is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants