foundry-rs / foundry-rs/foundry
`verify-bytecode`: support arbitrary contract creation methods
- Dominant language
- Rust
- Stars
- 10.6k
- Forks
- 2.6k
- Avg merge
- 16h 38m
- Merged PRs (30d)
- 511
Description
### Component
Forge
### Describe the feature you would like
forge supports `verify-bytecode` on:
- predeploys
- contracts deployed by the EOA by setting `tx.to = ''`
- contracts deployed by setting `tx.to = DEFAULT_CREATE2_DEPLOYER`
In other cases it [cannot find the contract creation code](https://github.com/foundry-rs/foundry/blob/5a8bd893eeeeb9489ea66dd52a02eeaa580e3af0/crates/verify/src/bytecode.rs#L344-L361).
It would be useful to support arbitrarily nested calls to create and create2. For instance it would allow using a custom create2 deployer and still verifying with `verify-bytecode`.
I think this is achievable by stepping through the transaction and finding uses of CREATE/CREATE2 that return the created contract address, then reading the relevant memory segment when the opcode was used.
### Additional context
_No response_
Contributor guide
Research direction
Start in crates/verify/src/bytecode.rs, especially the existing contract-creation handling around the linked lines, and trace the verify-bytecode entry point. Investigate how transaction execution exposes nested CREATE and CREATE2 operations and their returned addresses. Done means verify-bytecode can locate creation code for arbitrarily nested deployment methods, including custom CREATE2 deployers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- blockchain, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100