Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(forge): verify contracts created inside a call #2840

Merged
merged 18 commits into from
Aug 19, 2022

Conversation

joshieDo
Copy link
Collaborator

@joshieDo joshieDo commented Aug 18, 2022

Motivation

Identifies and verifies contracts created during a call or deploy.
ref #2518 (comment)

Solution

Since we recently enabled the traces for all scripts, independently of verbosity, we can get all the contracts through CallKind::Create and CallKind::Create2 traces.

Also:

  • Fix verification regression where libraries were not being used. And thus, failing any contract verification that required them
  • Added a CI job that only happens on push to master since it requires the following repository secrets: ${{ secrets.ETHERSCAN_API_KEY }} ${{ secrets.TEST_PRIVATE_KEY }}. It deploys and verifies a script which uses predeployed libraries and contracts create inside contracts.

@joshieDo joshieDo added Cmd-forge-verify Command: forge verify-contract/check Cmd-forge-script Command: forge script T-feature Type: feature labels Aug 18, 2022
@joshieDo joshieDo marked this pull request as ready for review August 19, 2022 18:40
env:
CARGO_TERM_COLOR: always

jobs:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer that this is in the main test workflow since it compiles once or twice and then reuses the compiled test binary

Copy link
Member

@gakonst gakonst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

am ok with the double compilation, it's running on a separate job so should be ok

@gakonst gakonst merged commit add0c0c into foundry-rs:master Aug 19, 2022
iFrostizz pushed a commit to iFrostizz/foundry that referenced this pull request Nov 9, 2022
* verify contracts created inside a call

* flat map

* one less arg try_verify_contract

* change name to get_verify_args

* style

* use AdditionalContract

* add CallKind::Create2

* add additional info to trace.address doc

* add commit to broadcast log

* remove expect

* specify how many contracts are being verified

* successful verification message

* make sure verifiers have library info

* add complex deployment and verification test

* add ci job for live tests on master

* exclude live tests from PRs

* fix text

* change job name
@alphak3y
Copy link

alphak3y commented Nov 1, 2024

I'm on the most recent version of foundry and am having trouble automatically verifying contracts deployed within other contracts.

Currently, it will only automatically verify the top level contracts being deployed.

Is there some recommended solution for this? 🤔 💭

@zerosnacks
Copy link
Member

Hi @alphak3y, would you mind opening up a new issue with this, preferably with a minimal reproduction / additional details? Thanks

@grandizzy grandizzy added the C-forge Command: forge label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge Cmd-forge-script Command: forge script Cmd-forge-verify Command: forge verify-contract/check T-feature Type: feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants