Skip to content

fix(compilers): use deployed bytecode in hardhat conversion - #263

Merged
figtracer merged 2 commits into
foundry-rs:mainfrom
ara-stock:fix/hh-deployed-bytecode
Oct 19, 2026
Merged

figtracer merged 2 commits into
foundry-rs:mainfrom
ara-stock:fix/hh-deployed-bytecode

Conversation

@ara-stock

Copy link
Copy Markdown
Contributor

Problem

impl From<HardhatArtifact> for ContractBytecode builds deployed_bytecode from artifact.bytecode instead of artifact.deployed_bytecode. The converted contract's runtime bytecode is the creation bytecode (with the deployed link references attached), and a Hardhat artifact's deployedBytecode is dropped. This also affects the CompactContractBytecode and CompactContractBytecodeCow conversions, which go through ContractBytecode.

Fix

Use artifact.deployed_bytecode for deployed_bytecode, as From<HardhatArtifact> for CompactContract already does.

Test

Added hh::tests::hardhat_artifact_into_contract_bytecode, which converts an artifact with different creation and runtime bytecode and checks both. Before the fix, it fails because the deployed bytecode is 6080600052 instead of 6001600055.

cargo test -p foundry-compilers-artifacts-solc --lib

This PR was written with help from Claude Code. I reviewed the change and ran the tests locally.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread crates/compilers/crates/artifacts/solc/src/hh.rs Outdated
@figtracer
figtracer enabled auto-merge (squash) October 19, 2026 17:45
@figtracer
figtracer merged commit 9dbc4f3 into foundry-rs:main Oct 19, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants