From 039439e78c850b14e3cb3befcf9b94abfa702258 Mon Sep 17 00:00:00 2001 From: ara-stock <226676426+ara-stock@users.noreply.github.com> Date: Mon, 19 Oct 2026 10:56:30 +0900 Subject: [PATCH 1/2] fix(compilers): use deployed bytecode in hardhat conversion Co-Authored-By: Claude Opus 5.5 --- .../compilers/crates/artifacts/solc/src/hh.rs | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/crates/compilers/crates/artifacts/solc/src/hh.rs b/crates/compilers/crates/artifacts/solc/src/hh.rs index 101c8cf8..cd4846f6 100644 --- a/crates/compilers/crates/artifacts/solc/src/hh.rs +++ b/crates/compilers/crates/artifacts/solc/src/hh.rs @@ -67,11 +67,12 @@ impl From for ContractBytecode { bcode }); - let deployed_bytecode: Option = artifact.bytecode.as_ref().map(|t| { - let mut bcode: Bytecode = t.clone().into(); - bcode.link_references = artifact.deployed_link_references.clone(); - bcode.into() - }); + let deployed_bytecode: Option = + artifact.deployed_bytecode.as_ref().map(|t| { + let mut bcode: Bytecode = t.clone().into(); + bcode.link_references = artifact.deployed_link_references.clone(); + bcode.into() + }); Self { abi: Some(artifact.abi), bytecode, deployed_bytecode } } @@ -84,3 +85,30 @@ impl From for CompactContractBytecode { c.into() } } + +#[cfg(test)] +mod tests { + use super::*; + use alloy_primitives::hex; + + #[test] + fn hardhat_artifact_into_contract_bytecode() { + let artifact = HardhatArtifact { + format: HH_ARTIFACT_VERSION.to_string(), + contract_name: "Greeter".to_string(), + source_name: "contracts/Greeter.sol".to_string(), + abi: Default::default(), + bytecode: Some(BytecodeObject::Bytecode(hex!("6080600052").into())), + deployed_bytecode: Some(BytecodeObject::Bytecode(hex!("6001600055").into())), + link_references: Default::default(), + deployed_link_references: Default::default(), + }; + + let c: ContractBytecode = artifact.into(); + assert_eq!(c.bytecode.unwrap().object.as_bytes().unwrap()[..], hex!("6080600052")); + assert_eq!( + c.deployed_bytecode.unwrap().bytecode.unwrap().object.as_bytes().unwrap()[..], + hex!("6001600055") + ); + } +} From 3d45a9b4ef366c2e4e17baa8a65f3ad4f0587eea Mon Sep 17 00:00:00 2001 From: figtracer Date: Mon, 19 Oct 2026 17:27:14 +0100 Subject: [PATCH 2/2] Update crates/compilers/crates/artifacts/solc/src/hh.rs --- .../compilers/crates/artifacts/solc/src/hh.rs | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/crates/compilers/crates/artifacts/solc/src/hh.rs b/crates/compilers/crates/artifacts/solc/src/hh.rs index cd4846f6..26953950 100644 --- a/crates/compilers/crates/artifacts/solc/src/hh.rs +++ b/crates/compilers/crates/artifacts/solc/src/hh.rs @@ -85,30 +85,3 @@ impl From for CompactContractBytecode { c.into() } } - -#[cfg(test)] -mod tests { - use super::*; - use alloy_primitives::hex; - - #[test] - fn hardhat_artifact_into_contract_bytecode() { - let artifact = HardhatArtifact { - format: HH_ARTIFACT_VERSION.to_string(), - contract_name: "Greeter".to_string(), - source_name: "contracts/Greeter.sol".to_string(), - abi: Default::default(), - bytecode: Some(BytecodeObject::Bytecode(hex!("6080600052").into())), - deployed_bytecode: Some(BytecodeObject::Bytecode(hex!("6001600055").into())), - link_references: Default::default(), - deployed_link_references: Default::default(), - }; - - let c: ContractBytecode = artifact.into(); - assert_eq!(c.bytecode.unwrap().object.as_bytes().unwrap()[..], hex!("6080600052")); - assert_eq!( - c.deployed_bytecode.unwrap().bytecode.unwrap().object.as_bytes().unwrap()[..], - hex!("6001600055") - ); - } -}