Skip to content

Commit ffe5a81

Browse files
committed
refactor(tests): update bytecode mismatch test to use inline source code
1 parent b5eb751 commit ffe5a81

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

crates/forge/tests/cli/verify_bytecode.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,12 @@ fn test_verify_bytecode_with_ignore(
145145
}
146146
}
147147

148-
#[expect(clippy::too_many_arguments)]
148+
#[inline]
149149
fn test_verify_bytecode_mismatch(
150150
prj: TestProject,
151151
mut cmd: TestCommand,
152152
addr: &str,
153153
contract_name: &str,
154-
source_code: &str,
155154
config: Config,
156155
verifier: &str,
157156
verifier_url: &str,
@@ -172,6 +171,16 @@ fn test_verify_bytecode_mismatch(
172171
// Build once with correct source (creates cache)
173172
cmd.forge_fuse().arg("build").assert_success();
174173

174+
let source_code = r#"
175+
contract SystemConfig {
176+
uint256 public constant MODIFIED_VALUE = 999;
177+
178+
function someFunction() public pure returns (uint256) {
179+
return MODIFIED_VALUE;
180+
}
181+
}
182+
"#;
183+
175184
// Now replace with different incorrect source code
176185
prj.add_source(contract_name, source_code);
177186
let args = vec![
@@ -348,22 +357,11 @@ forgetest_async!(can_ignore_runtime, |prj, cmd| {
348357

349358
// Test that verification fails when source code doesn't match deployed bytecode
350359
forgetest_async!(can_verify_bytecode_fails_on_source_mismatch, |prj, cmd| {
351-
let modified_source = r#"
352-
contract SystemConfig {
353-
uint256 public constant MODIFIED_VALUE = 999;
354-
355-
function someFunction() public pure returns (uint256) {
356-
return MODIFIED_VALUE;
357-
}
358-
}
359-
"#;
360-
361360
test_verify_bytecode_mismatch(
362361
prj,
363362
cmd,
364363
"0xba2492e52F45651B60B8B38d4Ea5E2390C64Ffb1",
365364
"SystemConfig",
366-
modified_source,
367365
Config {
368366
evm_version: EvmVersion::London,
369367
optimizer_runs: Some(999999),

0 commit comments

Comments
 (0)