mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-12 20:31:10 +00:00
Compile all contracts for a test file
This commit is contained in:
@@ -69,14 +69,27 @@ where
|
|||||||
anyhow::bail!("unsupported solc version: {:?}", &mode.solc_version);
|
anyhow::bail!("unsupported solc version: {:?}", &mode.solc_version);
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut compiler = Compiler::<T::Compiler>::new()
|
let compiler = Compiler::<T::Compiler>::new()
|
||||||
.base_path(metadata.directory()?.display().to_string())
|
.base_path(metadata.directory()?.display().to_string())
|
||||||
|
.allow_path(metadata.directory()?.display().to_string())
|
||||||
.solc_optimizer(mode.solc_optimize());
|
.solc_optimizer(mode.solc_optimize());
|
||||||
|
|
||||||
for (file, _contract) in metadata.contract_sources()?.values() {
|
let compiler = std::fs::read_dir(metadata.directory()?)?
|
||||||
tracing::debug!("contract source {}", file.display());
|
.flat_map(|entry| match entry {
|
||||||
compiler = compiler.with_source(file)?;
|
Ok(entry) => {
|
||||||
}
|
if entry
|
||||||
|
.path()
|
||||||
|
.extension()
|
||||||
|
.is_some_and(|ext| ext.eq_ignore_ascii_case("sol"))
|
||||||
|
{
|
||||||
|
Some(entry.path())
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(_) => None,
|
||||||
|
})
|
||||||
|
.try_fold(compiler, |compiler, path| compiler.with_source(&path))?;
|
||||||
|
|
||||||
let mut task = CompilationTask {
|
let mut task = CompilationTask {
|
||||||
json_input: compiler.input(),
|
json_input: compiler.input(),
|
||||||
@@ -180,12 +193,15 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn deploy_contracts(&mut self, input: &Input, node: &T::Blockchain) -> anyhow::Result<()> {
|
pub fn deploy_contracts(&mut self, input: &Input, node: &T::Blockchain) -> anyhow::Result<()> {
|
||||||
tracing::debug!(
|
let tracing_span = tracing::debug_span!(
|
||||||
"Deploying contracts {}, having address {} on node: {}",
|
"Deploying contracts",
|
||||||
&input.instance,
|
?input,
|
||||||
&input.caller,
|
node = std::any::type_name::<T>()
|
||||||
std::any::type_name::<T>()
|
|
||||||
);
|
);
|
||||||
|
let _guard = tracing_span.enter();
|
||||||
|
|
||||||
|
tracing::debug!(number_of_contracts_to_deploy = self.contracts.len());
|
||||||
|
|
||||||
for output in self.contracts.values() {
|
for output in self.contracts.values() {
|
||||||
let Some(contract_map) = &output.contracts else {
|
let Some(contract_map) = &output.contracts else {
|
||||||
tracing::debug!(
|
tracing::debug!(
|
||||||
|
|||||||
@@ -123,9 +123,14 @@ impl Input {
|
|||||||
return Ok(Bytes::default()); // fallback or deployer — no input
|
return Ok(Bytes::default()); // fallback or deployer — no input
|
||||||
};
|
};
|
||||||
|
|
||||||
let abi = deployed_abis
|
let Some(abi) = deployed_abis.get(&self.instance) else {
|
||||||
.get(&self.instance)
|
tracing::error!(
|
||||||
.ok_or_else(|| anyhow::anyhow!("ABI for instance '{}' not found", &self.instance))?;
|
contract_name = self.instance,
|
||||||
|
available_abis = ?deployed_abis.keys().collect::<Vec<_>>(),
|
||||||
|
"Attempted to lookup ABI of contract but it wasn't found"
|
||||||
|
);
|
||||||
|
anyhow::bail!("ABI for instance '{}' not found", &self.instance);
|
||||||
|
};
|
||||||
|
|
||||||
tracing::trace!("ABI found for instance: {}", &self.instance);
|
tracing::trace!("ABI found for instance: {}", &self.instance);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user