Skip to content

Commit

Permalink
Merge pull request #42 from Certora/remappings
Browse files Browse the repository at this point in the history
always strip / from lhs of a remapping
  • Loading branch information
chandrakananandi authored Apr 24, 2024
2 parents 6a6f72e + 9a40111 commit 078bf88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ impl Solc {
.map(|x| x.to_string())
.collect::<Vec<_>>()
.join(" ");

log::debug!(
"Invoking solc on {}: `{} {}`",
solidity_file.display(),
Expand Down
16 changes: 15 additions & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,21 @@ pub fn repair_remapping(remap_str: &str, resolve_against: Option<&str>) -> Strin
"repair_remappings: remapping must have the shape @foo=bar/baz/blip, please check {}.",
remap_str
);
let lhs = parts[0];
/*
We remove any trailing slashes on the lhs.
solc has strange behavior when it comes to remappings:
solmate=lib/solmate/src : solc likes this
solmate=lib/solmate/src/ : solc likes this
solmate/=lib/solmate/src/ : solc likes this
solmate/=lib/solmate/src : solc does not like this
So we remove the trailing / from the lhs always.
NOTE: this will not work if there is an import in a file for example that
is like: `import solmate//A.sol`.
This is rare so we are not handling it for now but
this is something to revisit in the future.
*/
let left: Vec<&str> = parts[0].split("/").collect();
let lhs = left[0];
let rhs = parts[1];
let resolved_path = PathBuf::from(against_path_str)
.join(rhs)
Expand Down

0 comments on commit 078bf88

Please sign in to comment.