Skip to content

Commit

Permalink
Set pruning data retention to 1 hour by default
Browse files Browse the repository at this point in the history
  • Loading branch information
slowli committed Apr 29, 2024
1 parent 334ad0a commit 454d6cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions core/bin/external_node/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ pub(crate) struct OptionalENConfig {
/// may be temporarily retained for other reasons; e.g., a batch cannot be pruned until it is executed on L1,
/// which happens roughly 24 hours after its generation on the mainnet. Thus, in practice this value can specify
/// the retention period greater than that implicitly imposed by other criteria (e.g., 7 or 30 days).
/// If not specified or set to 0, L1 batches will not be retained based on their timestamp.
#[serde(default)]
/// If set to 0, L1 batches will not be retained based on their timestamp. The default value is 1 hour.
#[serde(default = "OptionalENConfig::default_pruning_data_retention_sec")]
pruning_data_retention_sec: u64,
}

Expand Down Expand Up @@ -541,6 +541,10 @@ impl OptionalENConfig {
NonZeroU64::new(60).unwrap()
}

fn default_pruning_data_retention_sec() -> u64 {
3_600 // 1 hour
}

pub fn polling_interval(&self) -> Duration {
Duration::from_millis(self.polling_interval)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ describe('snapshot recovery', () => {

const pruningParams = {
EN_PRUNING_ENABLED: 'true',
EN_PRUNING_REMOVAL_DELAY_SEC: '3',
EN_PRUNING_REMOVAL_DELAY_SEC: '2',
EN_PRUNING_DATA_RETENTION_SEC: '0', // immediately prune executed batches
EN_PRUNING_CHUNK_SIZE: '1'
};
externalNodeEnv = { ...externalNodeEnv, ...pruningParams };
Expand Down

0 comments on commit 454d6cb

Please sign in to comment.