Skip to content

Commit

Permalink
Merge pull request #112 from alloy-rs/matt/bump-solc-0.8.24
Browse files Browse the repository at this point in the history
chore: solc 0.8.24
  • Loading branch information
mattsse authored Jan 27, 2024
2 parents 1e770b5 + 9e73a21 commit e360185
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 14 deletions.
38 changes: 29 additions & 9 deletions crates/svm-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,16 +415,16 @@ fn lock_file_path(version: &Version) -> PathBuf {

#[cfg(test)]
mod tests {
use super::*;
use crate::{
platform::Platform,
releases::{all_releases, artifact_url},
};
use rand::seq::SliceRandom;
use reqwest::Url;

use std::process::{Command, Stdio};

use super::*;
const LATEST: Version = Version::new(0, 8, 24);

#[tokio::test]
async fn test_data_dir_resolution() {
Expand All @@ -445,7 +445,7 @@ mod tests {
assert_eq!(
artifact_url(Platform::LinuxAarch64, &version, artifact).unwrap(),
Url::parse(&format!(
"https://github.com/nikitastupin/solc/raw/923ab4b852fadc00ffe87bb76fff21d0613bd280/linux/aarch64/{artifact}"
"https://github.com/nikitastupin/solc/raw/7687d6ce15553292adbb3e6c565eafea6e0caf85/linux/aarch64/{artifact}"
))
.unwrap(),
)
Expand Down Expand Up @@ -532,24 +532,44 @@ mod tests {
// ensures we can download the latest native solc for apple silicon
#[tokio::test(flavor = "multi_thread")]
async fn can_download_latest_native_apple_silicon() {
let latest: Version = "0.8.23".parse().unwrap();

let artifacts = all_releases(Platform::MacOsAarch64).await.unwrap();

let artifact = artifacts.releases.get(&latest).unwrap();
let artifact = artifacts.releases.get(&LATEST).unwrap();
let download_url = artifact_url(
Platform::MacOsAarch64,
&latest,
&LATEST,
artifact.to_string().as_str(),
)
.unwrap();

let checksum = artifacts.get_checksum(&LATEST).unwrap();

let resp = reqwest::get(download_url).await.unwrap();
assert!(resp.status().is_success());
let binbytes = resp.bytes().await.unwrap();
ensure_checksum(&binbytes, &LATEST, checksum).unwrap();
}

// ensures we can download the latest native solc for linux aarch64
#[tokio::test(flavor = "multi_thread")]
#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
async fn can_download_latest_linux_aarch64() {
let artifacts = all_releases(Platform::LinuxAarch64).await.unwrap();

let artifact = artifacts.releases.get(&LATEST).unwrap();
let download_url = artifact_url(
Platform::LinuxAarch64,
&LATEST,
artifact.to_string().as_str(),
)
.unwrap();

let checksum = artifacts.get_checksum(&latest).unwrap();
let checksum = artifacts.get_checksum(&LATEST).unwrap();

let resp = reqwest::get(download_url).await.unwrap();
assert!(resp.status().is_success());
let binbytes = resp.bytes().await.unwrap();
ensure_checksum(&binbytes, &latest, checksum).unwrap();
ensure_checksum(&binbytes, &LATEST, checksum).unwrap();
}

#[tokio::test]
Expand Down
13 changes: 8 additions & 5 deletions crates/svm-rs/src/releases.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::{error::SolcVmError, platform::Platform};
use once_cell::sync::Lazy;
use reqwest::get;
use semver::Version;
Expand All @@ -8,7 +9,9 @@ use serde::{
use std::collections::BTreeMap;
use url::Url;

use crate::{error::SolcVmError, platform::Platform};
// Updating new releases:
// 1. Update `https://github.com/nikitastupin/solc` commit for `linux/aarch64`
// 2. Update `https://github.com/alloy-rs/solc-builds` commit for `macosx/aarch64`

const SOLC_RELEASES_URL: &str = "https://binaries.soliditylang.org";

Expand All @@ -27,18 +30,18 @@ static OLD_SOLC_RELEASES: Lazy<Releases> = Lazy::new(|| {
static LINUX_AARCH64_MIN: Lazy<Version> = Lazy::new(|| Version::new(0, 5, 0));

static LINUX_AARCH64_URL_PREFIX: &str =
"https://github.com/nikitastupin/solc/raw/923ab4b852fadc00ffe87bb76fff21d0613bd280/linux/aarch64";
"https://github.com/nikitastupin/solc/raw/7687d6ce15553292adbb3e6c565eafea6e0caf85/linux/aarch64";

static LINUX_AARCH64_RELEASES_URL: &str =
"https://github.com/nikitastupin/solc/raw/923ab4b852fadc00ffe87bb76fff21d0613bd280/linux/aarch64/list.json";
"https://github.com/nikitastupin/solc/raw/7687d6ce15553292adbb3e6c565eafea6e0caf85/linux/aarch64/list.json";

static MACOS_AARCH64_NATIVE: Lazy<Version> = Lazy::new(|| Version::new(0, 8, 5));

static MACOS_AARCH64_URL_PREFIX: &str =
"https://github.com/alloy-rs/solc-builds/raw/260964c1fcae2502c0139070bdc5c83eb7036a68/macosx/aarch64";
"https://github.com/alloy-rs/solc-builds/raw/e4b80d33bc4d015b2fc3583e217fbf248b2014e1/macosx/aarch64";

static MACOS_AARCH64_RELEASES_URL: &str =
"https://github.com/alloy-rs/solc-builds/raw/260964c1fcae2502c0139070bdc5c83eb7036a68/macosx/aarch64/list.json";
"https://github.com/alloy-rs/solc-builds/raw/e4b80d33bc4d015b2fc3583e217fbf248b2014e1/macosx/aarch64/list.json";

/// Defines the struct that the JSON-formatted release list can be deserialized into.
///
Expand Down

0 comments on commit e360185

Please sign in to comment.