From b9d01a97d18c01a1eb9f6f9c152eeb1a53a8bfb7 Mon Sep 17 00:00:00 2001 From: fborello-lambda Date: Tue, 3 Dec 2024 11:08:43 -0300 Subject: [PATCH 1/3] wip: testing no_panic --- Cargo.lock | 13 ++++ cmd/ethrex/Cargo.toml | 4 ++ crates/common/types/block.rs | 42 +++++++++++++ crates/l2/Cargo.toml | 2 +- crates/l2/proposer/errors.rs | 4 +- crates/l2/proposer/l1_committer.rs | 35 ++++++----- crates/l2/proposer/prover_server.rs | 63 +++++++++++++------ crates/l2/proposer/state_diff.rs | 4 ++ crates/l2/prover/Cargo.toml | 1 + crates/l2/prover/src/prover_client.rs | 21 +++---- .../l2/prover/zkvm/interface/guest/Cargo.toml | 4 +- 11 files changed, 145 insertions(+), 48 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cfeba49f0..8057517d3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2146,6 +2146,7 @@ dependencies = [ "hex", "jsonwebtoken", "keccak-hash 0.10.0", + "no-panic", "rand 0.8.5", "reqwest", "risc0-zkvm", @@ -2218,6 +2219,7 @@ dependencies = [ "ethrex-storage", "ethrex-vm", "hex", + "no-panic", "risc0-zkvm", "serde", "serde_json", @@ -3841,6 +3843,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "no-panic" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13039f2e914d0c1b8674a6a63681cfb857c41f029920db505f850c36dee22df8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] + [[package]] name = "nom" version = "7.1.3" diff --git a/cmd/ethrex/Cargo.toml b/cmd/ethrex/Cargo.toml index 27303b318..df605378b 100644 --- a/cmd/ethrex/Cargo.toml +++ b/cmd/ethrex/Cargo.toml @@ -46,3 +46,7 @@ libmdbx = ["dep:libmdbx", "ethrex-storage/libmdbx"] redb = ["dep:redb", "ethrex-storage/redb"] l2 = ["ethrex-vm/l2"] levm = ["ethrex-vm/levm", "ethrex-blockchain/levm"] + +[profile.release] +lto = "fat" +codegen-units = 1 diff --git a/crates/common/types/block.rs b/crates/common/types/block.rs index d1b3f0fdb..90bab35d9 100644 --- a/crates/common/types/block.rs +++ b/crates/common/types/block.rs @@ -362,6 +362,48 @@ pub fn fake_exponential(factor: u64, numerator: u64, denominator: u64) -> u64 { output / denominator } +#[derive(Debug, thiserror::Error)] +pub enum FakeExponentialError { + #[error("Denominator cannot be zero.")] + DenominatorIsZero, + #[error("Checked div failed is None.")] + CheckedDiv, + #[error("Checked mul failed is None.")] + CheckedMul, +} + +pub fn fake_exponential_checked( + factor: u64, + numerator: u64, + denominator: u64, +) -> Result { + let mut i = 1_u64; + let mut output = 0_u64; + let mut numerator_accum = factor * denominator; + if denominator == 0 { + return Err(FakeExponentialError::DenominatorIsZero); + } + + while numerator_accum > 0 { + output = output.saturating_add(numerator_accum); + + let denominator_i = denominator + .checked_mul(i) + .ok_or(FakeExponentialError::CheckedMul)?; + + if denominator_i == 0 { + return Err(FakeExponentialError::DenominatorIsZero); + } + + numerator_accum = numerator_accum * numerator / denominator_i; + i += 1; + } + + output + .checked_div(denominator) + .ok_or(FakeExponentialError::CheckedDiv) +} + // Calculates the base fee for the current block based on its gas_limit and parent's gas and fee // Returns None if the block gas limit is not valid in relation to its parent's gas limit pub fn calculate_base_fee_per_gas( diff --git a/crates/l2/Cargo.toml b/crates/l2/Cargo.toml index f69ea8ae4..9f7a7ff31 100644 --- a/crates/l2/Cargo.toml +++ b/crates/l2/Cargo.toml @@ -27,8 +27,8 @@ secp256k1.workspace = true keccak-hash = "0.10.0" envy = "0.4.2" thiserror.workspace = true +no-panic = "0.1" zkvm_interface = { path = "./prover/zkvm/interface/", default-features = false } - # risc0 risc0-zkvm = { version = "1.1.2" } diff --git a/crates/l2/proposer/errors.rs b/crates/l2/proposer/errors.rs index 707d4fa37..7f6361f49 100644 --- a/crates/l2/proposer/errors.rs +++ b/crates/l2/proposer/errors.rs @@ -3,7 +3,7 @@ use std::sync::mpsc::SendError; use crate::utils::merkle_tree::MerkleError; use crate::utils::{config::errors::ConfigError, eth_client::errors::EthClientError}; use ethereum_types::FromStrRadixErr; -use ethrex_core::types::BlobsBundleError; +use ethrex_core::types::{BlobsBundleError, FakeExponentialError}; use ethrex_dev::utils::engine_client::errors::EngineClientError; use ethrex_storage::error::StoreError; use ethrex_vm::EvmError; @@ -115,6 +115,8 @@ pub enum BlobEstimationError { CalculationError, #[error("Blob gas estimation resulted in an infinite or undefined value. Outside valid or expected ranges")] NonFiniteResult, + #[error("{0}")] + FakeExponentialError(#[from] FakeExponentialError), } #[derive(Debug, thiserror::Error)] diff --git a/crates/l2/proposer/l1_committer.rs b/crates/l2/proposer/l1_committer.rs index 36ef35fb3..bd4f72bfe 100644 --- a/crates/l2/proposer/l1_committer.rs +++ b/crates/l2/proposer/l1_committer.rs @@ -12,7 +12,7 @@ use crate::{ use bytes::Bytes; use ethrex_core::{ types::{ - blobs_bundle, fake_exponential, BlobsBundle, Block, PrivilegedL2Transaction, + blobs_bundle, fake_exponential_checked, BlobsBundle, Block, PrivilegedL2Transaction, PrivilegedTxType, Transaction, TxKind, BLOB_BASE_FEE_UPDATE_FRACTION, MIN_BASE_FEE_PER_BLOB_GAS, }, @@ -28,6 +28,8 @@ use tracing::{error, info}; use super::errors::BlobEstimationError; +use no_panic::no_panic; + const COMMIT_FUNCTION_SELECTOR: [u8; 4] = [132, 97, 12, 179]; pub struct Committer { @@ -159,7 +161,8 @@ impl Committer { } } - pub fn get_block_withdrawals( + //#[no_panic] + fn get_block_withdrawals( &self, block: &Block, ) -> Result, CommitterError> { @@ -180,7 +183,8 @@ impl Committer { Ok(withdrawals) } - pub fn get_withdrawals_merkle_root( + //#[no_panic] + fn get_withdrawals_merkle_root( &self, withdrawals_hashes: Vec, ) -> Result { @@ -191,7 +195,8 @@ impl Committer { } } - pub fn get_block_deposits(&self, block: &Block) -> Vec { + //#[no_panic] + fn get_block_deposits(&self, block: &Block) -> Vec { let deposits = block .body .transactions @@ -209,7 +214,8 @@ impl Committer { deposits } - pub fn get_deposit_hash(&self, deposit_hashes: Vec) -> Result { + //#[no_panic] + fn get_deposit_hash(&self, deposit_hashes: Vec) -> Result { if !deposit_hashes.is_empty() { let deposit_hashes_len: u16 = deposit_hashes .len() @@ -237,14 +243,15 @@ impl Committer { } } /// Prepare the state diff for the block. - pub fn prepare_state_diff( + //#[no_panic] + fn prepare_state_diff( &self, block: &Block, store: Store, withdrawals: Vec<(H256, PrivilegedL2Transaction)>, deposits: Vec, ) -> Result { - info!("Preparing state diff for block {}", block.header.number); + //info!("Preparing state diff for block {}", block.header.number); let mut state = evm_state(store.clone(), block.header.parent_hash); execute_block(block, &mut state).map_err(CommitterError::from)?; @@ -314,10 +321,8 @@ impl Committer { } /// Generate the blob bundle necessary for the EIP-4844 transaction. - pub fn generate_blobs_bundle( - &self, - state_diff: &StateDiff, - ) -> Result { + //#[no_panic] + fn generate_blobs_bundle(&self, state_diff: &StateDiff) -> Result { let blob_data = state_diff.encode().map_err(CommitterError::from)?; let blob = blobs_bundle::blob_from_bytes(blob_data).map_err(CommitterError::from)?; @@ -325,7 +330,7 @@ impl Committer { BlobsBundle::create_from_blobs(&vec![blob]).map_err(CommitterError::from) } - pub async fn send_commitment( + async fn send_commitment( &self, block_number: u64, withdrawal_logs_merkle_root: H256, @@ -438,11 +443,13 @@ async fn estimate_blob_gas( }; // If the blob's market is in high demand, the equation may give a really big number. - let blob_gas = fake_exponential( + // This function doesn't panic, it performs checked/saturating operations. + let blob_gas = fake_exponential_checked( MIN_BASE_FEE_PER_BLOB_GAS, total_blob_gas, BLOB_BASE_FEE_UPDATE_FRACTION, - ); + ) + .map_err(BlobEstimationError::FakeExponentialError)?; let gas_with_headroom = (blob_gas * (100 + headroom)) / 100; diff --git a/crates/l2/proposer/prover_server.rs b/crates/l2/proposer/prover_server.rs index ac2d6e1e0..ed30d4745 100644 --- a/crates/l2/proposer/prover_server.rs +++ b/crates/l2/proposer/prover_server.rs @@ -16,7 +16,7 @@ use keccak_hash::keccak; use secp256k1::SecretKey; use serde::{Deserialize, Serialize}; use std::{ - io::{BufReader, BufWriter}, + io::{BufReader, BufWriter, Write}, net::{IpAddr, Shutdown, TcpListener, TcpStream}, sync::mpsc::{self, Receiver}, thread, @@ -28,6 +28,8 @@ use tokio::{ }; use tracing::{debug, error, info, warn}; +use no_panic::no_panic; + use risc0_zkvm::sha::{Digest, Digestible}; #[derive(Debug, Serialize, Deserialize, Default)] @@ -78,6 +80,34 @@ pub enum ProofData { SubmitAck { block_number: u64 }, } +impl ProofData { + /// Builder function for creating a Request + pub fn request() -> Self { + ProofData::Request + } + + /// Builder function for creating a Response + pub fn response(block_number: Option, input: Option) -> Self { + ProofData::Response { + block_number, + input, + } + } + + /// Builder function for creating a Submit + pub fn submit(block_number: u64, receipt: (risc0_zkvm::Receipt, Vec)) -> Self { + ProofData::Submit { + block_number, + receipt: Box::new(receipt), + } + } + + /// Builder function for creating a SubmitAck + pub fn submit_ack(block_number: u64) -> Self { + ProofData::SubmitAck { block_number } + } +} + pub async fn start_prover_server(store: Store) -> Result<(), ConfigError> { let server_config = ProverServerConfig::from_env()?; let eth_config = EthConfig::from_env()?; @@ -219,10 +249,7 @@ impl ProverServer { let data: Result = serde_json::de::from_reader(buf_reader); match data { Ok(ProofData::Request) => { - if let Err(e) = self - .handle_request(&mut stream, last_verified_block + 1) - .await - { + if let Err(e) = self.handle_request(&stream, last_verified_block + 1).await { warn!("Failed to handle request: {e}"); } } @@ -252,7 +279,7 @@ impl ProverServer { async fn handle_request( &self, - stream: &mut TcpStream, + stream: &TcpStream, block_number: u64, ) -> Result<(), ProverServerError> { debug!("Request received"); @@ -263,18 +290,12 @@ impl ProverServer { .ok_or(ProverServerError::StorageDataIsNone)?; let response = if block_number > latest_block_number { - let response = ProofData::Response { - block_number: None, - input: None, - }; + let response = ProofData::response(None, None); warn!("Didn't send response"); response } else { let input = self.create_prover_input(block_number)?; - let response = ProofData::Response { - block_number: Some(block_number), - input: Some(input), - }; + let response = ProofData::response(Some(block_number), Some(input)); info!("Sent Response for block_number: {block_number}"); response }; @@ -284,6 +305,7 @@ impl ProverServer { .map_err(|e| ProverServerError::ConnectionError(e.into())) } + #[no_panic] fn handle_submit( &self, stream: &mut TcpStream, @@ -291,10 +313,14 @@ impl ProverServer { ) -> Result<(), ProverServerError> { debug!("Submit received for BlockNumber: {block_number}"); - let response = ProofData::SubmitAck { block_number }; - let writer = BufWriter::new(stream); - serde_json::to_writer(writer, &response) - .map_err(|e| ProverServerError::ConnectionError(e.into())) + let response = ProofData::submit_ack(block_number); + let json_string = serde_json::to_string(&response) + .map_err(|e| ProverServerError::Custom(format!("serde_json::to_string(): {e}")))?; + stream + .write_all(json_string.as_bytes()) + .map_err(ProverServerError::ConnectionError)?; + + Ok(()) } async fn handle_proof_submission( @@ -342,6 +368,7 @@ impl ProverServer { Ok(()) } + //#[no_panic] fn create_prover_input(&self, block_number: u64) -> Result { let header = self .store diff --git a/crates/l2/proposer/state_diff.rs b/crates/l2/proposer/state_diff.rs index 2433f57a1..6ea216461 100644 --- a/crates/l2/proposer/state_diff.rs +++ b/crates/l2/proposer/state_diff.rs @@ -5,6 +5,8 @@ use ethereum_types::{Address, H256, U256}; use super::errors::StateDiffError; +use no_panic::no_panic; + #[derive(Clone)] pub struct AccountStateDiff { pub new_balance: Option, @@ -82,6 +84,7 @@ impl From for u8 { } impl StateDiff { + //#[no_panic] pub fn encode(&self) -> Result { if self.version != 1 { return Err(StateDiffError::UnsupportedVersion(self.version)); @@ -127,6 +130,7 @@ impl StateDiff { } impl AccountStateDiff { + //#[no_panic] pub fn encode(&self) -> Result<(u8, Bytes), StateDiffError> { if self.bytecode.is_some() && self.bytecode_hash.is_some() { return Err(StateDiffError::BytecodeAndBytecodeHashSet); diff --git a/crates/l2/prover/Cargo.toml b/crates/l2/prover/Cargo.toml index eb6e18a8d..a878c0b86 100644 --- a/crates/l2/prover/Cargo.toml +++ b/crates/l2/prover/Cargo.toml @@ -13,6 +13,7 @@ tokio-util.workspace = true tracing-subscriber = { workspace = true, features = ["env-filter"] } tracing.workspace = true hex.workspace = true +no-panic = "0.1" # ethrex ethrex-core.workspace = true diff --git a/crates/l2/prover/src/prover_client.rs b/crates/l2/prover/src/prover_client.rs index be1e0c6e7..076ca470f 100644 --- a/crates/l2/prover/src/prover_client.rs +++ b/crates/l2/prover/src/prover_client.rs @@ -1,20 +1,19 @@ +use ethrex_l2::{ + proposer::prover_server::ProofData, utils::config::prover_client::ProverClientConfig, +}; use std::{ io::{BufReader, BufWriter}, net::TcpStream, time::Duration, }; - use tokio::time::sleep; use tracing::{debug, error, info, warn}; - use zkvm_interface::io::ProgramInput; -use ethrex_l2::{ - proposer::prover_server::ProofData, utils::config::prover_client::ProverClientConfig, -}; - use super::prover::Prover; +use no_panic::no_panic; + pub async fn start_proof_data_client(config: ProverClientConfig) { let proof_data_client = ProverClient::new(config); proof_data_client.start().await; @@ -59,9 +58,10 @@ impl ProverClient { } } + //#[no_panic] fn request_new_input(&self) -> Result<(u64, ProgramInput), String> { // Request the input with the correct block_number - let request = ProofData::Request; + let request = ProofData::request(); let response = connect_to_prover_server_wr(&self.prover_server_endpoint, &request) .map_err(|e| format!("Failed to get Response: {e}"))?; @@ -87,16 +87,14 @@ impl ProverClient { } } + //#[no_panic] fn submit_proof( &self, block_number: u64, receipt: risc0_zkvm::Receipt, prover_id: Vec, ) -> Result<(), String> { - let submit = ProofData::Submit { - block_number, - receipt: Box::new((receipt, prover_id)), - }; + let submit = ProofData::submit(block_number, (receipt, prover_id)); let submit_ack = connect_to_prover_server_wr(&self.prover_server_endpoint, &submit) .map_err(|e| format!("Failed to get SubmitAck: {e}"))?; @@ -110,6 +108,7 @@ impl ProverClient { } } +//#[no_panic] fn connect_to_prover_server_wr( addr: &str, write: &ProofData, diff --git a/crates/l2/prover/zkvm/interface/guest/Cargo.toml b/crates/l2/prover/zkvm/interface/guest/Cargo.toml index 86d1c2c8f..ec6ab5ef9 100644 --- a/crates/l2/prover/zkvm/interface/guest/Cargo.toml +++ b/crates/l2/prover/zkvm/interface/guest/Cargo.toml @@ -17,9 +17,7 @@ ethrex-vm = { path = "../../../../../vm", default-features = false, features = [ ethrex-blockchain = { path = "../../../../../blockchain", default-features = false } [build-dependencies] -## cc version ^1.1.31 breaks the compilation. -## https://github.com/rust-lang/cc-rs/compare/cc-v1.1.34...main -cc = "=1.1.31" +cc = "=1.2.2" [patch.crates-io] crypto-bigint = { git = "https://github.com/risc0/RustCrypto-crypto-bigint", tag = "v0.5.5-risczero.0" } From d43f6ff584fe6711f032b26906c8ee1df762f252 Mon Sep 17 00:00:00 2001 From: fborello-lambda Date: Tue, 3 Dec 2024 12:26:08 -0300 Subject: [PATCH 2/3] rm: no_panic macros --- Cargo.lock | 13 ------------- crates/l2/Cargo.toml | 1 - crates/l2/proposer/l1_committer.rs | 13 ++----------- crates/l2/proposer/prover_server.rs | 4 ---- crates/l2/proposer/state_diff.rs | 4 ---- crates/l2/prover/Cargo.toml | 1 - crates/l2/prover/src/prover_client.rs | 5 ----- 7 files changed, 2 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8057517d3..cfeba49f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2146,7 +2146,6 @@ dependencies = [ "hex", "jsonwebtoken", "keccak-hash 0.10.0", - "no-panic", "rand 0.8.5", "reqwest", "risc0-zkvm", @@ -2219,7 +2218,6 @@ dependencies = [ "ethrex-storage", "ethrex-vm", "hex", - "no-panic", "risc0-zkvm", "serde", "serde_json", @@ -3843,17 +3841,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "no-panic" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13039f2e914d0c1b8674a6a63681cfb857c41f029920db505f850c36dee22df8" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", -] - [[package]] name = "nom" version = "7.1.3" diff --git a/crates/l2/Cargo.toml b/crates/l2/Cargo.toml index 9f7a7ff31..af0ee4039 100644 --- a/crates/l2/Cargo.toml +++ b/crates/l2/Cargo.toml @@ -27,7 +27,6 @@ secp256k1.workspace = true keccak-hash = "0.10.0" envy = "0.4.2" thiserror.workspace = true -no-panic = "0.1" zkvm_interface = { path = "./prover/zkvm/interface/", default-features = false } # risc0 risc0-zkvm = { version = "1.1.2" } diff --git a/crates/l2/proposer/l1_committer.rs b/crates/l2/proposer/l1_committer.rs index bd4f72bfe..93e7a89ad 100644 --- a/crates/l2/proposer/l1_committer.rs +++ b/crates/l2/proposer/l1_committer.rs @@ -28,8 +28,6 @@ use tracing::{error, info}; use super::errors::BlobEstimationError; -use no_panic::no_panic; - const COMMIT_FUNCTION_SELECTOR: [u8; 4] = [132, 97, 12, 179]; pub struct Committer { @@ -161,7 +159,6 @@ impl Committer { } } - //#[no_panic] fn get_block_withdrawals( &self, block: &Block, @@ -183,7 +180,6 @@ impl Committer { Ok(withdrawals) } - //#[no_panic] fn get_withdrawals_merkle_root( &self, withdrawals_hashes: Vec, @@ -195,7 +191,6 @@ impl Committer { } } - //#[no_panic] fn get_block_deposits(&self, block: &Block) -> Vec { let deposits = block .body @@ -214,7 +209,6 @@ impl Committer { deposits } - //#[no_panic] fn get_deposit_hash(&self, deposit_hashes: Vec) -> Result { if !deposit_hashes.is_empty() { let deposit_hashes_len: u16 = deposit_hashes @@ -242,8 +236,7 @@ impl Committer { Ok(H256::zero()) } } - /// Prepare the state diff for the block. - //#[no_panic] + fn prepare_state_diff( &self, block: &Block, @@ -251,7 +244,7 @@ impl Committer { withdrawals: Vec<(H256, PrivilegedL2Transaction)>, deposits: Vec, ) -> Result { - //info!("Preparing state diff for block {}", block.header.number); + info!("Preparing state diff for block {}", block.header.number); let mut state = evm_state(store.clone(), block.header.parent_hash); execute_block(block, &mut state).map_err(CommitterError::from)?; @@ -320,8 +313,6 @@ impl Committer { Ok(state_diff) } - /// Generate the blob bundle necessary for the EIP-4844 transaction. - //#[no_panic] fn generate_blobs_bundle(&self, state_diff: &StateDiff) -> Result { let blob_data = state_diff.encode().map_err(CommitterError::from)?; diff --git a/crates/l2/proposer/prover_server.rs b/crates/l2/proposer/prover_server.rs index ed30d4745..1e1b3bd17 100644 --- a/crates/l2/proposer/prover_server.rs +++ b/crates/l2/proposer/prover_server.rs @@ -28,8 +28,6 @@ use tokio::{ }; use tracing::{debug, error, info, warn}; -use no_panic::no_panic; - use risc0_zkvm::sha::{Digest, Digestible}; #[derive(Debug, Serialize, Deserialize, Default)] @@ -305,7 +303,6 @@ impl ProverServer { .map_err(|e| ProverServerError::ConnectionError(e.into())) } - #[no_panic] fn handle_submit( &self, stream: &mut TcpStream, @@ -368,7 +365,6 @@ impl ProverServer { Ok(()) } - //#[no_panic] fn create_prover_input(&self, block_number: u64) -> Result { let header = self .store diff --git a/crates/l2/proposer/state_diff.rs b/crates/l2/proposer/state_diff.rs index 6ea216461..2433f57a1 100644 --- a/crates/l2/proposer/state_diff.rs +++ b/crates/l2/proposer/state_diff.rs @@ -5,8 +5,6 @@ use ethereum_types::{Address, H256, U256}; use super::errors::StateDiffError; -use no_panic::no_panic; - #[derive(Clone)] pub struct AccountStateDiff { pub new_balance: Option, @@ -84,7 +82,6 @@ impl From for u8 { } impl StateDiff { - //#[no_panic] pub fn encode(&self) -> Result { if self.version != 1 { return Err(StateDiffError::UnsupportedVersion(self.version)); @@ -130,7 +127,6 @@ impl StateDiff { } impl AccountStateDiff { - //#[no_panic] pub fn encode(&self) -> Result<(u8, Bytes), StateDiffError> { if self.bytecode.is_some() && self.bytecode_hash.is_some() { return Err(StateDiffError::BytecodeAndBytecodeHashSet); diff --git a/crates/l2/prover/Cargo.toml b/crates/l2/prover/Cargo.toml index a878c0b86..eb6e18a8d 100644 --- a/crates/l2/prover/Cargo.toml +++ b/crates/l2/prover/Cargo.toml @@ -13,7 +13,6 @@ tokio-util.workspace = true tracing-subscriber = { workspace = true, features = ["env-filter"] } tracing.workspace = true hex.workspace = true -no-panic = "0.1" # ethrex ethrex-core.workspace = true diff --git a/crates/l2/prover/src/prover_client.rs b/crates/l2/prover/src/prover_client.rs index 076ca470f..26e4c9af9 100644 --- a/crates/l2/prover/src/prover_client.rs +++ b/crates/l2/prover/src/prover_client.rs @@ -12,8 +12,6 @@ use zkvm_interface::io::ProgramInput; use super::prover::Prover; -use no_panic::no_panic; - pub async fn start_proof_data_client(config: ProverClientConfig) { let proof_data_client = ProverClient::new(config); proof_data_client.start().await; @@ -58,7 +56,6 @@ impl ProverClient { } } - //#[no_panic] fn request_new_input(&self) -> Result<(u64, ProgramInput), String> { // Request the input with the correct block_number let request = ProofData::request(); @@ -87,7 +84,6 @@ impl ProverClient { } } - //#[no_panic] fn submit_proof( &self, block_number: u64, @@ -108,7 +104,6 @@ impl ProverClient { } } -//#[no_panic] fn connect_to_prover_server_wr( addr: &str, write: &ProofData, From 56934423953d134a255bdbe5e859563fd5497b70 Mon Sep 17 00:00:00 2001 From: fborello-lambda Date: Tue, 3 Dec 2024 12:30:01 -0300 Subject: [PATCH 3/3] chore: rm optimizations --- cmd/ethrex/Cargo.toml | 4 ---- crates/l2/proposer/l1_committer.rs | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/ethrex/Cargo.toml b/cmd/ethrex/Cargo.toml index df605378b..27303b318 100644 --- a/cmd/ethrex/Cargo.toml +++ b/cmd/ethrex/Cargo.toml @@ -46,7 +46,3 @@ libmdbx = ["dep:libmdbx", "ethrex-storage/libmdbx"] redb = ["dep:redb", "ethrex-storage/redb"] l2 = ["ethrex-vm/l2"] levm = ["ethrex-vm/levm", "ethrex-blockchain/levm"] - -[profile.release] -lto = "fat" -codegen-units = 1 diff --git a/crates/l2/proposer/l1_committer.rs b/crates/l2/proposer/l1_committer.rs index 93e7a89ad..babff46ac 100644 --- a/crates/l2/proposer/l1_committer.rs +++ b/crates/l2/proposer/l1_committer.rs @@ -237,6 +237,7 @@ impl Committer { } } + /// Prepare the state diff for the block. fn prepare_state_diff( &self, block: &Block, @@ -313,6 +314,7 @@ impl Committer { Ok(state_diff) } + /// Generate the blob bundle necessary for the EIP-4844 transaction. fn generate_blobs_bundle(&self, state_diff: &StateDiff) -> Result { let blob_data = state_diff.encode().map_err(CommitterError::from)?;