Skip to content

Commit

Permalink
Add a panic hook
Browse files Browse the repository at this point in the history
Given that a block producing node is considered mission critical, a panic should almost certainly be considered a bug, as the node should catch and respond to any errors in a more appropriate way. If we ever *do* panic, we show a nice message, and ask the user to open a ticket
  • Loading branch information
Quantumplation committed Dec 27, 2024
1 parent 85016df commit 5a1c6f0
Show file tree
Hide file tree
Showing 5 changed files with 252 additions and 1 deletion.
120 changes: 120 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion crates/amaru/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ homepage = "https://github.com/pragma-org/amaru"
documentation = "https://docs.rs/amaru"
readme = "README.md"
rust-version = "1.81.0"
build = "build.rs"

[dependencies]
async-trait = "0.1.83"
clap = { version = "4.5.20", features = ["derive"] }
gasket = { version = "0.8.0", features = ["derive"] }
hex = "0.4.3"
miette = "7.2.0"
indoc = "2.0"
strip-ansi-escapes = "0.1.1"
owo-colors = { version = "3.5.0", features = ["supports-colors"] }
ouroboros = { git = "https://github.com/pragma-org/ouroboros", rev = "ca1d447a6c106e421e6c2b1c7d9d59abf5ca9589" }
ouroboros-praos = { git = "https://github.com/pragma-org/ouroboros", rev = "ca1d447a6c106e421e6c2b1c7d9d59abf5ca9589" }
pallas-addresses = "0.31.0"
Expand All @@ -39,10 +43,17 @@ serde = "1.0.215"
bech32 = "0.11.0"
opentelemetry = { version = "0.27.1" }
opentelemetry_sdk = { version = "0.27.1", features = ["async-std", "rt-tokio"] }
opentelemetry-otlp = { version = "0.27.0", features = ["grpc-tonic", "http-proto", "reqwest-client"] }
opentelemetry-otlp = { version = "0.27.0", features = [
"grpc-tonic",
"http-proto",
"reqwest-client",
] }
tracing-opentelemetry = { version = "0.28.0" }

[dev-dependencies]
envpath = { version = "0.0.1-beta.3", features = ["rand"] }
insta = { version = "1.41.1", features = ["json"] }
proptest = "1.5.0"

[build-dependencies]
built = { version = "0.7.1", features = ["git2"] }
3 changes: 3 additions & 0 deletions crates/amaru/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
built::write_built_file().expect("Failed to acquire build-time information");
}
4 changes: 4 additions & 0 deletions crates/amaru/src/bin/amaru/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use clap::{Parser, Subcommand};
use opentelemetry::metrics::Counter;
use panic::panic_handler;
use std::env;

mod cmd;
mod config;
mod exit;
mod panic;

pub const SERVICE_NAME: &str = "amaru";

Expand All @@ -28,6 +30,8 @@ struct Cli {

#[tokio::main]
async fn main() -> miette::Result<()> {
panic_handler();

let counter = setup_tracing();

let args = Cli::parse();
Expand Down
Loading

0 comments on commit 5a1c6f0

Please sign in to comment.