Skip to content

Commit e66aa7b

Browse files
committed
refactor(coverage): refactor coverage analysis
1 parent f479e94 commit e66aa7b

File tree

17 files changed

+396
-329
lines changed

17 files changed

+396
-329
lines changed

Cargo.lock

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,17 @@ scrypt.opt-level = 3
8282
[profile.local]
8383
inherits = "dev"
8484
opt-level = 1
85+
debug-assertions = false
8586
strip = "debuginfo"
8687
panic = "abort"
8788
codegen-units = 16
8889

8990
# Like release, but with full debug symbols and with stack unwinds. Useful for e.g. `perf`.
9091
[profile.debug-fast]
91-
inherits = "release"
92+
inherits = "local"
9293
debug = true
9394
strip = "none"
9495
panic = "unwind"
95-
incremental = false
9696

9797
# Optimized release profile.
9898
[profile.release]
@@ -216,6 +216,7 @@ num-format = "0.4.4"
216216
yansi = { version = "1.0", features = ["detect-tty", "detect-env"] }
217217
tempfile = "3.10"
218218
tokio = "1"
219+
rayon = "1"
219220

220221
axum = "0.7"
221222
hyper = "1.0"

crates/anvil/Cargo.toml

+17-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ path = "src/anvil.rs"
1616
required-features = ["cli"]
1717

1818
[build-dependencies]
19-
vergen = { workspace = true, default-features = false, features = ["build", "git", "gitcl"] }
19+
vergen = { workspace = true, default-features = false, features = [
20+
"build",
21+
"git",
22+
"gitcl",
23+
] }
2024

2125
[dependencies]
2226
# foundry internal
@@ -31,7 +35,12 @@ foundry-evm.workspace = true
3135
# evm support
3236
bytes = "1.4.0"
3337
k256.workspace = true
34-
revm = { workspace = true, features = ["std", "serde", "memory_limit", "c-kzg"] }
38+
revm = { workspace = true, features = [
39+
"std",
40+
"serde",
41+
"memory_limit",
42+
"c-kzg",
43+
] }
3544
alloy-primitives = { workspace = true, features = ["serde"] }
3645
alloy-consensus = { workspace = true, features = ["k256", "kzg"] }
3746
alloy-contract = { workspace = true, features = ["pubsub"] }
@@ -78,7 +87,11 @@ rand = "0.8"
7887
eyre.workspace = true
7988

8089
# cli
81-
clap = { version = "4", features = ["derive", "env", "wrap_help"], optional = true }
90+
clap = { version = "4", features = [
91+
"derive",
92+
"env",
93+
"wrap_help",
94+
], optional = true }
8295
clap_complete = { version = "4", optional = true }
8396
chrono.workspace = true
8497
auto_impl = "1"
@@ -101,7 +114,7 @@ similar-asserts.workspace = true
101114
tokio = { workspace = true, features = ["full"] }
102115

103116
[features]
104-
default = ["cli"]
117+
default = ["cli", "jemalloc"]
105118
cmd = ["clap", "clap_complete", "ctrlc", "anvil-server/clap"]
106119
cli = ["tokio/full", "cmd", "fdlimit"]
107120
asm-keccak = ["alloy-primitives/asm-keccak"]

crates/cast/Cargo.toml

+7-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ name = "cast"
1515
path = "bin/main.rs"
1616

1717
[build-dependencies]
18-
vergen = { workspace = true, default-features = false, features = ["build", "git", "gitcl"] }
18+
vergen = { workspace = true, default-features = false, features = [
19+
"build",
20+
"git",
21+
"gitcl",
22+
] }
1923

2024
[dependencies]
2125
# lib
@@ -48,7 +52,7 @@ eyre.workspace = true
4852
futures = "0.3"
4953
hex.workspace = true
5054
rand.workspace = true
51-
rayon = "1"
55+
rayon.workspace = true
5256
serde_json.workspace = true
5357
serde.workspace = true
5458

@@ -83,7 +87,7 @@ async-trait = "0.1"
8387
criterion = "0.5"
8488

8589
[features]
86-
default = ["rustls"]
90+
default = ["rustls", "jemalloc"]
8791
rustls = ["foundry-cli/rustls", "foundry-wallets/rustls"]
8892
openssl = ["foundry-cli/openssl"]
8993
asm-keccak = ["alloy-primitives/asm-keccak"]

