the solc download per target helper

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
Cyrill Leutwiler
2025-03-24 22:33:37 +01:00
parent 97156ed21e
commit c69a87238d
16 changed files with 272 additions and 96 deletions
+1
View File
@@ -8,4 +8,5 @@ pub struct Case {
pub comment: Option<String>,
pub modes: Option<Vec<Mode>>,
pub inputs: Vec<Input>,
pub group: Option<String>,
}
+21
View File
@@ -3,6 +3,27 @@ use semver::VersionReq;
use serde::{Deserialize, de::Deserializer};
use serde_json::Value;
/* fn deserialize_calldata<'de, D>(deserializer: D) -> Result<Vec<u8>, D::Error>
where
D: Deserializer<'de>,
{
let calldata_strings: Vec<String> = Vec::deserialize(deserializer)?;
let mut result = Vec::with_capacity(calldata_strings.len() * 32);
for calldata_string in &calldata_strings {
match calldata_string.parse::<U256>() {
Ok(parsed) => result.extend_from_slice(&parsed.to_be_bytes::<32>()),
Err(error) => {
return Err(serde::de::Error::custom(format!(
"parsing U256 {calldata_string} error: {error}"
)));
}
};
}
Ok(result)
} */
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq)]
pub struct Input {
pub instance: Option<String>,
+8 -1
View File
@@ -17,11 +17,18 @@ pub struct Metadata {
pub contracts: Option<BTreeMap<String, String>>,
pub libraries: Option<BTreeMap<String, BTreeMap<String, String>>>,
pub ignore: Option<bool>,
pub modes: Option<Vec<Mode>>,
modes: Option<Vec<Mode>>,
pub file_path: Option<PathBuf>,
}
impl Metadata {
/// Returns the modes of this metadata, inserting a default mode if not present.
pub fn modes(&self) -> Vec<Mode> {
self.modes
.to_owned()
.unwrap_or_else(|| vec![Mode::Solidity(Default::default())])
}
/// Returns the base directory of this metadata.
pub fn directory(&self) -> anyhow::Result<PathBuf> {
Ok(self
+6 -1
View File
@@ -12,7 +12,7 @@ pub enum Mode {
#[derive(Debug, Default, Clone, Eq, PartialEq)]
pub struct SolcMode {
pub solc_version: Option<semver::VersionReq>,
pub solc_optimize: Option<bool>,
solc_optimize: Option<bool>,
pub llvm_optimizer_settings: Vec<String>,
}
@@ -52,6 +52,11 @@ impl SolcMode {
Some(result)
}
/// Returns whether to enable the solc optimizer.
pub fn solc_optimize(&self) -> bool {
self.solc_optimize.unwrap_or(true)
}
}
impl<'de> Deserialize<'de> for Mode {