-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(forge): Solidity Scripting #1208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
139 commits
Select commit
Hold shift + click to select a range
a055744
forge install: ds-test
brockelmore fda729d
basic scripting
brockelmore 0db6be0
remove dirty file
brockelmore 3bb489d
Merge branch 'master' into brock/scripting
brockelmore 19a2a38
updates
brockelmore 22bfc12
fixes
brockelmore ba514e5
remove excess comments
brockelmore 51f5aa6
updates
brockelmore 74d4857
fmt
brockelmore 29fd71e
Merge remote-tracking branch 'origin/master' into brock/scripting
brockelmore 299e401
diff score move
brockelmore 1bc36f9
working transaction sending MVP
brockelmore 6b7389e
Merge remote-tracking branch 'origin/master' into brock/scripting
brockelmore e6a611d
fixes
brockelmore c6836fa
remove accidental short rename
brockelmore 6723ba9
Merge branch 'master' into brock/scripting
brockelmore 8689595
updates
brockelmore 3264d6b
write tx receipts to file
brockelmore 4dd5261
Merge branch 'master' into brock/scripting
gakonst d04dbc0
panic if nonce changes unexpectedly while sending txes
joshieDo 2f1b27c
add ScriptSequence
joshieDo c3e077c
add transaction receipts to ScriptSequence
joshieDo ed833d8
add resume
joshieDo 04cdf9f
add forgetest for script
joshieDo 9a8a1d4
fix nonce tracking on broadcastable txes
joshieDo a5e24f4
do not send transactions if simulation failed
joshieDo e5f8288
add test with and without library
joshieDo 3998d34
replace link for link_with_nonce(1)
joshieDo b673577
make valid fork url a requirement
joshieDo ab83f12
fix nonce tracking & helper contract callers
joshieDo bb97a9f
refactor to a script testbuilder
joshieDo ebb26a3
remove old comment
joshieDo f6fb3d2
cleanup
joshieDo 36da1f4
change localhost to 127.0.0.1
joshieDo da693a8
ScriptTester takes ownership of cmd
joshieDo 484251d
move ScriptTester to its own module
joshieDo 893e7a8
use Paint instead of ansi
joshieDo 634a799
add missing Chain import
joshieDo 4422553
turn scripttester fn into async
joshieDo 55fdf89
add anvil to tests :fire: :hammer:
joshieDo 9103d92
better help description
joshieDo 5c55fcb
make sure anvil spawns on different ports
joshieDo 39c4583
link testdata to scripttester
joshieDo 5ec1a69
enforce evm.sender as the predeploys deployer
joshieDo c0a4f86
handle call_inner nonces + test
joshieDo d0f121f
remove ganache references
joshieDo dac87e0
Revert "enforce evm.sender as the predeploys deployer"
joshieDo 1fd7a9b
add --deployer to script
joshieDo ef6bb79
better error messages
joshieDo 0a07594
add better description to resume command
joshieDo 40ad4c9
cover case without a deployer set
joshieDo 2cc05f2
split forge script into modules
joshieDo 28e4e55
Merge remote-tracking branch 'origin/master' into brock/scripting
joshieDo af3ec8f
add missing arguments from merge
joshieDo 44fdd26
remove unneeded .gitmodules
joshieDo c1b555d
refactor script/runner
joshieDo ce44e6a
refactor script/executor
joshieDo d675774
some more script refactor
joshieDo 334f2da
add forgetest_async! macro
joshieDo ed00d69
refactor cli/wallet
joshieDo 51f48c6
Merge remote-tracking branch 'origin/master' into brock/scripting
joshieDo 04c632c
refactor: forge run calls forge script
joshieDo 4fdc963
rename forge run to forge debug
joshieDo e21a062
add etherscan identifier to script
joshieDo 0c0d2d7
move some functions to its proper modules
joshieDo 6c81d0c
turn panic into bail
joshieDo 75e5391
smol nits :shipit:
joshieDo d0ca036
simplify needs_setup
joshieDo 75eac82
use ethers set_chain_id
joshieDo 2b31cad
impl drop for scriptsequence
joshieDo e4edde4
Merge remote-tracking branch 'origin/master' into brock/scripting
joshieDo fa46f78
remove --force-resume
joshieDo d462919
fix broadcast without args
joshieDo 9288308
remove --deployer use --sender instead
joshieDo 3578e9e
fix gas for committed transactions
joshieDo 13eaa98
add missing arg on test_executor
joshieDo 837df25
fmt
joshieDo 7cbddab
add support for preexisting CREATE2
joshieDo b40d164
remove unnecessary println
joshieDo 3da69fe
Merge branch 'master' into brock/scripting
gakonst 99af23d
chore: use RuntimeOrHandle from ethers
gakonst 955b4eb
broadcast & receipt refactor for concurrent broadcasts
joshieDo 1ea8442
replace sender if only a single private key has been passed
joshieDo 95736b4
better logs
joshieDo 0e95d81
adapt resume test to new changes
joshieDo 8dea1fa
change scriptsequence saving behaviour
joshieDo 98b0daa
pass contract name, path or both to script/debug
joshieDo 1549dc2
Merge remote-tracking branch 'origin/master' into brock/scripting
joshieDo 110c098
add can_deploy_100_txes_concurrently test
joshieDo 49478df
add support for linking existing library addresses on script
joshieDo df30d13
only link external addresses if there is a RPC set
joshieDo 5e4d83e
increase gas estimation to 1.3
joshieDo 4eb4b90
remove unused forge run file
joshieDo 181f6e9
set --sender as msg.sender with nonce correction instead
joshieDo fdb5441
change broadcast log to filename-ts.json
joshieDo b525bd1
make broadcast log folder configurable
joshieDo f518031
improve documentation of correct_sender_nonce
joshieDo a3d06a8
add missing broadcast field on forgetest
joshieDo 814b306
fix broadcast wrap
joshieDo 90da469
Merge remote-tracking branch 'origin/master' into brock/scripting
joshieDo 1b3489f
group logs by chain_id
joshieDo 6bbfba0
only show return data if it's not empty
joshieDo 3ea0bd6
change accounts on ScriptTester to Address
joshieDo ca8c593
add default and async to debug.rs
joshieDo fe023e8
add all() to MultiWallet
joshieDo f5a13bb
convert some bails into map_err
joshieDo 627b5fa
wrap_err on link()
joshieDo 559131e
remove rt from debug and script
joshieDo 0070f5a
docs
joshieDo 7776d28
Merge remote-tracking branch 'origin/master' into brock/scripting
joshieDo deba4e5
clippy
joshieDo 7c0a4b1
use SourceFile coming from artifact
joshieDo 7271026
when sending, only clone tx as it iterates
joshieDo ed29f12
add ScriptOutcome
joshieDo 74c57e6
save tx with correct tx type on scriptsequence
joshieDo 7a08027
set DEFAULT_SENDER as H160
joshieDo 8b48159
dont replace tx.caller on broadcast end
joshieDo 93ff980
add create2 deployer to TestRunner as well
joshieDo 90abb33
fix expected output on script tests
joshieDo 25fd5c7
fix up receipts when resuming
joshieDo 7ef8df7
store and try to recover from pending transaction hashes on scriptseq…
joshieDo 8b51055
Merge remote-tracking branch 'origin/master' into brock/scripting
joshieDo 67bd90f
correct nonce after setUp if necessary
joshieDo ff83055
check status of the transaction receipt
joshieDo 4bf5abb
add fix and test for deployment with setUp
joshieDo 928558b
add slow flag to enforce sequential broadcasting
joshieDo 2762ce7
change docs for cheatcodes
joshieDo a3f530f
Merge remote-tracking branch 'origin/master' into brock/scripting
joshieDo ae5e640
chore: add missing trait import
gakonst 14d84cc
Merge remote-tracking branch 'origin/master' into brock/scripting
joshieDo 059a5b8
decode Create2Deployer on traces by default
joshieDo 8ff4359
revert if it it finds a staticcall after vm.broadcast
joshieDo ad8bb44
Merge remote-tracking branch 'origin/master' into brock/scripting
joshieDo 8384d8f
refactor signer discovery
joshieDo b7071ba
update test
joshieDo 0913d29
show missing warning
joshieDo f2317c8
Merge branch 'master' into brock/scripting
gakonst 8bed3a4
Merge branch 'master' into brock/scripting
gakonst 12921e2
chore: bump ethers
gakonst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
use super::{build::BuildArgs, script::ScriptArgs, watch::WatchArgs}; | ||
use crate::{cmd::forge::build::CoreBuildArgs, opts::MultiWallet}; | ||
use clap::{Parser, ValueHint}; | ||
use foundry_common::evm::EvmArgs; | ||
use std::path::PathBuf; | ||
|
||
// Loads project's figment and merges the build cli arguments into it | ||
foundry_config::impl_figment_convert!(DebugArgs, opts, evm_opts); | ||
|
||
#[derive(Debug, Clone, Parser)] | ||
pub struct DebugArgs { | ||
/// The contract you want to run. Either the file path or contract name. | ||
/// | ||
/// If multiple contracts exist in the same file you must specify the target contract with | ||
/// --target-contract. | ||
#[clap(value_hint = ValueHint::FilePath, value_name = "PATH")] | ||
pub path: PathBuf, | ||
|
||
/// Arguments to pass to the script function. | ||
#[clap(value_name = "ARGS")] | ||
pub args: Vec<String>, | ||
|
||
/// The name of the contract you want to run. | ||
#[clap(long, alias = "tc", value_name = "CONTRACT_NAME")] | ||
pub target_contract: Option<String>, | ||
|
||
/// The signature of the function you want to call in the contract, or raw calldata. | ||
#[clap(long, short, default_value = "run()", value_name = "SIGNATURE")] | ||
pub sig: String, | ||
|
||
/// Open the script in the debugger. | ||
#[clap(long)] | ||
pub debug: bool, | ||
|
||
#[clap(flatten, next_help_heading = "BUILD OPTIONS")] | ||
pub opts: CoreBuildArgs, | ||
|
||
#[clap(flatten, next_help_heading = "EVM OPTIONS")] | ||
pub evm_opts: EvmArgs, | ||
} | ||
|
||
impl DebugArgs { | ||
pub async fn debug(self) -> eyre::Result<()> { | ||
let script = ScriptArgs { | ||
path: self.path.to_str().expect("Invalid path string.").to_string(), | ||
args: self.args, | ||
target_contract: self.target_contract, | ||
sig: self.sig, | ||
legacy: false, | ||
broadcast: false, | ||
opts: BuildArgs { | ||
args: self.opts, | ||
names: false, | ||
sizes: false, | ||
watch: WatchArgs::default(), | ||
}, | ||
wallets: MultiWallet::default(), | ||
evm_opts: self.evm_opts, | ||
resume: false, | ||
debug: true, | ||
slow: false, | ||
}; | ||
script.run_script().await | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i cannot comment on teh file, but the
.gitmodules
above is probably unneeded