Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(katana): make gas oracle a critical task #2859

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions crates/katana/core/src/backend/gas_oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use katana_tasks::TaskSpawner;
use parking_lot::Mutex;
use tokio::time::Duration;
use tracing::info;
use tracing::error;
use url::Url;

const BUFFER_SIZE: usize = 60;
Expand Down Expand Up @@ -83,10 +83,13 @@
let prices = oracle.prices.clone();
let l1_provider = oracle.l1_provider.clone();

task_spawner.build_task().graceful_shutdown().name("L1 Gas Oracle worker").spawn(
task_spawner.build_task().critical().name("L1 Gas Oracle worker").spawn(

Check warning on line 86 in crates/katana/core/src/backend/gas_oracle.rs

View check run for this annotation

Codecov / codecov/patch

crates/katana/core/src/backend/gas_oracle.rs#L86

Added line #L86 was not covered by tests
async move {
let mut worker = GasOracleWorker::new(prices, l1_provider);
worker.run().await
worker
.run()
.await
.inspect_err(|error| error!(target: "gas_oracle", %error, "Gas oracle worker failed."))

Check warning on line 92 in crates/katana/core/src/backend/gas_oracle.rs

View check run for this annotation

Codecov / codecov/patch

crates/katana/core/src/backend/gas_oracle.rs#L89-L92

Added lines #L89 - L92 were not covered by tests
},
);
}
Expand Down Expand Up @@ -174,13 +177,13 @@

let mut prices = self.prices.lock();

if let Err(e) = update_gas_price(
if let Err(error) = update_gas_price(

Check warning on line 180 in crates/katana/core/src/backend/gas_oracle.rs

View check run for this annotation

Codecov / codecov/patch

crates/katana/core/src/backend/gas_oracle.rs#L180

Added line #L180 was not covered by tests
&mut prices,
&mut self.gas_price_buffer,
&mut self.data_gas_price_buffer,
fee_history,
) {
info!(%e, "Error running the gas oracle");
error!(target: "gas_oracle", %error, "Error updating gas prices.");

Check warning on line 186 in crates/katana/core/src/backend/gas_oracle.rs

View check run for this annotation

Codecov / codecov/patch

crates/katana/core/src/backend/gas_oracle.rs#L186

Added line #L186 was not covered by tests
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/katana/node/src/exit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
pub(crate) fn new(handle: &'a LaunchedNode) -> Self {
let fut = Box::pin(async {
handle.node.task_manager.wait_for_shutdown().await;
handle.rpc.clone().stopped().await;
handle.rpc.stop()?;

Check warning on line 21 in crates/katana/node/src/exit.rs

View check run for this annotation

Codecov / codecov/patch

crates/katana/node/src/exit.rs#L21

Added line #L21 was not covered by tests
Ok(())
});
Self { fut }
Expand Down
Loading