Skip to content

Commit

Permalink
chore: proper generate legacy asm extra output file (#207)
Browse files Browse the repository at this point in the history
- write contents in `Contract.legacyAssembly.json` file
  • Loading branch information
grandizzy authored Sep 30, 2024
1 parent ed3826d commit 090fb6a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/artifacts/solc/src/output_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ impl FromStr for EvmOutputSelection {
match s {
"evm" => Ok(Self::All),
"asm" | "evm.assembly" => Ok(Self::Assembly),
"evm.legacyAssembly" => Ok(Self::LegacyAssembly),
"legacyAssembly" | "evm.legacyAssembly" => Ok(Self::LegacyAssembly),
"methodidentifiers" | "evm.methodIdentifiers" | "evm.methodidentifiers" => {
Ok(Self::MethodIdentifiers)
}
Expand Down
6 changes: 3 additions & 3 deletions crates/compilers/src/artifact_output/configurable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,8 @@ impl ExtraOutputFiles {
) -> Result<(), SolcError> {
if self.legacy_assembly {
if let Some(legacy_asm) = asm {
let file = file.with_extension("legacyAssembly");
fs::write(&file, legacy_asm.as_str().unwrap_or_default())
.map_err(|err| SolcError::io(err, file))?
let file = file.with_extension("legacyAssembly.json");
fs::write(&file, format!("{legacy_asm}")).map_err(|err| SolcError::io(err, file))?
}
}
Ok(())
Expand Down Expand Up @@ -824,6 +823,7 @@ impl ExtraOutputFiles {

let evm = contract.evm.as_ref();
self.process_assembly(evm.and_then(|evm| evm.assembly.as_deref()), file)?;
self.process_legacy_assembly(evm.and_then(|evm| evm.legacy_assembly.clone()), file)?;

let bytecode = evm.and_then(|evm| evm.bytecode.as_ref());
self.process_generated_sources(bytecode.map(|b| &b.generated_sources), file)?;
Expand Down

0 comments on commit 090fb6a

Please sign in to comment.