From cb13c3c2cdf4cef231af0f913184a1ec446027bf Mon Sep 17 00:00:00 2001 From: Omar Abdulla Date: Mon, 21 Jul 2025 20:10:28 +0300 Subject: [PATCH] Wire up address replacement with rest of code --- crates/core/src/driver/mod.rs | 29 ++++++++++++----------------- crates/core/src/main.rs | 2 +- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/crates/core/src/driver/mod.rs b/crates/core/src/driver/mod.rs index c0626ce..47666fd 100644 --- a/crates/core/src/driver/mod.rs +++ b/crates/core/src/driver/mod.rs @@ -365,23 +365,7 @@ where let _guard = span.enter(); // Resolving the `input.expected` into a series of expectations that we can then assert on. - let expectations = match input { - // This is a bit of a special case and we have to support it separately on it's own. If - // it's a call to the deployer method, then the tests will assert that it "returns" the - // address of the contract. Deployments do not return the address of the contract but - // the runtime code of the contracts. Therefore, this assertion would always fail. So, - // we replace it with an assertion of "check if it succeeded" - Input { - expected: Some(Expected::Calldata(Calldata::Compound(compound))), - method: Method::Deployer, - .. - } if compound.len() == 1 - && compound - .first() - .is_some_and(|first| first.contains(".address")) => - { - vec![ExpectedOutput::new().with_success()] - } + let mut expectations = match input { Input { expected: Some(Expected::Calldata(calldata)), .. @@ -397,6 +381,17 @@ where Input { expected: None, .. } => vec![ExpectedOutput::new().with_success()], }; + // This is a bit of a special case and we have to support it separately on it's own. If it's + // a call to the deployer method, then the tests will assert that it "returns" the address + // of the contract. Deployments do not return the address of the contract but the runtime + // code of the contracts. Therefore, this assertion would always fail. So, we replace it + // with an assertion of "check if it succeeded" + if let Method::Deployer = &input.method { + for expectation in expectations.iter_mut() { + expectation.return_data = None; + } + } + // Note: we need to do assertions and checks on the output of the last call and this isn't // available in the receipt. The only way to get this information is through tracing on the // node. diff --git a/crates/core/src/main.rs b/crates/core/src/main.rs index 2670149..e64ea64 100644 --- a/crates/core/src/main.rs +++ b/crates/core/src/main.rs @@ -59,7 +59,7 @@ fn main() -> anyhow::Result<()> { ); } - for (corpus, tests) in collect_corpora(&args)? { + for (corpus, tests) in corpora { let span = Span::new(corpus, args.clone())?; match &args.compile_only {