resolc crate (#328)

- Factor the YUL crate out of `revive-solidity`.
- `revive-solidity` is in reality not a Solidity implementation but the
revive solidity compiler driver (`resolc`). By renaming we not only get
this straight but also a binary with the same name as the crate which
should be less confusing.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
xermicus
2025-05-27 09:48:43 +02:00
committed by GitHub
parent 090e3ac13c
commit bd4e108bb0
99 changed files with 599 additions and 624 deletions
+3 -3
View File
@@ -44,7 +44,7 @@ pub use crate::specs::*;
mod runtime;
mod specs;
#[cfg(not(feature = "revive-solidity"))]
#[cfg(not(feature = "resolc"))]
pub(crate) const NO_SOLIDITY_FRONTEND: &str =
"revive-runner was built without the solidity frontend; please enable the 'solidity' feature!";
@@ -234,7 +234,7 @@ impl CallResult {
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum Code {
#[cfg(feature = "revive-solidity")]
#[cfg(feature = "resolc")]
/// Compile a single solidity source and use the blob of `contract`
Solidity {
path: Option<std::path::PathBuf>,
@@ -270,7 +270,7 @@ impl From<Code> for pallet_revive::Code {
let Ok(source_code) = std::fs::read_to_string(&path) else {
panic!("Failed to reead source code from {}", path.display());
};
pallet_revive::Code::Upload(revive_solidity::test_utils::compile_blob_with_options(
pallet_revive::Code::Upload(resolc::test_utils::compile_blob_with_options(
&contract,
&source_code,
solc_optimizer.unwrap_or(true),
+7 -7
View File
@@ -4,12 +4,12 @@ use serde::{Deserialize, Serialize};
use crate::*;
use alloy_primitives::keccak256;
#[cfg(feature = "revive-solidity")]
#[cfg(feature = "resolc")]
use alloy_primitives::Address;
#[cfg(feature = "revive-solidity")]
#[cfg(feature = "resolc")]
use resolc::test_utils::*;
#[cfg(feature = "resolc")]
use revive_differential::{Evm, EvmLog};
#[cfg(feature = "revive-solidity")]
use revive_solidity::test_utils::*;
const SPEC_MARKER_BEGIN: &str = "/* runner.json";
const SPEC_MARKER_END: &str = "*/";
@@ -256,7 +256,7 @@ impl Specs {
};
match code {
#[cfg(feature = "revive-solidity")]
#[cfg(feature = "resolc")]
Code::Bytes(bytes) if bytes.is_empty() => {
let contract_source = match std::fs::read_to_string(contract_path) {
Err(err) => panic!("unable to read {contract_path}: {err}"),
@@ -264,9 +264,9 @@ impl Specs {
};
*bytes = compile_blob(contract_name, &contract_source)
}
#[cfg(not(feature = "revive-solidity"))]
#[cfg(not(feature = "resolc"))]
Code::Bytes(_) => panic!("{NO_SOLIDITY_FRONTEND}"),
#[cfg(feature = "revive-solidity")]
#[cfg(feature = "resolc")]
Code::Solidity { path, .. } if path.is_none() => *path = Some(contract_path.into()),
_ => continue,
}