diff --git a/bin/e2e-test-client/tests/integration_tests.rs b/bin/e2e-test-client/tests/integration_tests.rs index 720a4be4939..13f66893370 100644 --- a/bin/e2e-test-client/tests/integration_tests.rs +++ b/bin/e2e-test-client/tests/integration_tests.rs @@ -136,7 +136,7 @@ fn dev_config() -> Config { let reader = reader.with_chain_config(chain_config); let mut config = Config::local_node_with_reader(reader); - config.starting_exec_gas_price = 1; + config.gas_price_config.starting_exec_gas_price = 1; config.block_producer.coinbase_recipient = Some( ContractId::from_str( "0x7777777777777777777777777777777777777777777777777777777777777777", diff --git a/bin/fuel-core/src/cli/run.rs b/bin/fuel-core/src/cli/run.rs index 75e67c7a712..bd67af39390 100644 --- a/bin/fuel-core/src/cli/run.rs +++ b/bin/fuel-core/src/cli/run.rs @@ -14,8 +14,6 @@ use crate::{ }; use anyhow::Context; use clap::Parser; -#[cfg(feature = "production")] -use fuel_core::service::sub_services::DEFAULT_GAS_PRICE_CHANGE_PERCENT; use fuel_core::{ chain_config::default_consensus_dev_key, combined_database::{ @@ -90,11 +88,12 @@ use tracing::{ trace, warn, }; -use url::Url; #[cfg(feature = "rocksdb")] use fuel_core::state::historical_rocksdb::StateRewindPolicy; +use crate::cli::run::gas_price::GasPriceArgs; +use fuel_core::service::config::GasPriceConfig; #[cfg(feature = "parallel-executor")] use std::num::NonZeroUsize; @@ -111,6 +110,8 @@ mod profiling; mod relayer; mod tx_pool; +mod gas_price; + /// Run the Fuel client node locally. #[derive(Debug, Clone, Parser)] pub struct Command { @@ -204,83 +205,9 @@ pub struct Command { #[arg(long = "executor-number-of-cores", env, default_value = "1")] pub executor_number_of_cores: NonZeroUsize, - /// The starting execution gas price for the network - #[cfg_attr( - feature = "production", - arg(long = "starting-gas-price", default_value = "1000", env) - )] - #[cfg_attr( - not(feature = "production"), - arg(long = "starting-gas-price", default_value = "0", env) - )] - pub starting_gas_price: u64, - - /// The percentage change in gas price per block - #[cfg_attr( - feature = "production", - arg(long = "gas-price-change-percent", default_value_t = DEFAULT_GAS_PRICE_CHANGE_PERCENT, env) - )] - #[cfg_attr( - not(feature = "production"), - arg(long = "gas-price-change-percent", default_value = "0", env) - )] - pub gas_price_change_percent: u16, - - /// The minimum allowed gas price - #[arg(long = "min-gas-price", default_value = "0", env)] - pub min_gas_price: u64, - - /// The percentage threshold for gas price increase - #[arg(long = "gas-price-threshold-percent", default_value = "50", env)] - pub gas_price_threshold_percent: u8, - - /// Minimum DA gas price - #[cfg_attr( - feature = "production", - arg(long = "min-da-gas-price", default_value = "1000", env) - )] - #[cfg_attr( - not(feature = "production"), - arg(long = "min-da-gas-price", default_value = "0", env) - )] - pub min_da_gas_price: u64, - - /// Maximum allowed gas price for DA. - #[arg(long = "max-da-gas-price", default_value = "100000", env)] - pub max_da_gas_price: u64, - - /// P component of DA gas price calculation - /// **NOTE**: This is the **inverse** gain of a typical P controller. - /// Increasing this value will reduce gas price fluctuations. - #[arg( - long = "da-gas-price-p-component", - default_value = "799999999999993", - env - )] - pub da_gas_price_p_component: i64, - - /// D component of DA gas price calculation - /// **NOTE**: This is the **inverse** anticipatory control factor of a typical PD controller. - /// Increasing this value will reduce the dampening effect of quick algorithm changes. - #[arg( - long = "da-gas-price-d-component", - default_value = "10000000000000000", - env - )] - pub da_gas_price_d_component: i64, - - /// The URL for the DA Block Committer info - #[arg(long = "da-committer-url", env)] - pub da_committer_url: Option, - - /// The interval at which the `DaSourceService` polls for new data - #[arg(long = "da-poll-interval", env)] - pub da_poll_interval: Option, - - /// The L2 height the Gas Price Service will assume is already recorded on DA - /// i.e. If you want the Gas Price Service to look for the costs of block 1000, set to 999 - #[arg(long = "da-starting-recorded-height", env)] - da_starting_recorded_height: Option, + /// All the configurations for the gas price service. + #[clap(flatten)] + pub gas_price: gas_price::GasPriceArgs, /// The signing key used when producing blocks. /// Setting via the `CONSENSUS_KEY_SECRET` ENV var is preferred. @@ -382,17 +309,7 @@ impl Command { native_executor_version, #[cfg(feature = "parallel-executor")] executor_number_of_cores, - starting_gas_price, - gas_price_change_percent, - min_gas_price, - gas_price_threshold_percent, - min_da_gas_price, - max_da_gas_price, - da_gas_price_p_component, - da_gas_price_d_component, - da_committer_url, - da_poll_interval, - da_starting_recorded_height: starting_recorded_height, + gas_price, consensus_key, #[cfg(feature = "aws-kms")] consensus_aws_kms, @@ -419,6 +336,20 @@ impl Command { profiling: _, } = self; + let GasPriceArgs { + starting_gas_price, + gas_price_change_percent, + min_gas_price, + gas_price_threshold_percent, + min_da_gas_price, + max_da_gas_price, + da_gas_price_p_component, + da_gas_price_d_component, + da_committer_url, + da_poll_interval, + da_starting_recorded_height, + } = gas_price; + let enabled_metrics = disabled_metrics.list_of_enabled(); if !enabled_metrics.is_empty() { @@ -427,7 +358,7 @@ impl Command { info!("All metrics are disabled"); } - if max_da_gas_price < min_da_gas_price { + if gas_price.max_da_gas_price < gas_price.min_da_gas_price { anyhow::bail!( "The maximum DA gas price must be greater than or equal to the minimum DA gas price" ); @@ -629,6 +560,27 @@ impl Command { max_pending_write_pool_requests: tx_max_pending_write_requests, }; + let gas_price_config = GasPriceConfig { + starting_exec_gas_price: gas_price.starting_gas_price, + exec_gas_price_change_percent: gas_price.gas_price_change_percent, + min_exec_gas_price: gas_price.min_gas_price, + exec_gas_price_threshold_percent: gas_price.gas_price_threshold_percent, + da_gas_price_factor: NonZeroU64::new(100).expect("100 is not zero"), + starting_recorded_height: da_starting_recorded_height, + min_da_gas_price, + max_da_gas_price, + max_da_gas_price_change_percent: gas_price.gas_price_change_percent, + da_gas_price_p_component, + da_gas_price_d_component, + gas_price_metrics, + activity_normal_range_size: 100, + activity_capped_range_size: 0, + activity_decrease_range_size: 0, + da_committer_url, + block_activity_threshold: 0, + da_poll_interval: gas_price.da_poll_interval.map(Into::into), + }; + let config = Config { graphql_config: GraphQLConfig { addr, @@ -697,10 +649,7 @@ impl Command { coinbase_recipient, metrics: disabled_metrics.is_enabled(Module::Producer), }, - starting_exec_gas_price: starting_gas_price, - exec_gas_price_change_percent: gas_price_change_percent, - min_exec_gas_price: min_gas_price, - exec_gas_price_threshold_percent: gas_price_threshold_percent, + gas_price_config, block_importer, da_compression, #[cfg(feature = "relayer")] @@ -717,20 +666,6 @@ impl Command { min_connected_reserved_peers, time_until_synced: time_until_synced.into(), memory_pool_size, - da_gas_price_factor: NonZeroU64::new(100).expect("100 is not zero"), - starting_recorded_height, - min_da_gas_price, - max_da_gas_price, - max_da_gas_price_change_percent: gas_price_change_percent, - da_gas_price_p_component, - da_gas_price_d_component, - gas_price_metrics, - activity_normal_range_size: 100, - activity_capped_range_size: 0, - activity_decrease_range_size: 0, - da_committer_url, - block_activity_threshold: 0, - da_poll_interval: da_poll_interval.map(Into::into), }; Ok(config) } diff --git a/bin/fuel-core/src/cli/run/gas_price.rs b/bin/fuel-core/src/cli/run/gas_price.rs new file mode 100644 index 00000000000..3a0be194b4a --- /dev/null +++ b/bin/fuel-core/src/cli/run/gas_price.rs @@ -0,0 +1,85 @@ +use clap::Args; +#[cfg(feature = "production")] +use fuel_core::service::sub_services::DEFAULT_GAS_PRICE_CHANGE_PERCENT; +use url::Url; + +#[derive(Debug, Clone, Args)] +pub struct GasPriceArgs { + /// The starting execution gas price for the network + #[cfg_attr( + feature = "production", + arg(long = "starting-gas-price", default_value = "1000", env) + )] + #[cfg_attr( + not(feature = "production"), + arg(long = "starting-gas-price", default_value = "0", env) + )] + pub starting_gas_price: u64, + + /// The percentage change in gas price per block + #[cfg_attr( + feature = "production", + arg(long = "gas-price-change-percent", default_value_t = DEFAULT_GAS_PRICE_CHANGE_PERCENT, env) + )] + #[cfg_attr( + not(feature = "production"), + arg(long = "gas-price-change-percent", default_value = "0", env) + )] + pub gas_price_change_percent: u16, + + /// The minimum allowed gas price + #[arg(long = "min-gas-price", default_value = "0", env)] + pub min_gas_price: u64, + + /// The percentage threshold for gas price increase + #[arg(long = "gas-price-threshold-percent", default_value = "50", env)] + pub gas_price_threshold_percent: u8, + + /// Minimum DA gas price + #[cfg_attr( + feature = "production", + arg(long = "min-da-gas-price", default_value = "1000", env) + )] + #[cfg_attr( + not(feature = "production"), + arg(long = "min-da-gas-price", default_value = "0", env) + )] + pub min_da_gas_price: u64, + + /// Maximum allowed gas price for DA. + #[arg(long = "max-da-gas-price", default_value = "100000", env)] + pub max_da_gas_price: u64, + + /// P component of DA gas price calculation + /// **NOTE**: This is the **inverse** gain of a typical P controller. + /// Increasing this value will reduce gas price fluctuations. + #[arg( + long = "da-gas-price-p-component", + default_value = "799999999999993", + env + )] + pub da_gas_price_p_component: i64, + + /// D component of DA gas price calculation + /// **NOTE**: This is the **inverse** anticipatory control factor of a typical PD controller. + /// Increasing this value will reduce the dampening effect of quick algorithm changes. + #[arg( + long = "da-gas-price-d-component", + default_value = "10000000000000000", + env + )] + pub da_gas_price_d_component: i64, + + /// The URL for the DA Block Committer info + #[arg(long = "da-committer-url", env)] + pub da_committer_url: Option, + + /// The interval at which the `DaSourceService` polls for new data + #[arg(long = "da-poll-interval", env)] + pub da_poll_interval: Option, + + /// The L2 height the Gas Price Service will assume is already recorded on DA + /// i.e. If you want the Gas Price Service to look for the costs of block 1000, set to 999 + #[arg(long = "da-starting-recorded-height", env)] + pub da_starting_recorded_height: Option, +} diff --git a/crates/fuel-core/src/p2p_test_helpers.rs b/crates/fuel-core/src/p2p_test_helpers.rs index eb392dcf260..009d790edf5 100644 --- a/crates/fuel-core/src/p2p_test_helpers.rs +++ b/crates/fuel-core/src/p2p_test_helpers.rs @@ -461,7 +461,7 @@ pub fn make_config( node_config.utxo_validation = true; node_config.name = name; if let Some(min_gas_price) = config_overrides.min_exec_gas_price { - node_config.min_exec_gas_price = min_gas_price; + node_config.gas_price_config.min_exec_gas_price = min_gas_price; } node_config } diff --git a/crates/fuel-core/src/service/adapters/gas_price_adapters.rs b/crates/fuel-core/src/service/adapters/gas_price_adapters.rs index b8c5d849e69..0ee98cc5cf3 100644 --- a/crates/fuel-core/src/service/adapters/gas_price_adapters.rs +++ b/crates/fuel-core/src/service/adapters/gas_price_adapters.rs @@ -37,7 +37,10 @@ use crate::{ database_description::gas_price::GasPriceDatabase, Database, }, - service::Config, + service::{ + config::GasPriceConfig, + Config, + }, }; #[cfg(test)] @@ -64,26 +67,44 @@ impl GasPriceData for Database { impl From for V1AlgorithmConfig { fn from(value: Config) -> Self { + let GasPriceConfig { + starting_exec_gas_price, + exec_gas_price_change_percent, + min_exec_gas_price, + exec_gas_price_threshold_percent, + da_committer_url: _, + da_poll_interval, + da_gas_price_factor, + starting_recorded_height, + min_da_gas_price, + max_da_gas_price, + max_da_gas_price_change_percent, + da_gas_price_p_component, + da_gas_price_d_component, + gas_price_metrics, + activity_normal_range_size, + activity_capped_range_size, + activity_decrease_range_size, + block_activity_threshold, + } = value.gas_price_config; V1AlgorithmConfig { - new_exec_gas_price: value.starting_exec_gas_price, - min_exec_gas_price: value.min_exec_gas_price, - exec_gas_price_change_percent: value.exec_gas_price_change_percent, - l2_block_fullness_threshold_percent: value.exec_gas_price_threshold_percent, - min_da_gas_price: value.min_da_gas_price, - max_da_gas_price: value.max_da_gas_price, - max_da_gas_price_change_percent: value.max_da_gas_price_change_percent, - da_p_component: value.da_gas_price_p_component, - da_d_component: value.da_gas_price_d_component, - normal_range_size: value.activity_normal_range_size, - capped_range_size: value.activity_capped_range_size, - decrease_range_size: value.activity_decrease_range_size, - block_activity_threshold: value.block_activity_threshold, - da_poll_interval: value.da_poll_interval, - gas_price_factor: value.da_gas_price_factor, - starting_recorded_height: value - .starting_recorded_height - .map(BlockHeight::from), - record_metrics: value.gas_price_metrics, + new_exec_gas_price: starting_exec_gas_price, + min_exec_gas_price, + exec_gas_price_change_percent, + l2_block_fullness_threshold_percent: exec_gas_price_threshold_percent, + min_da_gas_price, + max_da_gas_price, + max_da_gas_price_change_percent, + da_p_component: da_gas_price_p_component, + da_d_component: da_gas_price_d_component, + normal_range_size: activity_normal_range_size, + capped_range_size: activity_capped_range_size, + decrease_range_size: activity_decrease_range_size, + block_activity_threshold, + da_poll_interval, + gas_price_factor: da_gas_price_factor, + starting_recorded_height: starting_recorded_height.map(BlockHeight::from), + record_metrics: gas_price_metrics, } } } diff --git a/crates/fuel-core/src/service/config.rs b/crates/fuel-core/src/service/config.rs index ca93580bedd..92a19cae79d 100644 --- a/crates/fuel-core/src/service/config.rs +++ b/crates/fuel-core/src/service/config.rs @@ -64,12 +64,7 @@ pub struct Config { pub vm: VMConfig, pub txpool: TxPoolConfig, pub block_producer: fuel_core_producer::Config, - pub starting_exec_gas_price: u64, - pub exec_gas_price_change_percent: u16, - pub min_exec_gas_price: u64, - pub exec_gas_price_threshold_percent: u8, - pub da_committer_url: Option, - pub da_poll_interval: Option, + pub gas_price_config: GasPriceConfig, pub da_compression: DaCompressionConfig, pub block_importer: fuel_core_importer::Config, #[cfg(feature = "relayer")] @@ -89,18 +84,6 @@ pub struct Config { pub time_until_synced: Duration, /// The size of the memory pool in number of `MemoryInstance`s. pub memory_pool_size: usize, - pub da_gas_price_factor: NonZeroU64, - pub starting_recorded_height: Option, - pub min_da_gas_price: u64, - pub max_da_gas_price: u64, - pub max_da_gas_price_change_percent: u16, - pub da_gas_price_p_component: i64, - pub da_gas_price_d_component: i64, - pub gas_price_metrics: bool, - pub activity_normal_range_size: u16, - pub activity_capped_range_size: u16, - pub activity_decrease_range_size: u16, - pub block_activity_threshold: u8, } impl Config { @@ -150,11 +133,8 @@ impl Config { state_rewind_policy: crate::state::historical_rocksdb::StateRewindPolicy::RewindFullRange, }; - let starting_gas_price = 0; - let gas_price_change_percent = 0; - let min_gas_price = 0; - let gas_price_threshold_percent = 50; - let gas_price_metrics = false; + + let gas_price_config = GasPriceConfig::local_node(); Self { graphql_config: GraphQLConfig { @@ -195,10 +175,7 @@ impl Config { ..Default::default() }, da_compression: DaCompressionConfig::Disabled, - starting_exec_gas_price: starting_gas_price, - exec_gas_price_change_percent: gas_price_change_percent, - min_exec_gas_price: min_gas_price, - exec_gas_price_threshold_percent: gas_price_threshold_percent, + gas_price_config, block_importer, #[cfg(feature = "relayer")] relayer: None, @@ -216,20 +193,6 @@ impl Config { min_connected_reserved_peers: 0, time_until_synced: Duration::ZERO, memory_pool_size: 4, - da_gas_price_factor: NonZeroU64::new(100).expect("100 is not zero"), - starting_recorded_height: None, - min_da_gas_price: 0, - max_da_gas_price: 1, - max_da_gas_price_change_percent: 0, - da_gas_price_p_component: 0, - da_gas_price_d_component: 0, - gas_price_metrics, - activity_normal_range_size: 0, - activity_capped_range_size: 0, - activity_decrease_range_size: 0, - da_committer_url: None, - block_activity_threshold: 0, - da_poll_interval: Some(Duration::from_secs(1)), } } @@ -281,3 +244,57 @@ pub enum DbType { InMemory, RocksDb, } + +#[derive(Clone, Debug)] +pub struct GasPriceConfig { + pub starting_exec_gas_price: u64, + pub exec_gas_price_change_percent: u16, + pub min_exec_gas_price: u64, + pub exec_gas_price_threshold_percent: u8, + pub da_committer_url: Option, + pub da_poll_interval: Option, + pub da_gas_price_factor: NonZeroU64, + pub starting_recorded_height: Option, + pub min_da_gas_price: u64, + pub max_da_gas_price: u64, + pub max_da_gas_price_change_percent: u16, + pub da_gas_price_p_component: i64, + pub da_gas_price_d_component: i64, + pub gas_price_metrics: bool, + pub activity_normal_range_size: u16, + pub activity_capped_range_size: u16, + pub activity_decrease_range_size: u16, + pub block_activity_threshold: u8, +} + +impl GasPriceConfig { + #[cfg(feature = "test-helpers")] + pub fn local_node() -> GasPriceConfig { + let starting_gas_price = 0; + let gas_price_change_percent = 0; + let min_gas_price = 0; + let gas_price_threshold_percent = 50; + let gas_price_metrics = false; + + GasPriceConfig { + starting_exec_gas_price: starting_gas_price, + exec_gas_price_change_percent: gas_price_change_percent, + min_exec_gas_price: min_gas_price, + exec_gas_price_threshold_percent: gas_price_threshold_percent, + da_gas_price_factor: NonZeroU64::new(100).expect("100 is not zero"), + starting_recorded_height: None, + min_da_gas_price: 0, + max_da_gas_price: 1, + max_da_gas_price_change_percent: 0, + da_gas_price_p_component: 0, + da_gas_price_d_component: 0, + gas_price_metrics, + activity_normal_range_size: 0, + activity_capped_range_size: 0, + activity_decrease_range_size: 0, + da_committer_url: None, + block_activity_threshold: 0, + da_poll_interval: Some(Duration::from_secs(1)), + } + } +} diff --git a/crates/fuel-core/src/service/sub_services.rs b/crates/fuel-core/src/service/sub_services.rs index e3e0d22aa15..342cd06039e 100644 --- a/crates/fuel-core/src/service/sub_services.rs +++ b/crates/fuel-core/src/service/sub_services.rs @@ -196,7 +196,8 @@ pub fn init_sub_services( let settings = consensus_parameters_provider.clone(); let block_stream = importer_adapter.events_shared_result(); - let committer_api = BlockCommitterHttpApi::new(config.da_committer_url.clone()); + let committer_api = + BlockCommitterHttpApi::new(config.gas_price_config.da_committer_url.clone()); let da_source = BlockCommitterDaBlockCosts::new(committer_api); let v1_config = V1AlgorithmConfig::from(config.clone()); diff --git a/tests/test-helpers/src/builder.rs b/tests/test-helpers/src/builder.rs index 1b866796f95..bbeeb8504d0 100644 --- a/tests/test-helpers/src/builder.rs +++ b/tests/test-helpers/src/builder.rs @@ -9,6 +9,7 @@ use fuel_core::{ StateConfig, }, service::{ + config::GasPriceConfig, Config, DbType, FuelService, @@ -244,11 +245,16 @@ impl TestSetupBuilder { }; txpool.heavy_work.size_of_verification_queue = self.max_txs; + let gas_price_config = GasPriceConfig { + starting_exec_gas_price: self.starting_gas_price, + ..GasPriceConfig::local_node() + }; + let mut config = Config { utxo_validation: self.utxo_validation, txpool, block_production: self.trigger, - starting_exec_gas_price: self.starting_gas_price, + gas_price_config, ..Config::local_node_with_configs(chain_conf, state) }; config.combined_db_config.database_config = self.database_config; diff --git a/tests/tests/chain.rs b/tests/tests/chain.rs index 42daf4f86d0..ee9c73f0a7f 100644 --- a/tests/tests/chain.rs +++ b/tests/tests/chain.rs @@ -5,6 +5,7 @@ use fuel_core::{ StateConfig, }, service::{ + config::GasPriceConfig, Config, FuelService, }, @@ -138,10 +139,14 @@ async fn network_operates_with_non_zero_base_asset_id() { chain_config .consensus_parameters .set_base_asset_id(new_base_asset_id); + let gas_price_config = GasPriceConfig { + starting_exec_gas_price: starting_gas_price, + ..GasPriceConfig::local_node() + }; let node_config = Config { debug: true, utxo_validation: true, - starting_exec_gas_price: starting_gas_price, + gas_price_config, ..Config::local_node_with_configs(chain_config, state_config) }; diff --git a/tests/tests/gas_price.rs b/tests/tests/gas_price.rs index f5b326f4b76..975cdc26b95 100644 --- a/tests/tests/gas_price.rs +++ b/tests/tests/gas_price.rs @@ -181,7 +181,7 @@ async fn latest_gas_price__for_single_block_should_be_starting_gas_price() { // given let mut config = Config::local_node(); let starting_gas_price = 982; - config.starting_exec_gas_price = starting_gas_price; + config.gas_price_config.starting_exec_gas_price = starting_gas_price; let srv = FuelService::from_database(Database::default(), config.clone()) .await .unwrap(); @@ -215,15 +215,17 @@ async fn produce_block__raises_gas_price() { let percent = 10; let threshold = 50; node_config.block_producer.coinbase_recipient = Some([5; 32].into()); - node_config.starting_exec_gas_price = starting_gas_price; - node_config.exec_gas_price_change_percent = percent; - node_config.exec_gas_price_threshold_percent = threshold; + node_config.gas_price_config.starting_exec_gas_price = starting_gas_price; + node_config.gas_price_config.exec_gas_price_change_percent = percent; + node_config + .gas_price_config + .exec_gas_price_threshold_percent = threshold; node_config.block_production = Trigger::Never; - node_config.da_gas_price_p_component = 0; - node_config.da_gas_price_d_component = 0; - node_config.max_da_gas_price_change_percent = 0; - node_config.min_da_gas_price = 0; - node_config.max_da_gas_price = 1; + node_config.gas_price_config.da_gas_price_p_component = 0; + node_config.gas_price_config.da_gas_price_d_component = 0; + node_config.gas_price_config.max_da_gas_price_change_percent = 0; + node_config.gas_price_config.min_da_gas_price = 0; + node_config.gas_price_config.max_da_gas_price = 1; let srv = FuelService::new_node(node_config.clone()).await.unwrap(); let client = FuelClient::from(srv.bound_address); @@ -265,15 +267,17 @@ async fn produce_block__lowers_gas_price() { let percent = 10; let threshold = 50; node_config.block_producer.coinbase_recipient = Some([5; 32].into()); - node_config.starting_exec_gas_price = starting_gas_price; - node_config.exec_gas_price_change_percent = percent; - node_config.exec_gas_price_threshold_percent = threshold; + node_config.gas_price_config.starting_exec_gas_price = starting_gas_price; + node_config.gas_price_config.exec_gas_price_change_percent = percent; + node_config + .gas_price_config + .exec_gas_price_threshold_percent = threshold; node_config.block_production = Trigger::Never; - node_config.da_gas_price_p_component = 0; - node_config.da_gas_price_d_component = 0; - node_config.max_da_gas_price_change_percent = 0; - node_config.min_da_gas_price = 0; - node_config.max_da_gas_price = 1; + node_config.gas_price_config.da_gas_price_p_component = 0; + node_config.gas_price_config.da_gas_price_d_component = 0; + node_config.gas_price_config.max_da_gas_price_change_percent = 0; + node_config.gas_price_config.min_da_gas_price = 0; + node_config.gas_price_config.max_da_gas_price = 1; let srv = FuelService::new_node(node_config.clone()).await.unwrap(); let client = FuelClient::from(srv.bound_address); @@ -349,10 +353,12 @@ async fn estimate_gas_price__is_greater_than_actual_price_at_desired_height() { let mut node_config = Config::local_node(); let starting_gas_price = 1000; let percent = 10; - node_config.starting_exec_gas_price = starting_gas_price; - node_config.exec_gas_price_change_percent = percent; + node_config.gas_price_config.starting_exec_gas_price = starting_gas_price; + node_config.gas_price_config.exec_gas_price_change_percent = percent; // Always increase - node_config.exec_gas_price_threshold_percent = 0; + node_config + .gas_price_config + .exec_gas_price_threshold_percent = 0; let srv = FuelService::new_node(node_config.clone()).await.unwrap(); let client = FuelClient::from(srv.bound_address); @@ -394,7 +400,12 @@ async fn latest_gas_price__if_node_restarts_gets_latest_value() { "0", ]; let driver = FuelCoreDriver::spawn(&args).await.unwrap(); - let starting = driver.node.shared.config.starting_exec_gas_price; + let starting = driver + .node + .shared + .config + .gas_price_config + .starting_exec_gas_price; let arb_blocks_to_produce = 10; for _ in 0..arb_blocks_to_produce { driver.client.produce_blocks(1, None).await.unwrap(); @@ -719,15 +730,15 @@ fn node_config_with_da_committer_url(url: url::Url) -> Config { Config::local_node_with_configs(chain_config, StateConfig::local_testnet()); let starting_gas_price = 10_000_000; node_config.block_producer.coinbase_recipient = Some([5; 32].into()); - node_config.min_da_gas_price = starting_gas_price; - node_config.max_da_gas_price = u64::MAX; - node_config.max_da_gas_price_change_percent = 15; + node_config.gas_price_config.min_da_gas_price = starting_gas_price; + node_config.gas_price_config.max_da_gas_price = u64::MAX; + node_config.gas_price_config.max_da_gas_price_change_percent = 15; node_config.block_production = Trigger::Never; - node_config.da_committer_url = Some(url); - node_config.da_poll_interval = Some(Duration::from_millis(100)); - node_config.da_gas_price_p_component = 123_456; - node_config.da_gas_price_d_component = 1_234_567; - node_config.block_activity_threshold = 0; + node_config.gas_price_config.da_committer_url = Some(url); + node_config.gas_price_config.da_poll_interval = Some(Duration::from_millis(100)); + node_config.gas_price_config.da_gas_price_p_component = 123_456; + node_config.gas_price_config.da_gas_price_d_component = 1_234_567; + node_config.gas_price_config.block_activity_threshold = 0; node_config }