From 57bf4984f85a546f88edafd7ea8331648f914167 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Wed, 3 Dec 2025 18:03:03 -0500 Subject: [PATCH] `panic = "abort"` `panic = "unwind"` was originally a requirement of Substrate, notably due to its [native runtime](https://github.com/paritytech/substrate/issues/10874). This does not mean all of Serai should use this setting however. As the native runtime has been removed, we do no longer need this for the Substrate node. With a review of our derivative, a panic guard is only used when fetching the version from the runtime, causing an error on boot if a panic occurs. Accordingly, we shouldn't have a need for `panic = "unwind"` within the node, and the runtime itself should be fine. The rest of Serai's services already registered bespoke hooks to ensure any panic caused the process to exit. Those are left as-is, even though they're now unnecessary. --- Cargo.toml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 36dab5f7..50941bdc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -116,6 +116,19 @@ members = [ "tests/reproducible-runtime", ] +[profile.dev] +panic = "abort" +overflow-checks = true +[profile.release] +panic = "abort" +overflow-checks = true +# These do not respect the `panic` configuration value, so we don't provide them +[profile.test] +# panic = "abort" # https://github.com/rust-lang/issues/67650 +overflow-checks = true +[profile.bench] +overflow-checks = true + [profile.dev.package] # Always compile Monero (and a variety of dependencies) with optimizations due # to the extensive operations required for Bulletproofs @@ -165,10 +178,6 @@ revm-precompile = { opt-level = 3 } revm-primitives = { opt-level = 3 } revm-state = { opt-level = 3 } -[profile.release] -panic = "unwind" -overflow-checks = true - [patch.crates-io] # Point to empty crates for crates unused within in our tree alloy-eip2124 = { path = "patches/ethereum/alloy-eip2124" }