From 016e58eaf3864b5e0f53340396c09ad2a369d863 Mon Sep 17 00:00:00 2001 From: Tan Chee Keong Date: Fri, 3 Jan 2025 09:04:19 +0800 Subject: [PATCH] Add prune_payloads false --- beacon_node/beacon_chain/src/chain_config.rs | 3 +++ .../beacon_chain/src/historical_blocks.rs | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/beacon_node/beacon_chain/src/chain_config.rs b/beacon_node/beacon_chain/src/chain_config.rs index b8a607c8864..15c7c890372 100644 --- a/beacon_node/beacon_chain/src/chain_config.rs +++ b/beacon_node/beacon_chain/src/chain_config.rs @@ -94,6 +94,8 @@ pub struct ChainConfig { /// The delay in milliseconds applied by the node between sending each blob or data column batch. /// This doesn't apply if the node is the block proposer. pub blob_publication_batch_interval: Duration, + /// When prune execution payloads is set to false, store full block information instead of blinded block. + pub prune_payloads: bool, } impl Default for ChainConfig { @@ -129,6 +131,7 @@ impl Default for ChainConfig { enable_sampling: false, blob_publication_batches: 4, blob_publication_batch_interval: Duration::from_millis(300), + prune_payloads: true, } } } diff --git a/beacon_node/beacon_chain/src/historical_blocks.rs b/beacon_node/beacon_chain/src/historical_blocks.rs index ddae54f464b..7d5e5ac56e9 100644 --- a/beacon_node/beacon_chain/src/historical_blocks.rs +++ b/beacon_node/beacon_chain/src/historical_blocks.rs @@ -133,10 +133,19 @@ impl BeaconChain { }); } - let blinded_block = block.clone_as_blinded(); - // Store block in the hot database without payload. - self.store - .blinded_block_as_kv_store_ops(&block_root, &blinded_block, &mut hot_batch); + if !self.config.prune_payloads { + // If prune-payloads is set to false, store the block which includes the execution payload + self.store + .block_as_kv_store_ops(&block_root, (*block).clone(), &mut hot_batch)?; + } else { + let blinded_block = block.clone_as_blinded(); + // Store block in the hot database without payload. + self.store.blinded_block_as_kv_store_ops( + &block_root, + &blinded_block, + &mut hot_batch, + ); + } // Store the blobs too if let Some(blobs) = maybe_blobs { new_oldest_blob_slot = Some(block.slot());