Skip to content

Commit

Permalink
Fix config switchup
Browse files Browse the repository at this point in the history
  • Loading branch information
jfldde committed Nov 27, 2024
1 parent 446af2c commit 44f4582
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/citrea_config/bitcoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,4 @@ pub struct BitcoinServiceConfig {
pub tx_backup_dir: String,

pub monitoring: Option<MonitoringConfig>,
pub fee: Option<FeeServiceConfig>,
}
4 changes: 1 addition & 3 deletions src/citrea_config/rollup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -155,7 +155,6 @@ impl Default for FullNodeConfig<BitcoinServiceConfig> {
.display()
.to_string(),
monitoring: Some(MonitoringConfig::default()),
fee: Some(FeeServiceConfig::default()),
},
public_keys: RollupPublicKeys {
sequencer_public_key: vec![
Expand Down Expand Up @@ -190,7 +189,6 @@ impl From<BitcoinConfig> for BitcoinServiceConfig {
da_private_key: None,
tx_backup_dir: String::new(),
monitoring: Some(Default::default()),
fee: Some(Default::default()),
}
}
}
Expand Down
36 changes: 36 additions & 0 deletions src/citrea_config/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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(),
}
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down

0 comments on commit 44f4582

Please sign in to comment.