Skip to content

Commit

Permalink
With FeeServiceConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
jfldde committed Nov 22, 2024
1 parent 5baaef3 commit 436d321
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
26 changes: 26 additions & 0 deletions src/citrea_config/bitcoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,31 @@ pub struct MonitoringConfig {
pub max_history_size: usize,
}

#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct FeeServiceConfig {
max_da_bandwidth_bytes: u64,
window_duration_secs: u64,
capacity_threshold: f64,
base_fee_multiplier: f64,
max_fee_multiplier: f64,
fee_exponential_factor: f64,
fee_multipler_scalar: f64,
}

impl Default for FeeServiceConfig {
fn default() -> Self {
Self {
max_da_bandwidth_bytes: 4 * 1024 * 1024, // 4MB
window_duration_secs: 600, // 10min
capacity_threshold: 0.5,
base_fee_multiplier: 1.0,
max_fee_multiplier: 4.0,
fee_exponential_factor: 4.0,
fee_multipler_scalar: 10.0,
}
}
}

/// Runtime configuration for the DA service
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct BitcoinServiceConfig {
Expand All @@ -35,4 +60,5 @@ pub struct BitcoinServiceConfig {
pub tx_backup_dir: String,

pub monitoring: Option<MonitoringConfig>,
pub fee: Option<FeeServiceConfig>,
}
4 changes: 3 additions & 1 deletion 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::MonitoringConfig;
use super::bitcoin::{FeeServiceConfig, MonitoringConfig};
use crate::config::{BitcoinConfig, BitcoinServiceConfig};

/// Runner configuration.
Expand Down Expand Up @@ -155,6 +155,7 @@ 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 @@ -189,6 +190,7 @@ impl From<BitcoinConfig> for BitcoinServiceConfig {
da_private_key: None,
tx_backup_dir: String::new(),
monitoring: Some(Default::default()),
fee: Some(Default::default()),
}
}
}
Expand Down

0 comments on commit 436d321

Please sign in to comment.