Skip to content

Commit

Permalink
fix: do not require --sender with --unlocked (#7742)
Browse files Browse the repository at this point in the history
* fix: do not require --sender with --unlocked

* test
  • Loading branch information
klkvr authored Apr 20, 2024
1 parent 30f145f commit 6f2668f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
33 changes: 33 additions & 0 deletions crates/forge/tests/cli/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1288,3 +1288,36 @@ contract SimpleScript is Script {
let output = cmd.stdout_lossy();
assert!(output.contains("ONCHAIN EXECUTION COMPLETE & SUCCESSFUL"));
});

// https://github.com/foundry-rs/foundry/pull/7742
forgetest_async!(unlocked_no_sender, |prj, cmd| {
foundry_test_utils::util::initialize(prj.root());
prj.add_script(
"Foo",
r#"
import "forge-std/Script.sol";
contract SimpleScript is Script {
function run() external {
vm.startBroadcast(0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266);
address(0).call("");
}
}
"#,
)
.unwrap();

let (_api, handle) = spawn(NodeConfig::test()).await;

cmd.args([
"script",
"SimpleScript",
"--fork-url",
&handle.http_endpoint(),
"--broadcast",
"--unlocked",
]);

let output = cmd.stdout_lossy();
assert!(output.contains("ONCHAIN EXECUTION COMPLETE & SUCCESSFUL"));
});
1 change: 0 additions & 1 deletion crates/script/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ pub struct ScriptArgs {
/// Send via `eth_sendTransaction` using the `--from` argument or `$ETH_FROM` as sender
#[arg(
long,
requires = "sender",
conflicts_with_all = &["private_key", "private_keys", "froms", "ledger", "trezor", "aws"],
)]
pub unlocked: bool,
Expand Down

0 comments on commit 6f2668f

Please sign in to comment.