Compare commits

...

1 Commits

Author SHA1 Message Date
Omar Abdulla 9676fca3fe Support compiler-version aware exceptions 2025-07-25 17:06:14 +03:00
2 changed files with 25 additions and 7 deletions
+4
View File
@@ -10,6 +10,10 @@ use crate::{CompilerInput, CompilerOutput, SolidityCompiler};
use revive_dt_config::Arguments; use revive_dt_config::Arguments;
use revive_solc_json_interface::SolcStandardJsonOutput; use revive_solc_json_interface::SolcStandardJsonOutput;
// TODO: I believe that we need to also pass the solc compiler to resolc so that resolc uses the
// specified solc compiler. I believe that currently we completely ignore the specified solc binary
// when invoking resolc which doesn't seem right if we're using solc as a compiler frontend.
/// A wrapper around the `resolc` binary, emitting PVM-compatible bytecode. /// A wrapper around the `resolc` binary, emitting PVM-compatible bytecode.
#[derive(Debug)] #[derive(Debug)]
pub struct Resolc { pub struct Resolc {
+21 -7
View File
@@ -200,12 +200,13 @@ where
case_idx: CaseIdx, case_idx: CaseIdx,
input: &Input, input: &Input,
node: &T::Blockchain, node: &T::Blockchain,
mode: &SolcMode,
) -> anyhow::Result<(TransactionReceipt, GethTrace, DiffMode)> { ) -> anyhow::Result<(TransactionReceipt, GethTrace, DiffMode)> {
let deployment_receipts = let deployment_receipts =
self.handle_contract_deployment(metadata, case_idx, input, node)?; self.handle_contract_deployment(metadata, case_idx, input, node)?;
let execution_receipt = let execution_receipt =
self.handle_input_execution(case_idx, input, deployment_receipts, node)?; self.handle_input_execution(case_idx, input, deployment_receipts, node)?;
self.handle_input_expectations(case_idx, input, &execution_receipt, node)?; self.handle_input_expectations(case_idx, input, &execution_receipt, node, mode)?;
self.handle_input_diff(case_idx, execution_receipt, node) self.handle_input_diff(case_idx, execution_receipt, node)
} }
@@ -312,6 +313,7 @@ where
input: &Input, input: &Input,
execution_receipt: &TransactionReceipt, execution_receipt: &TransactionReceipt,
node: &T::Blockchain, node: &T::Blockchain,
mode: &SolcMode,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
let span = tracing::info_span!("Handling input expectations"); let span = tracing::info_span!("Handling input expectations");
let _guard = span.enter(); let _guard = span.enter();
@@ -367,6 +369,7 @@ where
node, node,
expectation, expectation,
&tracing_result, &tracing_result,
mode,
)?; )?;
} }
@@ -380,11 +383,16 @@ where
node: &T::Blockchain, node: &T::Blockchain,
expectation: &ExpectedOutput, expectation: &ExpectedOutput,
tracing_result: &CallFrame, tracing_result: &CallFrame,
mode: &SolcMode,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
// TODO: We want to respect the compiler version filter on the expected output but would if let Some(ref version_requirement) = expectation.compiler_version {
// require some changes to the interfaces of the compiler and such. So, we add it later. let Some(compiler_version) = mode.last_patch_version(&self.config.solc) else {
// Additionally, what happens if the compiler filter doesn't match? Do we consider that the anyhow::bail!("unsupported solc version: {:?}", &mode.solc_version);
// transaction should succeed? Do we just ignore the expectation? };
if !version_requirement.matches(&compiler_version) {
return Ok(());
}
}
let deployed_contracts = self.deployed_contracts(case_idx); let deployed_contracts = self.deployed_contracts(case_idx);
let chain_state_provider = node; let chain_state_provider = node;
@@ -865,8 +873,13 @@ where
tracing::info_span!("Executing input", contract_name = ?input.instance) tracing::info_span!("Executing input", contract_name = ?input.instance)
.in_scope(|| { .in_scope(|| {
let (leader_receipt, _, leader_diff) = match leader_state let (leader_receipt, _, leader_diff) = match leader_state
.handle_input(self.metadata, case_idx, &input, self.leader_node) .handle_input(
{ self.metadata,
case_idx,
&input,
self.leader_node,
&mode,
) {
Ok(result) => result, Ok(result) => result,
Err(error) => { Err(error) => {
tracing::error!( tracing::error!(
@@ -895,6 +908,7 @@ where
case_idx, case_idx,
&input, &input,
self.follower_node, self.follower_node,
&mode,
) { ) {
Ok(result) => result, Ok(result) => result,
Err(error) => { Err(error) => {