diff --git a/.changeset/seven-dogs-decide.md b/.changeset/seven-dogs-decide.md new file mode 100644 index 000000000..9a4eff200 --- /dev/null +++ b/.changeset/seven-dogs-decide.md @@ -0,0 +1,5 @@ +--- +"@nomicfoundation/edr": patch +--- + +Handle optional solc settings better in the tracing engine diff --git a/crates/edr_napi/src/trace/error_inferrer.rs b/crates/edr_napi/src/trace/error_inferrer.rs index 15beddba3..0028a0964 100644 --- a/crates/edr_napi/src/trace/error_inferrer.rs +++ b/crates/edr_napi/src/trace/error_inferrer.rs @@ -955,8 +955,14 @@ impl ErrorInferrer { return Ok(entry); } + // This function is only called after we jumped into the initial function in + // call traces, so there should always be at least a function jumpdest. let trace = match trace { - Either::A(_call) => unreachable!("This shouldn't happen: a call trace has no functionJumpdest but has already jumped into a function"), + Either::A(_call) => return Err( + napi::Error::new( + napi::Status::GenericFailure, + "This shouldn't happen: a call trace has no functionJumpdest but has already jumped into a function" + )), Either::B(create) => create, }; diff --git a/crates/edr_solidity/src/artifacts.rs b/crates/edr_solidity/src/artifacts.rs index ebb61c690..d3370e1f7 100644 --- a/crates/edr_solidity/src/artifacts.rs +++ b/crates/edr_solidity/src/artifacts.rs @@ -1,5 +1,7 @@ //! Represents artifacts of the Solidity compiler input and output in the //! Standard JSON format. +//! +//! See . #![allow(missing_docs)] use std::collections::HashMap; @@ -37,7 +39,7 @@ pub struct Source { pub struct CompilerInput { pub language: String, pub sources: HashMap, - pub settings: CompilerSettings, + pub settings: Option, } /// Additional settings like the optimizer, metadata, etc. @@ -46,7 +48,7 @@ pub struct CompilerInput { pub struct CompilerSettings { #[serde(rename = "viaIR")] via_ir: Option, - optimizer: OptimizerSettings, + optimizer: Option, metadata: Option, output_selection: HashMap>>, evm_version: Option, @@ -66,21 +68,21 @@ pub struct OptimizerSettings { #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct OptimizerDetails { - yul_details: YulDetails, + yul_details: Option, } /// Yul-specific optimizer details. #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct YulDetails { - optimizer_steps: String, + optimizer_steps: Option, } /// Specifies the metadata settings. #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct MetadataSettings { - use_literal_content: bool, + use_literal_content: Option, } /// The main output of the Solidity compiler.