constants.mod, and Display for CaseIdx to use it

This commit is contained in:
James Wilson
2025-08-14 10:58:02 +01:00
parent 95ea886ba7
commit 1c335e5709
6 changed files with 17 additions and 6 deletions
+4
View File
@@ -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);
+2
View File
@@ -3,6 +3,8 @@
//! - Polkadot revive resolc compiler
//! - Polkadot revive Wasm compiler
mod constants;
use std::{
collections::HashMap,
fs::read_to_string,
+2 -1
View File
@@ -15,6 +15,7 @@ use revive_solc_json_interface::{
};
use crate::{CompilerInput, CompilerOutput, ModeOptimizerSetting, ModePipeline, SolidityCompiler};
use super::constants::VERSION_SUPPORTING_VIA_IR;
use alloy::json_abi::JsonAbi;
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
// 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.
pipeline == ModePipeline::Y && compiler_version >= &Version::new(0, 8, 13)
pipeline == ModePipeline::Y && compiler_version >= &VERSION_SUPPORTING_VIA_IR
}
}
+1 -3
View File
@@ -11,6 +11,7 @@ use revive_dt_config::Arguments;
use revive_dt_solc_binaries::download_solc;
use crate::{CompilerInput, CompilerOutput, ModeOptimizerSetting, ModePipeline, SolidityCompiler};
use super::constants::VERSION_SUPPORTING_VIA_IR;
use anyhow::Context;
use foundry_compilers_artifacts::{
@@ -23,9 +24,6 @@ use foundry_compilers_artifacts::{
use semver::Version;
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)]
pub struct Solc {
solc_path: PathBuf,