From 434f7644868fb085c40f58890569bc709374c400 Mon Sep 17 00:00:00 2001 From: Mitch Turner Date: Mon, 2 Dec 2024 13:25:58 -0700 Subject: [PATCH] WIP --- bin/fuel-core/src/cli/run.rs | 23 +++++++++++++++++++---- crates/services/src/service.rs | 2 +- tests/tests/gas_price.rs | 24 +++++++++++++----------- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/bin/fuel-core/src/cli/run.rs b/bin/fuel-core/src/cli/run.rs index cc5ef9765bb..8fabb729f0f 100644 --- a/bin/fuel-core/src/cli/run.rs +++ b/bin/fuel-core/src/cli/run.rs @@ -205,10 +205,22 @@ pub struct Command { #[arg(long = "gas-price-threshold-percent", default_value = "50", env)] pub gas_price_threshold_percent: u8, - // Minimum DA gas price + /// Minimum DA gas price #[arg(long = "min-da-gas-price", default_value = "0", env)] pub min_da_gas_price: u64, + /// P component of DA gas price calculation + #[arg(long = "da-p-component", default_value = "0", env)] + pub da_p_component: i64, + + /// D component of DA gas price calculation + #[arg(long = "da-d-component", default_value = "0", env)] + pub da_d_component: i64, + + /// Maximum DA gas price change percent + #[arg(long = "max-da-gas-price-change-percent", default_value = "0", env)] + pub max_da_gas_price_change_percent: u16, + /// The URL for the DA Block Committer info #[arg(long = "da-committer-url", env)] pub da_committer_url: Option, @@ -312,6 +324,9 @@ impl Command { min_gas_price, gas_price_threshold_percent, min_da_gas_price, + da_p_component, + da_d_component, + max_da_gas_price_change_percent, da_committer_url, consensus_key, #[cfg(feature = "aws-kms")] @@ -618,9 +633,9 @@ impl Command { memory_pool_size, da_gas_price_factor: NonZeroU64::new(100).expect("100 is not zero"), min_da_gas_price, - max_da_gas_price_change_percent: 0, - da_p_component: 0, - da_d_component: 0, + max_da_gas_price_change_percent, + da_p_component, + da_d_component, activity_normal_range_size: 100, activity_capped_range_size: 0, activity_decrease_range_size: 0, diff --git a/crates/services/src/service.rs b/crates/services/src/service.rs index 5b298ffe5e0..93b1b179ff6 100644 --- a/crates/services/src/service.rs +++ b/crates/services/src/service.rs @@ -356,7 +356,7 @@ async fn run( let mut task = service .into_task(&state, params) .await - .expect("The initialization of the service failed."); + .expect("The initialization of the service failed"); sender.send_if_modified(|s| { if s.starting() { diff --git a/tests/tests/gas_price.rs b/tests/tests/gas_price.rs index af46a03db6a..cd341948ff4 100644 --- a/tests/tests/gas_price.rs +++ b/tests/tests/gas_price.rs @@ -422,9 +422,13 @@ use fuel_core_gas_price_service::v1::da_source_service::block_committer_costs::R #[test] fn produce_block__l1_committed_block_effects_gas_price() { + let _ = tracing_subscriber::fmt() + .with_max_level(tracing::Level::DEBUG) + .try_init(); + let rt = tokio::runtime::Runtime::new().unwrap(); // set up chain with single unrecorded block - let args = vec![ + let mut args = vec![ "--debug", "--poa-instant", "true", @@ -435,6 +439,7 @@ fn produce_block__l1_committed_block_effects_gas_price() { let driver = FuelCoreDriver::spawn(&args).await.unwrap(); driver.client.produce_blocks(1, None).await.unwrap(); let first_gas_price = driver.client.latest_gas_price().await.unwrap().gas_price; + tokio::time::sleep(Duration::from_millis(100)).await; let temp_dir = driver.kill().await; (first_gas_price, temp_dir) }); @@ -445,20 +450,17 @@ fn produce_block__l1_committed_block_effects_gas_price() { let mock = FakeServer::new(); let url = mock.url(); - let args = vec![ - "--debug", - "--poa-instant", - "true", - "--da-committer-url", - &url, - "--min-da-gas-price", - "100", - ]; + // add the da committer url to the args + args.extend(&["--da-committer-url", &url]); rt.block_on(async { - let _driver = FuelCoreDriver::spawn_with_directory(temp_dir, &args) + let driver = FuelCoreDriver::spawn_with_directory(temp_dir, &args) .await .unwrap(); + tokio::time::sleep(Duration::from_millis(100)).await; + driver.client.produce_blocks(1, None).await.unwrap(); + let new_gas_price = driver.client.latest_gas_price().await.unwrap().gas_price; + assert_ne!(first_gas_price, new_gas_price); }); }