Skip to content
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

script refactoring #7247

Merged
merged 34 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6179036
[wip] script refactoring
klkvr Feb 27, 2024
ab2001b
execution refactor
klkvr Feb 28, 2024
43c7bc4
refactor simulation
klkvr Feb 29, 2024
fc3a391
wip
klkvr Feb 29, 2024
6024743
wip
klkvr Feb 29, 2024
a584d48
address #7244
klkvr Feb 29, 2024
3723eb7
wip: enum for multi/single sequences
klkvr Feb 29, 2024
a6cf296
refactor execution + resume
klkvr Mar 1, 2024
908b0c5
wip: refactor verification
klkvr Mar 1, 2024
580234a
wip: cleaning up
klkvr Mar 1, 2024
8f00328
naming
klkvr Mar 2, 2024
18a1ace
wip: clean up
klkvr Mar 2, 2024
e1fe09c
cleanup ScriptSequence
klkvr Mar 3, 2024
8c50ce5
fmt
klkvr Mar 4, 2024
993e6d3
better rpc tracking
klkvr Mar 4, 2024
8d6e4f2
fix rpc logic + extract states to separate file
klkvr Mar 4, 2024
2b8a311
fmt
klkvr Mar 4, 2024
df7fecc
some docs
klkvr Mar 4, 2024
43458c9
remove --multi flag mentions
klkvr Mar 4, 2024
304bdf5
docs
klkvr Mar 4, 2024
1f449ec
checkpoint saves for multichain sequences
klkvr Mar 4, 2024
4f2d6d4
docs + broadcasted renamed into dry_run
klkvr Mar 5, 2024
89d6e73
fmt
klkvr Mar 5, 2024
0fd0c42
Update crates/forge/bin/cmd/script/resume.rs
klkvr Mar 5, 2024
1ccf3ab
fmt
klkvr Mar 5, 2024
8e21bba
review fixes
klkvr Mar 6, 2024
be812de
fmt
klkvr Mar 6, 2024
d430da9
wip: start extracting to separate crate
klkvr Mar 6, 2024
300a181
Use CoreBuildArgs + skip
klkvr Mar 6, 2024
120433c
fmt
klkvr Mar 6, 2024
ee2c832
review fixes
klkvr Mar 7, 2024
532e9c8
review fixes
klkvr Mar 7, 2024
6468545
conflicts
klkvr Mar 7, 2024
5bd705d
remove redundant methods
klkvr Mar 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ forge = { path = "crates/forge" }
forge-doc = { path = "crates/doc" }
forge-fmt = { path = "crates/fmt" }
forge-verify = { path = "crates/verify" }
forge-script = { path = "crates/script" }
mattsse marked this conversation as resolved.
Show resolved Hide resolved
foundry-cheatcodes = { path = "crates/cheatcodes" }
foundry-cheatcodes-spec = { path = "crates/cheatcodes/spec" }
foundry-cli = { path = "crates/cli" }
Expand Down
17 changes: 0 additions & 17 deletions crates/common/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,6 @@ unsafe fn count_different_bytes(a: &[u8], b: &[u8]) -> usize {
sum
}

/// Flattens the contracts into (`id` -> (`JsonAbi`, `Vec<u8>`)) pairs
pub fn flatten_contracts(
contracts: &BTreeMap<ArtifactId, ContractBytecodeSome>,
deployed_code: bool,
) -> ContractsByArtifact {
ContractsByArtifact(
contracts
.iter()
.filter_map(|(id, c)| {
let bytecode =
if deployed_code { c.deployed_bytecode.bytes() } else { c.bytecode.bytes() };
bytecode.cloned().map(|code| (id.clone(), (c.abi.clone(), code.into())))
})
.collect(),
)
}

/// Artifact/Contract identifier can take the following form:
/// `<artifact file name>:<contract name>`, the `artifact file name` is the name of the json file of
/// the contract's artifact and the contract name is the name of the solidity contract, like
Expand Down
24 changes: 20 additions & 4 deletions crates/forge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ name = "forge"
path = "bin/main.rs"

[build-dependencies]
vergen = { workspace = true, default-features = false, features = ["build", "git", "gitcl"] }
vergen = { workspace = true, default-features = false, features = [
"build",
"git",
"gitcl",
] }

[dependencies]
# lib
Expand Down Expand Up @@ -47,6 +51,7 @@ yansi = "0.5"
forge-doc.workspace = true
forge-fmt.workspace = true
forge-verify.workspace = true
forge-script.workspace = true
foundry-cli.workspace = true
foundry-debugger.workspace = true

Expand Down Expand Up @@ -94,14 +99,25 @@ globset = "0.4"
paste = "1.0"
path-slash = "0.2"
pretty_assertions.workspace = true
svm = { package = "svm-rs", version = "0.3", default-features = false, features = ["rustls"] }
svm = { package = "svm-rs", version = "0.3", default-features = false, features = [
"rustls",
] }
tempfile = "3"
tracing-subscriber = { workspace = true, features = ["env-filter", "fmt"] }

[features]
default = ["rustls"]
rustls = ["foundry-cli/rustls", "foundry-wallets/rustls", "reqwest/rustls-tls", "reqwest/rustls-tls-native-roots"]
openssl = ["foundry-cli/openssl", "reqwest/default-tls", "foundry-wallets/openssl"]
rustls = [
"foundry-cli/rustls",
"foundry-wallets/rustls",
"reqwest/rustls-tls",
"reqwest/rustls-tls-native-roots",
]
openssl = [
"foundry-cli/openssl",
"reqwest/default-tls",
"foundry-wallets/openssl",
]
asm-keccak = ["alloy-primitives/asm-keccak"]

[[bench]]
Expand Down
4 changes: 2 additions & 2 deletions crates/forge/bin/cmd/debug.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{build::BuildArgs, script::ScriptArgs};
use clap::{Parser, ValueHint};
use forge_script::ScriptArgs;
use forge_verify::retry::RETRY_VERIFY_ON_CREATE;
use foundry_cli::opts::CoreBuildArgs;
use foundry_common::evm::EvmArgs;
Expand Down Expand Up @@ -48,7 +48,7 @@ impl DebugArgs {
target_contract: self.target_contract,
sig: self.sig,
gas_estimate_multiplier: 130,
opts: BuildArgs { args: self.opts, ..Default::default() },
opts: self.opts,
evm_opts: self.evm_opts,
debug: true,
retry: RETRY_VERIFY_ON_CREATE,
Expand Down
5 changes: 0 additions & 5 deletions crates/forge/bin/cmd/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,6 @@ impl InitArgs {
}
}

/// Returns the commit hash of the project if it exists
pub fn get_commit_hash(root: &Path) -> Option<String> {
Git::new(root).commit_hash(true, "HEAD").ok()
}

/// Initialises `root` as a git repository, if it isn't one already.
///
/// Creates `.gitignore` and `.github/workflows/test.yml`, if they don't exist already.
Expand Down
1 change: 0 additions & 1 deletion crates/forge/bin/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ pub mod inspect;
pub mod install;
pub mod remappings;
pub mod remove;
pub mod script;
pub mod selectors;
pub mod snapshot;
pub mod test;
Expand Down
Loading
Loading