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

🚸 script: ignore interfaces when inferring target #6246

Merged
merged 2 commits into from
Nov 8, 2023

Conversation

cruzdanilo
Copy link
Contributor

Motivation

currently, when running forge script without the --target-contract/--tc argument, forge will fail to identify the expected target contract if interfaces are declared in the same file, like in the following example:

// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.22;

contract Script {
  function run() external {}
}

interface Interface {}

error:

Multiple contracts in the target path. Please specify the contract name with `--tc ContractName

Solution

the ux can be improved by ignoring artifacts with zero-length bytecode.

Copy link
Member

@Evalir Evalir left a comment

Choose a reason for hiding this comment

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

ty! would appreciate a test!

crates/forge/bin/cmd/script/build.rs Outdated Show resolved Hide resolved
@cruzdanilo
Copy link
Contributor Author

🫡

Copy link
Member

@DaniPopes DaniPopes left a comment

Choose a reason for hiding this comment

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

lgtm

@DaniPopes DaniPopes merged commit 1a91bbb into foundry-rs:master Nov 8, 2023
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