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

fix(forge): fix cache search for verification #7053

Merged
merged 6 commits into from
Feb 10, 2024

Conversation

klkvr
Copy link
Member

@klkvr klkvr commented Feb 8, 2024

Motivation

Closes #7042

Solution

Current EtherscanVerificationProvider::cache_entry always looks for contract in cache by name, even if path present, this PR fixes it and uses path where possible.

@klkvr klkvr changed the title fix fix(`forge): fix cache search for verification Feb 8, 2024
@klkvr klkvr changed the title fix(`forge): fix cache search for verification fix(forge): fix cache search for verification Feb 8, 2024
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

nice!

pedantic style nit

crates/forge/bin/cmd/verify/etherscan/mod.rs Outdated Show resolved Hide resolved
Comment on lines 364 to 366
let path = match args.contract.path.as_ref() {
Some(path) => project.root().join(path),
None => {
Copy link
Member

Choose a reason for hiding this comment

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

while we're at it, let's also do if let some else for this

path.clone(),
cache
.entry(&path)
.ok_or_eyre(format!("Cache entry not found for {}", path.display()))?
Copy link
Member

Choose a reason for hiding this comment

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

TIL ok_or_eyre

@mattsse mattsse added the Cmd-forge-verify Command: forge verify-contract/check label Feb 8, 2024
path.clone(),
cache
.entry(&path)
.ok_or_eyre(format!("Cache entry not found for {}", path.display()))?
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.ok_or_eyre(format!("Cache entry not found for {}", path.display()))?
.ok_or_else(|| eyre::eyre!("Cache entry not found for {}", path.display()))?

@mattsse mattsse merged commit e5f63a2 into foundry-rs:master Feb 10, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cmd-forge-verify Command: forge verify-contract/check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate contract names error for contracts with different file names
3 participants