crates/chisel/Cargo.toml

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
[package]
22
name = "chisel"
3-
authors = ["clabby <https://github.com/clabby>", "asnared <https://github.com/abigger87>"]
3+
authors = [
4+
"clabby <https://github.com/clabby>",
5+
"asnared <https://github.com/abigger87>",
6+
]
47
description = "Fast, utilitarian, and verbose Solidity REPL"
58

69
version.workspace = true
@@ -15,7 +18,11 @@ name = "chisel"
1518
path = "bin/main.rs"
1619

1720
[build-dependencies]
18-
vergen = { workspace = true, default-features = false, features = ["build", "git", "gitcl"] }
21+
vergen = { workspace = true, default-features = false, features = [
22+
"build",
23+
"git",
24+
"gitcl",
25+
] }
1926

2027
[dependencies]
2128
# forge
@@ -28,7 +35,12 @@ foundry-config.workspace = true
2835
foundry-evm.workspace = true
2936

3037
alloy-dyn-abi = { workspace = true, features = ["arbitrary"] }
31-
alloy-primitives = { workspace = true, features = ["serde", "getrandom", "arbitrary", "rlp"] }
38+
alloy-primitives = { workspace = true, features = [
39+
"serde",
40+
"getrandom",
41+
"arbitrary",
42+
"rlp",
43+
] }
3244
alloy-json-abi.workspace = true
3345
alloy-rpc-types.workspace = true
3446

@@ -59,7 +71,7 @@ serial_test = "3"
5971
tracing-subscriber.workspace = true
6072

6173
[features]
62-
default = ["rustls"]
74+
default = ["rustls", "jemalloc"]
6375
rustls = ["reqwest/rustls-tls", "reqwest/rustls-tls-native-roots"]
6476
openssl = ["foundry-compilers/openssl", "reqwest/default-tls"]
6577
asm-keccak = ["alloy-primitives/asm-keccak"]

crates/doc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ eyre.workspace = true
2424
itertools.workspace = true
2525
mdbook = { version = "0.4", default-features = false, features = ["search"] }
2626
once_cell = "1"
27-
rayon = "1"
27+
rayon.workspace = true
2828
serde_json.workspace = true
2929
serde.workspace = true
3030
solang-parser.workspace = true

crates/evm/core/src/decode.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ use alloy_sol_types::{SolCall, SolError, SolEventInterface, SolInterface, SolVal
88
use foundry_common::SELECTOR_LEN;
99
use itertools::Itertools;
1010
use revm::interpreter::InstructionResult;
11-
use std::{collections::HashMap, sync::OnceLock};
11+
use rustc_hash::FxHashMap;
12+
use std::sync::OnceLock;
1213

1314
/// Decode a set of logs, only returning logs from DSTest logging events and Hardhat's `console.log`
1415
pub fn decode_console_logs(logs: &[Log]) -> Vec<String> {
@@ -27,7 +28,7 @@ pub fn decode_console_log(log: &Log) -> Option<String> {
2728
#[derive(Clone, Debug, Default)]
2829
pub struct RevertDecoder {
2930
/// The custom errors to use for decoding.
30-
pub errors: HashMap<Selector, Vec<Error>>,
31+
pub errors: FxHashMap<Selector, Vec<Error>>,
3132
}
3233

3334
impl Default for &RevertDecoder {

crates/evm/core/src/ic.rs

+20
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ impl PcIcMap {
1414
Self { inner: make_map::<true>(code) }
1515
}
1616

17+
/// Returns the length of the map.
18+
pub fn len(&self) -> usize {
19+
self.inner.len()
20+
}
21+
22+
/// Returns `true` if the map is empty.
23+
pub fn is_empty(&self) -> bool {
24+
self.inner.is_empty()
25+
}
26+
1727
/// Returns the instruction counter for the given program counter.
1828
pub fn get(&self, pc: usize) -> Option<usize> {
1929
self.inner.get(&pc).copied()
@@ -33,6 +43,16 @@ impl IcPcMap {
3343
Self { inner: make_map::<false>(code) }
3444
}
3545

46+
/// Returns the length of the map.
47+
pub fn len(&self) -> usize {
48+
self.inner.len()
49+
}
50+
51+
/// Returns `true` if the map is empty.
52+
pub fn is_empty(&self) -> bool {
53+
self.inner.is_empty()
54+
}
55+
3656
/// Returns the program counter for the given instruction counter.
3757
pub fn get(&self, ic: usize) -> Option<usize> {
3858
self.inner.get(&ic).copied()

crates/evm/coverage/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ revm.workspace = true
2121
semver = "1"
2222
tracing = "0.1"
2323
rustc-hash.workspace = true
24+
rayon.workspace = true

0 commit comments

Comments
 (0)