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 7490c57
Show file tree
Hide file tree
Showing 6 changed files with 363 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ slot = { git = "https://github.com/cartridge-gg/slot", rev = "1298a30" }
alloy-contract = { version = "0.3", default-features = false }
alloy-json-rpc = { version = "0.3", default-features = false }
alloy-network = { version = "0.3", default-features = false }
alloy-provider = { version = "0.3", default-features = false, features = [ "reqwest" ] }
alloy-provider = "0.3"
alloy-rpc-types-eth = { version = "0.3", default-features = false }
alloy-signer = { version = "0.3", default-features = false }
alloy-transport = { version = "0.3", default-features = false }
Expand Down
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 7490c57

Please sign in to comment.