Added implementation for resolc trait (#12)

Implement the Solidity Compiler trait for resolc
This commit is contained in:
activecoder10
2025-05-08 12:09:02 +03:00
committed by GitHub
parent 8009f5880c
commit 38b42560ec
8 changed files with 115 additions and 12 deletions
+4 -3
View File
@@ -8,7 +8,6 @@ use revive_dt_compiler::{Compiler, CompilerInput, SolidityCompiler};
use revive_dt_config::Arguments;
use revive_dt_format::{input::Input, metadata::Metadata, mode::SolcMode};
use revive_dt_node_interaction::EthereumNode;
use revive_dt_solc_binaries::download_solc;
use revive_solc_json_interface::SolcStandardJsonOutput;
use crate::Platform;
@@ -43,16 +42,18 @@ where
let sources = metadata.contract_sources()?;
let base_path = metadata.directory()?.display().to_string();
let mut compiler = Compiler::<T::Compiler>::new().base_path(base_path.clone());
for (file, _contract) in sources.values() {
log::debug!("contract source {}", file.display());
compiler = compiler.with_source(file)?;
}
let solc_path = download_solc(self.config.directory(), version, self.config.wasm)?;
let compiler_path = T::Compiler::get_compiler_executable(self.config, version)?;
let output = compiler
.solc_optimizer(mode.solc_optimize())
.try_build(solc_path)?;
.try_build(compiler_path)?;
self.contracts.insert(output.input, output.output);
+2 -2
View File
@@ -3,7 +3,7 @@
//! This crate defines the testing configuration and
//! provides a helper utilty to execute tests.
use revive_dt_compiler::{SolidityCompiler, solc};
use revive_dt_compiler::{SolidityCompiler, revive_resolc, solc};
use revive_dt_node::geth;
use revive_dt_node_interaction::EthereumNode;
@@ -30,5 +30,5 @@ pub struct Kitchensink;
impl Platform for Kitchensink {
type Blockchain = geth::Instance;
type Compiler = solc::Solc;
type Compiler = revive_resolc::Resolc;
}
+10 -5
View File
@@ -5,7 +5,7 @@ use rayon::{ThreadPoolBuilder, prelude::*};
use revive_dt_config::*;
use revive_dt_core::{
Geth,
Geth, Kitchensink,
driver::{Driver, State},
};
use revive_dt_format::{corpus::Corpus, metadata::Metadata};
@@ -109,11 +109,16 @@ fn main_compile_only(
) -> anyhow::Result<()> {
tests.par_iter().for_each(|metadata| {
for mode in &metadata.solc_modes() {
let mut state = match platform {
TestingPlatform::Geth => State::<Geth>::new(config),
_ => todo!(),
match platform {
TestingPlatform::Geth => {
let mut state = State::<Geth>::new(config);
let _ = state.build_contracts(mode, metadata);
}
TestingPlatform::Kitchensink => {
let mut state = State::<Kitchensink>::new(config);
let _ = state.build_contracts(mode, metadata);
}
};
let _ = state.build_contracts(mode, metadata);
}
});