Skip to content

Commit b802f1a

Browse files
committed
chore: More cleanups
1 parent 60450fd commit b802f1a

File tree

16 files changed

+127
-159
lines changed

16 files changed

+127
-159
lines changed

Diff for: Cargo.lock

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

Diff for: Cargo.toml

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ version = "0.1.0"
77
authors = ["clabby"]
88

99
[workspace.dependencies]
10-
# types
10+
# ETH types
1111
alloy-primitives = "0.7.7"
1212

13+
# kona
14+
kona-preimage = { git = "https://github.com/ethereum-optimism/kona" }
15+
kona-common = { git = "https://github.com/ethereum-optimism/kona" }
16+
1317
# ser
1418
serde = { version = "1.0.204", features = ["derive"] }
1519
serde_json = "1.0.120"
@@ -19,6 +23,7 @@ tokio = { version = "1.38.0", features = ["full"] }
1923

2024
# misc
2125
anyhow = "1.0.86"
26+
tracing = "0.1.40"
2227

2328
[profile.release]
2429
opt-level = 3

Diff for: crates/cannon/Cargo.toml

+4-8
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,18 @@ anyhow.workspace = true
1313
serde.workspace = true
1414
serde_json.workspace = true
1515
tokio.workspace = true
16+
kona-preimage.workspace = true
17+
kona-common.workspace = true
18+
tracing.workspace = true
1619

1720
# local
1821
cannon-fpvm = { path = "../fpvm" }
1922

20-
# misc
21-
kona-preimage = { git = "https://github.com/ethereum-optimism/kona" }
22-
kona-common = { git = "https://github.com/ethereum-optimism/kona" }
23-
23+
# misc external
2424
tempfile = "3.10"
2525
async-trait = "0.1.81"
2626
flate2 = "1.0.28"
2727
command-fds = "0.2.3"
28-
tracing = { version = "0.1.40", optional = true }
2928

3029
[dev-dependencies]
3130
proptest = "1.4.0"
32-
33-
[features]
34-
tracing = ["dep:tracing"]

Diff for: crates/cannon/src/kernel.rs

+9-13
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ use crate::{gz::compress_bytes, types::Proof};
44
use anyhow::{anyhow, Result};
55
use cannon_fpvm::{state_hash, InstrumentedState};
66
use kona_preimage::{HintRouter, PreimageFetcher};
7+
use std::time::Instant;
78
use std::{
89
fs::File,
910
io::{BufWriter, Write},
1011
process::Child,
1112
};
1213
use tokio::{runtime::Runtime, task::JoinHandle};
1314

14-
#[cfg(feature = "tracing")]
15-
use std::time::Instant;
16-
1715
/// The [Kernel] struct contains the configuration for a Cannon kernel as well as
1816
/// the [PreimageOracle] and [InstrumentedState] instances that form it.
1917
#[allow(dead_code)]
@@ -93,7 +91,6 @@ where
9391
let proof_fmt = self.proof_format.unwrap_or("%d.json.gz".to_string());
9492
let snapshot_fmt = self.snapshot_format.unwrap_or("%d.json.gz".to_string());
9593

