mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-16 23:31:08 +00:00
constants.mod, and Display for CaseIdx to use it
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
use semver::Version;
|
||||||
|
|
||||||
|
/// This is the first version of solc that supports the `--via-ir` flag / "viaIR" input JSON.
|
||||||
|
pub const VERSION_SUPPORTING_VIA_IR: Version = Version::new(0, 8, 13);
|
||||||
@@ -3,6 +3,8 @@
|
|||||||
//! - Polkadot revive resolc compiler
|
//! - Polkadot revive resolc compiler
|
||||||
//! - Polkadot revive Wasm compiler
|
//! - Polkadot revive Wasm compiler
|
||||||
|
|
||||||
|
mod constants;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
fs::read_to_string,
|
fs::read_to_string,
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use revive_solc_json_interface::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::{CompilerInput, CompilerOutput, ModeOptimizerSetting, ModePipeline, SolidityCompiler};
|
use crate::{CompilerInput, CompilerOutput, ModeOptimizerSetting, ModePipeline, SolidityCompiler};
|
||||||
|
use super::constants::VERSION_SUPPORTING_VIA_IR;
|
||||||
|
|
||||||
use alloy::json_abi::JsonAbi;
|
use alloy::json_abi::JsonAbi;
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
@@ -246,7 +247,7 @@ impl SolidityCompiler for Resolc {
|
|||||||
// We only support the Y (IE compile via Yul IR) mode here, which also means that we can
|
// We only support the Y (IE compile via Yul IR) mode here, which also means that we can
|
||||||
// only use solc version 0.8.13 and above. We must always compile via Yul IR as resolc
|
// only use solc version 0.8.13 and above. We must always compile via Yul IR as resolc
|
||||||
// needs this to translate to LLVM IR and then RISCV.
|
// needs this to translate to LLVM IR and then RISCV.
|
||||||
pipeline == ModePipeline::Y && compiler_version >= &Version::new(0, 8, 13)
|
pipeline == ModePipeline::Y && compiler_version >= &VERSION_SUPPORTING_VIA_IR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use revive_dt_config::Arguments;
|
|||||||
use revive_dt_solc_binaries::download_solc;
|
use revive_dt_solc_binaries::download_solc;
|
||||||
|
|
||||||
use crate::{CompilerInput, CompilerOutput, ModeOptimizerSetting, ModePipeline, SolidityCompiler};
|
use crate::{CompilerInput, CompilerOutput, ModeOptimizerSetting, ModePipeline, SolidityCompiler};
|
||||||
|
use super::constants::VERSION_SUPPORTING_VIA_IR;
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use foundry_compilers_artifacts::{
|
use foundry_compilers_artifacts::{
|
||||||
@@ -23,9 +24,6 @@ use foundry_compilers_artifacts::{
|
|||||||
use semver::Version;
|
use semver::Version;
|
||||||
use tokio::{io::AsyncWriteExt, process::Command as AsyncCommand};
|
use tokio::{io::AsyncWriteExt, process::Command as AsyncCommand};
|
||||||
|
|
||||||
/// This is the first version of solc that supports the `--via-ir` flag / "viaIR" input JSON.
|
|
||||||
const VERSION_SUPPORTING_VIA_IR: Version = Version::new(0, 8, 13);
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Solc {
|
pub struct Solc {
|
||||||
solc_path: PathBuf,
|
solc_path: PathBuf,
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ struct Test {
|
|||||||
metadata: Metadata,
|
metadata: Metadata,
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
mode: Mode,
|
mode: Mode,
|
||||||
case_idx: usize,
|
case_idx: CaseIdx,
|
||||||
case: Case,
|
case: Case,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ where
|
|||||||
metadata: metadata.clone(),
|
metadata: metadata.clone(),
|
||||||
path: metadata_file_path.to_path_buf(),
|
path: metadata_file_path.to_path_buf(),
|
||||||
mode: solc_mode,
|
mode: solc_mode,
|
||||||
case_idx,
|
case_idx: case_idx.into(),
|
||||||
case: case.clone(),
|
case: case.clone(),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -67,3 +67,9 @@ define_wrapper_type!(
|
|||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct CaseIdx(usize);
|
pub struct CaseIdx(usize);
|
||||||
);
|
);
|
||||||
|
|
||||||
|
impl std::fmt::Display for CaseIdx {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(f, "{}", self.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user