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

Proper domain block/state pruning #3005

Open
NingLin-P opened this issue Sep 4, 2024 · 0 comments
Open

Proper domain block/state pruning #3005

NingLin-P opened this issue Sep 4, 2024 · 0 comments

Comments

@NingLin-P
Copy link
Member

Currently, even the user can specify the state_pruning and blocks_pruning in the domain cli arguments but only the finalized blocks are subject to removal and the domain block finalization is disabled:

// if let Some(to_finalize_block_number) =
// header_number.checked_sub(&self.domain_confirmation_depth)
// {
// if to_finalize_block_number > self.client.info().finalized_number {
// let to_finalize_block_hash =
// self.client.hash(to_finalize_block_number)?.ok_or_else(|| {
// sp_blockchain::Error::Backend(format!(
// "Header for #{to_finalize_block_number} not found"
// ))
// })?;
// self.client
// .finalize_block(to_finalize_block_hash, None, true)?;
// tracing::debug!("Successfully finalized block: #{to_finalize_block_number},{to_finalize_block_hash}");
// }
// }

So no matter what the domain state_pruning and blocks_pruning specified to, the domain block/state won't be pruned and the node will occupy more and more space as running.

We can enable domain block finalization but there are some requirements for the domain block/state from FP and XDM that we should consider first:

  • For fraud proof, the FP generation requires the domain block/state so the domain node must keep all the domain blocks that have not passed the challenge period yet
  • For XDM, the relayer can only relay the XDM after the domain block that contains the XDM is confirmed, i.e. passed the challenge period, if the domain block is pruned immediately after becoming confirmed then the relayer may fail to generate XDM due to there is race condition and the block just be pruned before the relayer start to handle the block. So the node should also keep some confirmed domain block to workaround the race condition.

TLDR: to enable proper domain block/state pruning we need:

  • Enable domain block finalization (by uncommenting the above linked code)
  • Check the state_pruning and blocks_pruning arg to at least keep challenge period + N or challenge period * N where N is used to keep extra confirmed domain block for the XDM relayer
  • Remove the aux storage for the pruned domain block
  • Keep compatible with the incoming domain snap sync
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

No branches or pull requests

1 participant