-
Notifications
You must be signed in to change notification settings - Fork 794
Conversation
let src = project | ||
.add_source( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this technique makes test building so much easier
T::contract_name(&path).map(|name| { | ||
(format!("{}:{}", path.file_name().unwrap().to_string_lossy(), name), art) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was there a bug here and you do to_string_lossy
? I guess the issue would be that due to the {:?}
the key becomes a quoted string, which ends up having a different key from {}:{}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this added quotes for the file path like \"file\":name
let artifacts: Box<dyn Iterator<Item = (String, T::Artifact)>> = if let Some(output) = | ||
self.compiler_output.take() | ||
{ | ||
Box::new(artifacts.chain(T::output_to_artifacts(output).into_values().flatten().map( | ||
|(name, artifact)| { | ||
(format!("{}:{}", T::output_file_name(&name).display(), name), artifact) | ||
}, | ||
))) | ||
} else { | ||
Box::new(artifacts) | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good catch
we used different keys for the into_artifacts iterator, while for cached artifacts we used : we only used the name for recompiled assets
// ensure change is detected | ||
assert!(!compiled.is_unchanged()); | ||
// and all recompiled artifacts are different | ||
for (p, artifact) in compiled.into_artifacts() { | ||
let other = artifacts.remove(&p).unwrap(); | ||
assert_ne!(artifact, other); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Motivation
foundry-rs/foundry#316
the way we checked if we need to recompile a contract was too optimistic and didn't check for their usage properly so in foundry-rs/foundry#316 we only recompiled the base contract and not the contract that inherits.
This was fixed but should be improved, generally the whole compile <-> cache pipeline is ripe for a v2 rewrite that uses the new dependency path.
I also discovered and fixed the issue that's likely related to #727, we used different keys for the
into_artifacts
iterator, while for cached artifacts we used<file>:<name>
we only used the name for recompiled assets. but #727 needs an additional test as follow-up.Solution
resolve all imports and check if they were changed.
PR Checklist