Skip to content

Commit 090fb6a

Browse files
authored
chore: proper generate legacy asm extra output file (#207)
- write contents in `Contract.legacyAssembly.json` file
1 parent ed3826d commit 090fb6a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

crates/artifacts/solc/src/output_selection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ impl FromStr for EvmOutputSelection {
379379
match s {
380380
"evm" => Ok(Self::All),
381381
"asm" | "evm.assembly" => Ok(Self::Assembly),
382-
"evm.legacyAssembly" => Ok(Self::LegacyAssembly),
382+
"legacyAssembly" | "evm.legacyAssembly" => Ok(Self::LegacyAssembly),
383383
"methodidentifiers" | "evm.methodIdentifiers" | "evm.methodidentifiers" => {
384384
Ok(Self::MethodIdentifiers)
385385
}

crates/compilers/src/artifact_output/configurable.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -751,9 +751,8 @@ impl ExtraOutputFiles {
751751
) -> Result<(), SolcError> {
752752
if self.legacy_assembly {
753753
if let Some(legacy_asm) = asm {
754-
let file = file.with_extension("legacyAssembly");
755-
fs::write(&file, legacy_asm.as_str().unwrap_or_default())
756-
.map_err(|err| SolcError::io(err, file))?
754+
let file = file.with_extension("legacyAssembly.json");
755+
fs::write(&file, format!("{legacy_asm}")).map_err(|err| SolcError::io(err, file))?
757756
}
758757
}
759758
Ok(())
@@ -824,6 +823,7 @@ impl ExtraOutputFiles {
824823

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

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

0 commit comments

Comments
 (0)