From c857a56b1bcc682e200946a9711ea30dbe675cd4 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Wed, 4 Dec 2024 17:39:22 -0300 Subject: [PATCH 01/37] add price estimate as submission fee mechanism --- batcher/aligned-sdk/src/core/constants.rs | 4 +- batcher/aligned-sdk/src/core/errors.rs | 22 +++-- batcher/aligned-sdk/src/core/types.rs | 27 +++++- batcher/aligned-sdk/src/sdk.rs | 107 ++++------------------ batcher/aligned/src/main.rs | 52 ++++++++--- 5 files changed, 102 insertions(+), 110 deletions(-) diff --git a/batcher/aligned-sdk/src/core/constants.rs b/batcher/aligned-sdk/src/core/constants.rs index d45189000..2190f6ae4 100644 --- a/batcher/aligned-sdk/src/core/constants.rs +++ b/batcher/aligned-sdk/src/core/constants.rs @@ -21,10 +21,10 @@ pub const PERCENTAGE_DIVIDER: u128 = 100; /// Number of proofs we a batch for estimation. /// This is the number of proofs in a batch of size n, where we set n = 32. /// i.e. the user pays for the entire batch and his proof is instantly submitted. -pub const MAX_FEE_BATCH_PROOF_NUMBER: usize = 32; +pub const INSTANT_MAX_FEE_PROOF_NUMBER: usize = 1; /// Estimated number of proofs for batch submission. /// This corresponds to the number of proofs to compute for a default max_fee. -pub const MAX_FEE_DEFAULT_PROOF_NUMBER: usize = 10; +pub const DEFAULT_MAX_FEE_PROOF_NUMBER: usize = 10; /// Ethereum calls retry constants pub const ETHEREUM_CALL_MIN_RETRY_DELAY: u64 = 500; // milliseconds diff --git a/batcher/aligned-sdk/src/core/errors.rs b/batcher/aligned-sdk/src/core/errors.rs index 8712009c6..52485a708 100644 --- a/batcher/aligned-sdk/src/core/errors.rs +++ b/batcher/aligned-sdk/src/core/errors.rs @@ -17,7 +17,7 @@ pub enum AlignedError { SubmitError(SubmitError), VerificationError(VerificationError), ChainIdError(ChainIdError), - MaxFeeEstimateError(MaxFeeEstimateError), + FeeEstimateError(FeeEstimateError), FileError(FileError), } @@ -39,9 +39,9 @@ impl From for AlignedError { } } -impl From for AlignedError { - fn from(e: MaxFeeEstimateError) -> Self { - AlignedError::MaxFeeEstimateError(e) +impl From for AlignedError { + fn from(e: FeeEstimateError) -> Self { + AlignedError::FeeEstimateError(e) } } @@ -57,7 +57,7 @@ impl fmt::Display for AlignedError { AlignedError::SubmitError(e) => write!(f, "Submit error: {}", e), AlignedError::VerificationError(e) => write!(f, "Verification error: {}", e), AlignedError::ChainIdError(e) => write!(f, "Chain ID error: {}", e), - AlignedError::MaxFeeEstimateError(e) => write!(f, "Max fee estimate error: {}", e), + AlignedError::FeeEstimateError(e) => write!(f, "Max fee estimate error: {}", e), AlignedError::FileError(e) => write!(f, "File error: {}", e), } } @@ -266,20 +266,24 @@ impl fmt::Display for ChainIdError { } #[derive(Debug)] -pub enum MaxFeeEstimateError { +pub enum FeeEstimateError { EthereumProviderError(String), EthereumGasPriceError(String), + PriceEstimateParseError(String), } -impl fmt::Display for MaxFeeEstimateError { +impl fmt::Display for FeeEstimateError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - MaxFeeEstimateError::EthereumProviderError(e) => { + FeeEstimateError::EthereumProviderError(e) => { write!(f, "Ethereum provider error: {}", e) } - MaxFeeEstimateError::EthereumGasPriceError(e) => { + FeeEstimateError::EthereumGasPriceError(e) => { write!(f, "Failed to retreive the current gas price: {}", e) } + FeeEstimateError::PriceEstimateParseError(e) => { + write!(f, "Error parsing PriceEstimate: {}", e) + } } } } diff --git a/batcher/aligned-sdk/src/core/types.rs b/batcher/aligned-sdk/src/core/types.rs index ab392df51..cc5a9867e 100644 --- a/batcher/aligned-sdk/src/core/types.rs +++ b/batcher/aligned-sdk/src/core/types.rs @@ -89,9 +89,34 @@ impl NoncedVerificationData { // Defines an estimate price preference for the user. #[derive(Debug, Serialize, Deserialize, Clone)] pub enum PriceEstimate { - Min, Default, Instant, + Custom(usize), +} + +impl TryFrom for PriceEstimate { + type Error = String; + + fn try_from(value: String) -> Result { + let val = match value.as_str() { + // TODO remove the InvalidMaxFee error... + "default" => Self::Default, + "instant" => Self::Instant, + s if s.starts_with("custom") => { + println!("{s}"); + let n = s.split_whitespace() + .nth(1) + .ok_or("Failed to Parse: `number_proofs_per_batch` not supplied")? + .parse() + .map_err(|_| "Failed to Parse: Value of `number_proofs_per_batch` invalid")?; + PriceEstimate::Custom(n) + }, + _ => + return Err("Invalid network, possible values are: \"default\", \"instant\", \"custom\"" + .to_string()), + }; + Ok(val) + } } #[derive(Debug, Serialize, Deserialize, Clone, Default)] diff --git a/batcher/aligned-sdk/src/sdk.rs b/batcher/aligned-sdk/src/sdk.rs index a9a0ad5a0..d6a13ee59 100644 --- a/batcher/aligned-sdk/src/sdk.rs +++ b/batcher/aligned-sdk/src/sdk.rs @@ -8,7 +8,7 @@ use crate::{ core::{ constants::{ ADDITIONAL_SUBMISSION_GAS_COST_PER_PROOF, CONSTANT_GAS_COST, - MAX_FEE_BATCH_PROOF_NUMBER, MAX_FEE_DEFAULT_PROOF_NUMBER, + DEFAULT_MAX_FEE_PROOF_NUMBER, INSTANT_MAX_FEE_PROOF_NUMBER, }, errors::{self, GetNonceError}, types::{ @@ -136,37 +136,17 @@ pub async fn submit_multiple_and_wait_verification( pub async fn estimate_fee( eth_rpc_url: &str, estimate: PriceEstimate, -) -> Result { +) -> Result { // Price of 1 proof in 32 proof batch - let fee_per_proof = fee_per_proof(eth_rpc_url, MAX_FEE_BATCH_PROOF_NUMBER).await?; - - let proof_price = match estimate { - PriceEstimate::Min => fee_per_proof, - PriceEstimate::Default => U256::from(MAX_FEE_DEFAULT_PROOF_NUMBER) * fee_per_proof, - PriceEstimate::Instant => U256::from(MAX_FEE_BATCH_PROOF_NUMBER) * fee_per_proof, - }; - Ok(proof_price) -} - -/// Returns the computed `max_fee` for a proof based on the number of proofs in a batch (`num_proofs_per_batch`) and -/// number of proofs (`num_proofs`) in that batch the user would pay for i.e (`num_proofs` / `num_proofs_per_batch`). -/// NOTE: The `max_fee` is computed from an rpc nodes max priority gas price. -/// # Arguments -/// * `eth_rpc_url` - The URL of the users Ethereum RPC node. -/// * `num_proofs` - number of proofs in a batch the user would pay for. -/// * `num_proofs_per_batch` - number of proofs within a batch. -/// # Returns -/// * The calculated `max_fee` as a `U256`. -/// # Errors -/// * `EthereumProviderError` if there is an error in the connection with the RPC provider. -/// * `EthereumGasPriceError` if there is an error retrieving the Ethereum gas price. -pub async fn compute_max_fee( - eth_rpc_url: &str, - num_proofs: usize, - num_proofs_per_batch: usize, -) -> Result { - let fee_per_proof = fee_per_proof(eth_rpc_url, num_proofs_per_batch).await?; - Ok(fee_per_proof * num_proofs) + match estimate { + PriceEstimate::Default => { + max_fee_per_proof_in_batch(eth_rpc_url, DEFAULT_MAX_FEE_PROOF_NUMBER).await + } + PriceEstimate::Instant => { + max_fee_per_proof_in_batch(eth_rpc_url, INSTANT_MAX_FEE_PROOF_NUMBER).await + } + PriceEstimate::Custom(n) => max_fee_per_proof_in_batch(eth_rpc_url, n).await, + } } /// Returns the `fee_per_proof` based on the current gas price for a batch compromised of `num_proofs_per_batch` @@ -180,22 +160,22 @@ pub async fn compute_max_fee( /// # Errors /// * `EthereumProviderError` if there is an error in the connection with the RPC provider. /// * `EthereumGasPriceError` if there is an error retrieving the Ethereum gas price. -pub async fn fee_per_proof( +pub async fn max_fee_per_proof_in_batch( eth_rpc_url: &str, - num_proofs_per_batch: usize, -) -> Result { + num_proofs_in_batch: usize, +) -> Result { let eth_rpc_provider = Provider::::try_from(eth_rpc_url).map_err(|e: url::ParseError| { - errors::MaxFeeEstimateError::EthereumProviderError(e.to_string()) + errors::FeeEstimateError::EthereumProviderError(e.to_string()) })?; let gas_price = fetch_gas_price(ð_rpc_provider).await?; // Cost for estimate `num_proofs_per_batch` proofs let estimated_gas_per_proof = (CONSTANT_GAS_COST - + ADDITIONAL_SUBMISSION_GAS_COST_PER_PROOF * num_proofs_per_batch as u128) - / num_proofs_per_batch as u128; + + ADDITIONAL_SUBMISSION_GAS_COST_PER_PROOF * num_proofs_in_batch as u128) + / num_proofs_in_batch as u128; - // Price of 1 proof in 32 proof batch + // Price of 1 / `num_proofs_in_batch` proof batch let fee_per_proof = U256::from(estimated_gas_per_proof) * gas_price; Ok(fee_per_proof) @@ -203,11 +183,11 @@ pub async fn fee_per_proof( async fn fetch_gas_price( eth_rpc_provider: &Provider, -) -> Result { +) -> Result { let gas_price = match eth_rpc_provider.get_gas_price().await { Ok(price) => price, Err(e) => { - return Err(errors::MaxFeeEstimateError::EthereumGasPriceError( + return Err(errors::FeeEstimateError::EthereumGasPriceError( e.to_string(), )) } @@ -823,50 +803,3 @@ fn save_response_json( Ok(()) } - -#[cfg(test)] -mod test { - //Public constants for convenience - pub const HOLESKY_PUBLIC_RPC_URL: &str = "https://ethereum-holesky-rpc.publicnode.com"; - use super::*; - - #[tokio::test] - async fn computed_max_fee_for_larger_batch_is_smaller() { - let small_fee = compute_max_fee(HOLESKY_PUBLIC_RPC_URL, 2, 10) - .await - .unwrap(); - let large_fee = compute_max_fee(HOLESKY_PUBLIC_RPC_URL, 5, 10) - .await - .unwrap(); - - assert!(small_fee < large_fee); - } - - #[tokio::test] - async fn computed_max_fee_for_more_proofs_larger_than_for_less_proofs() { - let small_fee = compute_max_fee(HOLESKY_PUBLIC_RPC_URL, 5, 20) - .await - .unwrap(); - let large_fee = compute_max_fee(HOLESKY_PUBLIC_RPC_URL, 5, 10) - .await - .unwrap(); - - assert!(small_fee < large_fee); - } - - #[tokio::test] - async fn estimate_fee_are_larger_than_one_another() { - let min_fee = estimate_fee(HOLESKY_PUBLIC_RPC_URL, PriceEstimate::Min) - .await - .unwrap(); - let default_fee = estimate_fee(HOLESKY_PUBLIC_RPC_URL, PriceEstimate::Default) - .await - .unwrap(); - let instant_fee = estimate_fee(HOLESKY_PUBLIC_RPC_URL, PriceEstimate::Instant) - .await - .unwrap(); - - assert!(min_fee < default_fee); - assert!(default_fee < instant_fee); - } -} diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index e8df5118b..ef814a787 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -6,10 +6,12 @@ use std::path::PathBuf; use std::str::FromStr; use aligned_sdk::communication::serialization::cbor_deserialize; +use aligned_sdk::core::types::PriceEstimate; use aligned_sdk::core::{ errors::{AlignedError, SubmitError}, types::{AlignedVerificationData, Network, ProvingSystemId, VerificationData}, }; +use aligned_sdk::sdk::estimate_fee; use aligned_sdk::sdk::get_chain_id; use aligned_sdk::sdk::get_nonce_from_batcher; use aligned_sdk::sdk::{deposit_to_aligned, get_balance_in_aligned}; @@ -107,12 +109,15 @@ pub struct SubmitArgs { keystore_path: Option, #[arg(name = "Private key", long = "private_key")] private_key: Option, + #[arg(name = "Max Fee", long = "max_fee")] + max_fee: Option, // String because U256 expects hex #[arg( - name = "Max Fee", - long = "max_fee", - default_value = "1300000000000000" // 13_000 gas per proof * 100 gwei gas price (upper bound) + name = "Price Estimate", + long = "price_estimate", + default_value = "default", + allow_hyphen_values = true )] - max_fee: String, // String because U256 expects hex + price_estimate: Option, #[arg(name = "Nonce", long = "nonce")] nonce: Option, // String because U256 expects hex #[arg( @@ -120,7 +125,34 @@ pub struct SubmitArgs { long = "network", default_value = "devnet" )] - network: NetworkArg, + network: Network, +} + +impl SubmitArgs { + async fn get_max_fee(&self) -> Result { + // If max_fee is explicitly provided it is used first + if let Some(max_fee) = &self.max_fee { + // We explicitly tell the user that using both is invalid + if self.price_estimate.is_some() { + warn!("`max_fee` and `price_estimate` are both present using `max_fee`"); + } + return Ok( + U256::from_str(max_fee).map_err(|e| SubmitError::GenericError(e.to_string()))? + ); + } + + if let Some(price_est) = &self.price_estimate { + let estimate = PriceEstimate::try_from(price_est.clone()) + .map_err(|e| SubmitError::GenericError(e.to_string()))?; + return estimate_fee(&self.eth_rpc_url, estimate) + .await + .map_err(AlignedError::FeeEstimateError); + } + + // Fallback to default value + Ok(U256::from_str("1300000000000000") + .map_err(|e| SubmitError::GenericError(e.to_string()))?) + } } #[derive(Parser, Debug)] @@ -277,9 +309,9 @@ async fn main() -> Result<(), AlignedError> { SubmitError::IoError(batch_inclusion_data_directory_path.clone(), e) })?; - let max_fee = - U256::from_dec_str(&submit_args.max_fee).map_err(|_| SubmitError::InvalidMaxFee)?; - + let eth_rpc_url = submit_args.eth_rpc_url.clone(); + // `max_fee` is required unless `price_estimate` is present. + let max_fee = submit_args.get_max_fee().await?; let repetitions = submit_args.repetitions; let connect_addr = submit_args.batcher_url.clone(); @@ -314,8 +346,6 @@ async fn main() -> Result<(), AlignedError> { } }; - let eth_rpc_url = submit_args.eth_rpc_url.clone(); - let chain_id = get_chain_id(eth_rpc_url.as_str()).await?; wallet = wallet.with_chain_id(chain_id); @@ -356,7 +386,7 @@ async fn main() -> Result<(), AlignedError> { let aligned_verification_data_vec = submit_multiple( &connect_addr, - submit_args.network.into(), + submit_args.network, &verification_data_arr, max_fee, wallet.clone(), From 6040beb0064580fffedf09636a609d2d6f2e9891 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Wed, 4 Dec 2024 17:45:34 -0300 Subject: [PATCH 02/37] rm error --- batcher/aligned-sdk/src/core/types.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/batcher/aligned-sdk/src/core/types.rs b/batcher/aligned-sdk/src/core/types.rs index cc5a9867e..6a3838614 100644 --- a/batcher/aligned-sdk/src/core/types.rs +++ b/batcher/aligned-sdk/src/core/types.rs @@ -99,7 +99,6 @@ impl TryFrom for PriceEstimate { fn try_from(value: String) -> Result { let val = match value.as_str() { - // TODO remove the InvalidMaxFee error... "default" => Self::Default, "instant" => Self::Instant, s if s.starts_with("custom") => { From 2e17db3db66cf0468788d3676895f8810cde1738 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Wed, 4 Dec 2024 17:51:19 -0300 Subject: [PATCH 03/37] fmt --- batcher/aligned-sdk/src/core/types.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/batcher/aligned-sdk/src/core/types.rs b/batcher/aligned-sdk/src/core/types.rs index 6a3838614..fd4235423 100644 --- a/batcher/aligned-sdk/src/core/types.rs +++ b/batcher/aligned-sdk/src/core/types.rs @@ -96,23 +96,27 @@ pub enum PriceEstimate { impl TryFrom for PriceEstimate { type Error = String; - + fn try_from(value: String) -> Result { let val = match value.as_str() { "default" => Self::Default, "instant" => Self::Instant, s if s.starts_with("custom") => { println!("{s}"); - let n = s.split_whitespace() + let n = s + .split_whitespace() .nth(1) .ok_or("Failed to Parse: `number_proofs_per_batch` not supplied")? .parse() .map_err(|_| "Failed to Parse: Value of `number_proofs_per_batch` invalid")?; PriceEstimate::Custom(n) - }, - _ => - return Err("Invalid network, possible values are: \"default\", \"instant\", \"custom\"" - .to_string()), + } + _ => { + return Err( + "Invalid network, possible values are: \"default\", \"instant\", \"custom\"" + .to_string(), + ) + } }; Ok(val) } From 4811db34b44fbb682416593957c66eb441168128 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Wed, 4 Dec 2024 17:54:14 -0300 Subject: [PATCH 04/37] change name per cmts in #1558 --- batcher/aligned-sdk/src/sdk.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/batcher/aligned-sdk/src/sdk.rs b/batcher/aligned-sdk/src/sdk.rs index d6a13ee59..84f2a6045 100644 --- a/batcher/aligned-sdk/src/sdk.rs +++ b/batcher/aligned-sdk/src/sdk.rs @@ -140,12 +140,12 @@ pub async fn estimate_fee( // Price of 1 proof in 32 proof batch match estimate { PriceEstimate::Default => { - max_fee_per_proof_in_batch(eth_rpc_url, DEFAULT_MAX_FEE_PROOF_NUMBER).await + suggest_fee_per_proof(eth_rpc_url, DEFAULT_MAX_FEE_PROOF_NUMBER).await } PriceEstimate::Instant => { - max_fee_per_proof_in_batch(eth_rpc_url, INSTANT_MAX_FEE_PROOF_NUMBER).await + suggest_fee_per_proof(eth_rpc_url, INSTANT_MAX_FEE_PROOF_NUMBER).await } - PriceEstimate::Custom(n) => max_fee_per_proof_in_batch(eth_rpc_url, n).await, + PriceEstimate::Custom(n) => suggest_fee_per_proof(eth_rpc_url, n).await, } } @@ -160,7 +160,7 @@ pub async fn estimate_fee( /// # Errors /// * `EthereumProviderError` if there is an error in the connection with the RPC provider. /// * `EthereumGasPriceError` if there is an error retrieving the Ethereum gas price. -pub async fn max_fee_per_proof_in_batch( +pub async fn suggest_fee_per_proof( eth_rpc_url: &str, num_proofs_in_batch: usize, ) -> Result { From 9e19acb3e687a34be2a3bc67a986c895ad49d6db Mon Sep 17 00:00:00 2001 From: PatStiles Date: Thu, 5 Dec 2024 09:54:37 -0300 Subject: [PATCH 05/37] comment nit --- batcher/aligned/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index ef814a787..6ae37534f 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -132,7 +132,7 @@ impl SubmitArgs { async fn get_max_fee(&self) -> Result { // If max_fee is explicitly provided it is used first if let Some(max_fee) = &self.max_fee { - // We explicitly tell the user that using both is invalid + // Inform the user if both are declared that `max_fee` is used. if self.price_estimate.is_some() { warn!("`max_fee` and `price_estimate` are both present using `max_fee`"); } From 7c2d8f90cf295b0393449084f6caeee84237bf5f Mon Sep 17 00:00:00 2001 From: PatStiles Date: Thu, 5 Dec 2024 12:22:45 -0300 Subject: [PATCH 06/37] remove unneeded println --- batcher/aligned-sdk/src/core/types.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/batcher/aligned-sdk/src/core/types.rs b/batcher/aligned-sdk/src/core/types.rs index fd4235423..879132a2b 100644 --- a/batcher/aligned-sdk/src/core/types.rs +++ b/batcher/aligned-sdk/src/core/types.rs @@ -102,7 +102,6 @@ impl TryFrom for PriceEstimate { "default" => Self::Default, "instant" => Self::Instant, s if s.starts_with("custom") => { - println!("{s}"); let n = s .split_whitespace() .nth(1) From d9c6b65657900a16860ada7f0e18604da24af930 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Thu, 5 Dec 2024 12:35:20 -0300 Subject: [PATCH 07/37] help section for cli command + prompt correct usage in errors --- batcher/aligned-sdk/src/core/types.rs | 6 +++--- batcher/aligned/src/main.rs | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/batcher/aligned-sdk/src/core/types.rs b/batcher/aligned-sdk/src/core/types.rs index 879132a2b..fe6ea1c4a 100644 --- a/batcher/aligned-sdk/src/core/types.rs +++ b/batcher/aligned-sdk/src/core/types.rs @@ -105,14 +105,14 @@ impl TryFrom for PriceEstimate { let n = s .split_whitespace() .nth(1) - .ok_or("Failed to Parse: `number_proofs_per_batch` not supplied")? + .ok_or("Failed to Parse: `number_proofs_per_batch` not supplied, correct usage \"custom \" (note quotations)")? .parse() - .map_err(|_| "Failed to Parse: Value of `number_proofs_per_batch` invalid")?; + .map_err(|_| "Failed to Parse: Value of `number_proofs_per_batch` invalid , correct usage \"custom \" (note quotations)")?; PriceEstimate::Custom(n) } _ => { return Err( - "Invalid network, possible values are: \"default\", \"instant\", \"custom\"" + "Invalid network, possible values are: \"default\", \"instant\", \"custom \"" .to_string(), ) } diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index 6ae37534f..3a8e2feb7 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -115,6 +115,7 @@ pub struct SubmitArgs { name = "Price Estimate", long = "price_estimate", default_value = "default", + help = "`price_estimate` allows for a user to use the aligned_sdk `estimate_fee` function to compute there `max_fee`.\n Usage: `default,`, `instant`, \"custom \"", allow_hyphen_values = true )] price_estimate: Option, From b1c1f198476c1605ce1d3a1a9c76cda74321e91b Mon Sep 17 00:00:00 2001 From: PatStiles Date: Thu, 5 Dec 2024 15:18:42 -0300 Subject: [PATCH 08/37] update doc comment --- batcher/aligned-sdk/src/sdk.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/batcher/aligned-sdk/src/sdk.rs b/batcher/aligned-sdk/src/sdk.rs index 84f2a6045..0fb8d8b29 100644 --- a/batcher/aligned-sdk/src/sdk.rs +++ b/batcher/aligned-sdk/src/sdk.rs @@ -115,16 +115,15 @@ pub async fn submit_multiple_and_wait_verification( aligned_verification_data } -/// Returns the estimated `max_fee` depending on the batch inclusion preference of the user, based on the max priority gas price. +/// Returns the estimated `max_fee` depending on the batch inclusion preference of the user, computed based on the current gas price, and the number of proofs in a batch. /// NOTE: The `max_fee` is computed from an rpc nodes max priority gas price. -/// To estimate the `max_fee` of a batch we use a compute the `max_fee` with respect to a batch of ~32 proofs present. +/// To estimate the `max_fee` of a batch we use a compute the `max_fee` with respect to a batch size of 1 (Instant), 10 (Default), or `number_proofs_in_batch` (Custom). /// The `max_fee` estimates therefore are: -/// * `Min`: Specifies a `max_fee` equivalent to the cost of 1 proof in a 32 proof batch. -/// This estimates the lowest possible `max_fee` the user should specify for there proof with lowest priority. -/// * `Default`: Specifies a `max_fee` equivalent to the cost of 10 proofs in a 32 proof batch. -/// This estimates the `max_fee` the user should specify for inclusion within the batch. -/// * `Instant`: specifies a `max_fee` equivalent to the cost of all proofs within in a 32 proof batch. -/// This estimates the `max_fee` the user should specify to pay for the entire batch of proofs and have there proof included instantly. +/// * `Default`: Specifies a `max_fee` equivalent to the cost of paying for one proof within a batch of 10 proofs ie. 1 / 10 proofs. +/// This estimates a default `max_fee` the user should specify for including there proof within the batch. +/// * `Instant`: Specifies a `max_fee` equivalent to the cost of paying for an entire batch ensuring the user's proof is included instantly. +/// * `Custom (number_proofs_in_batch)`: Specifies a `max_fee` equivalent to the cost of paying 1 proof / `num_proofs_in_batch` allowing the user a user to estimate there `max_fee` precisely based on the `number_proofs_in_batch`. +/// /// # Arguments /// * `eth_rpc_url` - The URL of the Ethereum RPC node. /// * `estimate` - Enum specifying the type of price estimate: MIN, DEFAULT, INSTANT. From ad91ac66f15050978f9c0e0d01b1d014932edc28 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Thu, 5 Dec 2024 15:24:09 -0300 Subject: [PATCH 09/37] return error if user specifies both fee arguments are specified --- batcher/aligned/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index 3a8e2feb7..7bfe83450 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -135,7 +135,7 @@ impl SubmitArgs { if let Some(max_fee) = &self.max_fee { // Inform the user if both are declared that `max_fee` is used. if self.price_estimate.is_some() { - warn!("`max_fee` and `price_estimate` are both present using `max_fee`"); + return Err(SubmitError::GenericError("`max_fee` and `price_estimate` are both present please specify one or the other".to_string()))? } return Ok( U256::from_str(max_fee).map_err(|e| SubmitError::GenericError(e.to_string()))? From 5f9d3442798228c92fa0851e2196df97bf77a0fd Mon Sep 17 00:00:00 2001 From: PatStiles Date: Thu, 5 Dec 2024 15:35:14 -0300 Subject: [PATCH 10/37] print max_fee in ethers --- batcher/aligned/src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index 7bfe83450..5bd47ae98 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -109,13 +109,13 @@ pub struct SubmitArgs { keystore_path: Option, #[arg(name = "Private key", long = "private_key")] private_key: Option, - #[arg(name = "Max Fee", long = "max_fee")] + #[arg(name = "Max Fee", help = "Specifies the `max_fee` the user of the submitted proof in ether" , long = "max_fee")] max_fee: Option, // String because U256 expects hex #[arg( name = "Price Estimate", long = "price_estimate", default_value = "default", - help = "`price_estimate` allows for a user to use the aligned_sdk `estimate_fee` function to compute there `max_fee`.\n Usage: `default,`, `instant`, \"custom \"", + help = "Specifies the aligned_sdk `estimate_fee` function should be used to compute the `max_fee` of the submitted proof based on the number of proofs in a batch and the current gas price from the node specified by `eth_rpc_url`.\n Usage: `default,`, `instant`, \"custom \"", allow_hyphen_values = true )] price_estimate: Option, @@ -313,6 +313,7 @@ async fn main() -> Result<(), AlignedError> { let eth_rpc_url = submit_args.eth_rpc_url.clone(); // `max_fee` is required unless `price_estimate` is present. let max_fee = submit_args.get_max_fee().await?; + info!("max_fee: {} ether", format_ether(max_fee)); let repetitions = submit_args.repetitions; let connect_addr = submit_args.batcher_url.clone(); From c2742ffb223e3c04a86037a3a0242da707b69563 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Thu, 5 Dec 2024 15:43:15 -0300 Subject: [PATCH 11/37] doc changes --- batcher/aligned/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index 5bd47ae98..98c28bbf7 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -109,7 +109,7 @@ pub struct SubmitArgs { keystore_path: Option, #[arg(name = "Private key", long = "private_key")] private_key: Option, - #[arg(name = "Max Fee", help = "Specifies the `max_fee` the user of the submitted proof in ether" , long = "max_fee")] + #[arg(name = "Max Fee", help = "Specifies the `max_fee` the user of the submitted proof in `ether`" , long = "max_fee")] max_fee: Option, // String because U256 expects hex #[arg( name = "Price Estimate", From 233004fc750b0f2103dfa9ffafbbff7bde4977b8 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Thu, 5 Dec 2024 15:50:55 -0300 Subject: [PATCH 12/37] adjust fee estime with respect to gas percentage bump in batcher + fmt --- batcher/aligned-sdk/src/sdk.rs | 8 ++++++-- batcher/aligned/src/main.rs | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/batcher/aligned-sdk/src/sdk.rs b/batcher/aligned-sdk/src/sdk.rs index 0fb8d8b29..c1a8090fc 100644 --- a/batcher/aligned-sdk/src/sdk.rs +++ b/batcher/aligned-sdk/src/sdk.rs @@ -8,7 +8,8 @@ use crate::{ core::{ constants::{ ADDITIONAL_SUBMISSION_GAS_COST_PER_PROOF, CONSTANT_GAS_COST, - DEFAULT_MAX_FEE_PROOF_NUMBER, INSTANT_MAX_FEE_PROOF_NUMBER, + DEFAULT_MAX_FEE_PROOF_NUMBER, GAS_PRICE_PERCENTAGE_MULTIPLIER, + INSTANT_MAX_FEE_PROOF_NUMBER, PERCENTAGE_DIVIDER, }, errors::{self, GetNonceError}, types::{ @@ -175,7 +176,10 @@ pub async fn suggest_fee_per_proof( / num_proofs_in_batch as u128; // Price of 1 / `num_proofs_in_batch` proof batch - let fee_per_proof = U256::from(estimated_gas_per_proof) * gas_price; + let fee_per_proof = (U256::from(estimated_gas_per_proof) + * gas_price + * U256::from(GAS_PRICE_PERCENTAGE_MULTIPLIER)) + / U256::from(PERCENTAGE_DIVIDER); Ok(fee_per_proof) } diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index 98c28bbf7..d4a5deaef 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -109,7 +109,11 @@ pub struct SubmitArgs { keystore_path: Option, #[arg(name = "Private key", long = "private_key")] private_key: Option, - #[arg(name = "Max Fee", help = "Specifies the `max_fee` the user of the submitted proof in `ether`" , long = "max_fee")] + #[arg( + name = "Max Fee", + help = "Specifies the `max_fee` the user of the submitted proof in `ether`", + long = "max_fee" + )] max_fee: Option, // String because U256 expects hex #[arg( name = "Price Estimate", @@ -135,7 +139,7 @@ impl SubmitArgs { if let Some(max_fee) = &self.max_fee { // Inform the user if both are declared that `max_fee` is used. if self.price_estimate.is_some() { - return Err(SubmitError::GenericError("`max_fee` and `price_estimate` are both present please specify one or the other".to_string()))? + return Err(SubmitError::GenericError("`max_fee` and `price_estimate` are both present please specify one or the other".to_string()))?; } return Ok( U256::from_str(max_fee).map_err(|e| SubmitError::GenericError(e.to_string()))? From dccfbbf3feecb4fbda377dc52f83fb5381787476 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Thu, 5 Dec 2024 16:10:12 -0300 Subject: [PATCH 13/37] max_fee => max_fee_wei --- batcher/aligned/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index d4a5deaef..d047d576c 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -316,8 +316,8 @@ async fn main() -> Result<(), AlignedError> { let eth_rpc_url = submit_args.eth_rpc_url.clone(); // `max_fee` is required unless `price_estimate` is present. - let max_fee = submit_args.get_max_fee().await?; - info!("max_fee: {} ether", format_ether(max_fee)); + let max_fee_wei = submit_args.get_max_fee().await?; + info!("max_fee: {} ether", format_ether(max_fee_wei)); let repetitions = submit_args.repetitions; let connect_addr = submit_args.batcher_url.clone(); @@ -394,7 +394,7 @@ async fn main() -> Result<(), AlignedError> { &connect_addr, submit_args.network, &verification_data_arr, - max_fee, + max_fee_wei, wallet.clone(), nonce, ) From 196056b90c04a472b2d8c31c594db548091b5efd Mon Sep 17 00:00:00 2001 From: PatStiles Date: Thu, 5 Dec 2024 16:16:58 -0300 Subject: [PATCH 14/37] nit: types.rs network -> price estimate --- batcher/aligned-sdk/src/core/types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher/aligned-sdk/src/core/types.rs b/batcher/aligned-sdk/src/core/types.rs index fe6ea1c4a..e1d927a89 100644 --- a/batcher/aligned-sdk/src/core/types.rs +++ b/batcher/aligned-sdk/src/core/types.rs @@ -112,7 +112,7 @@ impl TryFrom for PriceEstimate { } _ => { return Err( - "Invalid network, possible values are: \"default\", \"instant\", \"custom \"" + "Invalid price estimate, possible values are: \"default\", \"instant\", \"custom \"" .to_string(), ) } From d0a99e0bffad0b152ea92e314098d634ad00adda Mon Sep 17 00:00:00 2001 From: PatStiles Date: Thu, 5 Dec 2024 20:12:30 -0300 Subject: [PATCH 15/37] use mutual exclusive args + fmting + fmt --- batcher/Cargo.lock | 663 +++++++++++++++++++----------------- batcher/aligned/src/main.rs | 106 ++++-- 2 files changed, 424 insertions(+), 345 deletions(-) diff --git a/batcher/Cargo.lock b/batcher/Cargo.lock index 02ce4b217..ce3fed794 100644 --- a/batcher/Cargo.lock +++ b/batcher/Cargo.lock @@ -147,9 +147,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy-primitives" @@ -194,7 +194,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -210,7 +210,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "syn-solidity", "tiny-keccak", ] @@ -226,7 +226,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "syn-solidity", ] @@ -302,9 +302,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" +checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" [[package]] name = "ark-bn254" @@ -569,7 +569,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -597,7 +597,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -619,7 +619,7 @@ dependencies = [ "aws-sdk-sts", "aws-smithy-async", "aws-smithy-http", - "aws-smithy-json", + "aws-smithy-json 0.60.7", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types", @@ -650,9 +650,9 @@ dependencies = [ [[package]] name = "aws-runtime" -version = "1.4.3" +version = "1.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a10d5c055aa540164d9561a0e2e74ad30f0dcf7393c3a92f6733ddf9c5762468" +checksum = "b5ac934720fbb46206292d2c75b57e67acfc56fe7dfd34fb9a02334af08409ea" dependencies = [ "aws-credential-types", "aws-sigv4", @@ -676,9 +676,9 @@ dependencies = [ [[package]] name = "aws-sdk-s3" -version = "1.60.0" +version = "1.65.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0506cc60e392e33712d47717d5ae5760a3b134bf8ee7aea7e43df3d7e2669ae0" +checksum = "d3ba2c5c0f2618937ce3d4a5ad574b86775576fa24006bcb3128c6e2cbf3c34e" dependencies = [ "aws-credential-types", "aws-runtime", @@ -687,7 +687,7 @@ dependencies = [ "aws-smithy-checksums", "aws-smithy-eventstream", "aws-smithy-http", - "aws-smithy-json", + "aws-smithy-json 0.61.1", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types", @@ -710,15 +710,15 @@ dependencies = [ [[package]] name = "aws-sdk-sso" -version = "1.49.0" +version = "1.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09677244a9da92172c8dc60109b4a9658597d4d298b188dd0018b6a66b410ca4" +checksum = "05ca43a4ef210894f93096039ef1d6fa4ad3edfabb3be92b80908b9f2e4b4eab" dependencies = [ "aws-credential-types", "aws-runtime", "aws-smithy-async", "aws-smithy-http", - "aws-smithy-json", + "aws-smithy-json 0.61.1", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types", @@ -732,15 +732,15 @@ dependencies = [ [[package]] name = "aws-sdk-ssooidc" -version = "1.50.0" +version = "1.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fea2f3a8bb3bd10932ae7ad59cc59f65f270fc9183a7e91f501dc5efbef7ee" +checksum = "abaf490c2e48eed0bb8e2da2fb08405647bd7f253996e0f93b981958ea0f73b0" dependencies = [ "aws-credential-types", "aws-runtime", "aws-smithy-async", "aws-smithy-http", - "aws-smithy-json", + "aws-smithy-json 0.61.1", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types", @@ -754,15 +754,15 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "1.49.0" +version = "1.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53dcf5e7d9bd1517b8b998e170e650047cea8a2b85fe1835abe3210713e541b7" +checksum = "b68fde0d69c8bfdc1060ea7da21df3e39f6014da316783336deff0a9ec28f4bf" dependencies = [ "aws-credential-types", "aws-runtime", "aws-smithy-async", "aws-smithy-http", - "aws-smithy-json", + "aws-smithy-json 0.61.1", "aws-smithy-query", "aws-smithy-runtime", "aws-smithy-runtime-api", @@ -777,9 +777,9 @@ dependencies = [ [[package]] name = "aws-sigv4" -version = "1.2.5" +version = "1.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5619742a0d8f253be760bfbb8e8e8368c69e3587e4637af5754e488a611499b1" +checksum = "7d3820e0c08d0737872ff3c7c1f21ebbb6693d832312d6152bf18ef50a5471c2" dependencies = [ "aws-credential-types", "aws-smithy-eventstream", @@ -792,7 +792,7 @@ dependencies = [ "hex", "hmac", "http 0.2.12", - "http 1.1.0", + "http 1.2.0", "once_cell", "p256", "percent-encoding", @@ -877,6 +877,15 @@ dependencies = [ "aws-smithy-types", ] +[[package]] +name = "aws-smithy-json" +version = "0.61.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee4e69cc50921eb913c6b662f8d909131bb3e6ad6cb6090d3a39b66fc5c52095" +dependencies = [ + "aws-smithy-types", +] + [[package]] name = "aws-smithy-query" version = "0.60.7" @@ -889,9 +898,9 @@ dependencies = [ [[package]] name = "aws-smithy-runtime" -version = "1.7.3" +version = "1.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be28bd063fa91fd871d131fc8b68d7cd4c5fa0869bea68daca50dcb1cbd76be2" +checksum = "9f20685047ca9d6f17b994a07f629c813f08b5bce65523e47124879e60103d45" dependencies = [ "aws-smithy-async", "aws-smithy-http", @@ -924,7 +933,7 @@ dependencies = [ "aws-smithy-types", "bytes", "http 0.2.12", - "http 1.1.0", + "http 1.2.0", "pin-project-lite", "tokio", "tracing", @@ -942,7 +951,7 @@ dependencies = [ "bytes-utils", "futures-core", "http 0.2.12", - "http 1.1.0", + "http 1.2.0", "http-body 0.4.6", "http-body 1.0.1", "http-body-util", @@ -982,18 +991,18 @@ dependencies = [ [[package]] name = "axum" -version = "0.7.7" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "504e3947307ac8326a5437504c517c4b56716c9d98fac0028c2acc7ca47d70ae" +checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" dependencies = [ "async-trait", "axum-core", "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.0", + "hyper 1.5.1", "hyper-util", "itoa", "matchit", @@ -1006,7 +1015,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper 1.0.2", "tokio", "tower", "tower-layer", @@ -1023,13 +1032,13 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "http-body-util", "mime", "pin-project-lite", "rustversion", - "sync_wrapper 1.0.1", + "sync_wrapper 1.0.2", "tower-layer", "tower-service", "tracing", @@ -1037,9 +1046,9 @@ dependencies = [ [[package]] name = "backon" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4fa97bb310c33c811334143cf64c5bb2b7b3c06e453db6b095d7061eff8f113" +checksum = "ba5289ec98f68f28dd809fd601059e6aa908bb8f6108620930828283d4ee23d7" dependencies = [ "fastrand", "gloo-timers 0.3.0", @@ -1140,7 +1149,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -1204,9 +1213,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.5.4" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82033247fd8e890df8f740e407ad4d038debb9eb1f40533fffb32e7d17dc6f7" +checksum = "b8ee0c1824c4dea5b5f81736aff91bae041d2c07ee1192bec91054e10e3e601e" dependencies = [ "arrayref", "arrayvec", @@ -1252,14 +1261,14 @@ dependencies = [ "maybe-async", "reqwest 0.12.9", "serde", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "borsh" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5327f6c99920069d1fe374aa743be1af0031dea9f250852cdf1ae6a0861ee24" +checksum = "2506947f73ad44e344215ccd6403ac2ae18cd8e046e581a441bf8d199f257f03" dependencies = [ "borsh-derive", "cfg_aliases", @@ -1267,15 +1276,15 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10aedd8f1a81a8aafbfde924b0e3061cd6fedd6f6bbcfc6a76e6fd426d7bfe26" +checksum = "c2593a3b8b938bd68373196c9832f516be11fa487ef4ae745eb282e6a56a7244" dependencies = [ "once_cell", "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -1302,9 +1311,9 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "bytemuck" -version = "1.19.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" +checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" dependencies = [ "bytemuck_derive", ] @@ -1317,7 +1326,7 @@ checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -1328,9 +1337,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" dependencies = [ "serde", ] @@ -1377,9 +1386,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" dependencies = [ "serde", ] @@ -1395,14 +1404,14 @@ dependencies = [ "semver 1.0.23", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "cc" -version = "1.1.37" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40545c26d092346d8a8dab71ee48e7685a7a9cba76e634790c215b41a4a7b4cf" +checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" dependencies = [ "jobserver", "libc", @@ -1489,9 +1498,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.20" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" +checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" dependencies = [ "clap_builder", "clap_derive", @@ -1499,9 +1508,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.20" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" +checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" dependencies = [ "anstream", "anstyle", @@ -1518,14 +1527,14 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "coins-bip32" @@ -1540,7 +1549,7 @@ dependencies = [ "k256", "serde", "sha2", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1556,7 +1565,7 @@ dependencies = [ "pbkdf2 0.12.2", "rand", "sha2", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1576,7 +1585,7 @@ dependencies = [ "serde_derive", "sha2", "sha3", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1594,15 +1603,15 @@ dependencies = [ "encode_unicode", "lazy_static", "libc", - "unicode-width", + "unicode-width 0.1.14", "windows-sys 0.52.0", ] [[package]] name = "const-hex" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0121754e84117e65f9d90648ee6aa4882a6e63110307ab73967a4c5e7e69e586" +checksum = "4b0485bab839b018a8f1723fc5391819fea5f8f0f32288ef8a735fd096b6160c" dependencies = [ "cfg-if", "cpufeatures", @@ -1664,9 +1673,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca741a962e1b0bff6d724a1a0958b686406e853bb14061f218562e1896f95e6" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] @@ -1786,7 +1795,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -1923,7 +1932,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.1", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -1943,7 +1952,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -1955,7 +1964,7 @@ dependencies = [ "console", "shell-words", "tempfile", - "thiserror", + "thiserror 1.0.69", "zeroize", ] @@ -2030,7 +2039,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -2204,7 +2213,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -2238,12 +2247,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2264,7 +2273,7 @@ dependencies = [ "serde_json", "sha2", "sha3", - "thiserror", + "thiserror 1.0.69", "uuid 0.8.2", ] @@ -2281,7 +2290,7 @@ dependencies = [ "serde", "serde_json", "sha3", - "thiserror", + "thiserror 1.0.69", "uint", ] @@ -2360,7 +2369,7 @@ dependencies = [ "pin-project", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2382,7 +2391,7 @@ dependencies = [ "reqwest 0.11.27", "serde", "serde_json", - "syn 2.0.87", + "syn 2.0.90", "toml", "walkdir", ] @@ -2400,7 +2409,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -2426,9 +2435,9 @@ dependencies = [ "serde", "serde_json", "strum", - "syn 2.0.87", + "syn 2.0.90", "tempfile", - "thiserror", + "thiserror 1.0.69", "tiny-keccak", "unicode-xid", ] @@ -2445,7 +2454,7 @@ dependencies = [ "semver 1.0.23", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "tracing", ] @@ -2469,7 +2478,7 @@ dependencies = [ "reqwest 0.11.27", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "tokio", "tracing", "tracing-futures", @@ -2502,7 +2511,7 @@ dependencies = [ "reqwest 0.11.27", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-tungstenite 0.20.1", "tracing", @@ -2529,7 +2538,7 @@ dependencies = [ "ethers-core", "rand", "sha2", - "thiserror", + "thiserror 1.0.69", "tracing", ] @@ -2557,7 +2566,7 @@ dependencies = [ "serde_json", "solang-parser", "svm-rs", - "thiserror", + "thiserror 1.0.69", "tiny-keccak", "tokio", "tracing", @@ -2658,9 +2667,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", "miniz_oxide", @@ -2705,7 +2714,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -2811,7 +2820,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -2882,9 +2891,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96512db27971c2c3eece70a1e106fbe6c87760234e31e8f7e5634912fe52794a" +checksum = "2cb8bc4c28d15ade99c7e90b219f30da4be5c88e586277e8cbe886beeb868ab2" dependencies = [ "serde", "typenum", @@ -2897,8 +2906,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -2994,16 +3005,16 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" dependencies = [ "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "http 1.1.0", + "http 1.2.0", "indexmap", "slab", "tokio", @@ -3066,9 +3077,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" dependencies = [ "allocator-api2", "equivalent", @@ -3169,9 +3180,9 @@ dependencies = [ [[package]] name = "http" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" dependencies = [ "bytes", "fnv", @@ -3196,7 +3207,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.1.0", + "http 1.2.0", ] [[package]] @@ -3207,7 +3218,7 @@ checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "pin-project-lite", ] @@ -3256,15 +3267,15 @@ dependencies = [ [[package]] name = "hyper" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.6", - "http 1.1.0", + "h2 0.4.7", + "http 1.2.0", "http-body 1.0.1", "httparse", "httpdate", @@ -3298,15 +3309,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", - "http 1.1.0", - "hyper 1.5.0", + "http 1.2.0", + "hyper 1.5.1", "hyper-util", - "rustls 0.23.16", + "rustls 0.23.19", "rustls-pki-types", "tokio", - "tokio-rustls 0.26.0", + "tokio-rustls 0.26.1", "tower-service", - "webpki-roots 0.26.6", + "webpki-roots 0.26.7", ] [[package]] @@ -3330,7 +3341,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.5.0", + "hyper 1.5.1", "hyper-util", "native-tls", "tokio", @@ -3347,9 +3358,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", - "hyper 1.5.0", + "hyper 1.5.1", "pin-project-lite", "socket2", "tokio", @@ -3472,7 +3483,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -3525,13 +3536,13 @@ dependencies = [ [[package]] name = "impl-trait-for-tuples" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.90", ] [[package]] @@ -3542,25 +3553,25 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", - "hashbrown 0.15.1", + "hashbrown 0.15.2", ] [[package]] name = "indicatif" -version = "0.17.8" +version = "0.17.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" +checksum = "cbf675b85ed934d3c67b5c5469701eec7db22689d0a2139d856e0925fa28b281" dependencies = [ "console", - "instant", "number_prefix", "portable-atomic", - "unicode-width", + "unicode-width 0.2.0", + "web-time", ] [[package]] @@ -3631,9 +3642,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "jobserver" @@ -3646,10 +3657,11 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.72" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -3784,7 +3796,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -3798,9 +3810,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.162" +version = "0.2.167" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" +checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] name = "libgit2-sys" @@ -3816,9 +3828,9 @@ dependencies = [ [[package]] name = "libloading" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", "windows-targets 0.52.6", @@ -3860,9 +3872,9 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "litemap" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "lock_api" @@ -3886,7 +3898,7 @@ version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" dependencies = [ - "hashbrown 0.15.1", + "hashbrown 0.15.2", ] [[package]] @@ -3921,7 +3933,7 @@ checksum = "5cf92c10c7e361d6b99666ec1c6f9805b0bea2c3bd8c78dc6fe98ac5bd78db11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -3994,11 +4006,10 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ - "hermit-abi", "libc", "wasi", "windows-sys 0.52.0", @@ -4235,7 +4246,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -4325,7 +4336,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -4789,7 +4800,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" dependencies = [ "memchr", - "thiserror", + "thiserror 1.0.69", "ucd-trie", ] @@ -4843,7 +4854,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -4881,7 +4892,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -4924,9 +4935,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "portable-atomic" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" +checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" [[package]] name = "powerfmt" @@ -4956,7 +4967,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" dependencies = [ "proc-macro2", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -5029,9 +5040,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -5073,7 +5084,7 @@ dependencies = [ "parking_lot", "procfs", "protobuf", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5116,7 +5127,7 @@ dependencies = [ "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -5133,37 +5144,40 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quinn" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" +checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" dependencies = [ "bytes", "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash 2.0.0", - "rustls 0.23.16", + "rustc-hash 2.1.0", + "rustls 0.23.19", "socket2", - "thiserror", + "thiserror 2.0.4", "tokio", "tracing", ] [[package]] name = "quinn-proto" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" +checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" dependencies = [ "bytes", + "getrandom", "rand", "ring 0.17.8", - "rustc-hash 2.0.0", - "rustls 0.23.16", + "rustc-hash 2.1.0", + "rustls 0.23.19", + "rustls-pki-types", "slab", - "thiserror", + "thiserror 2.0.4", "tinyvec", "tracing", + "web-time", ] [[package]] @@ -5280,7 +5294,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5389,11 +5403,11 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.4.6", - "http 1.1.0", + "h2 0.4.7", + "http 1.2.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.0", + "hyper 1.5.1", "hyper-rustls 0.27.3", "hyper-tls 0.6.0", "hyper-util", @@ -5406,17 +5420,17 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.16", + "rustls 0.23.19", "rustls-pemfile 2.2.0", "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper 1.0.2", "system-configuration 0.6.1", "tokio", "tokio-native-tls", - "tokio-rustls 0.26.0", + "tokio-rustls 0.26.1", "tokio-util", "tower-service", "url", @@ -5424,7 +5438,7 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", - "webpki-roots 0.26.6", + "webpki-roots 0.26.7", "windows-registry", ] @@ -5436,10 +5450,10 @@ checksum = "562ceb5a604d3f7c885a792d42c199fd8af239d0a51b2fa6a78aafa092452b04" dependencies = [ "anyhow", "async-trait", - "http 1.1.0", + "http 1.2.0", "reqwest 0.12.9", "serde", - "thiserror", + "thiserror 1.0.69", "tower-service", ] @@ -5766,9 +5780,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc-hash" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" [[package]] name = "rustc-hex" @@ -5796,9 +5810,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.40" +version = "0.38.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0" +checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" dependencies = [ "bitflags 2.6.0", "errno", @@ -5821,9 +5835,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.16" +version = "0.23.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e" +checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ "once_cell", "ring 0.17.8", @@ -5868,6 +5882,9 @@ name = "rustls-pki-types" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +dependencies = [ + "web-time", +] [[package]] name = "rustls-webpki" @@ -5934,9 +5951,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.11.5" +version = "2.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aa7ffc1c0ef49b0452c6e2986abf2b07743320641ffd5fc63d552458e3b779b" +checksum = "346a3b32eba2640d17a9cb5927056b08f3de90f65b72fe09402c2ad07d684d0b" dependencies = [ "cfg-if", "derive_more 1.0.0", @@ -5946,30 +5963,30 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.11.5" +version = "2.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46385cc24172cf615450267463f937c10072516359b3ff1cb24228a4a08bf951" +checksum = "c6630024bf739e2179b91fb424b28898baf819414262c5d376677dbff1fe7ebf" dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "scc" -version = "2.2.4" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8d25269dd3a12467afe2e510f69fb0b46b698e5afb296b59f2145259deaf8e8" +checksum = "66b202022bb57c049555430e11fc22fea12909276a80a4c3d368da36ac1d88ed" dependencies = [ "sdd", ] [[package]] name = "schannel" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ "windows-sys 0.59.0", ] @@ -6085,9 +6102,9 @@ dependencies = [ [[package]] name = "semver-parser" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +checksum = "9900206b54a3527fdc7b8a938bffd94a568bac4f4aa8113b209df75a09c0dec2" dependencies = [ "pest", ] @@ -6106,29 +6123,29 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "serde_json" -version = "1.0.132" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "itoa", "memchr", @@ -6154,7 +6171,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -6213,7 +6230,7 @@ checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -6316,7 +6333,7 @@ checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" dependencies = [ "num-bigint 0.4.6", "num-traits", - "thiserror", + "thiserror 1.0.69", "time", ] @@ -6359,9 +6376,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -6377,7 +6394,7 @@ dependencies = [ "lalrpop", "lalrpop-util", "phf", - "thiserror", + "thiserror 1.0.69", "unicode-xid", ] @@ -6407,7 +6424,7 @@ dependencies = [ "sp1-stark", "strum", "strum_macros", - "thiserror", + "thiserror 1.0.69", "tiny-keccak", "tracing", "typenum", @@ -6422,7 +6439,7 @@ dependencies = [ "bincode", "cfg-if", "elliptic-curve 0.13.8", - "generic-array 1.1.0", + "generic-array 1.1.1", "hashbrown 0.14.5", "hex", "itertools 0.13.0", @@ -6453,10 +6470,10 @@ dependencies = [ "strum", "strum_macros", "tempfile", - "thiserror", + "thiserror 1.0.69", "tracing", "tracing-forest", - "tracing-subscriber 0.3.18", + "tracing-subscriber 0.3.19", "typenum", "web-time", ] @@ -6470,7 +6487,7 @@ dependencies = [ "curve25519-dalek", "dashu", "elliptic-curve 0.13.8", - "generic-array 1.1.0", + "generic-array 1.1.1", "itertools 0.13.0", "k256", "num", @@ -6544,9 +6561,9 @@ dependencies = [ "sp1-stark", "subtle-encoding", "tempfile", - "thiserror", + "thiserror 1.0.69", "tracing", - "tracing-subscriber 0.3.18", + "tracing-subscriber 0.3.19", ] [[package]] @@ -6632,7 +6649,7 @@ dependencies = [ "sp1-primitives", "sp1-stark", "static_assertions", - "thiserror", + "thiserror 1.0.69", "tracing", "vec_map", "zkhash", @@ -6705,7 +6722,7 @@ dependencies = [ "strum", "strum_macros", "tempfile", - "thiserror", + "thiserror 1.0.69", "tokio", "tracing", "twirp-rs", @@ -6743,7 +6760,7 @@ dependencies = [ "strum", "strum_macros", "sysinfo", - "thiserror", + "thiserror 1.0.69", "tracing", ] @@ -6786,7 +6803,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d904e7009df136af5297832a3ace3370cd14ff1546a232f4f185036c2736fcac" dependencies = [ "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -6839,7 +6856,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -6872,7 +6889,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "thiserror", + "thiserror 1.0.69", "url", "zip", ] @@ -6890,9 +6907,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.87" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -6908,7 +6925,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -6919,9 +6936,9 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "sync_wrapper" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" dependencies = [ "futures-core", ] @@ -6934,7 +6951,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -7049,7 +7066,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f49a1853cf82743e3b7950f77e0f4d622ca36cf4317cba00c767838bac8d490" +dependencies = [ + "thiserror-impl 2.0.4", ] [[package]] @@ -7060,7 +7086,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8381894bb3efe0c4acac3ded651301ceee58a15d47c2e34885ed1908ad667061" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", ] [[package]] @@ -7075,9 +7112,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", "itoa", @@ -7098,9 +7135,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" dependencies = [ "num-conv", "time-core", @@ -7142,9 +7179,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.1" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", "bytes", @@ -7166,7 +7203,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -7191,12 +7228,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.26.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" dependencies = [ - "rustls 0.23.16", - "rustls-pki-types", + "rustls 0.23.19", "tokio", ] @@ -7236,13 +7272,13 @@ dependencies = [ "futures-util", "log", "native-tls", - "rustls 0.23.16", + "rustls 0.23.19", "rustls-pki-types", "tokio", "tokio-native-tls", - "tokio-rustls 0.26.0", + "tokio-rustls 0.26.1", "tungstenite 0.23.0", - "webpki-roots 0.26.6", + "webpki-roots 0.26.7", ] [[package]] @@ -7254,20 +7290,20 @@ dependencies = [ "futures-util", "log", "native-tls", - "rustls 0.23.16", + "rustls 0.23.19", "rustls-pki-types", "tokio", "tokio-native-tls", - "tokio-rustls 0.26.0", + "tokio-rustls 0.26.1", "tungstenite 0.24.0", - "webpki-roots 0.26.6", + "webpki-roots 0.26.7", ] [[package]] name = "tokio-util" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -7351,9 +7387,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", "pin-project-lite", @@ -7363,20 +7399,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -7390,9 +7426,9 @@ checksum = "ee40835db14ddd1e3ba414292272eddde9dad04d3d4b65509656414d1c42592f" dependencies = [ "ansi_term", "smallvec", - "thiserror", + "thiserror 1.0.69", "tracing", - "tracing-subscriber 0.3.18", + "tracing-subscriber 0.3.19", ] [[package]] @@ -7427,9 +7463,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", @@ -7464,7 +7500,7 @@ dependencies = [ "rand", "rustls 0.21.12", "sha1", - "thiserror", + "thiserror 1.0.69", "url", "utf-8", ] @@ -7478,12 +7514,12 @@ dependencies = [ "byteorder", "bytes", "data-encoding", - "http 1.1.0", + "http 1.2.0", "httparse", "log", "rand", "sha1", - "thiserror", + "thiserror 1.0.69", "url", "utf-8", ] @@ -7497,15 +7533,15 @@ dependencies = [ "byteorder", "bytes", "data-encoding", - "http 1.1.0", + "http 1.2.0", "httparse", "log", "native-tls", "rand", - "rustls 0.23.16", + "rustls 0.23.19", "rustls-pki-types", "sha1", - "thiserror", + "thiserror 1.0.69", "utf-8", ] @@ -7518,15 +7554,15 @@ dependencies = [ "byteorder", "bytes", "data-encoding", - "http 1.1.0", + "http 1.2.0", "httparse", "log", "native-tls", "rand", - "rustls 0.23.16", + "rustls 0.23.19", "rustls-pki-types", "sha1", - "thiserror", + "thiserror 1.0.69", "utf-8", ] @@ -7539,14 +7575,14 @@ dependencies = [ "async-trait", "axum", "futures", - "http 1.1.0", + "http 1.2.0", "http-body-util", - "hyper 1.5.0", + "hyper 1.5.1", "prost", "reqwest 0.12.9", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "tokio", "tower", "url", @@ -7590,9 +7626,9 @@ checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-width" @@ -7600,6 +7636,12 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + [[package]] name = "unicode-xid" version = "0.2.6" @@ -7626,9 +7668,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.3" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", @@ -7792,9 +7834,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" dependencies = [ "cfg-if", "once_cell", @@ -7803,36 +7845,37 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.45" +version = "0.4.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +checksum = "9dfaf8f50e5f293737ee323940c7d8b08a66a95a419223d9f41610ca08b0833d" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -7840,22 +7883,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" +checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" [[package]] name = "wasm-streams" @@ -7872,9 +7915,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.72" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +checksum = "a98bc3c33f0fe7e59ad7cd041b89034fa82a7c2d4365ca538dda6cdaf513863c" dependencies = [ "js-sys", "wasm-bindgen", @@ -7898,9 +7941,9 @@ checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "webpki-roots" -version = "0.26.6" +version = "0.26.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" dependencies = [ "rustls-pki-types", ] @@ -8186,7 +8229,7 @@ dependencies = [ "pharos", "rustc_version 0.4.1", "send_wrapper 0.6.0", - "thiserror", + "thiserror 1.0.69", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -8215,9 +8258,9 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "yoke" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" dependencies = [ "serde", "stable_deref_trait", @@ -8227,13 +8270,13 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "synstructure", ] @@ -8255,27 +8298,27 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] name = "zerofrom" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", "synstructure", ] @@ -8296,7 +8339,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] @@ -8318,7 +8361,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.90", ] [[package]] diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index d047d576c..b7af0a007 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -16,6 +16,7 @@ use aligned_sdk::sdk::get_chain_id; use aligned_sdk::sdk::get_nonce_from_batcher; use aligned_sdk::sdk::{deposit_to_aligned, get_balance_in_aligned}; use aligned_sdk::sdk::{get_vk_commitment, is_proof_verified, save_response, submit_multiple}; +use clap::Args; use clap::Parser; use clap::Subcommand; use clap::ValueEnum; @@ -63,7 +64,6 @@ pub enum AlignedCommands { } #[derive(Parser, Debug)] -#[command(version, about, long_about = None)] pub struct SubmitArgs { #[arg( name = "Batcher connection address", @@ -109,20 +109,8 @@ pub struct SubmitArgs { keystore_path: Option, #[arg(name = "Private key", long = "private_key")] private_key: Option, - #[arg( - name = "Max Fee", - help = "Specifies the `max_fee` the user of the submitted proof in `ether`", - long = "max_fee" - )] - max_fee: Option, // String because U256 expects hex - #[arg( - name = "Price Estimate", - long = "price_estimate", - default_value = "default", - help = "Specifies the aligned_sdk `estimate_fee` function should be used to compute the `max_fee` of the submitted proof based on the number of proofs in a batch and the current gas price from the node specified by `eth_rpc_url`.\n Usage: `default,`, `instant`, \"custom \"", - allow_hyphen_values = true - )] - price_estimate: Option, + #[command(flatten)] + price_estimate: PriceEstimateArgs, #[arg(name = "Nonce", long = "nonce")] nonce: Option, // String because U256 expects hex #[arg( @@ -133,30 +121,78 @@ pub struct SubmitArgs { network: Network, } +#[derive(Args, Debug)] +#[group(required = false, multiple = false)] +pub struct PriceEstimateArgs { + #[arg( + name = "Max Fee", + long = "max_fee", + help = "Specifies the `max_fee` the user of the submitted proof in `ether`." + )] + max_fee: Option, // String because U256 expects hex + #[arg( + name = "Price Estimate: Custom", + long = "custom_fee_estimate", + help = "Specifies a `max_fee` equivalent to the cost of paying 1 proof / `num_proofs_in_batch` allowing the user a user to estimate there `max_fee` precisely based on the `number_proofs_in_batch`." + )] + custom_fee_estimate: Option, + #[arg( + name = "Price Estimate: Instant", + long = "instant_fee_estimate", + help = "Specifies a `max_fee` equivalent to the cost of paying for an entire batch ensuring the user's proof is included instantly." + )] + instant_fee_estimate: bool, + #[arg( + name = "Price Estimate: Default", + long = "default_fee_estimate", + help = "Specifies a `max_fee` equivalent to the cost of paying for one proof within a batch of 10 proofs ie. 1 / 10 proofs. This estimates a default `max_fee` the user should specify for including there proof within the batch." + )] + default_fee_estimate: bool, +} + impl SubmitArgs { async fn get_max_fee(&self) -> Result { - // If max_fee is explicitly provided it is used first - if let Some(max_fee) = &self.max_fee { - // Inform the user if both are declared that `max_fee` is used. - if self.price_estimate.is_some() { - return Err(SubmitError::GenericError("`max_fee` and `price_estimate` are both present please specify one or the other".to_string()))?; - } - return Ok( - U256::from_str(max_fee).map_err(|e| SubmitError::GenericError(e.to_string()))? - ); - } + // The fee types are present as a ArgGroup in clap that in which declaring multiple arguments is not allowed. + // Therefore we can switch over the returned values of each with a guarantee that only one or none are set. + // In the case of none being set we return a default `max_fee`. + let estimate = match ( + &self.price_estimate.max_fee, + &self.price_estimate.custom_fee_estimate, + self.price_estimate.instant_fee_estimate, + self.price_estimate.default_fee_estimate, + ) { + (Some(max_fee), None, false, false) => { + if !max_fee.ends_with("ether") { + error!("`max_fee` should be in the format XX.XXether"); + Err(SubmitError::EthereumProviderError( + "Error while parsing `max_fee`".to_string(), + ))? + } - if let Some(price_est) = &self.price_estimate { - let estimate = PriceEstimate::try_from(price_est.clone()) - .map_err(|e| SubmitError::GenericError(e.to_string()))?; - return estimate_fee(&self.eth_rpc_url, estimate) + let max_fee_ether = max_fee.replace("ether", ""); + parse_ether(&max_fee_ether).map_err(|e| { + SubmitError::EthereumProviderError(format!( + "Error while parsing `max_fee`: {}", + e + )) + })? + } + (None, Some(number_proofs_in_batch), false, false) => estimate_fee( + &self.eth_rpc_url, + PriceEstimate::Custom(*number_proofs_in_batch), + ) + .await + .map_err(AlignedError::FeeEstimateError)?, + (None, None, true, false) => estimate_fee(&self.eth_rpc_url, PriceEstimate::Instant) .await - .map_err(AlignedError::FeeEstimateError); - } - - // Fallback to default value - Ok(U256::from_str("1300000000000000") - .map_err(|e| SubmitError::GenericError(e.to_string()))?) + .map_err(AlignedError::FeeEstimateError)?, + (None, None, false, true) => estimate_fee(&self.eth_rpc_url, PriceEstimate::Default) + .await + .map_err(AlignedError::FeeEstimateError)?, + _ => U256::from_dec_str("13000000000000") + .map_err(|e| SubmitError::GenericError(e.to_string()))?, + }; + Ok(estimate) } } From 33b1044e075b0bd53de308d9c7b5dfaca98cfb06 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Thu, 5 Dec 2024 20:33:49 -0300 Subject: [PATCH 16/37] remove unneeded TryFrom --- batcher/aligned-sdk/src/core/types.rs | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/batcher/aligned-sdk/src/core/types.rs b/batcher/aligned-sdk/src/core/types.rs index e1d927a89..eb95e0634 100644 --- a/batcher/aligned-sdk/src/core/types.rs +++ b/batcher/aligned-sdk/src/core/types.rs @@ -94,33 +94,6 @@ pub enum PriceEstimate { Custom(usize), } -impl TryFrom for PriceEstimate { - type Error = String; - - fn try_from(value: String) -> Result { - let val = match value.as_str() { - "default" => Self::Default, - "instant" => Self::Instant, - s if s.starts_with("custom") => { - let n = s - .split_whitespace() - .nth(1) - .ok_or("Failed to Parse: `number_proofs_per_batch` not supplied, correct usage \"custom \" (note quotations)")? - .parse() - .map_err(|_| "Failed to Parse: Value of `number_proofs_per_batch` invalid , correct usage \"custom \" (note quotations)")?; - PriceEstimate::Custom(n) - } - _ => { - return Err( - "Invalid price estimate, possible values are: \"default\", \"instant\", \"custom \"" - .to_string(), - ) - } - }; - Ok(val) - } -} - #[derive(Debug, Serialize, Deserialize, Clone, Default)] pub struct VerificationDataCommitment { pub proof_commitment: [u8; 32], From 8cae2c98a16e1a1b77e78b1cec0b7c3e09e1f7d3 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Thu, 5 Dec 2024 20:36:46 -0300 Subject: [PATCH 17/37] cmt nits --- batcher/aligned/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index b7af0a007..5e4bb74eb 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -152,9 +152,9 @@ pub struct PriceEstimateArgs { impl SubmitArgs { async fn get_max_fee(&self) -> Result { - // The fee types are present as a ArgGroup in clap that in which declaring multiple arguments is not allowed. - // Therefore we can switch over the returned values of each with a guarantee that only one or none are set. - // In the case of none being set we return a default `max_fee`. + // The fee types are present as a ArgGroup in clap in which declaring multiple arguments is not allowed. + // Therefore we switch over the returned values of each argument with as we assume that only one or none are set. + // In the case of none are set we return a default `max_fee`. let estimate = match ( &self.price_estimate.max_fee, &self.price_estimate.custom_fee_estimate, From 4e23678b390cbf872bf436caf16c98510c213c98 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Thu, 5 Dec 2024 23:33:36 -0300 Subject: [PATCH 18/37] make cases explicit instead of fun --- batcher/aligned/src/main.rs | 71 ++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index 5e4bb74eb..9095860eb 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -152,47 +152,46 @@ pub struct PriceEstimateArgs { impl SubmitArgs { async fn get_max_fee(&self) -> Result { - // The fee types are present as a ArgGroup in clap in which declaring multiple arguments is not allowed. - // Therefore we switch over the returned values of each argument with as we assume that only one or none are set. - // In the case of none are set we return a default `max_fee`. - let estimate = match ( - &self.price_estimate.max_fee, - &self.price_estimate.custom_fee_estimate, - self.price_estimate.instant_fee_estimate, - self.price_estimate.default_fee_estimate, - ) { - (Some(max_fee), None, false, false) => { - if !max_fee.ends_with("ether") { - error!("`max_fee` should be in the format XX.XXether"); - Err(SubmitError::EthereumProviderError( - "Error while parsing `max_fee`".to_string(), - ))? - } - - let max_fee_ether = max_fee.replace("ether", ""); - parse_ether(&max_fee_ether).map_err(|e| { - SubmitError::EthereumProviderError(format!( - "Error while parsing `max_fee`: {}", - e - )) - })? + if let Some(max_fee) = &self.price_estimate.max_fee { + if !max_fee.ends_with("ether") { + error!("`max_fee` should be in the format XX.XXether"); + Err(SubmitError::EthereumProviderError( + "Error while parsing `max_fee`".to_string(), + ))? } - (None, Some(number_proofs_in_batch), false, false) => estimate_fee( + + let max_fee_ether = max_fee.replace("ether", ""); + return Ok(parse_ether(&max_fee_ether).map_err(|e| { + SubmitError::EthereumProviderError(format!( + "Error while parsing `max_fee`: {}", + e + )) + })?) + } + + if let Some(number_proofs_in_batch) = &self.price_estimate.custom_fee_estimate { + return Ok(estimate_fee( &self.eth_rpc_url, PriceEstimate::Custom(*number_proofs_in_batch), ) .await - .map_err(AlignedError::FeeEstimateError)?, - (None, None, true, false) => estimate_fee(&self.eth_rpc_url, PriceEstimate::Instant) - .await - .map_err(AlignedError::FeeEstimateError)?, - (None, None, false, true) => estimate_fee(&self.eth_rpc_url, PriceEstimate::Default) - .await - .map_err(AlignedError::FeeEstimateError)?, - _ => U256::from_dec_str("13000000000000") - .map_err(|e| SubmitError::GenericError(e.to_string()))?, - }; - Ok(estimate) + .map_err(AlignedError::FeeEstimateError)?) + } + + if self.price_estimate.instant_fee_estimate { + return Ok(estimate_fee(&self.eth_rpc_url, PriceEstimate::Instant) + .await + .map_err(AlignedError::FeeEstimateError)?) + } + + if self.price_estimate.default_fee_estimate { + return Ok(estimate_fee(&self.eth_rpc_url, PriceEstimate::Instant) + .await + .map_err(AlignedError::FeeEstimateError)?) + } + + Ok(U256::from_dec_str("13000000000000") + .map_err(|e| SubmitError::GenericError(e.to_string()))?) } } From ac8e5b3ade1dd03446ba54051695949798d3b324 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Fri, 6 Dec 2024 04:28:56 -0300 Subject: [PATCH 19/37] clippy --- batcher/aligned/src/main.rs | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index 4fdca5c7c..9f6e28b56 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -152,7 +152,7 @@ pub struct PriceEstimateArgs { impl SubmitArgs { async fn get_max_fee(&self) -> Result { - if let Some(max_fee) = &self.price_estimate.max_fee { + if let Some(max_fee) = &self.price_estimate.max_fee { if !max_fee.ends_with("ether") { error!("`max_fee` should be in the format XX.XXether"); Err(SubmitError::EthereumProviderError( @@ -162,36 +162,33 @@ impl SubmitArgs { let max_fee_ether = max_fee.replace("ether", ""); return Ok(parse_ether(&max_fee_ether).map_err(|e| { - SubmitError::EthereumProviderError(format!( - "Error while parsing `max_fee`: {}", - e - )) - })?) + SubmitError::EthereumProviderError(format!("Error while parsing `max_fee`: {}", e)) + })?); } if let Some(number_proofs_in_batch) = &self.price_estimate.custom_fee_estimate { - return Ok(estimate_fee( + return estimate_fee( &self.eth_rpc_url, PriceEstimate::Custom(*number_proofs_in_batch), ) .await - .map_err(AlignedError::FeeEstimateError)?) + .map_err(AlignedError::FeeEstimateError); } if self.price_estimate.instant_fee_estimate { - return Ok(estimate_fee(&self.eth_rpc_url, PriceEstimate::Instant) - .await - .map_err(AlignedError::FeeEstimateError)?) + return estimate_fee(&self.eth_rpc_url, PriceEstimate::Instant) + .await + .map_err(AlignedError::FeeEstimateError); } if self.price_estimate.default_fee_estimate { - return Ok(estimate_fee(&self.eth_rpc_url, PriceEstimate::Instant) - .await - .map_err(AlignedError::FeeEstimateError)?) + return estimate_fee(&self.eth_rpc_url, PriceEstimate::Instant) + .await + .map_err(AlignedError::FeeEstimateError); } Ok(U256::from_dec_str("13000000000000") - .map_err(|e| SubmitError::GenericError(e.to_string()))?) + .map_err(|e| SubmitError::GenericError(e.to_string()))?) } } @@ -295,7 +292,6 @@ enum NetworkArg { Devnet, Holesky, HoleskyStage, - Mainnet, } impl From for Network { @@ -304,7 +300,6 @@ impl From for Network { NetworkArg::Devnet => Network::Devnet, NetworkArg::Holesky => Network::Holesky, NetworkArg::HoleskyStage => Network::HoleskyStage, - NetworkArg::Mainnet => Network::Mainnet, } } } @@ -516,13 +511,13 @@ async fn main() -> Result<(), AlignedError> { } DepositToBatcher(deposit_to_batcher_args) => { if !deposit_to_batcher_args.amount.ends_with("ether") { - error!("`amount` should be in the format XX.XXether"); + error!("Amount should be in the format XX.XXether"); return Ok(()); } - let amount_ether = deposit_to_batcher_args.amount.replace("ether", ""); + let amount = deposit_to_batcher_args.amount.replace("ether", ""); - let amount_wei = parse_ether(&amount_ether).map_err(|e| { + let amount_ether = parse_ether(&amount).map_err(|e| { SubmitError::EthereumProviderError(format!("Error while parsing amount: {}", e)) })?; @@ -553,7 +548,7 @@ async fn main() -> Result<(), AlignedError> { let client = SignerMiddleware::new(eth_rpc_provider.clone(), wallet.clone()); - match deposit_to_aligned(amount_wei, client, deposit_to_batcher_args.network.into()) + match deposit_to_aligned(amount_ether, client, deposit_to_batcher_args.network.into()) .await { Ok(receipt) => { From 620384bf6ae416ebebb8b869258acdc950d6e982 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Fri, 6 Dec 2024 09:57:00 -0300 Subject: [PATCH 20/37] docs + cmts + made function name more specific --- batcher/aligned-sdk/src/sdk.rs | 13 ++++++++----- batcher/aligned/src/main.rs | 6 +++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/batcher/aligned-sdk/src/sdk.rs b/batcher/aligned-sdk/src/sdk.rs index f478bfa4d..5d14d1350 100644 --- a/batcher/aligned-sdk/src/sdk.rs +++ b/batcher/aligned-sdk/src/sdk.rs @@ -140,12 +140,12 @@ pub async fn estimate_fee( // Price of 1 proof in 32 proof batch match estimate { PriceEstimate::Default => { - suggest_fee_per_proof(eth_rpc_url, DEFAULT_MAX_FEE_PROOF_NUMBER).await + fee_per_proof_in_batch(eth_rpc_url, DEFAULT_MAX_FEE_PROOF_NUMBER).await } PriceEstimate::Instant => { - suggest_fee_per_proof(eth_rpc_url, INSTANT_MAX_FEE_PROOF_NUMBER).await + fee_per_proof_in_batch(eth_rpc_url, INSTANT_MAX_FEE_PROOF_NUMBER).await } - PriceEstimate::Custom(n) => suggest_fee_per_proof(eth_rpc_url, n).await, + PriceEstimate::Custom(n) => fee_per_proof_in_batch(eth_rpc_url, n).await, } } @@ -160,7 +160,7 @@ pub async fn estimate_fee( /// # Errors /// * `EthereumProviderError` if there is an error in the connection with the RPC provider. /// * `EthereumGasPriceError` if there is an error retrieving the Ethereum gas price. -pub async fn suggest_fee_per_proof( +pub async fn fee_per_proof_in_batch( eth_rpc_url: &str, num_proofs_in_batch: usize, ) -> Result { @@ -175,7 +175,10 @@ pub async fn suggest_fee_per_proof( + ADDITIONAL_SUBMISSION_GAS_COST_PER_PROOF * num_proofs_in_batch as u128) / num_proofs_in_batch as u128; - // Price of 1 / `num_proofs_in_batch` proof batch + + // Price of 1 proof in a batch of size `num_proofs_in_batch` (i.e. 1 / `num_proofs_in_batch`). + // The computed price is adjusted with respect to the percentage multiplier from: + // https://github.com/yetanotherco/aligned_layer/blob/staging/batcher/aligned-batcher/src/lib.rs#L1401 let fee_per_proof = (U256::from(estimated_gas_per_proof) * gas_price * U256::from(GAS_PRICE_PERCENTAGE_MULTIPLIER)) diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index 9f6e28b56..d8547385d 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -125,13 +125,13 @@ pub struct SubmitArgs { #[group(required = false, multiple = false)] pub struct PriceEstimateArgs { #[arg( - name = "Max Fee", + name = "Max Fee (ether)", long = "max_fee", help = "Specifies the `max_fee` the user of the submitted proof in `ether`." )] max_fee: Option, // String because U256 expects hex #[arg( - name = "Price Estimate: Custom", + name = "NUMBER_PROOFS_IN_BATCH", long = "custom_fee_estimate", help = "Specifies a `max_fee` equivalent to the cost of paying 1 proof / `num_proofs_in_batch` allowing the user a user to estimate there `max_fee` precisely based on the `number_proofs_in_batch`." )] @@ -188,7 +188,7 @@ impl SubmitArgs { } Ok(U256::from_dec_str("13000000000000") - .map_err(|e| SubmitError::GenericError(e.to_string()))?) + .map_err(|e| SubmitError::GenericError(e.to_string()))?) // 13_000 gas per proof * 100 gwei gas price (upper bound) } } From dcd00a13022ccf0bd777d0c166ffca1d5b0c664c Mon Sep 17 00:00:00 2001 From: PatStiles Date: Fri, 6 Dec 2024 10:07:12 -0300 Subject: [PATCH 21/37] clippy --- batcher/aligned-sdk/src/sdk.rs | 3 +-- batcher/aligned/src/main.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/batcher/aligned-sdk/src/sdk.rs b/batcher/aligned-sdk/src/sdk.rs index 5d14d1350..6ef58edfe 100644 --- a/batcher/aligned-sdk/src/sdk.rs +++ b/batcher/aligned-sdk/src/sdk.rs @@ -175,8 +175,7 @@ pub async fn fee_per_proof_in_batch( + ADDITIONAL_SUBMISSION_GAS_COST_PER_PROOF * num_proofs_in_batch as u128) / num_proofs_in_batch as u128; - - // Price of 1 proof in a batch of size `num_proofs_in_batch` (i.e. 1 / `num_proofs_in_batch`). + // Price of 1 proof in a batch of size `num_proofs_in_batch` i.e. (1 / `num_proofs_in_batch`). // The computed price is adjusted with respect to the percentage multiplier from: // https://github.com/yetanotherco/aligned_layer/blob/staging/batcher/aligned-batcher/src/lib.rs#L1401 let fee_per_proof = (U256::from(estimated_gas_per_proof) diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index d8547385d..03397fb99 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -188,7 +188,7 @@ impl SubmitArgs { } Ok(U256::from_dec_str("13000000000000") - .map_err(|e| SubmitError::GenericError(e.to_string()))?) // 13_000 gas per proof * 100 gwei gas price (upper bound) + .map_err(|e| SubmitError::GenericError(e.to_string()))?) // 13_000 gas per proof * 100 gwei gas price (upper bound) } } From 4482459f7858403a1ad68c7cf89a35404acd94a1 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Fri, 6 Dec 2024 12:19:03 -0300 Subject: [PATCH 22/37] marcos comments --- batcher/aligned-sdk/src/core/errors.rs | 2 +- batcher/aligned/src/main.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/batcher/aligned-sdk/src/core/errors.rs b/batcher/aligned-sdk/src/core/errors.rs index 52485a708..6b51ab2f7 100644 --- a/batcher/aligned-sdk/src/core/errors.rs +++ b/batcher/aligned-sdk/src/core/errors.rs @@ -57,7 +57,7 @@ impl fmt::Display for AlignedError { AlignedError::SubmitError(e) => write!(f, "Submit error: {}", e), AlignedError::VerificationError(e) => write!(f, "Verification error: {}", e), AlignedError::ChainIdError(e) => write!(f, "Chain ID error: {}", e), - AlignedError::FeeEstimateError(e) => write!(f, "Max fee estimate error: {}", e), + AlignedError::FeeEstimateError(e) => write!(f, "Fee estimate error: {}", e), AlignedError::FileError(e) => write!(f, "File error: {}", e), } } diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index 03397fb99..99265521d 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -127,7 +127,7 @@ pub struct PriceEstimateArgs { #[arg( name = "Max Fee (ether)", long = "max_fee", - help = "Specifies the `max_fee` the user of the submitted proof in `ether`." + help = "Specifies the maximum fee (`max_fee`) the user is willing to pay for the submitted proof, in Ether." )] max_fee: Option, // String because U256 expects hex #[arg( @@ -139,13 +139,13 @@ pub struct PriceEstimateArgs { #[arg( name = "Price Estimate: Instant", long = "instant_fee_estimate", - help = "Specifies a `max_fee` equivalent to the cost of paying for an entire batch ensuring the user's proof is included instantly." + help = "Specifies a `max_fee` that covers the cost of paying for the entire batch, ensuring the proof is included instantly." )] instant_fee_estimate: bool, #[arg( name = "Price Estimate: Default", long = "default_fee_estimate", - help = "Specifies a `max_fee` equivalent to the cost of paying for one proof within a batch of 10 proofs ie. 1 / 10 proofs. This estimates a default `max_fee` the user should specify for including there proof within the batch." + help = "Specifies a default `max_fee` based on the cost of one proof within a batch of 10 proofs, providing a standard fee for batch inclusion." )] default_fee_estimate: bool, } From 4ffab999ad5e6bc17ccf64e398bf9f9852e59137 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Fri, 6 Dec 2024 13:19:13 -0300 Subject: [PATCH 23/37] marcos comments --- batcher/aligned/src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index 99265521d..d12771481 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -182,7 +182,7 @@ impl SubmitArgs { } if self.price_estimate.default_fee_estimate { - return estimate_fee(&self.eth_rpc_url, PriceEstimate::Instant) + return estimate_fee(&self.eth_rpc_url, PriceEstimate::Default) .await .map_err(AlignedError::FeeEstimateError); } @@ -292,6 +292,7 @@ enum NetworkArg { Devnet, Holesky, HoleskyStage, + Mainnet } impl From for Network { @@ -300,6 +301,7 @@ impl From for Network { NetworkArg::Devnet => Network::Devnet, NetworkArg::Holesky => Network::Holesky, NetworkArg::HoleskyStage => Network::HoleskyStage, + NetworkArg::Mainnet => Network::Mainnet, } } } @@ -347,9 +349,8 @@ async fn main() -> Result<(), AlignedError> { })?; let eth_rpc_url = submit_args.eth_rpc_url.clone(); - // `max_fee` is required unless `price_estimate` is present. let max_fee_wei = submit_args.get_max_fee().await?; - info!("max_fee: {} ether", format_ether(max_fee_wei)); + info!("Will send proof with an estimated max_fee of: {}ether", format_ether(max_fee_wei)); let repetitions = submit_args.repetitions; let connect_addr = submit_args.batcher_url.clone(); From ff5ff80bd7f39d5ee1e2b88f21f8f1c21b6d4a68 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Fri, 6 Dec 2024 13:21:45 -0300 Subject: [PATCH 24/37] fmt --- batcher/aligned/src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index d12771481..872702800 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -292,7 +292,7 @@ enum NetworkArg { Devnet, Holesky, HoleskyStage, - Mainnet + Mainnet, } impl From for Network { @@ -350,7 +350,10 @@ async fn main() -> Result<(), AlignedError> { let eth_rpc_url = submit_args.eth_rpc_url.clone(); let max_fee_wei = submit_args.get_max_fee().await?; - info!("Will send proof with an estimated max_fee of: {}ether", format_ether(max_fee_wei)); + info!( + "Will send proof with an estimated max_fee of: {}ether", + format_ether(max_fee_wei) + ); let repetitions = submit_args.repetitions; let connect_addr = submit_args.batcher_url.clone(); From 430b989b4d2954fc727c48a4b2cc31d26a65ccb9 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Fri, 6 Dec 2024 19:44:41 -0300 Subject: [PATCH 25/37] address Uri's comments + clippy + fmt --- batcher/aligned-sdk/src/core/constants.rs | 6 +++--- batcher/aligned-sdk/src/core/types.rs | 2 +- batcher/aligned-sdk/src/sdk.rs | 24 +++++++++++------------ batcher/aligned/src/main.rs | 24 +++++++++++------------ 4 files changed, 27 insertions(+), 29 deletions(-) diff --git a/batcher/aligned-sdk/src/core/constants.rs b/batcher/aligned-sdk/src/core/constants.rs index 2190f6ae4..e0564946d 100644 --- a/batcher/aligned-sdk/src/core/constants.rs +++ b/batcher/aligned-sdk/src/core/constants.rs @@ -19,12 +19,12 @@ pub const PERCENTAGE_DIVIDER: u128 = 100; /// SDK /// /// Number of proofs we a batch for estimation. -/// This is the number of proofs in a batch of size n, where we set n = 32. +/// This is the number of proofs in a batch of size 1. /// i.e. the user pays for the entire batch and his proof is instantly submitted. -pub const INSTANT_MAX_FEE_PROOF_NUMBER: usize = 1; +pub const INSTANT_MAX_FEE_BATCH_SIZE: usize = 1; /// Estimated number of proofs for batch submission. /// This corresponds to the number of proofs to compute for a default max_fee. -pub const DEFAULT_MAX_FEE_PROOF_NUMBER: usize = 10; +pub const DEFAULT_MAX_FEE_BATCH_SIZE: usize = 16; /// Ethereum calls retry constants pub const ETHEREUM_CALL_MIN_RETRY_DELAY: u64 = 500; // milliseconds diff --git a/batcher/aligned-sdk/src/core/types.rs b/batcher/aligned-sdk/src/core/types.rs index 4ab115cce..afa0e7108 100644 --- a/batcher/aligned-sdk/src/core/types.rs +++ b/batcher/aligned-sdk/src/core/types.rs @@ -88,7 +88,7 @@ impl NoncedVerificationData { // Defines an estimate price preference for the user. #[derive(Debug, Serialize, Deserialize, Clone)] -pub enum PriceEstimate { +pub enum FeeEstimateType { Default, Instant, Custom(usize), diff --git a/batcher/aligned-sdk/src/sdk.rs b/batcher/aligned-sdk/src/sdk.rs index 6ef58edfe..183476758 100644 --- a/batcher/aligned-sdk/src/sdk.rs +++ b/batcher/aligned-sdk/src/sdk.rs @@ -8,13 +8,13 @@ use crate::{ core::{ constants::{ ADDITIONAL_SUBMISSION_GAS_COST_PER_PROOF, CONSTANT_GAS_COST, - DEFAULT_MAX_FEE_PROOF_NUMBER, GAS_PRICE_PERCENTAGE_MULTIPLIER, - INSTANT_MAX_FEE_PROOF_NUMBER, PERCENTAGE_DIVIDER, + DEFAULT_MAX_FEE_BATCH_SIZE, GAS_PRICE_PERCENTAGE_MULTIPLIER, + INSTANT_MAX_FEE_BATCH_SIZE, PERCENTAGE_DIVIDER, }, errors::{self, GetNonceError}, types::{ - AlignedVerificationData, ClientMessage, GetNonceResponseMessage, Network, - PriceEstimate, ProvingSystemId, VerificationData, + AlignedVerificationData, ClientMessage, FeeEstimateType, GetNonceResponseMessage, + Network, ProvingSystemId, VerificationData, }, }, eth::{ @@ -118,7 +118,7 @@ pub async fn submit_multiple_and_wait_verification( /// Returns the estimated `max_fee` depending on the batch inclusion preference of the user, computed based on the current gas price, and the number of proofs in a batch. /// NOTE: The `max_fee` is computed from an rpc nodes max priority gas price. -/// To estimate the `max_fee` of a batch we use a compute the `max_fee` with respect to a batch size of 1 (Instant), 10 (Default), or `number_proofs_in_batch` (Custom). +/// To estimate the `max_fee` of a batch we compute it based on a batch size of 1 (Instant), 10 (Default), or `number_proofs_in_batch` (Custom). /// The `max_fee` estimates therefore are: /// * `Default`: Specifies a `max_fee` equivalent to the cost of paying for one proof within a batch of 10 proofs ie. 1 / 10 proofs. /// This estimates a default `max_fee` the user should specify for including there proof within the batch. @@ -135,17 +135,17 @@ pub async fn submit_multiple_and_wait_verification( /// * `EthereumGasPriceError` if there is an error retrieving the Ethereum gas price. pub async fn estimate_fee( eth_rpc_url: &str, - estimate: PriceEstimate, + estimate: FeeEstimateType, ) -> Result { // Price of 1 proof in 32 proof batch match estimate { - PriceEstimate::Default => { - fee_per_proof_in_batch(eth_rpc_url, DEFAULT_MAX_FEE_PROOF_NUMBER).await + FeeEstimateType::Default => { + calculate_fee_per_proof_in_batch(eth_rpc_url, DEFAULT_MAX_FEE_BATCH_SIZE).await } - PriceEstimate::Instant => { - fee_per_proof_in_batch(eth_rpc_url, INSTANT_MAX_FEE_PROOF_NUMBER).await + FeeEstimateType::Instant => { + calculate_fee_per_proof_in_batch(eth_rpc_url, INSTANT_MAX_FEE_BATCH_SIZE).await } - PriceEstimate::Custom(n) => fee_per_proof_in_batch(eth_rpc_url, n).await, + FeeEstimateType::Custom(n) => calculate_fee_per_proof_in_batch(eth_rpc_url, n).await, } } @@ -160,7 +160,7 @@ pub async fn estimate_fee( /// # Errors /// * `EthereumProviderError` if there is an error in the connection with the RPC provider. /// * `EthereumGasPriceError` if there is an error retrieving the Ethereum gas price. -pub async fn fee_per_proof_in_batch( +pub async fn calculate_fee_per_proof_in_batch( eth_rpc_url: &str, num_proofs_in_batch: usize, ) -> Result { diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index 872702800..1abff9e7b 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -6,7 +6,7 @@ use std::path::PathBuf; use std::str::FromStr; use aligned_sdk::communication::serialization::cbor_deserialize; -use aligned_sdk::core::types::PriceEstimate; +use aligned_sdk::core::types::FeeEstimateType; use aligned_sdk::core::{ errors::{AlignedError, SubmitError}, types::{AlignedVerificationData, Network, ProvingSystemId, VerificationData}, @@ -110,7 +110,7 @@ pub struct SubmitArgs { #[arg(name = "Private key", long = "private_key")] private_key: Option, #[command(flatten)] - price_estimate: PriceEstimateArgs, + fee_type: FeeType, #[arg(name = "Nonce", long = "nonce")] nonce: Option, // String because U256 expects hex #[arg( @@ -123,7 +123,7 @@ pub struct SubmitArgs { #[derive(Args, Debug)] #[group(required = false, multiple = false)] -pub struct PriceEstimateArgs { +pub struct FeeType { #[arg( name = "Max Fee (ether)", long = "max_fee", @@ -137,13 +137,11 @@ pub struct PriceEstimateArgs { )] custom_fee_estimate: Option, #[arg( - name = "Price Estimate: Instant", long = "instant_fee_estimate", help = "Specifies a `max_fee` that covers the cost of paying for the entire batch, ensuring the proof is included instantly." )] instant_fee_estimate: bool, #[arg( - name = "Price Estimate: Default", long = "default_fee_estimate", help = "Specifies a default `max_fee` based on the cost of one proof within a batch of 10 proofs, providing a standard fee for batch inclusion." )] @@ -152,7 +150,7 @@ pub struct PriceEstimateArgs { impl SubmitArgs { async fn get_max_fee(&self) -> Result { - if let Some(max_fee) = &self.price_estimate.max_fee { + if let Some(max_fee) = &self.fee_type.max_fee { if !max_fee.ends_with("ether") { error!("`max_fee` should be in the format XX.XXether"); Err(SubmitError::EthereumProviderError( @@ -161,28 +159,28 @@ impl SubmitArgs { } let max_fee_ether = max_fee.replace("ether", ""); - return Ok(parse_ether(&max_fee_ether).map_err(|e| { + return Ok(parse_ether(max_fee_ether).map_err(|e| { SubmitError::EthereumProviderError(format!("Error while parsing `max_fee`: {}", e)) })?); } - if let Some(number_proofs_in_batch) = &self.price_estimate.custom_fee_estimate { + if let Some(number_proofs_in_batch) = &self.fee_type.custom_fee_estimate { return estimate_fee( &self.eth_rpc_url, - PriceEstimate::Custom(*number_proofs_in_batch), + FeeEstimateType::Custom(*number_proofs_in_batch), ) .await .map_err(AlignedError::FeeEstimateError); } - if self.price_estimate.instant_fee_estimate { - return estimate_fee(&self.eth_rpc_url, PriceEstimate::Instant) + if self.fee_type.instant_fee_estimate { + return estimate_fee(&self.eth_rpc_url, FeeEstimateType::Instant) .await .map_err(AlignedError::FeeEstimateError); } - if self.price_estimate.default_fee_estimate { - return estimate_fee(&self.eth_rpc_url, PriceEstimate::Default) + if self.fee_type.default_fee_estimate { + return estimate_fee(&self.eth_rpc_url, FeeEstimateType::Default) .await .map_err(AlignedError::FeeEstimateError); } From 61ab98c32e9963ef159fb09895ca82d92140dc90 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Fri, 6 Dec 2024 20:03:19 -0300 Subject: [PATCH 26/37] nit --- batcher/aligned-sdk/src/sdk.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher/aligned-sdk/src/sdk.rs b/batcher/aligned-sdk/src/sdk.rs index 183476758..5a3aca867 100644 --- a/batcher/aligned-sdk/src/sdk.rs +++ b/batcher/aligned-sdk/src/sdk.rs @@ -135,7 +135,7 @@ pub async fn submit_multiple_and_wait_verification( /// * `EthereumGasPriceError` if there is an error retrieving the Ethereum gas price. pub async fn estimate_fee( eth_rpc_url: &str, - estimate: FeeEstimateType, + estimate_type: FeeEstimateType, ) -> Result { // Price of 1 proof in 32 proof batch match estimate { From e03f75a4d362473bcecde96f947d19e27ac2a33c Mon Sep 17 00:00:00 2001 From: PatStiles Date: Fri, 6 Dec 2024 20:06:27 -0300 Subject: [PATCH 27/37] missing name change --- batcher/aligned-sdk/src/sdk.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher/aligned-sdk/src/sdk.rs b/batcher/aligned-sdk/src/sdk.rs index 5a3aca867..0b1ef213e 100644 --- a/batcher/aligned-sdk/src/sdk.rs +++ b/batcher/aligned-sdk/src/sdk.rs @@ -138,7 +138,7 @@ pub async fn estimate_fee( estimate_type: FeeEstimateType, ) -> Result { // Price of 1 proof in 32 proof batch - match estimate { + match estimate_type { FeeEstimateType::Default => { calculate_fee_per_proof_in_batch(eth_rpc_url, DEFAULT_MAX_FEE_BATCH_SIZE).await } From 170f3a3d81b7c1f33eded9c53ebe8447defdc059 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Fri, 6 Dec 2024 20:34:15 -0300 Subject: [PATCH 28/37] gaston's comments --- batcher/aligned-sdk/src/core/constants.rs | 9 ++++----- batcher/aligned-sdk/src/sdk.rs | 13 ++++++------- batcher/aligned/src/main.rs | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/batcher/aligned-sdk/src/core/constants.rs b/batcher/aligned-sdk/src/core/constants.rs index e0564946d..f554b7734 100644 --- a/batcher/aligned-sdk/src/core/constants.rs +++ b/batcher/aligned-sdk/src/core/constants.rs @@ -18,12 +18,11 @@ pub const OVERRIDE_GAS_PRICE_PERCENTAGE_MULTIPLIER: u128 = 120; // gasPrice modi pub const PERCENTAGE_DIVIDER: u128 = 100; /// SDK /// -/// Number of proofs we a batch for estimation. -/// This is the number of proofs in a batch of size 1. -/// i.e. the user pays for the entire batch and his proof is instantly submitted. +/// Constants used for `max_fee` estimation in the sdk `estimate_fee()` function. +/// The number of proofs in a batch to compute the `Instant` fee estimate for proof submission to Aligned. +/// i.e. the user pays for the entire batch and his proof is instantly submitted, therefore a batch of one proof. pub const INSTANT_MAX_FEE_BATCH_SIZE: usize = 1; -/// Estimated number of proofs for batch submission. -/// This corresponds to the number of proofs to compute for a default max_fee. +/// The number of proofs in a batch to compute the `Default` fee estimate for proof submission to Aligned. pub const DEFAULT_MAX_FEE_BATCH_SIZE: usize = 16; /// Ethereum calls retry constants diff --git a/batcher/aligned-sdk/src/sdk.rs b/batcher/aligned-sdk/src/sdk.rs index 0b1ef213e..cca6689b8 100644 --- a/batcher/aligned-sdk/src/sdk.rs +++ b/batcher/aligned-sdk/src/sdk.rs @@ -118,18 +118,18 @@ pub async fn submit_multiple_and_wait_verification( /// Returns the estimated `max_fee` depending on the batch inclusion preference of the user, computed based on the current gas price, and the number of proofs in a batch. /// NOTE: The `max_fee` is computed from an rpc nodes max priority gas price. -/// To estimate the `max_fee` of a batch we compute it based on a batch size of 1 (Instant), 10 (Default), or `number_proofs_in_batch` (Custom). +/// To estimate the `max_fee` of a batch we compute it based on a batch size of 1 (Instant), 16 (Default), or a user supplied `number_proofs_in_batch` (Custom). /// The `max_fee` estimates therefore are: -/// * `Default`: Specifies a `max_fee` equivalent to the cost of paying for one proof within a batch of 10 proofs ie. 1 / 10 proofs. +/// * `Default`: Specifies a `max_fee` equivalent to the cost of paying for one proof within a batch of 16 proofs ie. 1 / 16 proofs. /// This estimates a default `max_fee` the user should specify for including there proof within the batch. /// * `Instant`: Specifies a `max_fee` equivalent to the cost of paying for an entire batch ensuring the user's proof is included instantly. -/// * `Custom (number_proofs_in_batch)`: Specifies a `max_fee` equivalent to the cost of paying 1 proof / `num_proofs_in_batch` allowing the user a user to estimate there `max_fee` precisely based on the `number_proofs_in_batch`. +/// * `Custom (number_proofs_in_batch)`: Specifies a `max_fee` equivalent to the cost of paying 1 proof / `num_proofs_in_batch` allowing the user a user to estimate the `max_fee` precisely based on the `number_proofs_in_batch`. /// /// # Arguments /// * `eth_rpc_url` - The URL of the Ethereum RPC node. -/// * `estimate` - Enum specifying the type of price estimate: MIN, DEFAULT, INSTANT. +/// * `estimate_type` - Enum specifying the type of price estimate: Default, Instant. Custom(usize) /// # Returns -/// The estimated `max_fee` in gas for a proof based on the users `PriceEstimate` as a `U256`. +/// The estimated `max_fee` in gas for a proof based on the users `FeeEstimateType` as a `U256`. /// # Errors /// * `EthereumProviderError` if there is an error in the connection with the RPC provider. /// * `EthereumGasPriceError` if there is an error retrieving the Ethereum gas price. @@ -137,7 +137,6 @@ pub async fn estimate_fee( eth_rpc_url: &str, estimate_type: FeeEstimateType, ) -> Result { - // Price of 1 proof in 32 proof batch match estimate_type { FeeEstimateType::Default => { calculate_fee_per_proof_in_batch(eth_rpc_url, DEFAULT_MAX_FEE_BATCH_SIZE).await @@ -170,7 +169,7 @@ pub async fn calculate_fee_per_proof_in_batch( })?; let gas_price = fetch_gas_price(ð_rpc_provider).await?; - // Cost for estimate `num_proofs_per_batch` proofs + // Cost for estimate `num_proofs_in_batch` proofs let estimated_gas_per_proof = (CONSTANT_GAS_COST + ADDITIONAL_SUBMISSION_GAS_COST_PER_PROOF * num_proofs_in_batch as u128) / num_proofs_in_batch as u128; diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index 1abff9e7b..1682b9b5c 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -133,7 +133,7 @@ pub struct FeeType { #[arg( name = "NUMBER_PROOFS_IN_BATCH", long = "custom_fee_estimate", - help = "Specifies a `max_fee` equivalent to the cost of paying 1 proof / `num_proofs_in_batch` allowing the user a user to estimate there `max_fee` precisely based on the `number_proofs_in_batch`." + help = "Specifies a `max_fee` equivalent to the cost of paying 1 proof / `num_proofs_in_batch` allowing the user a user to estimate a `max_fee` precisely based on the `number_proofs_in_batch`." )] custom_fee_estimate: Option, #[arg( From f8d83082cca7fc929f6a5769c506d0c8eb66e63c Mon Sep 17 00:00:00 2001 From: PatStiles Date: Fri, 6 Dec 2024 20:36:06 -0300 Subject: [PATCH 29/37] naming nit --- batcher/aligned-sdk/src/core/errors.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher/aligned-sdk/src/core/errors.rs b/batcher/aligned-sdk/src/core/errors.rs index 6b51ab2f7..f0a358e54 100644 --- a/batcher/aligned-sdk/src/core/errors.rs +++ b/batcher/aligned-sdk/src/core/errors.rs @@ -269,7 +269,7 @@ impl fmt::Display for ChainIdError { pub enum FeeEstimateError { EthereumProviderError(String), EthereumGasPriceError(String), - PriceEstimateParseError(String), + FeeEstimateParseError(String), } impl fmt::Display for FeeEstimateError { From ad111db7a8f18772004e1cb228a8b8517b818eea Mon Sep 17 00:00:00 2001 From: PatStiles Date: Fri, 6 Dec 2024 20:41:51 -0300 Subject: [PATCH 30/37] can variable names for price in DepositToBatcher that got mixed in merge + doc nits --- batcher/aligned-sdk/src/core/errors.rs | 2 +- batcher/aligned-sdk/src/sdk.rs | 2 +- batcher/aligned/src/main.rs | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/batcher/aligned-sdk/src/core/errors.rs b/batcher/aligned-sdk/src/core/errors.rs index f0a358e54..31fc3ee54 100644 --- a/batcher/aligned-sdk/src/core/errors.rs +++ b/batcher/aligned-sdk/src/core/errors.rs @@ -281,7 +281,7 @@ impl fmt::Display for FeeEstimateError { FeeEstimateError::EthereumGasPriceError(e) => { write!(f, "Failed to retreive the current gas price: {}", e) } - FeeEstimateError::PriceEstimateParseError(e) => { + FeeEstimateError::FeeEstimateParseError(e) => { write!(f, "Error parsing PriceEstimate: {}", e) } } diff --git a/batcher/aligned-sdk/src/sdk.rs b/batcher/aligned-sdk/src/sdk.rs index cca6689b8..4c43eedac 100644 --- a/batcher/aligned-sdk/src/sdk.rs +++ b/batcher/aligned-sdk/src/sdk.rs @@ -123,7 +123,7 @@ pub async fn submit_multiple_and_wait_verification( /// * `Default`: Specifies a `max_fee` equivalent to the cost of paying for one proof within a batch of 16 proofs ie. 1 / 16 proofs. /// This estimates a default `max_fee` the user should specify for including there proof within the batch. /// * `Instant`: Specifies a `max_fee` equivalent to the cost of paying for an entire batch ensuring the user's proof is included instantly. -/// * `Custom (number_proofs_in_batch)`: Specifies a `max_fee` equivalent to the cost of paying 1 proof / `num_proofs_in_batch` allowing the user a user to estimate the `max_fee` precisely based on the `number_proofs_in_batch`. +/// * `Custom (number_proofs_in_batch)`: Specifies a `max_fee` equivalent to the cost of paying 1 proof / `number_proofs_in_batch` allowing the user a user to estimate the `max_fee` precisely based on the `number_proofs_in_batch`. /// /// # Arguments /// * `eth_rpc_url` - The URL of the Ethereum RPC node. diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index 1682b9b5c..4256cd53d 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -133,7 +133,7 @@ pub struct FeeType { #[arg( name = "NUMBER_PROOFS_IN_BATCH", long = "custom_fee_estimate", - help = "Specifies a `max_fee` equivalent to the cost of paying 1 proof / `num_proofs_in_batch` allowing the user a user to estimate a `max_fee` precisely based on the `number_proofs_in_batch`." + help = "Specifies a `max_fee` equivalent to the cost of paying (1 proof / `num_proofs_in_batch`) allowing the user to estimate a `max_fee` precisely based on the `number_proofs_in_batch`." )] custom_fee_estimate: Option, #[arg( @@ -143,7 +143,7 @@ pub struct FeeType { instant_fee_estimate: bool, #[arg( long = "default_fee_estimate", - help = "Specifies a default `max_fee` based on the cost of one proof within a batch of 10 proofs, providing a standard fee for batch inclusion." + help = "Specifies a default `max_fee` based on the cost of one proof within a batch of 16 proofs, providing a standard fee for batch inclusion." )] default_fee_estimate: bool, } @@ -517,9 +517,9 @@ async fn main() -> Result<(), AlignedError> { return Ok(()); } - let amount = deposit_to_batcher_args.amount.replace("ether", ""); + let amount_ether = deposit_to_batcher_args.amount.replace("ether", ""); - let amount_ether = parse_ether(&amount).map_err(|e| { + let amount_wei = parse_ether(&amount_ether).map_err(|e| { SubmitError::EthereumProviderError(format!("Error while parsing amount: {}", e)) })?; @@ -550,7 +550,7 @@ async fn main() -> Result<(), AlignedError> { let client = SignerMiddleware::new(eth_rpc_provider.clone(), wallet.clone()); - match deposit_to_aligned(amount_ether, client, deposit_to_batcher_args.network.into()) + match deposit_to_aligned(amount_wei, client, deposit_to_batcher_args.network.into()) .await { Ok(receipt) => { From 13efe4df07ff93e195dc8bf494f1eccacef55a8b Mon Sep 17 00:00:00 2001 From: PatStiles Date: Mon, 9 Dec 2024 10:28:29 -0300 Subject: [PATCH 31/37] change to 10 --- batcher/aligned-sdk/src/core/constants.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher/aligned-sdk/src/core/constants.rs b/batcher/aligned-sdk/src/core/constants.rs index f554b7734..d88829613 100644 --- a/batcher/aligned-sdk/src/core/constants.rs +++ b/batcher/aligned-sdk/src/core/constants.rs @@ -23,7 +23,7 @@ pub const PERCENTAGE_DIVIDER: u128 = 100; /// i.e. the user pays for the entire batch and his proof is instantly submitted, therefore a batch of one proof. pub const INSTANT_MAX_FEE_BATCH_SIZE: usize = 1; /// The number of proofs in a batch to compute the `Default` fee estimate for proof submission to Aligned. -pub const DEFAULT_MAX_FEE_BATCH_SIZE: usize = 16; +pub const DEFAULT_MAX_FEE_BATCH_SIZE: usize = 10; /// Ethereum calls retry constants pub const ETHEREUM_CALL_MIN_RETRY_DELAY: u64 = 500; // milliseconds From d1e4c9e295d88a0c5690fd03fba2bbaa307299a7 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Mon, 9 Dec 2024 16:11:33 -0300 Subject: [PATCH 32/37] uri's comments + nits + naming changes --- batcher/aligned-sdk/src/core/constants.rs | 3 ++- batcher/aligned-sdk/src/core/types.rs | 4 ++-- batcher/aligned-sdk/src/sdk.rs | 20 +++++++++++--------- batcher/aligned/src/main.rs | 16 ++++++---------- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/batcher/aligned-sdk/src/core/constants.rs b/batcher/aligned-sdk/src/core/constants.rs index d88829613..0dd055ae7 100644 --- a/batcher/aligned-sdk/src/core/constants.rs +++ b/batcher/aligned-sdk/src/core/constants.rs @@ -23,7 +23,8 @@ pub const PERCENTAGE_DIVIDER: u128 = 100; /// i.e. the user pays for the entire batch and his proof is instantly submitted, therefore a batch of one proof. pub const INSTANT_MAX_FEE_BATCH_SIZE: usize = 1; /// The number of proofs in a batch to compute the `Default` fee estimate for proof submission to Aligned. -pub const DEFAULT_MAX_FEE_BATCH_SIZE: usize = 10; +/// We define `16` as the `Default` setting as every 24 hours the batcher receives a batch of `16` proofs sent from Aligned to confirm the network is live. +pub const DEFAULT_MAX_FEE_BATCH_SIZE: usize = 16; /// Ethereum calls retry constants pub const ETHEREUM_CALL_MIN_RETRY_DELAY: u64 = 500; // milliseconds diff --git a/batcher/aligned-sdk/src/core/types.rs b/batcher/aligned-sdk/src/core/types.rs index afa0e7108..17006c550 100644 --- a/batcher/aligned-sdk/src/core/types.rs +++ b/batcher/aligned-sdk/src/core/types.rs @@ -86,9 +86,9 @@ impl NoncedVerificationData { } } -// Defines an estimate price preference for the user. +// Defines an price estimate type for the user. #[derive(Debug, Serialize, Deserialize, Clone)] -pub enum FeeEstimateType { +pub enum FeeEstimationType { Default, Instant, Custom(usize), diff --git a/batcher/aligned-sdk/src/sdk.rs b/batcher/aligned-sdk/src/sdk.rs index 4c43eedac..8470b8f2d 100644 --- a/batcher/aligned-sdk/src/sdk.rs +++ b/batcher/aligned-sdk/src/sdk.rs @@ -13,7 +13,7 @@ use crate::{ }, errors::{self, GetNonceError}, types::{ - AlignedVerificationData, ClientMessage, FeeEstimateType, GetNonceResponseMessage, + AlignedVerificationData, ClientMessage, FeeEstimationType, GetNonceResponseMessage, Network, ProvingSystemId, VerificationData, }, }, @@ -135,16 +135,18 @@ pub async fn submit_multiple_and_wait_verification( /// * `EthereumGasPriceError` if there is an error retrieving the Ethereum gas price. pub async fn estimate_fee( eth_rpc_url: &str, - estimate_type: FeeEstimateType, + fee_estimation_type: FeeEstimationType, ) -> Result { - match estimate_type { - FeeEstimateType::Default => { - calculate_fee_per_proof_in_batch(eth_rpc_url, DEFAULT_MAX_FEE_BATCH_SIZE).await + match fee_estimation_type { + FeeEstimationType::Default => { + calculate_fee_per_proof_for_batch_of_size(eth_rpc_url, DEFAULT_MAX_FEE_BATCH_SIZE).await } - FeeEstimateType::Instant => { - calculate_fee_per_proof_in_batch(eth_rpc_url, INSTANT_MAX_FEE_BATCH_SIZE).await + FeeEstimationType::Instant => { + calculate_fee_per_proof_for_batch_of_size(eth_rpc_url, INSTANT_MAX_FEE_BATCH_SIZE).await + } + FeeEstimationType::Custom(n) => { + calculate_fee_per_proof_for_batch_of_size(eth_rpc_url, n).await } - FeeEstimateType::Custom(n) => calculate_fee_per_proof_in_batch(eth_rpc_url, n).await, } } @@ -159,7 +161,7 @@ pub async fn estimate_fee( /// # Errors /// * `EthereumProviderError` if there is an error in the connection with the RPC provider. /// * `EthereumGasPriceError` if there is an error retrieving the Ethereum gas price. -pub async fn calculate_fee_per_proof_in_batch( +pub async fn calculate_fee_per_proof_for_batch_of_size( eth_rpc_url: &str, num_proofs_in_batch: usize, ) -> Result { diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index 4256cd53d..2a9968cc4 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -6,7 +6,7 @@ use std::path::PathBuf; use std::str::FromStr; use aligned_sdk::communication::serialization::cbor_deserialize; -use aligned_sdk::core::types::FeeEstimateType; +use aligned_sdk::core::types::FeeEstimationType; use aligned_sdk::core::{ errors::{AlignedError, SubmitError}, types::{AlignedVerificationData, Network, ProvingSystemId, VerificationData}, @@ -143,7 +143,7 @@ pub struct FeeType { instant_fee_estimate: bool, #[arg( long = "default_fee_estimate", - help = "Specifies a default `max_fee` based on the cost of one proof within a batch of 16 proofs, providing a standard fee for batch inclusion." + help = "Specifies a `max_fee`, based on the cost of one proof within a batch of 16 proofs, providing a `default` fee for batch inclusion." )] default_fee_estimate: bool, } @@ -167,26 +167,22 @@ impl SubmitArgs { if let Some(number_proofs_in_batch) = &self.fee_type.custom_fee_estimate { return estimate_fee( &self.eth_rpc_url, - FeeEstimateType::Custom(*number_proofs_in_batch), + FeeEstimationType::Custom(*number_proofs_in_batch), ) .await .map_err(AlignedError::FeeEstimateError); } if self.fee_type.instant_fee_estimate { - return estimate_fee(&self.eth_rpc_url, FeeEstimateType::Instant) + return estimate_fee(&self.eth_rpc_url, FeeEstimationType::Instant) .await .map_err(AlignedError::FeeEstimateError); - } - - if self.fee_type.default_fee_estimate { - return estimate_fee(&self.eth_rpc_url, FeeEstimateType::Default) + } else { + return estimate_fee(&self.eth_rpc_url, FeeEstimationType::Default) .await .map_err(AlignedError::FeeEstimateError); } - Ok(U256::from_dec_str("13000000000000") - .map_err(|e| SubmitError::GenericError(e.to_string()))?) // 13_000 gas per proof * 100 gwei gas price (upper bound) } } From 590c7d5ccdf1ae87eb4801bbead06634ca54df66 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Mon, 9 Dec 2024 16:29:20 -0300 Subject: [PATCH 33/37] add back tests --- batcher/aligned-sdk/src/sdk.rs | 47 ++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/batcher/aligned-sdk/src/sdk.rs b/batcher/aligned-sdk/src/sdk.rs index 8470b8f2d..f0a92ed14 100644 --- a/batcher/aligned-sdk/src/sdk.rs +++ b/batcher/aligned-sdk/src/sdk.rs @@ -811,3 +811,50 @@ fn save_response_json( Ok(()) } + +#[cfg(test)] +mod test { + //Public constants for convenience + pub const HOLESKY_PUBLIC_RPC_URL: &str = "https://ethereum-holesky-rpc.publicnode.com"; + use super::*; + + #[tokio::test] + async fn computed_max_fee_for_larger_batch_is_smaller() { + let small_fee = calculate_fee_per_proof_for_batch_of_size(HOLESKY_PUBLIC_RPC_URL, 2) + .await + .unwrap(); + let large_fee = calculate_fee_per_proof_for_batch_of_size(HOLESKY_PUBLIC_RPC_URL, 5) + .await + .unwrap(); + + assert!(small_fee < large_fee); + } + + #[tokio::test] + async fn computed_max_fee_for_more_proofs_larger_than_for_less_proofs() { + let small_fee = calculate_fee_per_proof_for_batch_of_size(HOLESKY_PUBLIC_RPC_URL, 20) + .await + .unwrap(); + let large_fee = calculate_fee_per_proof_for_batch_of_size(HOLESKY_PUBLIC_RPC_URL, 10) + .await + .unwrap(); + + assert!(small_fee < large_fee); + } + + #[tokio::test] + async fn estimate_fee_are_larger_than_one_another() { + let min_fee = estimate_fee(HOLESKY_PUBLIC_RPC_URL, FeeEstimationType::Custom(100)) + .await + .unwrap(); + let default_fee = estimate_fee(HOLESKY_PUBLIC_RPC_URL, FeeEstimationType::Default) + .await + .unwrap(); + let instant_fee = estimate_fee(HOLESKY_PUBLIC_RPC_URL, FeeEstimationType::Instant) + .await + .unwrap(); + + assert!(min_fee < default_fee); + assert!(default_fee < instant_fee); + } +} \ No newline at end of file From 543c0556fecfcd67bfd2760ea8a1ec135e019671 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Mon, 9 Dec 2024 16:35:08 -0300 Subject: [PATCH 34/37] clippy --- batcher/aligned/src/main.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index 2a9968cc4..b74611811 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -174,15 +174,14 @@ impl SubmitArgs { } if self.fee_type.instant_fee_estimate { - return estimate_fee(&self.eth_rpc_url, FeeEstimationType::Instant) + estimate_fee(&self.eth_rpc_url, FeeEstimationType::Instant) .await - .map_err(AlignedError::FeeEstimateError); + .map_err(AlignedError::FeeEstimateError) } else { - return estimate_fee(&self.eth_rpc_url, FeeEstimationType::Default) + estimate_fee(&self.eth_rpc_url, FeeEstimationType::Default) .await - .map_err(AlignedError::FeeEstimateError); + .map_err(AlignedError::FeeEstimateError) } - } } From 5471636157ade527953b5fb07c096ad5e6d80661 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Mon, 9 Dec 2024 16:36:20 -0300 Subject: [PATCH 35/37] fmt --- batcher/aligned-sdk/src/sdk.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher/aligned-sdk/src/sdk.rs b/batcher/aligned-sdk/src/sdk.rs index f0a92ed14..89f3979fd 100644 --- a/batcher/aligned-sdk/src/sdk.rs +++ b/batcher/aligned-sdk/src/sdk.rs @@ -857,4 +857,4 @@ mod test { assert!(min_fee < default_fee); assert!(default_fee < instant_fee); } -} \ No newline at end of file +} From 495787a27bb398419892cac07f26a05202787fac Mon Sep 17 00:00:00 2001 From: PatStiles Date: Tue, 10 Dec 2024 11:45:57 -0300 Subject: [PATCH 36/37] fix tests --- batcher/aligned-sdk/src/sdk.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/batcher/aligned-sdk/src/sdk.rs b/batcher/aligned-sdk/src/sdk.rs index 89f3979fd..d42ce4cdf 100644 --- a/batcher/aligned-sdk/src/sdk.rs +++ b/batcher/aligned-sdk/src/sdk.rs @@ -820,10 +820,10 @@ mod test { #[tokio::test] async fn computed_max_fee_for_larger_batch_is_smaller() { - let small_fee = calculate_fee_per_proof_for_batch_of_size(HOLESKY_PUBLIC_RPC_URL, 2) + let small_fee = calculate_fee_per_proof_for_batch_of_size(HOLESKY_PUBLIC_RPC_URL, 5) .await .unwrap(); - let large_fee = calculate_fee_per_proof_for_batch_of_size(HOLESKY_PUBLIC_RPC_URL, 5) + let large_fee = calculate_fee_per_proof_for_batch_of_size(HOLESKY_PUBLIC_RPC_URL, 2) .await .unwrap(); From 17c3ba8ef78d488970f006ab35234a4d89ae5ce6 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:19:58 -0300 Subject: [PATCH 37/37] feat: better msg --- batcher/aligned/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index b74611811..67d079012 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -344,7 +344,7 @@ async fn main() -> Result<(), AlignedError> { let eth_rpc_url = submit_args.eth_rpc_url.clone(); let max_fee_wei = submit_args.get_max_fee().await?; info!( - "Will send proof with an estimated max_fee of: {}ether", + "Will send each proof with an estimated max_fee of: {}ether", format_ether(max_fee_wei) ); let repetitions = submit_args.repetitions;