We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ec3911c commit c4a0cc9Copy full SHA for c4a0cc9
crates/apollo_compile_to_casm/src/compiler.rs
@@ -45,7 +45,17 @@ impl SierraToCasmCompiler {
45
additional_args,
46
resource_limits,
47
)?;
48
- Ok(serde_json::from_slice::<CasmContractClass>(&stdout)?)
+
49
+ if let Some(pos) = stdout.iter().position(|&b| b == b'{') {
50
+ // Extract the JSON representation of `CasmContractClass` by removing leading non-JSON
51
+ // compiler output.
52
+ Ok(serde_json::from_slice::<CasmContractClass>(&stdout[pos..])?)
53
+ } else {
54
+ Err(CompilationUtilError::UnexpectedError(format!(
55
+ "Failed to find the start of the JSON output in the compilation output: {:?}",
56
+ stdout
57
+ )))
58
+ }
59
}
60
61
0 commit comments