Skip to content

Commit 07b0ec3

Browse files
authored
chore(deps): bump foundry-compilers (#8291)
* chore(deps): bump foundry-compilers * bumpies
1 parent 844f3f5 commit 07b0ec3

File tree

14 files changed

+36
-42
lines changed

14 files changed

+36
-42
lines changed

Cargo.lock

Lines changed: 13 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ foundry-wallets = { path = "crates/wallets" }
147147
foundry-linking = { path = "crates/linking" }
148148

149149
# solc & compilation utilities
150-
foundry-block-explorers = { version = "0.4.1", default-features = false }
151-
foundry-compilers = { version = "0.8.0", default-features = false }
150+
foundry-block-explorers = { version = "0.5.0", default-features = false }
151+
foundry-compilers = { version = "0.9.0", default-features = false }
152152
solang-parser = "=0.3.3"
153153

154154
## revm

crates/cli/src/utils/cmd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub fn remove_contract(
3333
path: &Path,
3434
name: &str,
3535
) -> Result<(JsonAbi, CompactBytecode, CompactDeployedBytecode)> {
36-
let contract = if let Some(contract) = output.remove(path.to_string_lossy(), name) {
36+
let contract = if let Some(contract) = output.remove(path, name) {
3737
contract
3838
} else {
3939
let mut err = format!("could not find artifact: `{name}`");

crates/config/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,7 @@ impl Config {
13131313
"evm.bytecode".to_string(),
13141314
"evm.deployedBytecode".to_string(),
13151315
]),
1316+
search_paths: None,
13161317
})
13171318
}
13181319

