Skip to content
This repository was archived by the owner on Oct 19, 2024. It is now read-only.

Commit 1788f05

Browse files
authored
feat(solc): use svm-builds instead of fetching http releases list (#1063)
* feat(solc): use svm-builds instead of fetching http releases list * use correct features
1 parent b6b5b09 commit 1788f05

File tree

3 files changed

+38
-16
lines changed

3 files changed

+38
-16
lines changed

Diff for: Cargo.lock

+22-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: ethers-solc/Cargo.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ home = "0.5.3"
4444
# SVM is not WASM compatible yet.
4545
# svm = { package = "svm-rs", default-features = false, version = "0.2.7", optional = true }
4646
svm = { package = "svm-rs", default-features = false, git = "https://github.com/roynalnaruto/svm-rs", optional = true, features = ["blocking"] }
47+
svm-builds = { package = "svm-rs-builds", git = "https://github.com/roynalnaruto/svm-rs", optional = true}
4748

4849
[target.'cfg(target_arch = "wasm32")'.dependencies]
4950
# NOTE: this enables wasm compatibility for getrandom indirectly
@@ -69,17 +70,17 @@ harness = false
6970
[[test]]
7071
name = "project"
7172
path = "tests/project.rs"
72-
required-features = ["async", "svm", "project-util"]
73+
required-features = ["async", "svm", "svm-builds", "project-util"]
7374

7475
[[test]]
7576
name = "mocked"
7677
path = "tests/mocked.rs"
77-
required-features = ["async", "svm", "project-util"]
78+
required-features = ["async", "svm", "svm-builds", "project-util"]
7879

7980
[features]
8081
default = ["rustls"]
8182
async = ["tokio", "futures-util"]
82-
full = ["async", "svm", "svm/blocking"]
83+
full = ["async", "svm", "svm/blocking", "svm-builds"]
8384
# Utilities for creating and testing project workspaces
8485
project-util = ["tempfile", "fs_extra", "rand"]
8586
tests = []

Diff for: ethers-solc/src/compile/mod.rs

+12-10
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,19 @@ pub(crate) fn take_solc_installer_lock() -> std::sync::MutexGuard<'static, ()> {
6363

6464
/// A list of upstream Solc releases, used to check which version
6565
/// we should download.
66-
/// The boolean value marks whether there was an error.
67-
#[cfg(all(feature = "svm"))]
66+
/// The boolean value marks whether there was an error accessing the release list
67+
#[cfg(all(feature = "svm", feature = "svm-builds"))]
6868
pub static RELEASES: once_cell::sync::Lazy<(svm::Releases, Vec<Version>, bool)> =
69-
once_cell::sync::Lazy::new(|| match svm::blocking_all_releases(svm::platform()) {
70-
Ok(releases) => {
71-
let sorted_versions = releases.clone().into_versions();
72-
(releases, sorted_versions, true)
73-
}
74-
Err(err) => {
75-
tracing::error!("{:?}", err);
76-
(svm::Releases::default(), Vec::new(), false)
69+
once_cell::sync::Lazy::new(|| {
70+
match serde_json::from_str::<svm::Releases>(svm_builds::RELEASE_LIST_JSON) {
71+
Ok(releases) => {
72+
let sorted_versions = releases.clone().into_versions();
73+
(releases, sorted_versions, true)
74+
}
75+
Err(err) => {
76+
tracing::error!("{:?}", err);
77+
(svm::Releases::default(), Vec::new(), false)
78+
}
7779
}
7880
});
7981

0 commit comments

Comments
 (0)