Compare commits

...

2 Commits

Author SHA1 Message Date
James Wilson ca7af278cb Increase geth instantiate timeout from 2s to 5s 2025-07-28 15:04:48 +01:00
Omar 429f2e92a2 Fix contract discovery for simple tests (#83) 2025-07-28 07:05:53 +00:00
3 changed files with 23 additions and 5 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ pub struct Arguments {
pub geth: PathBuf, pub geth: PathBuf,
/// The maximum time in milliseconds to wait for geth to start. /// The maximum time in milliseconds to wait for geth to start.
#[arg(long = "geth-start-timeout", default_value = "2000")] #[arg(long = "geth-start-timeout", default_value = "5000")]
pub geth_start_timeout: u64, pub geth_start_timeout: u64,
/// The test network chain ID. /// The test network chain ID.
+21 -3
View File
@@ -101,12 +101,30 @@ where
anyhow::bail!("unsupported solc version: {:?}", &mode.solc_version); anyhow::bail!("unsupported solc version: {:?}", &mode.solc_version);
}; };
// Note: if the metadata is contained within a solidity file then this is the only file that
// we wish to compile since this is a self-contained test. Otherwise, if it's a JSON file
// then we need to compile all of the contracts that are in the directory since imports are
// allowed in there.
let Some(ref metadata_file_path) = metadata.file_path else {
anyhow::bail!("The metadata file path is not defined");
};
let mut files_to_compile = if metadata_file_path
.extension()
.is_some_and(|extension| extension.eq_ignore_ascii_case("sol"))
{
Box::new(std::iter::once(metadata_file_path.clone())) as Box<dyn Iterator<Item = _>>
} else {
Box::new(
FilesWithExtensionIterator::new(metadata.directory()?)
.with_allowed_extension("sol"),
)
};
let compiler = Compiler::<T::Compiler>::new() let compiler = Compiler::<T::Compiler>::new()
.allow_path(metadata.directory()?) .allow_path(metadata.directory()?)
.solc_optimizer(mode.solc_optimize()); .solc_optimizer(mode.solc_optimize());
let mut compiler = FilesWithExtensionIterator::new(metadata.directory()?) let mut compiler =
.with_allowed_extension("sol") files_to_compile.try_fold(compiler, |compiler, path| compiler.with_source(&path))?;
.try_fold(compiler, |compiler, path| compiler.with_source(&path))?;
for (library_instance, (library_address, _)) in self.deployed_libraries.iter() { for (library_instance, (library_address, _)) in self.deployed_libraries.iter() {
let library_ident = &metadata let library_ident = &metadata
.contracts .contracts
+1 -1
View File
@@ -193,7 +193,7 @@ impl Metadata {
metadata.file_path = Some(path.to_path_buf()); metadata.file_path = Some(path.to_path_buf());
metadata.contracts = Some( metadata.contracts = Some(
[( [(
ContractInstance::new("test"), ContractInstance::new("Test"),
ContractPathAndIdent { ContractPathAndIdent {
contract_source_path: path.to_path_buf(), contract_source_path: path.to_path_buf(),
contract_ident: ContractIdent::new("Test"), contract_ident: ContractIdent::new("Test"),