crates/config/src/providers/remappings.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,8 @@ impl<'a> RemappingsProvider<'a> {
164164
.lib_paths
165165
.iter()
166166
.map(|lib| self.root.join(lib))
167-
.inspect(|lib| {
168-
trace!("find all remappings in lib path: {:?}", lib);
169-
})
170-
.flat_map(Remapping::find_many)
167+
.inspect(|lib| trace!(?lib, "find all remappings"))
168+
.flat_map(|lib| Remapping::find_many(&lib))
171169
{
172170
// this is an additional safety check for weird auto-detected remappings
173171
if ["lib/", "src/", "contracts/"].contains(&r.name.as_str()) {

crates/forge/bin/cmd/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl BuildArgs {
9191

9292
// Collect sources to compile if build subdirectories specified.
9393
let mut files = vec![];
94-
if let Some(paths) = self.paths {
94+
if let Some(paths) = &self.paths {
9595
for path in paths {
9696
files.extend(source_files_iter(path, MultiCompilerLanguage::FILE_EXTENSIONS));
9797
}

crates/forge/bin/cmd/init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ fn init_git_repo(git: Git<'_>, no_commit: bool) -> Result<()> {
201201
fn init_vscode(root: &Path) -> Result<()> {
202202
let remappings_file = root.join("remappings.txt");
203203
if !remappings_file.exists() {
204-
let mut remappings = Remapping::find_many(root.join("lib"))
204+
let mut remappings = Remapping::find_many(&root.join("lib"))
205205
.into_iter()
206206
.map(|r| r.into_relative(root).to_relative_remapping().to_string())
207207
.collect::<Vec<_>>();

crates/forge/bin/cmd/test/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ impl TestArgs {
217217

218218
// Always recompile all sources to ensure that `getCode` cheatcode can use any artifact.
219219
test_sources.extend(source_files_iter(
220-
project.paths.sources,
220+
&project.paths.sources,
221221
MultiCompilerLanguage::FILE_EXTENSIONS,
222222
));
223223

crates/forge/src/multi_runner.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,7 @@ impl MultiContractRunnerBuilder {
371371
) -> Result<MultiContractRunner> {
372372
let contracts = output
373373
.artifact_ids()
374-
.map(|(mut id, v)| {
375-
// TODO: Use ArtifactId::with_stripped_file_prefixes
376-
if let Ok(stripped) = id.source.strip_prefix(root) {
377-
id.source = stripped.to_path_buf();
378-
}
379-
(id, v)
380-
})
374+
.map(|(id, v)| (id.with_stripped_file_prefixes(root), v))
381375
.collect();
382376
let linker = Linker::new(root, contracts);
383377

crates/forge/tests/cli/cmd.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -577,15 +577,15 @@ forgetest_init!(can_emit_extra_output, |prj, cmd| {
577577

578578
let artifact_path = prj.paths().artifacts.join(TEMPLATE_CONTRACT_ARTIFACT_JSON);
579579
let artifact: ConfigurableContractArtifact =
580-
foundry_compilers::utils::read_json_file(artifact_path).unwrap();
580+
foundry_compilers::utils::read_json_file(&artifact_path).unwrap();
581581
assert!(artifact.metadata.is_some());
582582

583583
cmd.forge_fuse().args(["build", "--extra-output-files", "metadata", "--force"]).root_arg();
584584
cmd.assert_non_empty_stdout();
585585

586586
let metadata_path =
587587
prj.paths().artifacts.join(format!("{TEMPLATE_CONTRACT_ARTIFACT_BASE}.metadata.json"));
588-
let _artifact: Metadata = foundry_compilers::utils::read_json_file(metadata_path).unwrap();
588+
let _artifact: Metadata = foundry_compilers::utils::read_json_file(&metadata_path).unwrap();
589589
});
590590

591591
// checks that extra output works
@@ -595,7 +595,7 @@ forgetest_init!(can_emit_multiple_extra_output, |prj, cmd| {
595595

596596
let artifact_path = prj.paths().artifacts.join(TEMPLATE_CONTRACT_ARTIFACT_JSON);
597597
let artifact: ConfigurableContractArtifact =
598-
foundry_compilers::utils::read_json_file(artifact_path).unwrap();
598+
foundry_compilers::utils::read_json_file(&artifact_path).unwrap();
599599
assert!(artifact.metadata.is_some());
600600
assert!(artifact.ir.is_some());
601601
assert!(artifact.ir_optimized.is_some());
@@ -614,7 +614,7 @@ forgetest_init!(can_emit_multiple_extra_output, |prj, cmd| {
614614

615615
let metadata_path =
616616
prj.paths().artifacts.join(format!("{TEMPLATE_CONTRACT_ARTIFACT_BASE}.metadata.json"));
617-
let _artifact: Metadata = foundry_compilers::utils::read_json_file(metadata_path).unwrap();
617+
let _artifact: Metadata = foundry_compilers::utils::read_json_file(&metadata_path).unwrap();
618618

619619
let iropt = prj.paths().artifacts.join(format!("{TEMPLATE_CONTRACT_ARTIFACT_BASE}.iropt"));
620620
std::fs::read_to_string(iropt).unwrap();

crates/linking/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ impl<'a> Linker<'a> {
232232
let (file, name) = self.convert_artifact_id_to_lib_path(id);
233233

234234
for (_, bytecode) in &mut needed_libraries {
235-
bytecode.to_mut().link(file.to_string_lossy(), name.clone(), address);
235+
bytecode.to_mut().link(&file.to_string_lossy(), &name, address);
236236
}
237237

238238
libraries.libs.entry(file).or_default().insert(name, address.to_checksum(None));
@@ -253,12 +253,12 @@ impl<'a> Linker<'a> {
253253
for (name, address) in libs {
254254
let address = Address::from_str(address).map_err(LinkerError::InvalidAddress)?;
255255
if let Some(bytecode) = contract.bytecode.as_mut() {
256-
bytecode.to_mut().link(file.to_string_lossy(), name, address);
256+
bytecode.to_mut().link(&file.to_string_lossy(), name, address);
257257
}
258258
if let Some(deployed_bytecode) =
259259
contract.deployed_bytecode.as_mut().and_then(|b| b.to_mut().bytecode.as_mut())
260260
{
261-
deployed_bytecode.link(file.to_string_lossy(), name, address);
261+
deployed_bytecode.link(&file.to_string_lossy(), name, address);
262262
}
263263
}
264264
}

crates/verify/src/etherscan/flatten.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::provider::VerificationContext;
33
use eyre::{Context, Result};
44
use foundry_block_explorers::verify::CodeFormat;
55
use foundry_compilers::{
6-
artifacts::{BytecodeHash, Source},
6+
artifacts::{BytecodeHash, Source, Sources},
77
buildinfo::RawBuildInfo,
88
compilers::{
99
solc::{SolcCompiler, SolcLanguage, SolcVersionedInput},
@@ -13,7 +13,7 @@ use foundry_compilers::{
1313
AggregatedCompilerOutput,
1414
};
1515
use semver::{BuildMetadata, Version};
16-
use std::{collections::BTreeMap, path::Path};
16+
use std::path::Path;
1717

1818
#[derive(Debug)]
1919
pub struct EtherscanFlattenedSource;
@@ -81,7 +81,7 @@ impl EtherscanFlattenedSource {
8181
let solc = Solc::find_or_install(&version)?;
8282

8383
let input = SolcVersionedInput::build(
84-
BTreeMap::from([("contract.sol".into(), Source::new(content))]),
84+
Sources::from([("contract.sol".into(), Source::new(content))]),
8585
Default::default(),
8686
SolcLanguage::Solidity,
8787
version.clone(),

crates/verify/src/etherscan/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ impl EtherscanVerificationProvider {
401401

402402
let output = context.project.compile_file(&context.target_path)?;
403403
let artifact = output
404-
.find(context.target_path.to_string_lossy(), &context.target_name)
404+
.find(&context.target_path, &context.target_name)
405405
.ok_or_eyre("Contract artifact wasn't found locally")?;
406406
let bytecode = artifact
407407
.get_bytecode_object()

crates/verify/src/provider.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl VerificationContext {
5555
.compile(&project)?;
5656

5757
let artifact = output
58-
.find(self.target_path.to_string_lossy(), &self.target_name)
58+
.find(&self.target_path, &self.target_name)
5959
.ok_or_eyre("failed to find target artifact when compiling for abi")?;
6060

6161
artifact.abi.clone().ok_or_eyre("target artifact does not have an ABI")
@@ -74,7 +74,7 @@ impl VerificationContext {
7474
.compile(&project)?;
7575

7676
let artifact = output
77-
.find(self.target_path.to_string_lossy(), &self.target_name)
77+
.find(&self.target_path, &self.target_name)
7878
.ok_or_eyre("failed to find target artifact when compiling for metadata")?;
7979

8080
artifact.metadata.clone().ok_or_eyre("target artifact does not have an ABI")

0 commit comments

Comments
 (0)