Update revive compiler dependencies

This commit is contained in:
Marian Radu
2026-01-15 17:13:01 +02:00
parent 94b04c0189
commit 4a4ac7ede6
3 changed files with 1105 additions and 1100 deletions
Generated
+1065 -1076
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -73,9 +73,9 @@ indexmap = { version = "2.10.0", default-features = false }
itertools = { version = "0.14.0" } itertools = { version = "0.14.0" }
# revive compiler # revive compiler
revive-solc-json-interface = { git = "https://github.com/paritytech/revive", rev = "3389865af7c3ff6f29a586d82157e8bc573c1a8e" } revive-solc-json-interface = { version = "0.5.0" }
revive-common = { git = "https://github.com/paritytech/revive", rev = "3389865af7c3ff6f29a586d82157e8bc573c1a8e" } revive-common = { version = "0.3.0" }
revive-differential = { git = "https://github.com/paritytech/revive", rev = "3389865af7c3ff6f29a586d82157e8bc573c1a8e" } revive-differential = { version = "0.3.0" }
zombienet-sdk = { git = "https://github.com/paritytech/zombienet-sdk.git", rev = "891f6554354ce466abd496366dbf8b4f82141241" } zombienet-sdk = { git = "https://github.com/paritytech/zombienet-sdk.git", rev = "891f6554354ce466abd496366dbf8b4f82141241" }
+37 -21
View File
@@ -12,9 +12,13 @@ use dashmap::DashMap;
use revive_dt_common::types::VersionOrRequirement; use revive_dt_common::types::VersionOrRequirement;
use revive_dt_config::{ResolcConfiguration, SolcConfiguration, WorkingDirectoryConfiguration}; use revive_dt_config::{ResolcConfiguration, SolcConfiguration, WorkingDirectoryConfiguration};
use revive_solc_json_interface::{ use revive_solc_json_interface::{
SolcStandardJsonInput, SolcStandardJsonInputLanguage, SolcStandardJsonInputSettings, PolkaVMDefaultHeapMemorySize, PolkaVMDefaultStackMemorySize, SolcStandardJsonInput,
SolcStandardJsonInputSettingsOptimizer, SolcStandardJsonInputSettingsSelection, SolcStandardJsonInputLanguage, SolcStandardJsonInputSettings,
SolcStandardJsonOutput, SolcStandardJsonInputSettingsLibraries, SolcStandardJsonInputSettingsMetadata,
SolcStandardJsonInputSettingsOptimizer, SolcStandardJsonInputSettingsPolkaVM,
SolcStandardJsonInputSettingsPolkaVMMemory, SolcStandardJsonInputSettingsSelection,
SolcStandardJsonOutput, standard_json::input::settings::optimizer::Optimizer,
standard_json::input::settings::optimizer::details::Details,
}; };
use tracing::{Span, field::display}; use tracing::{Span, field::display};
@@ -25,6 +29,7 @@ use crate::{
use alloy::json_abi::JsonAbi; use alloy::json_abi::JsonAbi;
use anyhow::{Context as _, Result}; use anyhow::{Context as _, Result};
use semver::Version; use semver::Version;
use std::collections::BTreeSet;
use tokio::{io::AsyncWriteExt, process::Command as AsyncCommand}; use tokio::{io::AsyncWriteExt, process::Command as AsyncCommand};
/// A wrapper around the `resolc` binary, emitting PVM-compatible bytecode. /// A wrapper around the `resolc` binary, emitting PVM-compatible bytecode.
@@ -67,6 +72,16 @@ impl Resolc {
}) })
.clone()) .clone())
} }
fn polkavm_settings() -> SolcStandardJsonInputSettingsPolkaVM {
SolcStandardJsonInputSettingsPolkaVM::new(
Some(SolcStandardJsonInputSettingsPolkaVMMemory::new(
Some(PolkaVMDefaultHeapMemorySize),
Some(PolkaVMDefaultStackMemorySize),
)),
false,
)
}
} }
impl SolidityCompiler for Resolc { impl SolidityCompiler for Resolc {
@@ -121,8 +136,8 @@ impl SolidityCompiler for Resolc {
.collect(), .collect(),
settings: SolcStandardJsonInputSettings { settings: SolcStandardJsonInputSettings {
evm_version, evm_version,
libraries: Some( libraries: SolcStandardJsonInputSettingsLibraries {
libraries inner: libraries
.into_iter() .into_iter()
.map(|(source_code, libraries_map)| { .map(|(source_code, libraries_map)| {
( (
@@ -136,20 +151,20 @@ impl SolidityCompiler for Resolc {
) )
}) })
.collect(), .collect(),
), },
remappings: None, remappings: BTreeSet::<String>::new(),
output_selection: Some(SolcStandardJsonInputSettingsSelection::new_required()), output_selection: SolcStandardJsonInputSettingsSelection::new_required(),
via_ir: Some(true), via_ir: Some(true),
optimizer: SolcStandardJsonInputSettingsOptimizer::new( optimizer: SolcStandardJsonInputSettingsOptimizer::new(
optimization optimization
.unwrap_or(ModeOptimizerSetting::M0) .unwrap_or(ModeOptimizerSetting::M0)
.optimizations_enabled(), .optimizations_enabled(),
None, Optimizer::default_mode(),
&Version::new(0, 0, 0), Details::disabled(&Version::new(0, 0, 0)),
false,
), ),
metadata: None, polkavm: Self::polkavm_settings(),
polkavm: None, metadata: SolcStandardJsonInputSettingsMetadata::default(),
detect_missing_libraries: false,
}, },
}; };
Span::current().record("json_in", display(serde_json::to_string(&input).unwrap())); Span::current().record("json_in", display(serde_json::to_string(&input).unwrap()));
@@ -228,7 +243,7 @@ impl SolidityCompiler for Resolc {
// Detecting if the compiler output contained errors and reporting them through logs and // Detecting if the compiler output contained errors and reporting them through logs and
// errors instead of returning the compiler output that might contain errors. // errors instead of returning the compiler output that might contain errors.
for error in parsed.errors.iter().flatten() { for error in parsed.errors.iter() {
if error.severity == "error" { if error.severity == "error" {
tracing::error!( tracing::error!(
?error, ?error,
@@ -240,12 +255,12 @@ impl SolidityCompiler for Resolc {
} }
} }
let Some(contracts) = parsed.contracts else { if parsed.contracts.is_empty() {
anyhow::bail!("Unexpected error - resolc output doesn't have a contracts section"); anyhow::bail!("Unexpected error - resolc output doesn't have a contracts section");
}; }
let mut compiler_output = CompilerOutput::default(); let mut compiler_output = CompilerOutput::default();
for (source_path, contracts) in contracts.into_iter() { for (source_path, contracts) in parsed.contracts.into_iter() {
let src_for_msg = source_path.clone(); let src_for_msg = source_path.clone();
let source_path = PathBuf::from(source_path) let source_path = PathBuf::from(source_path)
.canonicalize() .canonicalize()
@@ -258,10 +273,11 @@ impl SolidityCompiler for Resolc {
.and_then(|evm| evm.bytecode.clone()) .and_then(|evm| evm.bytecode.clone())
.context("Unexpected - Contract compiled with resolc has no bytecode")?; .context("Unexpected - Contract compiled with resolc has no bytecode")?;
let abi = { let abi = {
let metadata = contract_information let metadata = &contract_information.metadata;
.metadata if metadata.is_null() {
.as_ref() anyhow::bail!("No metadata found for the contract");
.context("No metadata found for the contract")?; }
let solc_metadata_str = match metadata { let solc_metadata_str = match metadata {
serde_json::Value::String(solc_metadata_str) => { serde_json::Value::String(solc_metadata_str) => {
solc_metadata_str.as_str() solc_metadata_str.as_str()