Skip to content

Commit

Permalink
feat: gas price oracle v2
Browse files Browse the repository at this point in the history
  • Loading branch information
augustin-v committed Dec 5, 2024
1 parent ffc9259 commit 309e1cd
Show file tree
Hide file tree
Showing 5 changed files with 362 additions and 9 deletions.
26 changes: 24 additions & 2 deletions crates/katana/cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use serde::{Deserialize, Serialize};
use tracing::{info, Subscriber};
use tracing_log::LogTracer;
use tracing_subscriber::{fmt, EnvFilter};
use url::Url;

use crate::file::NodeArgsConfig;
use crate::options::*;
Expand Down Expand Up @@ -69,6 +70,11 @@ pub struct NodeArgs {
#[arg(value_parser = katana_core::service::messaging::MessagingConfig::parse)]
pub messaging: Option<MessagingConfig>,

#[arg(long = "l1.provider", value_name = "URL", alias = "l1-provider")]
#[arg(help = "The Ethereum RPC provider to sample the gas prices from to enable the gas \
price oracle.")]
pub l1_provider_url: Option<Url>,

#[command(flatten)]
pub logging: LoggingOptions,

Expand Down Expand Up @@ -171,8 +177,20 @@ impl NodeArgs {
let execution = self.execution_config();
let sequencing = self.sequencer_config();
let messaging = self.messaging.clone();

Ok(Config { metrics, db, dev, rpc, chain, execution, sequencing, messaging, forking })
let l1_provider_url = self.gpo_config();

Ok(Config {
metrics,
db,
dev,
rpc,
chain,
execution,
sequencing,
messaging,
forking,
l1_provider_url,
})
}

fn sequencer_config(&self) -> SequencingConfig {
Expand Down Expand Up @@ -296,6 +314,10 @@ impl NodeArgs {
None
}

fn gpo_config(&self) -> Option<Url> {
self.l1_provider_url.clone()
}

/// Parse the node config from the command line arguments and the config file,
/// and merge them together prioritizing the command line arguments.
pub fn with_config_file(mut self) -> Result<Self> {
Expand Down
Loading

0 comments on commit 309e1cd

Please sign in to comment.