Compare commits

..

3 Commits

Author SHA1 Message Date
Omar Abdulla b7ddb2da92 Increase kitchensink wait time to 60 seconds 2025-08-04 15:30:43 +03:00
Omar Abdulla 17b56a8155 Increase the number of private keys 2025-08-04 13:39:56 +03:00
Omar Abdulla 8578862537 Added a resolver tied to a specific block 2025-08-04 12:08:50 +03:00
7 changed files with 32 additions and 86 deletions
-21
View File
@@ -238,25 +238,4 @@ mod test {
Version::new(0, 7, 6)
)
}
#[tokio::test]
async fn compiler_version_can_be_obtained1() {
// Arrange
let args = Arguments::default();
println!("Getting compiler path");
let path = Solc::get_compiler_executable(&args, Version::new(0, 4, 21))
.await
.unwrap();
println!("Got compiler path");
let compiler = Solc::new(path);
// Act
let version = compiler.version();
// Assert
assert_eq!(
version.expect("Failed to get version"),
Version::new(0, 4, 21)
)
}
}
-6
View File
@@ -5,7 +5,6 @@ use std::marker::PhantomData;
use std::path::PathBuf;
use alloy::eips::BlockNumberOrTag;
use alloy::hex;
use alloy::json_abi::JsonAbi;
use alloy::network::{Ethereum, TransactionBuilder};
use alloy::primitives::{BlockNumber, U256};
@@ -243,11 +242,6 @@ where
) {
let value = U256::from_be_slice(output_word);
self.variables.insert(variable_name.clone(), value);
tracing::info!(
variable_name,
variable_value = hex::encode(value.to_be_bytes::<32>()),
"Assigned variable"
);
}
Ok(())
-25
View File
@@ -162,20 +162,6 @@ where
Some(false) | None => true,
},
)
.filter(
|(metadata_file_path, _, case_idx, case, _)| match case.ignore {
Some(true) => {
tracing::warn!(
metadata_file_path = %metadata_file_path.display(),
case_idx,
case_name = ?case.name,
"Ignoring case"
);
false
}
Some(false) | None => true,
},
)
.collect::<Vec<_>>();
let metadata_case_status = Arc::new(RwLock::new(test_cases.iter().fold(
@@ -477,17 +463,6 @@ where
}
};
tracing::info!(
?library_instance,
library_address = ?leader_receipt.contract_address,
"Deployed library to leader"
);
tracing::info!(
?library_instance,
library_address = ?follower_receipt.contract_address,
"Deployed library to follower"
);
let Some(leader_library_address) = leader_receipt.contract_address else {
tracing::error!("Contract deployment transaction didn't return an address");
anyhow::bail!("Contract deployment didn't return an address");
-1
View File
@@ -15,7 +15,6 @@ pub struct Case {
pub inputs: Vec<Input>,
pub group: Option<String>,
pub expected: Option<Expected>,
pub ignore: Option<bool>,
}
impl Case {
+3 -3
View File
@@ -11,14 +11,14 @@ use std::{
use tokio::sync::Mutex;
use crate::download::SolcDownloader;
use crate::download::GHDownloader;
pub const SOLC_CACHE_DIRECTORY: &str = "solc";
pub(crate) static SOLC_CACHER: LazyLock<Mutex<HashSet<PathBuf>>> = LazyLock::new(Default::default);
pub(crate) async fn get_or_download(
working_directory: &Path,
downloader: &SolcDownloader,
downloader: &GHDownloader,
) -> anyhow::Result<PathBuf> {
let target_directory = working_directory
.join(SOLC_CACHE_DIRECTORY)
@@ -38,7 +38,7 @@ pub(crate) async fn get_or_download(
Ok(target_file)
}
async fn download_to_file(path: &Path, downloader: &SolcDownloader) -> anyhow::Result<()> {
async fn download_to_file(path: &Path, downloader: &GHDownloader) -> anyhow::Result<()> {
tracing::info!("caching file: {}", path.display());
let Ok(file) = File::create_new(path) else {
+24 -25
View File
@@ -38,21 +38,21 @@ impl List {
}
}
/// Download solc binaries from the official SolidityLang site
/// Download solc binaries from GitHub releases (IPFS links aren't reliable).
#[derive(Clone, Debug)]
pub struct SolcDownloader {
pub struct GHDownloader {
pub version: Version,
pub target: &'static str,
pub list: &'static str,
}
impl SolcDownloader {
pub const BASE_URL: &str = "https://binaries.soliditylang.org";
impl GHDownloader {
pub const BASE_URL: &str = "https://github.com/ethereum/solidity/releases/download";
pub const LINUX_NAME: &str = "linux-amd64";
pub const MACOSX_NAME: &str = "macosx-amd64";
pub const WINDOWS_NAME: &str = "windows-amd64";
pub const WASM_NAME: &str = "wasm";
pub const LINUX_NAME: &str = "solc-static-linux";
pub const MACOSX_NAME: &str = "solc-macos";
pub const WINDOWS_NAME: &str = "solc-windows.exe";
pub const WASM_NAME: &str = "soljson.js";
async fn new(
version: impl Into<VersionOrRequirement>,
@@ -102,27 +102,26 @@ impl SolcDownloader {
Self::new(version, Self::WASM_NAME, List::WASM_URL).await
}
/// Returns the download link.
pub fn url(&self) -> String {
format!("{}/v{}/{}", Self::BASE_URL, &self.version, &self.target)
}
/// Download the solc binary.
///
/// Errors out if the download fails or the digest of the downloaded file
/// mismatches the expected digest from the release [List].
pub async fn download(&self) -> anyhow::Result<Vec<u8>> {
tracing::info!("downloading solc: {self:?}");
let builds = List::download(self.list).await?.builds;
let build = builds
let expected_digest = List::download(self.list)
.await?
.builds
.iter()
.find(|build| build.version == self.version)
.ok_or_else(|| anyhow::anyhow!("solc v{} not found builds", self.version))?;
.ok_or_else(|| anyhow::anyhow!("solc v{} not found builds", self.version))
.map(|b| b.sha256.strip_prefix("0x").unwrap_or(&b.sha256).to_string())?;
let path = build.path.clone();
let expected_digest = build
.sha256
.strip_prefix("0x")
.unwrap_or(&build.sha256)
.to_string();
let url = format!("{}/{}/{}", Self::BASE_URL, self.target, path.display());
let file = reqwest::get(url).await?.bytes().await?.to_vec();
let file = reqwest::get(self.url()).await?.bytes().await?.to_vec();
if hex::encode(Sha256::digest(&file)) != expected_digest {
anyhow::bail!("sha256 mismatch for solc version {}", self.version);
@@ -134,7 +133,7 @@ impl SolcDownloader {
#[cfg(test)]
mod tests {
use crate::{download::SolcDownloader, list::List};
use crate::{download::GHDownloader, list::List};
#[tokio::test]
async fn try_get_windows() {
@@ -142,7 +141,7 @@ mod tests {
.await
.unwrap()
.latest_release;
SolcDownloader::windows(version)
GHDownloader::windows(version)
.await
.unwrap()
.download()
@@ -156,7 +155,7 @@ mod tests {
.await
.unwrap()
.latest_release;
SolcDownloader::macosx(version)
GHDownloader::macosx(version)
.await
.unwrap()
.download()
@@ -170,7 +169,7 @@ mod tests {
.await
.unwrap()
.latest_release;
SolcDownloader::linux(version)
GHDownloader::linux(version)
.await
.unwrap()
.download()
@@ -181,7 +180,7 @@ mod tests {
#[tokio::test]
async fn try_get_wasm() {
let version = List::download(List::WASM_URL).await.unwrap().latest_release;
SolcDownloader::wasm(version)
GHDownloader::wasm(version)
.await
.unwrap()
.download()
+5 -5
View File
@@ -6,7 +6,7 @@
use std::path::{Path, PathBuf};
use cache::get_or_download;
use download::SolcDownloader;
use download::GHDownloader;
use revive_dt_common::types::VersionOrRequirement;
@@ -25,13 +25,13 @@ pub async fn download_solc(
wasm: bool,
) -> anyhow::Result<PathBuf> {
let downloader = if wasm {
SolcDownloader::wasm(version).await
GHDownloader::wasm(version).await
} else if cfg!(target_os = "linux") {
SolcDownloader::linux(version).await
GHDownloader::linux(version).await
} else if cfg!(target_os = "macos") {
SolcDownloader::macosx(version).await
GHDownloader::macosx(version).await
} else if cfg!(target_os = "windows") {
SolcDownloader::windows(version).await
GHDownloader::windows(version).await
} else {
unimplemented!()
}?;