From 649f6029a41c30f0f5372f3440d5bb8e3cc5df97 Mon Sep 17 00:00:00 2001 From: clabby Date: Mon, 13 Jan 2025 19:29:43 -0500 Subject: [PATCH] lint --- Cargo.lock | 2 -- crates/proof-sdk/proof-interop/Cargo.toml | 4 ---- crates/proof-sdk/proof-interop/src/boot.rs | 5 ++--- crates/proof-sdk/proof-interop/src/hint.rs | 3 ++- .../proof-sdk/proof-interop/src/pre_state.rs | 21 ++++++++++++------- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9879061b..438c6f74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2355,7 +2355,6 @@ dependencies = [ "kona-mpt", "kona-preimage", "kona-proof", - "kona-proof-interop", "kona-std-fpvm", "kona-std-fpvm-proc", "lru", @@ -2570,7 +2569,6 @@ dependencies = [ "rand", "serde", "serde_json", - "tokio", "tracing", ] diff --git a/crates/proof-sdk/proof-interop/Cargo.toml b/crates/proof-sdk/proof-interop/Cargo.toml index 70abdd61..0820b9df 100644 --- a/crates/proof-sdk/proof-interop/Cargo.toml +++ b/crates/proof-sdk/proof-interop/Cargo.toml @@ -32,9 +32,6 @@ serde.workspace = true tracing.workspace = true serde_json.workspace = true -# `std` feature dependencies -tokio = { workspace = true, features = ["full"], optional = true } - # Arbitrary arbitrary = { version = "1.4", features = ["derive"], optional = true } @@ -45,5 +42,4 @@ arbitrary = { version = "1.4", features = ["derive"] } rand.workspace = true [features] -std = ["dep:tokio"] arbitrary = ["dep:arbitrary", "alloy-primitives/arbitrary", "kona-interop/arbitrary"] diff --git a/crates/proof-sdk/proof-interop/src/boot.rs b/crates/proof-sdk/proof-interop/src/boot.rs index eff0a35f..51d0349a 100644 --- a/crates/proof-sdk/proof-interop/src/boot.rs +++ b/crates/proof-sdk/proof-interop/src/boot.rs @@ -1,11 +1,11 @@ //! This module contains the prologue phase of the client program, pulling in the boot information //! through the `PreimageOracle` ABI as local keys. -use kona_proof::errors::OracleProviderError; use alloy_primitives::{B256, U256}; use kona_preimage::{PreimageKey, PreimageOracleClient}; -use op_alloy_genesis::RollupConfig; +use kona_proof::errors::OracleProviderError; use maili_registry::ROLLUP_CONFIGS; +use op_alloy_genesis::RollupConfig; use serde::{Deserialize, Serialize}; use tracing::warn; @@ -121,4 +121,3 @@ impl BootInfo { }) } } - diff --git a/crates/proof-sdk/proof-interop/src/hint.rs b/crates/proof-sdk/proof-interop/src/hint.rs index 840bab38..c1a1d43f 100644 --- a/crates/proof-sdk/proof-interop/src/hint.rs +++ b/crates/proof-sdk/proof-interop/src/hint.rs @@ -62,7 +62,8 @@ pub enum HintType { L2Code, /// A hint that specifies the preimage of the agreed upon pre-state claim. AgreedPreState, - /// A hint that specifies the preimage of an L2 output root within the agreed upon pre-state, by chain ID. + /// A hint that specifies the preimage of an L2 output root within the agreed upon pre-state, + /// by chain ID. L2OutputRoot, /// A hint that specifies the state node in the L2 state trie. L2StateNode, diff --git a/crates/proof-sdk/proof-interop/src/pre_state.rs b/crates/proof-sdk/proof-interop/src/pre_state.rs index 3dde2f2d..db173952 100644 --- a/crates/proof-sdk/proof-interop/src/pre_state.rs +++ b/crates/proof-sdk/proof-interop/src/pre_state.rs @@ -24,10 +24,10 @@ pub enum PreState { impl Encodable for PreState { fn encode(&self, out: &mut dyn alloy_rlp::BufMut) { match self { - PreState::SuperRoot(super_root) => { + Self::SuperRoot(super_root) => { super_root.encode(out); } - PreState::TransitionState(transition_state) => { + Self::TransitionState(transition_state) => { transition_state.encode(out); } } @@ -43,12 +43,12 @@ impl Decodable for PreState { match buf[0] { TRANSITION_STATE_VERSION => { let transition_state = TransitionState::decode(buf)?; - Ok(PreState::TransitionState(transition_state)) + Ok(Self::TransitionState(transition_state)) } SUPER_ROOT_VERSION => { let super_root = SuperRoot::decode(buf).map_err(|_| alloy_rlp::Error::UnexpectedString)?; - Ok(PreState::SuperRoot(super_root)) + Ok(Self::SuperRoot(super_root)) } _ => Err(alloy_rlp::Error::Custom("invalid version byte")), } @@ -70,7 +70,11 @@ pub struct TransitionState { impl TransitionState { /// Create a new [TransitionState] with the given pre-state, pending progress, and step number. - pub fn new(pre_state: SuperRoot, pending_progress: Vec, step: u64) -> Self { + pub const fn new( + pre_state: SuperRoot, + pending_progress: Vec, + step: u64, + ) -> Self { Self { pre_state, pending_progress, step } } @@ -138,8 +142,8 @@ pub struct OptimisticBlock { } impl OptimisticBlock { - /// Create a new [OutputRootWithBlockHash] with the given block hash and output root hash. - pub fn new(block_hash: B256, output_root: B256) -> Self { + /// Create a new [OptimisticBlock] with the given block hash and output root hash. + pub const fn new(block_hash: B256, output_root: B256) -> Self { Self { block_hash, output_root } } } @@ -177,7 +181,8 @@ mod test { fn test_arbitrary_pre_state_roundtrip() { let mut bytes = [0u8; 1024]; rand::thread_rng().fill(bytes.as_mut_slice()); - let pre_state = super::PreState::arbitrary(&mut arbitrary::Unstructured::new(&bytes)).unwrap(); + let pre_state = + super::PreState::arbitrary(&mut arbitrary::Unstructured::new(&bytes)).unwrap(); let mut rlp_buf = Vec::with_capacity(pre_state.length()); pre_state.encode(&mut rlp_buf);