96-
#[cfg(feature = "tracing")]
9794
let (info_at, start_step, start) = (
9895
create_matcher(self.info_at.as_ref())?,
9996
self.ins_state.state.step,
@@ -105,10 +102,9 @@ where
105102
while !self.ins_state.state.exited {
106103
let step = self.ins_state.state.step;
107104

108-
#[cfg(feature = "tracing")]
109105
if info_at.matches(step) {
110106
let delta = start.elapsed();
111-
crate::traces::info!(
107+
tracing::info!(
112108
target: "cannon::kernel",
113109
"[ELAPSED: {}.{:03}s] step: {}, pc: {}, instruction: {:08x}, ips: {}, pages: {}, mem: {}",
114110
delta.as_secs(),
@@ -123,26 +119,26 @@ where
123119
}
124120

125121
if stop_at.matches(step) {
126-
crate::traces::info!(target: "cannon::kernel", "Stopping at step {}", step);
122+
tracing::info!(target: "cannon::kernel", "Stopping at step {}", step);
127123
break;
128124
}
129125

130126
if snapshot_at.matches(step) {
131-
crate::traces::info!(target: "cannon::kernel", "Writing snapshot at step {}", step);
127+
tracing::info!(target: "cannon::kernel", "Writing snapshot at step {}", step);
132128
let ser_state = serde_json::to_vec(&self.ins_state.state).unwrap();
133129
let snap_path = snapshot_fmt.replace("%d", &format!("{}", step));
134130
io_tasks.push(tokio::task::spawn(async move {
135131
let gz_state = compress_bytes(&ser_state)?;
136132
let mut writer = BufWriter::new(File::create(snap_path)?);
137133
writer.write_all(&gz_state)?;
138-
crate::traces::info!(target: "cannon::kernel", "Wrote snapshot at step {} successfully.", step);
134+
tracing::info!(target: "cannon::kernel", "Wrote snapshot at step {} successfully.", step);
139135

140136
Ok(())
141137
}));
142138
}
143139

144140
if proof_at.matches(step) {
145-
crate::traces::info!(target: "cannon::kernel", "Writing proof at step {}", step);
141+
tracing::info!(target: "cannon::kernel", "Writing proof at step {}", step);
146142

147143
let prestate_hash = state_hash(self.ins_state.state.encode_witness()?);
148144
let step_witness = self
@@ -173,7 +169,7 @@ where
173169
let mut writer = BufWriter::new(File::create(proof_path)?);
174170
writer.write_all(ser_proof.as_bytes())?;
175171

176-
crate::traces::info!(target: "cannon::kernel", "Wrote proof at step {} successfully.", step);
172+
tracing::info!(target: "cannon::kernel", "Wrote proof at step {} successfully.", step);
177173

178174
Ok(())
179175
}));
@@ -203,7 +199,7 @@ where
203199
// Output the final state
204200
if let Some(output) = &self.output {
205201
if !output.is_empty() {
206-
crate::traces::info!(target: "cannon::kernel", "Writing final state to {}", output);
202+
tracing::info!(target: "cannon::kernel", "Writing final state to {}", output);
207203
let mut writer = BufWriter::new(File::create(output)?);
208204

209205
let ser_state = &serde_json::to_vec(&self.ins_state.state)?;
@@ -215,7 +211,7 @@ where
215211
println!("{:?}", &self.ins_state.state);
216212
}
217213

218-
crate::traces::info!(target: "cannon::kernel", "Kernel exiting...");
214+
tracing::info!(target: "cannon::kernel", "Kernel exiting...");
219215

220216
// Wait for all of the i/o tasks to finish.
221217
for task in io_tasks {

Diff for: crates/cannon/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,3 @@ mod types;
1616
pub use types::Proof;
1717

1818
mod utils;
19-
20-
mod traces;

Diff for: crates/cannon/src/proc_oracle.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl ProcessPreimageOracle {
3737
) -> Result<(Self, Option<Child>)> {
3838
let cmd_str = cmd.display().to_string();
3939
let child = (!cmd_str.is_empty()).then(|| {
40-
crate::info!(
40+
tracing::info!(
4141
"Starting preimage server process: {} {:?}",
4242
cmd.display(),
4343
args
@@ -54,7 +54,7 @@ impl ProcessPreimageOracle {
5454
pipe_files.hint_write.as_raw_fd()
5555
];
5656

57-
crate::traces::info!(target: "cannon::preimage::server", "Starting preimage server process: {:?} with fds {:?}", args, fds);
57+
tracing::info!(target: "cannon::preimage::server", "Starting preimage server process: {:?} with fds {:?}", args, fds);
5858

5959
command
6060
.args(args)

Diff for: crates/cannon/src/traces.rs

-51
This file was deleted.

Diff for: crates/fpvm/Cargo.toml

+5-6
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ serde.workspace = true
1313
serde_json.workspace = true
1414
anyhow.workspace = true
1515
tokio.workspace = true
16+
kona-preimage.workspace = true
17+
kona-common.workspace = true
18+
tracing.workspace = true
1619

1720
# external
18-
kona-preimage = { git = "https://github.com/ethereum-optimism/kona" }
1921
async-trait = "0.1.81"
2022
alloy-sol-types = "0.7.7"
2123
once_cell = "1.19.0"
@@ -26,22 +28,19 @@ rustc-hash = "2.0.0"
2628
xkcp-rs = { git = "https://github.com/DaniPopes/xkcp-rs", rev = "40447a5" }
2729
keccak256-aarch64-simd = { git = "https://github.com/clabby/keccak256-aarch64", rev = "5c4c8f8", optional = true }
2830

29-
# tracing
30-
tracing = { version = "0.1.40", optional = true }
31-
3231
# evm
3332
revm = { version = "12.1.0", optional = true }
3433

3534
[dev-dependencies]
3635
rand = "0.8.5"
37-
criterion = { version = "0.5.1", features = ["html_reports"] }
36+
criterion = { version = "0.5.1", features = ["html_reports", "async_tokio"] }
3837
pprof = { version = "0.13.0", features = ["criterion", "flamegraph", "frame-pointer"] }
3938
proptest = "1.4.0"
4039

4140
[features]
42-
tracing = ["dep:tracing"]
4341
evm = ["dep:revm"]
4442
simd-keccak = ["dep:keccak256-aarch64-simd"]
43+
test-utils = []
4544

4645
[[bench]]
4746
name = "memory"

0 commit comments

Comments
 (0)