From 44f45825dc4055179ab1f2c2d11f38bec07e029f Mon Sep 17 00:00:00 2001 From: jfldde <168934971+jfldde@users.noreply.github.com> Date: Wed, 27 Nov 2024 20:40:20 +0000 Subject: [PATCH] Fix config switchup --- src/citrea_config/bitcoin.rs | 1 - src/citrea_config/rollup.rs | 4 +--- src/citrea_config/sequencer.rs | 36 ++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/citrea_config/bitcoin.rs b/src/citrea_config/bitcoin.rs index 971231f..f5d6b0d 100644 --- a/src/citrea_config/bitcoin.rs +++ b/src/citrea_config/bitcoin.rs @@ -60,5 +60,4 @@ pub struct BitcoinServiceConfig { pub tx_backup_dir: String, pub monitoring: Option, - pub fee: Option, } diff --git a/src/citrea_config/rollup.rs b/src/citrea_config/rollup.rs index 3d923d3..297aa73 100644 --- a/src/citrea_config/rollup.rs +++ b/src/citrea_config/rollup.rs @@ -3,7 +3,7 @@ use std::path::PathBuf; use serde::{Deserialize, Serialize}; use tempfile::TempDir; -use super::bitcoin::{FeeServiceConfig, MonitoringConfig}; +use super::bitcoin::MonitoringConfig; use crate::config::{BitcoinConfig, BitcoinServiceConfig}; /// Runner configuration. @@ -155,7 +155,6 @@ impl Default for FullNodeConfig { .display() .to_string(), monitoring: Some(MonitoringConfig::default()), - fee: Some(FeeServiceConfig::default()), }, public_keys: RollupPublicKeys { sequencer_public_key: vec![ @@ -190,7 +189,6 @@ impl From for BitcoinServiceConfig { da_private_key: None, tx_backup_dir: String::new(), monitoring: Some(Default::default()), - fee: Some(Default::default()), } } } diff --git a/src/citrea_config/sequencer.rs b/src/citrea_config/sequencer.rs index 412527e..ecb6ad9 100644 --- a/src/citrea_config/sequencer.rs +++ b/src/citrea_config/sequencer.rs @@ -17,6 +17,7 @@ pub struct SequencerConfig { pub da_update_interval_ms: u64, /// Block production interval in ms pub block_production_interval_ms: u64, + pub fee_throttle: FeeThrottleConfig, } impl Default for SequencerConfig { @@ -30,6 +31,7 @@ impl Default for SequencerConfig { block_production_interval_ms: 100, da_update_interval_ms: 100, mempool_conf: SequencerMempoolConfig::default(), + fee_throttle: FeeThrottleConfig::default(), } } } @@ -68,6 +70,27 @@ impl Default for SequencerMempoolConfig { } } +#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] +pub struct FeeThrottleConfig { + capacity_threshold: f64, + base_fee_multiplier: f64, + max_fee_multiplier: f64, + fee_exponential_factor: f64, + fee_multiplier_scalar: f64, +} + +impl Default for FeeThrottleConfig { + fn default() -> Self { + Self { + capacity_threshold: 0.5, + base_fee_multiplier: 1.0, + max_fee_multiplier: 4.0, + fee_exponential_factor: 4.0, + fee_multiplier_scalar: 10.0, + } + } +} + #[cfg(test)] mod tests { use std::io::Write; @@ -100,6 +123,12 @@ mod tests { base_fee_tx_limit = 100000 base_fee_tx_size = 200 max_account_slots = 16 + [fee_throttle] + capacity_threshold = 0.5 + base_fee_multiplier = 1.0 + max_fee_multiplier = 4.0 + fee_exponential_factor = 4.0 + fee_multiplier_scalar = 10.0 "#; let config_file = create_config_from(config); @@ -123,6 +152,13 @@ mod tests { }, da_update_interval_ms: 1000, block_production_interval_ms: 1000, + fee_throttle: FeeThrottleConfig { + capacity_threshold: 0.5, + base_fee_multiplier: 1.0, + max_fee_multiplier: 4.0, + fee_exponential_factor: 4.0, + fee_multiplier_scalar: 10.0, + }, }; assert_eq!(config, expected); }