From 76dd96bb615adbd6be59ea0eb28f93bbac9f5daf Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Tue, 3 Oct 2023 11:14:17 +0300 Subject: [PATCH 01/26] implement gas oracle --- full-node/sov-ethereum/src/lib.rs | 36 ++ .../module-implementations/sov-evm/Cargo.toml | 1 + .../sov-evm/src/evm/gas_oracle.rs | 313 ++++++++++++++++++ .../sov-evm/src/evm/mod.rs | 1 + .../module-implementations/sov-evm/src/lib.rs | 2 +- 5 files changed, 352 insertions(+), 1 deletion(-) create mode 100644 module-system/module-implementations/sov-evm/src/evm/gas_oracle.rs diff --git a/full-node/sov-ethereum/src/lib.rs b/full-node/sov-ethereum/src/lib.rs index 264e5420a..f0e9880e8 100644 --- a/full-node/sov-ethereum/src/lib.rs +++ b/full-node/sov-ethereum/src/lib.rs @@ -3,6 +3,8 @@ mod batch_builder; #[cfg(feature = "experimental")] pub use experimental::{get_ethereum_rpc, Ethereum}; #[cfg(feature = "experimental")] +pub use sov_evm::gas_oracle; +#[cfg(feature = "experimental")] pub use sov_evm::DevSigner; #[cfg(feature = "experimental")] @@ -21,11 +23,13 @@ pub mod experimental { Address as RethAddress, TransactionSignedNoHash as RethTransactionSignedNoHash, U128, U256, }; use reth_rpc_types::{CallRequest, TransactionRequest, TypedTransactionRequest}; + use sov_evm::gas_oracle::{GasPriceOracle, GasPriceOracleConfig}; use sov_evm::{CallMessage, Evm, RlpEvmTransaction}; use sov_modules_api::transaction::Transaction; use sov_modules_api::utils::to_jsonrpsee_error_object; use sov_modules_api::{EncodeCall, WorkingSet}; use sov_rollup_interface::services::da::DaService; + use tokio::try_join; use super::batch_builder::EthBatchBuilder; #[cfg(feature = "local")] @@ -43,6 +47,7 @@ pub mod experimental { pub fn get_ethereum_rpc( da_service: Da, eth_rpc_config: EthRpcConfig, + gas_price_oracle_config: GasPriceOracleConfig, storage: C::Storage, ) -> RpcModule> { let mut rpc = RpcModule::new(Ethereum::new( @@ -50,6 +55,7 @@ pub mod experimental { da_service, Arc::new(Mutex::new(EthBatchBuilder::default())), eth_rpc_config, + gas_price_oracle_config, storage, )); @@ -62,6 +68,7 @@ pub mod experimental { da_service: Da, batch_builder: Arc>, eth_rpc_config: EthRpcConfig, + gas_price_oracle: GasPriceOracle, storage: C::Storage, } @@ -71,13 +78,17 @@ pub mod experimental { da_service: Da, batch_builder: Arc>, eth_rpc_config: EthRpcConfig, + gas_price_oracle_config: GasPriceOracleConfig, storage: C::Storage, ) -> Self { + let gas_price_oracle = + GasPriceOracle::new(Evm::::default(), gas_price_oracle_config); Self { nonces, da_service, batch_builder, eth_rpc_config, + gas_price_oracle, storage, } } @@ -149,6 +160,31 @@ pub mod experimental { fn register_rpc_methods( rpc: &mut RpcModule>, ) -> Result<(), jsonrpsee::core::Error> { + rpc.register_async_method("eth_gasPrice", |_, ethereum| async move { + let price = { + let mut working_set = WorkingSet::::new(ethereum.storage.clone()); + + let suggested_tip = ethereum + .gas_price_oracle + .suggest_tip_cap(&mut working_set) + .await + .unwrap(); + + let evm = Evm::::default(); + let base_fee = evm + .get_block_by_number(None, None, &mut working_set) + .unwrap() + .unwrap() + .header + .base_fee_per_gas + .unwrap_or_default(); + + suggested_tip + base_fee + }; + + Ok::(price) + })?; + rpc.register_async_method("eth_publishBatch", |params, ethereum| async move { let mut params_iter = params.sequence(); diff --git a/module-system/module-implementations/sov-evm/Cargo.toml b/module-system/module-implementations/sov-evm/Cargo.toml index ffa78cf1a..c4838cfd6 100644 --- a/module-system/module-implementations/sov-evm/Cargo.toml +++ b/module-system/module-implementations/sov-evm/Cargo.toml @@ -33,6 +33,7 @@ jsonrpsee = { workspace = true, features = [ ], optional = true } tracing = { workspace = true } derive_more = { workspace = true } +tokio = { workspace = true } lazy_static = "1.4.0" diff --git a/module-system/module-implementations/sov-evm/src/evm/gas_oracle.rs b/module-system/module-implementations/sov-evm/src/evm/gas_oracle.rs new file mode 100644 index 000000000..f78e2b2e2 --- /dev/null +++ b/module-system/module-implementations/sov-evm/src/evm/gas_oracle.rs @@ -0,0 +1,313 @@ +//! An implementation of the eth gas price oracle, used for providing gas price estimates based on +//! previous blocks. +use reth_primitives::constants::GWEI_TO_WEI; +use reth_primitives::{H256, U256}; +use serde::{Deserialize, Serialize}; +use sov_modules_api::{AccessoryWorkingSet, WorkingSet}; +use tokio::sync::Mutex; + + +use tracing::warn; + +use crate::error::rpc::{EthApiError, EthResult, RpcInvalidTransactionError}; +use crate::Evm; + +/// The number of transactions sampled in a block +pub const SAMPLE_NUMBER: u32 = 3; + +/// The default maximum gas price to use for the estimate +pub const DEFAULT_MAX_PRICE: U256 = U256::from_limbs([500_000_000_000u64, 0, 0, 0]); + +/// The default minimum gas price, under which the sample will be ignored +pub const DEFAULT_IGNORE_PRICE: U256 = U256::from_limbs([2u64, 0, 0, 0]); + +/// Settings for the [GasPriceOracle] +#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct GasPriceOracleConfig { + /// The number of populated blocks to produce the gas price estimate + pub blocks: u32, + + /// The percentile of gas prices to use for the estimate + pub percentile: u32, + + /// The maximum number of headers to keep in the cache + pub max_header_history: u64, + + /// The maximum number of blocks for estimating gas price + pub max_block_history: u64, + + /// The default gas price to use if there are no blocks to use + pub default: Option, + + /// The maximum gas price to use for the estimate + pub max_price: Option, + + /// The minimum gas price, under which the sample will be ignored + pub ignore_price: Option, +} + +impl Default for GasPriceOracleConfig { + fn default() -> Self { + GasPriceOracleConfig { + blocks: 20, + percentile: 60, + max_header_history: 1024, + max_block_history: 1024, + default: None, + max_price: Some(DEFAULT_MAX_PRICE), + ignore_price: Some(DEFAULT_IGNORE_PRICE), + } + } +} + +impl GasPriceOracleConfig { + /// Creating a new gpo config with blocks, ignoreprice, maxprice and percentile + pub fn new( + blocks: Option, + ignore_price: Option, + max_price: Option, + percentile: Option, + ) -> Self { + Self { + blocks: blocks.unwrap_or(20), + percentile: percentile.unwrap_or(60), + max_header_history: 1024, + max_block_history: 1024, + default: None, + max_price: max_price.map(U256::from).or(Some(DEFAULT_MAX_PRICE)), + ignore_price: ignore_price.map(U256::from).or(Some(DEFAULT_IGNORE_PRICE)), + } + } +} + +/// Calculates a gas price depending on recent blocks. +pub struct GasPriceOracle { + /// The type used to get block and tx info + provider: Evm, + /// The config for the oracle + oracle_config: GasPriceOracleConfig, + /// The latest calculated price and its block hash + last_price: Mutex, +} + +unsafe impl Send for GasPriceOracle {} + +impl GasPriceOracle { + /// Creates and returns the [GasPriceOracle]. + pub fn new(provider: Evm, mut oracle_config: GasPriceOracleConfig) -> Self { + // sanitize the percentile to be less than 100 + if oracle_config.percentile > 100 { + warn!(prev_percentile = ?oracle_config.percentile, "Invalid configured gas price percentile, assuming 100."); + oracle_config.percentile = 100; + } + + Self { + provider, + oracle_config, + last_price: Default::default(), + } + } + + /// Returns the configuration of the gas price oracle. + pub fn config(&self) -> &GasPriceOracleConfig { + &self.oracle_config + } + + /// Suggests a gas price estimate based on recent blocks, using the configured percentile. + pub async fn suggest_tip_cap(&self, working_set: &mut WorkingSet) -> EthResult { + let header = self + .provider + .head + .get(working_set) + .expect("Head block must be set") + .seal() + .header; + + let mut last_price = self.last_price.lock().await; + + // if we have stored a last price, then we check whether or not it was for the same head + if last_price.block_hash == header.hash { + return Ok(last_price.price); + } + + // if all responses are empty, then we can return a maximum of 2*check_block blocks' worth + // of prices + // + // we only return more than check_block blocks' worth of prices if one or more return empty + // transactions + let mut current_hash = header.hash; + let mut results = Vec::new(); + let mut populated_blocks = 0; + + // we only check a maximum of 2 * max_block_history, or the number of blocks in the chain + let max_blocks = if self.oracle_config.max_block_history * 2 > header.number { + header.number + } else { + self.oracle_config.max_block_history * 2 + }; + + for _ in 0..max_blocks { + let (parent_hash, block_values) = self + .get_block_values( + current_hash, + SAMPLE_NUMBER as usize, + &mut working_set.accessory_state(), + ) + .await? + .ok_or(EthApiError::UnknownBlockNumber)?; + + if block_values.is_empty() { + results.push(U256::from(last_price.price)); + } else { + results.extend(block_values); + populated_blocks += 1; + } + + // break when we have enough populated blocks + if populated_blocks >= self.oracle_config.blocks { + break; + } + + current_hash = parent_hash; + } + + // sort results then take the configured percentile result + let mut price = last_price.price; + if !results.is_empty() { + results.sort_unstable(); + price = *results + .get((results.len() - 1) * self.oracle_config.percentile as usize / 100) + .expect("gas price index is a percent of nonzero array length, so a value always exists; qed"); + } + + // constrain to the max price + if let Some(max_price) = self.oracle_config.max_price { + if price > max_price { + price = max_price; + } + } + + *last_price = GasPriceOracleResult { + block_hash: header.hash, + price, + }; + + Ok(price) + } + + /// Get the `limit` lowest effective tip values for the given block. If the oracle has a + /// configured `ignore_price` threshold, then tip values under that threshold will be ignored + /// before returning a result. + /// + /// If the block cannot be found, then this will return `None`. + /// + /// This method also returns the parent hash for the given block. + async fn get_block_values( + &self, + block_hash: H256, + limit: usize, + working_set: &mut AccessoryWorkingSet<'_, C>, + ) -> EthResult)>> { + // check the cache (this will hit the disk if the block is not cached) + let block = match self + .provider + .block_hashes + .get(&block_hash, working_set) + .and_then(|block_number| self.provider.blocks.get(block_number as usize, working_set)) + { + Some(block) => block, + None => return Ok(None), + }; + + // sort the transactions by effective tip + // but first filter those that should be ignored + + let transactions_with_ids = block.transactions.clone().map(|id| { + let tx = self + .provider + .transactions + .get(id as usize, working_set) + .expect("Transaction must be set"); + (id, tx) + }); + + let txs = transactions_with_ids.map(|(_, tx)| tx.signed_transaction); + + let mut txs = txs + .filter(|tx| { + if let Some(ignore_under) = self.oracle_config.ignore_price { + if tx + .effective_gas_tip(block.header.base_fee_per_gas) + .map(U256::from) + < Some(ignore_under) + { + return false; + } + } + + // recover sender, check if coinbase + let sender = tx.recover_signer(); + match sender { + // transactions will be filtered if this is false + Some(addr) => addr != block.header.beneficiary, + // TODO: figure out an error for this case or ignore + None => false, + } + }) + // map all values to effective_gas_tip because we will be returning those values + // anyways + .map(|tx| tx.effective_gas_tip(block.header.base_fee_per_gas)) + .collect::>(); + + // now do the sort + txs.sort_unstable(); + + // fill result with the top `limit` transactions + let mut final_result = Vec::with_capacity(limit); + for tx in txs.iter().take(limit) { + // a `None` effective_gas_tip represents a transaction where the max_fee_per_gas is + // less than the base fee + let effective_tip = tx.ok_or(RpcInvalidTransactionError::FeeCapTooLow)?; + final_result.push(U256::from(effective_tip)); + } + + Ok(Some((block.header.parent_hash, final_result))) + } +} + +/// Stores the last result that the oracle returned +#[derive(Debug, Clone)] +pub struct GasPriceOracleResult { + /// The block hash that the oracle used to calculate the price + pub block_hash: H256, + /// The price that the oracle calculated + pub price: U256, +} + +impl Default for GasPriceOracleResult { + fn default() -> Self { + Self { + block_hash: H256::zero(), + price: U256::from(GWEI_TO_WEI), + } + } +} + +#[cfg(test)] +mod tests { + use reth_primitives::constants::GWEI_TO_WEI; + + use super::*; + + #[test] + fn max_price_sanity() { + assert_eq!(DEFAULT_MAX_PRICE, U256::from(500_000_000_000u64)); + assert_eq!(DEFAULT_MAX_PRICE, U256::from(500 * GWEI_TO_WEI)) + } + + #[test] + fn ignore_price_sanity() { + assert_eq!(DEFAULT_IGNORE_PRICE, U256::from(2u64)); + } +} diff --git a/module-system/module-implementations/sov-evm/src/evm/mod.rs b/module-system/module-implementations/sov-evm/src/evm/mod.rs index 3beaa1945..7c94d23cc 100644 --- a/module-system/module-implementations/sov-evm/src/evm/mod.rs +++ b/module-system/module-implementations/sov-evm/src/evm/mod.rs @@ -11,6 +11,7 @@ mod db_commit; pub(crate) mod db_init; pub(crate) mod error; pub(crate) mod executor; +pub mod gas_oracle; pub(crate) mod primitive_types; #[cfg(test)] mod tests; diff --git a/module-system/module-implementations/sov-evm/src/lib.rs b/module-system/module-implementations/sov-evm/src/lib.rs index a53d197aa..caa2a085e 100644 --- a/module-system/module-implementations/sov-evm/src/lib.rs +++ b/module-system/module-implementations/sov-evm/src/lib.rs @@ -9,7 +9,7 @@ mod genesis; #[cfg(feature = "experimental")] mod hooks; #[cfg(feature = "experimental")] -pub use {call::*, error::rpc::EthApiError, evm::*, genesis::*, hooks::*}; +pub use {call::*, error::rpc::EthApiError, evm::*, gas_oracle, genesis::*, hooks::*}; #[cfg(feature = "native")] #[cfg(feature = "experimental")] mod query; From 8b2d0630c9c7dd26a4846718dddec9dd16d6c4cb Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Tue, 3 Oct 2023 11:16:38 +0300 Subject: [PATCH 02/26] lint --- full-node/sov-ethereum/src/lib.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/full-node/sov-ethereum/src/lib.rs b/full-node/sov-ethereum/src/lib.rs index f0e9880e8..156ba21de 100644 --- a/full-node/sov-ethereum/src/lib.rs +++ b/full-node/sov-ethereum/src/lib.rs @@ -13,6 +13,9 @@ pub mod experimental { use std::collections::HashMap; use std::sync::{Arc, Mutex}; + use super::batch_builder::EthBatchBuilder; + #[cfg(feature = "local")] + use super::DevSigner; use borsh::ser::BorshSerialize; use demo_stf::app::DefaultPrivateKey; use demo_stf::runtime::{DefaultContext, Runtime}; @@ -29,11 +32,6 @@ pub mod experimental { use sov_modules_api::utils::to_jsonrpsee_error_object; use sov_modules_api::{EncodeCall, WorkingSet}; use sov_rollup_interface::services::da::DaService; - use tokio::try_join; - - use super::batch_builder::EthBatchBuilder; - #[cfg(feature = "local")] - use super::DevSigner; const ETH_RPC_ERROR: &str = "ETH_RPC_ERROR"; From 2b00df16e1899b8415ffbf2adf1c3cee04c9dbe7 Mon Sep 17 00:00:00 2001 From: bkolad Date: Tue, 3 Oct 2023 11:03:25 +0200 Subject: [PATCH 03/26] fix compilation issues --- full-node/sov-ethereum/src/lib.rs | 1 + .../module-implementations/sov-evm/src/evm/gas_oracle.rs | 3 +-- module-system/sov-modules-api/src/gas.rs | 2 +- module-system/sov-state/src/lib.rs | 2 +- module-system/sov-state/src/storage.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/full-node/sov-ethereum/src/lib.rs b/full-node/sov-ethereum/src/lib.rs index 156ba21de..bffc6017f 100644 --- a/full-node/sov-ethereum/src/lib.rs +++ b/full-node/sov-ethereum/src/lib.rs @@ -162,6 +162,7 @@ pub mod experimental { let price = { let mut working_set = WorkingSet::::new(ethereum.storage.clone()); + let suggested_tip = ethereum .gas_price_oracle .suggest_tip_cap(&mut working_set) diff --git a/module-system/module-implementations/sov-evm/src/evm/gas_oracle.rs b/module-system/module-implementations/sov-evm/src/evm/gas_oracle.rs index f78e2b2e2..1f7fc7bb5 100644 --- a/module-system/module-implementations/sov-evm/src/evm/gas_oracle.rs +++ b/module-system/module-implementations/sov-evm/src/evm/gas_oracle.rs @@ -6,7 +6,6 @@ use serde::{Deserialize, Serialize}; use sov_modules_api::{AccessoryWorkingSet, WorkingSet}; use tokio::sync::Mutex; - use tracing::warn; use crate::error::rpc::{EthApiError, EthResult, RpcInvalidTransactionError}; @@ -91,7 +90,7 @@ pub struct GasPriceOracle { last_price: Mutex, } -unsafe impl Send for GasPriceOracle {} +//unsafe impl Send for GasPriceOracle {} impl GasPriceOracle { /// Creates and returns the [GasPriceOracle]. diff --git a/module-system/sov-modules-api/src/gas.rs b/module-system/sov-modules-api/src/gas.rs index 071af99fe..3768d5e7b 100644 --- a/module-system/sov-modules-api/src/gas.rs +++ b/module-system/sov-modules-api/src/gas.rs @@ -3,7 +3,7 @@ use core::fmt; use anyhow::Result; /// A gas unit that provides scalar conversion from complex, multi-dimensional types. -pub trait GasUnit: fmt::Debug + Clone { +pub trait GasUnit: fmt::Debug + Clone + Send+ Sync { /// A zeroed instance of the unit. const ZEROED: Self; diff --git a/module-system/sov-state/src/lib.rs b/module-system/sov-state/src/lib.rs index 0c29f96c0..a306bc90d 100644 --- a/module-system/sov-state/src/lib.rs +++ b/module-system/sov-state/src/lib.rs @@ -110,7 +110,7 @@ impl Extend for Prefix { /// merkle proofs for storage access pub trait MerkleProofSpec { /// The structure that accumulates the witness data - type Witness: Witness; + type Witness: Witness+Send+Sync; /// The hash function used to compute the merkle root type Hasher: Digest; } diff --git a/module-system/sov-state/src/storage.rs b/module-system/sov-state/src/storage.rs index aa7a289f8..c2865df0d 100644 --- a/module-system/sov-state/src/storage.rs +++ b/module-system/sov-state/src/storage.rs @@ -147,7 +147,7 @@ pub struct StorageProof

{ /// An interface for storing and retrieving values in the storage. pub trait Storage: Clone { /// The witness type for this storage instance. - type Witness: Witness; + type Witness: Witness + Send + Sync; /// The runtime config for this storage instance. type RuntimeConfig; From a1f51dfa7aa697bbf6879d0ccdd94fe4a5eaa8db Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Thu, 5 Oct 2023 12:17:19 +0300 Subject: [PATCH 04/26] move gas oracle to sequencer with cache --- Cargo.lock | 34 +++++ Cargo.toml | 1 + full-node/sov-ethereum-gas-oracle/Cargo.toml | 45 ++++++ .../sov-ethereum-gas-oracle/src/cache.rs | 50 +++++++ .../src}/gas_oracle.rs | 131 +++++++++++------- full-node/sov-ethereum-gas-oracle/src/lib.rs | 73 ++++++++++ full-node/sov-ethereum/src/lib.rs | 36 ----- .../sov-evm/src/evm/mod.rs | 1 - .../module-implementations/sov-evm/src/lib.rs | 2 +- .../sov-evm/src/query.rs | 19 +++ 10 files changed, 303 insertions(+), 89 deletions(-) create mode 100644 full-node/sov-ethereum-gas-oracle/Cargo.toml create mode 100644 full-node/sov-ethereum-gas-oracle/src/cache.rs rename {module-system/module-implementations/sov-evm/src/evm => full-node/sov-ethereum-gas-oracle/src}/gas_oracle.rs (73%) create mode 100644 full-node/sov-ethereum-gas-oracle/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 8d7dd54a4..4f7842a86 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -118,6 +118,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if", + "getrandom 0.2.10", "once_cell", "version_check", ] @@ -6576,6 +6577,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "schnellru" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" +dependencies = [ + "ahash 0.8.3", + "cfg-if", + "hashbrown 0.13.2", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -7361,6 +7373,28 @@ dependencies = [ "tokio", ] +[[package]] +name = "sov-ethereum-gas-oracle" +version = "0.2.0" +dependencies = [ + "anyhow", + "borsh", + "demo-stf", + "ethers", + "jsonrpsee", + "reth-interfaces", + "reth-primitives", + "reth-rpc-types", + "schnellru", + "serde", + "serde_json", + "sov-evm", + "sov-modules-api", + "sov-rollup-interface", + "tokio", + "tracing", +] + [[package]] name = "sov-evm" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index aa556b226..e91393b5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ members = [ "full-node/db/sov-db", "full-node/sov-sequencer", "full-node/sov-ethereum", + "full-node/sov-ethereum-gas-oracle", "full-node/sov-stf-runner", "utils/zk-cycle-macros", diff --git a/full-node/sov-ethereum-gas-oracle/Cargo.toml b/full-node/sov-ethereum-gas-oracle/Cargo.toml new file mode 100644 index 000000000..b13350961 --- /dev/null +++ b/full-node/sov-ethereum-gas-oracle/Cargo.toml @@ -0,0 +1,45 @@ +[package] +name = "sov-ethereum-gas-oracle" +authors = { workspace = true } +edition = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +repository = { workspace = true } +rust-version = { workspace = true } +version = { workspace = true } +readme = "README.md" +resolver = "2" +publish = false + +[dependencies] +anyhow = { workspace = true } +serde = { workspace = true } +tokio = { workspace = true } +tracing = { workspace = true } +jsonrpsee = { workspace = true, features = ["http-client", "server"] } +sov-rollup-interface = { path = "../../rollup-interface" } + +sov-evm = { path = "../../module-system/module-implementations/sov-evm" } +demo-stf = { path = "../../examples/demo-stf", features = ["native"] } +sov-modules-api = { path = "../../module-system/sov-modules-api" } + +borsh = { workspace = true } +serde_json = { workspace = true } + +reth-primitives = { workspace = true } +reth-rpc-types = { workspace = true } +reth-interfaces = { workspace = true } + +ethers = { workspace = true } +schnellru = "0.2.1" + +[dev-dependencies] +sov-rollup-interface = { path = "../../rollup-interface", features = ["mocks"] } +tokio = { workspace = true } + + +[features] +default = [] +local = [] +experimental = ["demo-stf/experimental", "sov-evm/experimental", "local"] +native = ["demo-stf/native", "sov-evm/native"] diff --git a/full-node/sov-ethereum-gas-oracle/src/cache.rs b/full-node/sov-ethereum-gas-oracle/src/cache.rs new file mode 100644 index 000000000..d92efb12c --- /dev/null +++ b/full-node/sov-ethereum-gas-oracle/src/cache.rs @@ -0,0 +1,50 @@ +use std::{ + hash::Hash, + sync::{Mutex, RwLock}, +}; + +use reth_primitives::H256; +use reth_rpc_types::{Block, Rich, RichBlock}; +use schnellru::{ByLength, Limiter, LruMap}; +use sov_evm::EthResult; +use sov_modules_api::WorkingSet; + +// Create BlockCache +pub struct BlockCache { + cache: Mutex, ByLength>>, + provider: sov_evm::Evm, +} + +impl BlockCache { + pub fn new(max_size: u32, provider: sov_evm::Evm) -> Self { + Self { + cache: Mutex::new(LruMap::new(ByLength::new(max_size))), + provider, + } + } + + /// Gets block from cache or from provider + pub fn get_block( + &self, + block_hash: H256, + working_set: &mut WorkingSet, + ) -> EthResult>> { + // Check if block is in cache + let mut cache = self.cache.lock().unwrap(); + if let Some(block) = cache.get(&block_hash) { + return Ok(Some(block.clone())); + } + + // Get block from provider + let block = self + .provider + .get_block_by_hash(block_hash.into(), Some(true), working_set) + .unwrap() + .unwrap(); + + // Add block to cache + cache.insert(block_hash, block.clone()); + + Ok(Some(block)) + } +} diff --git a/module-system/module-implementations/sov-evm/src/evm/gas_oracle.rs b/full-node/sov-ethereum-gas-oracle/src/gas_oracle.rs similarity index 73% rename from module-system/module-implementations/sov-evm/src/evm/gas_oracle.rs rename to full-node/sov-ethereum-gas-oracle/src/gas_oracle.rs index 1f7fc7bb5..6d124dafa 100644 --- a/module-system/module-implementations/sov-evm/src/evm/gas_oracle.rs +++ b/full-node/sov-ethereum-gas-oracle/src/gas_oracle.rs @@ -1,15 +1,21 @@ //! An implementation of the eth gas price oracle, used for providing gas price estimates based on //! previous blocks. +use std::array::TryFromSliceError; + use reth_primitives::constants::GWEI_TO_WEI; -use reth_primitives::{H256, U256}; +use reth_primitives::{H256, U256, U64}; +use reth_rpc_types::{Block, BlockTransactions}; +use schnellru::ByLength; use serde::{Deserialize, Serialize}; use sov_modules_api::{AccessoryWorkingSet, WorkingSet}; use tokio::sync::Mutex; use tracing::warn; -use crate::error::rpc::{EthApiError, EthResult, RpcInvalidTransactionError}; -use crate::Evm; +use sov_evm::{EthApiError, EthResult}; +use sov_evm::{Evm, RpcInvalidTransactionError}; + +use crate::cache::BlockCache; /// The number of transactions sampled in a block pub const SAMPLE_NUMBER: u32 = 3; @@ -31,7 +37,7 @@ pub struct GasPriceOracleConfig { pub percentile: u32, /// The maximum number of headers to keep in the cache - pub max_header_history: u64, + pub max_header_history: u32, /// The maximum number of blocks for estimating gas price pub max_block_history: u64, @@ -88,6 +94,8 @@ pub struct GasPriceOracle { oracle_config: GasPriceOracleConfig, /// The latest calculated price and its block hash last_price: Mutex, + /// Cache + cache: BlockCache, } //unsafe impl Send for GasPriceOracle {} @@ -101,10 +109,13 @@ impl GasPriceOracle { oracle_config.percentile = 100; } + let max_header_history = oracle_config.max_header_history; + Self { - provider, + provider: provider.clone(), oracle_config, last_price: Default::default(), + cache: BlockCache::::new(max_header_history, provider), } } @@ -115,18 +126,17 @@ impl GasPriceOracle { /// Suggests a gas price estimate based on recent blocks, using the configured percentile. pub async fn suggest_tip_cap(&self, working_set: &mut WorkingSet) -> EthResult { - let header = self + let header = &self .provider - .head - .get(working_set) - .expect("Head block must be set") - .seal() + .get_block_by_number(None, None, working_set) + .unwrap() + .unwrap() .header; let mut last_price = self.last_price.lock().await; // if we have stored a last price, then we check whether or not it was for the same head - if last_price.block_hash == header.hash { + if last_price.block_hash == header.hash.unwrap() { return Ok(last_price.price); } @@ -135,24 +145,22 @@ impl GasPriceOracle { // // we only return more than check_block blocks' worth of prices if one or more return empty // transactions - let mut current_hash = header.hash; + let mut current_hash = header.hash.unwrap(); let mut results = Vec::new(); let mut populated_blocks = 0; // we only check a maximum of 2 * max_block_history, or the number of blocks in the chain - let max_blocks = if self.oracle_config.max_block_history * 2 > header.number { - header.number + let max_blocks = if self.oracle_config.max_block_history * 2 + > convert_u256_to_u64(header.number.unwrap()).unwrap() + { + convert_u256_to_u64(header.number.unwrap()).unwrap() } else { self.oracle_config.max_block_history * 2 }; for _ in 0..max_blocks { let (parent_hash, block_values) = self - .get_block_values( - current_hash, - SAMPLE_NUMBER as usize, - &mut working_set.accessory_state(), - ) + .get_block_values(current_hash, SAMPLE_NUMBER as usize, working_set) .await? .ok_or(EthApiError::UnknownBlockNumber)?; @@ -188,7 +196,7 @@ impl GasPriceOracle { } *last_price = GasPriceOracleResult { - block_hash: header.hash, + block_hash: header.hash.unwrap(), price, }; @@ -206,15 +214,10 @@ impl GasPriceOracle { &self, block_hash: H256, limit: usize, - working_set: &mut AccessoryWorkingSet<'_, C>, + working_set: &mut WorkingSet, ) -> EthResult)>> { // check the cache (this will hit the disk if the block is not cached) - let block = match self - .provider - .block_hashes - .get(&block_hash, working_set) - .and_then(|block_number| self.provider.blocks.get(block_number as usize, working_set)) - { + let block = match self.cache.get_block(block_hash, working_set)? { Some(block) => block, None => return Ok(None), }; @@ -222,41 +225,29 @@ impl GasPriceOracle { // sort the transactions by effective tip // but first filter those that should be ignored - let transactions_with_ids = block.transactions.clone().map(|id| { - let tx = self - .provider - .transactions - .get(id as usize, working_set) - .expect("Transaction must be set"); - (id, tx) - }); - - let txs = transactions_with_ids.map(|(_, tx)| tx.signed_transaction); + // get the transactions (block.transactions is a enum but we only care about the 2nd arm) + let txs = match &block.transactions { + BlockTransactions::Full(txs) => txs, + _ => return Ok(None), + }; let mut txs = txs + .iter() .filter(|tx| { if let Some(ignore_under) = self.oracle_config.ignore_price { - if tx - .effective_gas_tip(block.header.base_fee_per_gas) - .map(U256::from) - < Some(ignore_under) - { + let effective_gas_tip = effective_gas_tip(tx, block.header.base_fee_per_gas); + if effective_gas_tip < Some(ignore_under) { return false; } } - // recover sender, check if coinbase - let sender = tx.recover_signer(); - match sender { - // transactions will be filtered if this is false - Some(addr) => addr != block.header.beneficiary, - // TODO: figure out an error for this case or ignore - None => false, - } + // check if coinbase + let sender = tx.from; + sender != block.header.miner }) // map all values to effective_gas_tip because we will be returning those values // anyways - .map(|tx| tx.effective_gas_tip(block.header.base_fee_per_gas)) + .map(|tx| effective_gas_tip(tx, block.header.base_fee_per_gas)) .collect::>(); // now do the sort @@ -293,6 +284,32 @@ impl Default for GasPriceOracleResult { } } +fn effective_gas_tip( + transaction: &reth_rpc_types::Transaction, + base_fee: Option, +) -> Option { + let priority_fee_or_price = U256::from(match transaction.transaction_type { + Some(U64([2])) => transaction.max_priority_fee_per_gas.unwrap(), + _ => transaction.gas_price.unwrap(), + }); + + if let Some(base_fee) = base_fee { + let max_fee_per_gas = U256::from(match transaction.transaction_type { + Some(U64([2])) => transaction.max_fee_per_gas.unwrap(), + _ => transaction.gas_price.unwrap(), + }); + + if max_fee_per_gas < base_fee { + None + } else { + let effective_max_fee = max_fee_per_gas - base_fee; + Some(std::cmp::min(effective_max_fee, priority_fee_or_price)) + } + } else { + Some(priority_fee_or_price) + } +} + #[cfg(test)] mod tests { use reth_primitives::constants::GWEI_TO_WEI; @@ -310,3 +327,15 @@ mod tests { assert_eq!(DEFAULT_IGNORE_PRICE, U256::from(2u64)); } } + +fn convert_u256_to_u64(u256: reth_primitives::U256) -> Result { + let bytes: [u8; 32] = u256.to_be_bytes(); + let bytes: [u8; 8] = bytes[24..].try_into()?; + Ok(u64::from_be_bytes(bytes)) +} + +fn convert_u256_to_u128(u256: reth_primitives::U256) -> Result { + let bytes: [u8; 32] = u256.to_be_bytes(); + let bytes: [u8; 16] = bytes[16..].try_into()?; + Ok(u128::from_be_bytes(bytes)) +} diff --git a/full-node/sov-ethereum-gas-oracle/src/lib.rs b/full-node/sov-ethereum-gas-oracle/src/lib.rs new file mode 100644 index 000000000..0de7bea19 --- /dev/null +++ b/full-node/sov-ethereum-gas-oracle/src/lib.rs @@ -0,0 +1,73 @@ +#[cfg(feature = "experimental")] +pub use experimental::{get_ethereum_gas_price_rpc, EthereumGasPrice}; +#[cfg(feature = "experimental")] +mod cache; +#[cfg(feature = "experimental")] +mod gas_oracle; + +#[cfg(feature = "experimental")] +pub mod experimental { + use crate::gas_oracle::{GasPriceOracle, GasPriceOracleConfig}; + use jsonrpsee::types::ErrorObjectOwned; + use jsonrpsee::RpcModule; + use reth_primitives::U256; + use sov_evm::Evm; + use sov_modules_api::WorkingSet; + + pub fn get_ethereum_gas_price_rpc( + gas_price_oracle_config: GasPriceOracleConfig, + storage: C::Storage, + ) -> RpcModule> { + let mut rpc = RpcModule::new(EthereumGasPrice::new(gas_price_oracle_config, storage)); + + register_rpc_methods(&mut rpc).expect("Failed to register sequencer RPC methods"); + rpc + } + + pub struct EthereumGasPrice { + gas_price_oracle: GasPriceOracle, + storage: C::Storage, + } + + impl EthereumGasPrice { + fn new(gas_price_oracle_config: GasPriceOracleConfig, storage: C::Storage) -> Self { + let gas_price_oracle = + GasPriceOracle::new(Evm::::default(), gas_price_oracle_config); + Self { + gas_price_oracle, + storage, + } + } + } + + fn register_rpc_methods( + rpc: &mut RpcModule>, + ) -> Result<(), jsonrpsee::core::Error> { + rpc.register_async_method("eth_gasPrice", |_, ethereum| async move { + let price = { + let mut working_set = WorkingSet::::new(ethereum.storage.clone()); + + let suggested_tip = ethereum + .gas_price_oracle + .suggest_tip_cap(&mut working_set) + .await + .unwrap(); + + let evm = Evm::::default(); + let base_fee = evm + .get_block_by_number(None, None, &mut working_set) + .unwrap() + .unwrap() + .header + .base_fee_per_gas + .unwrap_or_default(); + + suggested_tip + base_fee + }; + + Ok::(price) + })?; + + Ok(()) + } +} diff --git a/full-node/sov-ethereum/src/lib.rs b/full-node/sov-ethereum/src/lib.rs index bffc6017f..85081bcf5 100644 --- a/full-node/sov-ethereum/src/lib.rs +++ b/full-node/sov-ethereum/src/lib.rs @@ -3,8 +3,6 @@ mod batch_builder; #[cfg(feature = "experimental")] pub use experimental::{get_ethereum_rpc, Ethereum}; #[cfg(feature = "experimental")] -pub use sov_evm::gas_oracle; -#[cfg(feature = "experimental")] pub use sov_evm::DevSigner; #[cfg(feature = "experimental")] @@ -26,7 +24,6 @@ pub mod experimental { Address as RethAddress, TransactionSignedNoHash as RethTransactionSignedNoHash, U128, U256, }; use reth_rpc_types::{CallRequest, TransactionRequest, TypedTransactionRequest}; - use sov_evm::gas_oracle::{GasPriceOracle, GasPriceOracleConfig}; use sov_evm::{CallMessage, Evm, RlpEvmTransaction}; use sov_modules_api::transaction::Transaction; use sov_modules_api::utils::to_jsonrpsee_error_object; @@ -45,7 +42,6 @@ pub mod experimental { pub fn get_ethereum_rpc( da_service: Da, eth_rpc_config: EthRpcConfig, - gas_price_oracle_config: GasPriceOracleConfig, storage: C::Storage, ) -> RpcModule> { let mut rpc = RpcModule::new(Ethereum::new( @@ -53,7 +49,6 @@ pub mod experimental { da_service, Arc::new(Mutex::new(EthBatchBuilder::default())), eth_rpc_config, - gas_price_oracle_config, storage, )); @@ -66,7 +61,6 @@ pub mod experimental { da_service: Da, batch_builder: Arc>, eth_rpc_config: EthRpcConfig, - gas_price_oracle: GasPriceOracle, storage: C::Storage, } @@ -76,17 +70,13 @@ pub mod experimental { da_service: Da, batch_builder: Arc>, eth_rpc_config: EthRpcConfig, - gas_price_oracle_config: GasPriceOracleConfig, storage: C::Storage, ) -> Self { - let gas_price_oracle = - GasPriceOracle::new(Evm::::default(), gas_price_oracle_config); Self { nonces, da_service, batch_builder, eth_rpc_config, - gas_price_oracle, storage, } } @@ -158,32 +148,6 @@ pub mod experimental { fn register_rpc_methods( rpc: &mut RpcModule>, ) -> Result<(), jsonrpsee::core::Error> { - rpc.register_async_method("eth_gasPrice", |_, ethereum| async move { - let price = { - let mut working_set = WorkingSet::::new(ethereum.storage.clone()); - - - let suggested_tip = ethereum - .gas_price_oracle - .suggest_tip_cap(&mut working_set) - .await - .unwrap(); - - let evm = Evm::::default(); - let base_fee = evm - .get_block_by_number(None, None, &mut working_set) - .unwrap() - .unwrap() - .header - .base_fee_per_gas - .unwrap_or_default(); - - suggested_tip + base_fee - }; - - Ok::(price) - })?; - rpc.register_async_method("eth_publishBatch", |params, ethereum| async move { let mut params_iter = params.sequence(); diff --git a/module-system/module-implementations/sov-evm/src/evm/mod.rs b/module-system/module-implementations/sov-evm/src/evm/mod.rs index 7c94d23cc..3beaa1945 100644 --- a/module-system/module-implementations/sov-evm/src/evm/mod.rs +++ b/module-system/module-implementations/sov-evm/src/evm/mod.rs @@ -11,7 +11,6 @@ mod db_commit; pub(crate) mod db_init; pub(crate) mod error; pub(crate) mod executor; -pub mod gas_oracle; pub(crate) mod primitive_types; #[cfg(test)] mod tests; diff --git a/module-system/module-implementations/sov-evm/src/lib.rs b/module-system/module-implementations/sov-evm/src/lib.rs index caa2a085e..64cd7ba4a 100644 --- a/module-system/module-implementations/sov-evm/src/lib.rs +++ b/module-system/module-implementations/sov-evm/src/lib.rs @@ -9,7 +9,7 @@ mod genesis; #[cfg(feature = "experimental")] mod hooks; #[cfg(feature = "experimental")] -pub use {call::*, error::rpc::EthApiError, evm::*, gas_oracle, genesis::*, hooks::*}; +pub use {call::*, error::rpc::*, evm::*, genesis::*, hooks::*}; #[cfg(feature = "native")] #[cfg(feature = "experimental")] mod query; diff --git a/module-system/module-implementations/sov-evm/src/query.rs b/module-system/module-implementations/sov-evm/src/query.rs index efb542d25..6f297c93f 100644 --- a/module-system/module-implementations/sov-evm/src/query.rs +++ b/module-system/module-implementations/sov-evm/src/query.rs @@ -55,6 +55,25 @@ impl Evm { Ok(Some(chain_id)) } + /// Handler for `eth_getBlockByHash` + #[rpc_method(name = "eth_getBlockByHash")] + pub fn get_block_by_hash( + &self, + block_hash: reth_primitives::H256, + details: Option, + working_set: &mut WorkingSet, + ) -> RpcResult> { + info!("evm module: eth_getBlockByHash"); + + let block_number_hex = self + .block_hashes + .get(&block_hash, &mut working_set.accessory_state()) + .map(|number| hex::encode(number.to_be_bytes())) + .expect("Block number for known block hash must be set"); + + self.get_block_by_number(Some(block_number_hex), details, working_set) + } + /// Handler for: `eth_getBlockByNumber` #[rpc_method(name = "eth_getBlockByNumber")] pub fn get_block_by_number( From 091c7da1a70dcab97c490903fdeeb660d36f542a Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Thu, 5 Oct 2023 12:19:52 +0300 Subject: [PATCH 05/26] lint --- full-node/sov-ethereum-gas-oracle/src/cache.rs | 6 ++---- full-node/sov-ethereum-gas-oracle/src/gas_oracle.rs | 5 +---- full-node/sov-ethereum-gas-oracle/src/lib.rs | 3 ++- full-node/sov-ethereum/src/lib.rs | 7 ++++--- module-system/sov-modules-api/src/gas.rs | 2 +- module-system/sov-state/src/lib.rs | 2 +- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/full-node/sov-ethereum-gas-oracle/src/cache.rs b/full-node/sov-ethereum-gas-oracle/src/cache.rs index d92efb12c..47ccf14e6 100644 --- a/full-node/sov-ethereum-gas-oracle/src/cache.rs +++ b/full-node/sov-ethereum-gas-oracle/src/cache.rs @@ -1,7 +1,5 @@ -use std::{ - hash::Hash, - sync::{Mutex, RwLock}, -}; +use std::hash::Hash; +use std::sync::{Mutex, RwLock}; use reth_primitives::H256; use reth_rpc_types::{Block, Rich, RichBlock}; diff --git a/full-node/sov-ethereum-gas-oracle/src/gas_oracle.rs b/full-node/sov-ethereum-gas-oracle/src/gas_oracle.rs index 6d124dafa..f71187071 100644 --- a/full-node/sov-ethereum-gas-oracle/src/gas_oracle.rs +++ b/full-node/sov-ethereum-gas-oracle/src/gas_oracle.rs @@ -7,14 +7,11 @@ use reth_primitives::{H256, U256, U64}; use reth_rpc_types::{Block, BlockTransactions}; use schnellru::ByLength; use serde::{Deserialize, Serialize}; +use sov_evm::{EthApiError, EthResult, Evm, RpcInvalidTransactionError}; use sov_modules_api::{AccessoryWorkingSet, WorkingSet}; use tokio::sync::Mutex; - use tracing::warn; -use sov_evm::{EthApiError, EthResult}; -use sov_evm::{Evm, RpcInvalidTransactionError}; - use crate::cache::BlockCache; /// The number of transactions sampled in a block diff --git a/full-node/sov-ethereum-gas-oracle/src/lib.rs b/full-node/sov-ethereum-gas-oracle/src/lib.rs index 0de7bea19..31719bcad 100644 --- a/full-node/sov-ethereum-gas-oracle/src/lib.rs +++ b/full-node/sov-ethereum-gas-oracle/src/lib.rs @@ -7,13 +7,14 @@ mod gas_oracle; #[cfg(feature = "experimental")] pub mod experimental { - use crate::gas_oracle::{GasPriceOracle, GasPriceOracleConfig}; use jsonrpsee::types::ErrorObjectOwned; use jsonrpsee::RpcModule; use reth_primitives::U256; use sov_evm::Evm; use sov_modules_api::WorkingSet; + use crate::gas_oracle::{GasPriceOracle, GasPriceOracleConfig}; + pub fn get_ethereum_gas_price_rpc( gas_price_oracle_config: GasPriceOracleConfig, storage: C::Storage, diff --git a/full-node/sov-ethereum/src/lib.rs b/full-node/sov-ethereum/src/lib.rs index 85081bcf5..264e5420a 100644 --- a/full-node/sov-ethereum/src/lib.rs +++ b/full-node/sov-ethereum/src/lib.rs @@ -11,9 +11,6 @@ pub mod experimental { use std::collections::HashMap; use std::sync::{Arc, Mutex}; - use super::batch_builder::EthBatchBuilder; - #[cfg(feature = "local")] - use super::DevSigner; use borsh::ser::BorshSerialize; use demo_stf::app::DefaultPrivateKey; use demo_stf::runtime::{DefaultContext, Runtime}; @@ -30,6 +27,10 @@ pub mod experimental { use sov_modules_api::{EncodeCall, WorkingSet}; use sov_rollup_interface::services::da::DaService; + use super::batch_builder::EthBatchBuilder; + #[cfg(feature = "local")] + use super::DevSigner; + const ETH_RPC_ERROR: &str = "ETH_RPC_ERROR"; pub struct EthRpcConfig { diff --git a/module-system/sov-modules-api/src/gas.rs b/module-system/sov-modules-api/src/gas.rs index 3768d5e7b..5ebfcd4ad 100644 --- a/module-system/sov-modules-api/src/gas.rs +++ b/module-system/sov-modules-api/src/gas.rs @@ -3,7 +3,7 @@ use core::fmt; use anyhow::Result; /// A gas unit that provides scalar conversion from complex, multi-dimensional types. -pub trait GasUnit: fmt::Debug + Clone + Send+ Sync { +pub trait GasUnit: fmt::Debug + Clone + Send + Sync { /// A zeroed instance of the unit. const ZEROED: Self; diff --git a/module-system/sov-state/src/lib.rs b/module-system/sov-state/src/lib.rs index a306bc90d..a8b6a675e 100644 --- a/module-system/sov-state/src/lib.rs +++ b/module-system/sov-state/src/lib.rs @@ -110,7 +110,7 @@ impl Extend for Prefix { /// merkle proofs for storage access pub trait MerkleProofSpec { /// The structure that accumulates the witness data - type Witness: Witness+Send+Sync; + type Witness: Witness + Send + Sync; /// The hash function used to compute the merkle root type Hasher: Digest; } From bcc2c5611d55726b17819d931c2a91810ed409de Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Thu, 5 Oct 2023 14:59:15 +0300 Subject: [PATCH 06/26] test --- examples/demo-rollup/Cargo.toml | 66 +++++++++++++++++++----- examples/demo-rollup/src/register_rpc.rs | 16 ++++++ examples/demo-rollup/src/rollup.rs | 18 ++++++- 3 files changed, 86 insertions(+), 14 deletions(-) diff --git a/examples/demo-rollup/Cargo.toml b/examples/demo-rollup/Cargo.toml index 2814df35e..4f69f1067 100644 --- a/examples/demo-rollup/Cargo.toml +++ b/examples/demo-rollup/Cargo.toml @@ -24,7 +24,10 @@ methods = { path = "../demo-prover/methods" } async-trait = { workspace = true, optional = true } anyhow = { workspace = true, optional = true } borsh = { workspace = true, features = ["bytes"], optional = true } -jsonrpsee = { workspace = true, features = ["http-client", "server"], optional = true } +jsonrpsee = { workspace = true, features = [ + "http-client", + "server", +], optional = true } serde = { workspace = true, features = ["derive"], optional = true } serde_json = { workspace = true, optional = true } tracing = { workspace = true, optional = true } @@ -33,20 +36,27 @@ secp256k1 = { workspace = true, optional = true } tokio = { workspace = true, optional = true } reth-primitives = { workspace = true, optional = true } -tracing-subscriber = { version = "0.3.17", features = ["env-filter"], optional = true } +tracing-subscriber = { version = "0.3.17", features = [ + "env-filter", +], optional = true } sov-db = { path = "../../full-node/db/sov-db", optional = true } +sov-ethereum-gas-price = { path = "../../full-node/sov-ethereum-gas-price", optional = true } sov-ethereum = { path = "../../full-node/sov-ethereum", optional = true } -sov-sequencer = { path = "../../full-node/sov-sequencer", optional = true } +sov-sequencer = { path = "../../full-node/sov-sequencer", optional = true } sov-risc0-adapter = { path = "../../adapters/risc0" } sov-state = { path = "../../module-system/sov-state" } sov-cli = { path = "../../module-system/sov-cli", optional = true } -clap = { workspace = true, optional = true} +clap = { workspace = true, optional = true } [dev-dependencies] -sov-evm = { path = "../../module-system/module-implementations/sov-evm", features = ["smart_contracts"] } -sov-bank = { path = "../../module-system/module-implementations/sov-bank", features = ["native"] } +sov-evm = { path = "../../module-system/module-implementations/sov-evm", features = [ + "smart_contracts", +] } +sov-bank = { path = "../../module-system/module-implementations/sov-bank", features = [ + "native", +] } borsh = { workspace = true } sha2 = { workspace = true } hex = { workspace = true } @@ -55,7 +65,9 @@ reqwest = "0.11" tendermint = "0.32" tempfile = { workspace = true } proptest = { workspace = true } -sov-rollup-interface = { path = "../../rollup-interface", features = ["fuzzing"] } +sov-rollup-interface = { path = "../../rollup-interface", features = [ + "fuzzing", +] } tokio = { workspace = true } sov-demo-rollup = { path = ".", features = ["native"] } prometheus = "0.11.0" @@ -72,12 +84,40 @@ ethers = { workspace = true } revm = { workspace = true } [features] -default = ["native"] # Deviate from convention by making the "native" feature active by default. This aligns with how this package is meant to be used (as a binary first, library second). -experimental = ["default", "sov-ethereum/experimental", "reth-primitives", "secp256k1", "demo-stf/experimental", "sov-ethereum/local"] -native = ["anyhow", "jsonrpsee", "serde", "serde_json", "tracing", "tokio", "tracing-subscriber", - "demo-stf/native", "sov-modules-stf-template/native", "sov-risc0-adapter/native", "sov-modules-api/native", - "sov-state/native", "sov-cli", "clap", "sov-celestia-adapter/native", "sov-db", "sov-sequencer", "sov-stf-runner/native", - "sov-modules-api/native", "sov-rollup-interface/native"] +default = [ + "native", +] # Deviate from convention by making the "native" feature active by default. This aligns with how this package is meant to be used (as a binary first, library second). +experimental = [ + "default", + "sov-ethereum/experimental", + "sov-ethereum-gas-price/experimental", + "reth-primitives", + "secp256k1", + "demo-stf/experimental", + "sov-ethereum/local", +] +native = [ + "anyhow", + "jsonrpsee", + "serde", + "serde_json", + "tracing", + "tokio", + "tracing-subscriber", + "demo-stf/native", + "sov-modules-stf-template/native", + "sov-risc0-adapter/native", + "sov-modules-api/native", + "sov-state/native", + "sov-cli", + "clap", + "sov-celestia-adapter/native", + "sov-db", + "sov-sequencer", + "sov-stf-runner/native", + "sov-modules-api/native", + "sov-rollup-interface/native", +] bench = ["native", "async-trait", "borsh", "hex"] offchain = ["demo-stf/offchain"] diff --git a/examples/demo-rollup/src/register_rpc.rs b/examples/demo-rollup/src/register_rpc.rs index 57d1a340b..f83ce94e4 100644 --- a/examples/demo-rollup/src/register_rpc.rs +++ b/examples/demo-rollup/src/register_rpc.rs @@ -54,3 +54,19 @@ pub fn register_ethereum( .merge(ethereum_rpc) .context("Failed to merge Ethereum RPC modules") } + +#[cfg(feature = "experimental")] +/// register ethereum gas price methods. +pub fn register_ethereum_gas_price( + gas_price_oracle_config: sov_ethereum_gas_price::experimental::GasPriceOracleConfig, + storage: C::Storage, + methods: &mut jsonrpsee::RpcModule<()>, +) -> Result<(), anyhow::Error> { + let ethereum_gas_price_rpc = sov_ethereum_gas_price::experimental::get_ethereum_gas_price_rpc::< + C, + >(gas_price_oracle_config, storage); + + methods + .merge(ethereum_gas_price_rpc) + .context("Failed to merge Ethereum gas price RPC modules") +} diff --git a/examples/demo-rollup/src/rollup.rs b/examples/demo-rollup/src/rollup.rs index cdaec16b6..9f39d35e0 100644 --- a/examples/demo-rollup/src/rollup.rs +++ b/examples/demo-rollup/src/rollup.rs @@ -19,6 +19,8 @@ use sov_cli::wallet_state::PrivateKeyAndAddress; use sov_db::ledger_db::LedgerDB; #[cfg(feature = "experimental")] use sov_ethereum::experimental::EthRpcConfig; +#[cfg(feature = "experimental")] +use sov_ethereum_gas_price::experimental::GasPriceOracleConfig; use sov_modules_api::default_context::ZkDefaultContext; use sov_modules_stf_template::AppTemplate; use sov_rollup_interface::mocks::{MockAddress, MockDaConfig, MockDaService}; @@ -32,7 +34,7 @@ use tracing::debug; #[cfg(feature = "experimental")] use crate::register_rpc::register_ethereum; -use crate::register_rpc::{register_ledger, register_sequencer}; +use crate::register_rpc::{register_ethereum_gas_price, register_ledger, register_sequencer}; use crate::{initialize_ledger, ROLLUP_NAMESPACE}; #[cfg(feature = "experimental")] @@ -55,6 +57,9 @@ pub struct Rollup { #[cfg(feature = "experimental")] /// Configuration for the Ethereum RPC. pub eth_rpc_config: EthRpcConfig, + #[cfg(feature = "experimental")] + /// Configuration for the gas price oracle. + pub gas_price_oracle_config: GasPriceOracleConfig, /// Prover for the rollup. #[allow(clippy::type_complexity)] pub prover: Option, Da, Vm>>, @@ -117,6 +122,7 @@ pub async fn new_rollup_with_celestia_da( #[cfg(feature = "experimental")] eth_signer.signers(), ); + let prover = prover.map(|(vm, config)| { configure_prover( vm, @@ -139,6 +145,8 @@ pub async fn new_rollup_with_celestia_da( sov_tx_signer_priv_key: read_sov_tx_signer_priv_key()?, eth_signer, }, + #[cfg(feature = "experimental")] + gas_price_oracle_config: GasPriceOracleConfig::default(), prover, }) } @@ -187,6 +195,8 @@ pub fn new_rollup_with_mock_da_from_config( sov_tx_signer_priv_key: read_sov_tx_signer_priv_key()?, eth_signer, }, + #[cfg(feature = "experimental")] + gas_price_oracle_config: GasPriceOracleConfig::default(), prover, }) } @@ -238,6 +248,12 @@ impl + Clone> Rollup register_ethereum::( self.da_service.clone(), self.eth_rpc_config, + storage.clone(), + &mut methods, + )?; + #[cfg(feature = "experimental")] + register_ethereum_gas_price::( + self.gas_price_oracle_config, storage, &mut methods, )?; From 75c9eb9cdf42ba741c2e73dcd67f9cd836035ad5 Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Thu, 5 Oct 2023 15:16:55 +0300 Subject: [PATCH 07/26] integration test for failing case --- Cargo.lock | 3 ++- Cargo.toml | 2 +- examples/demo-rollup/tests/evm/mod.rs | 16 ++++++++++++++++ .../Cargo.toml | 2 +- .../src/cache.rs | 11 ++++++----- .../src/gas_oracle.rs | 0 .../src/lib.rs | 5 +++-- .../module-implementations/sov-evm/src/call.rs | 2 ++ .../module-implementations/sov-evm/src/query.rs | 17 ++++++++++------- 9 files changed, 41 insertions(+), 17 deletions(-) rename full-node/{sov-ethereum-gas-oracle => sov-ethereum-gas-price}/Cargo.toml (97%) rename full-node/{sov-ethereum-gas-oracle => sov-ethereum-gas-price}/src/cache.rs (86%) rename full-node/{sov-ethereum-gas-oracle => sov-ethereum-gas-price}/src/gas_oracle.rs (100%) rename full-node/{sov-ethereum-gas-oracle => sov-ethereum-gas-price}/src/lib.rs (95%) diff --git a/Cargo.lock b/Cargo.lock index 4f7842a86..af4b46510 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7340,6 +7340,7 @@ dependencies = [ "sov-db", "sov-demo-rollup", "sov-ethereum", + "sov-ethereum-gas-price", "sov-evm", "sov-modules-api", "sov-modules-stf-template", @@ -7374,7 +7375,7 @@ dependencies = [ ] [[package]] -name = "sov-ethereum-gas-oracle" +name = "sov-ethereum-gas-price" version = "0.2.0" dependencies = [ "anyhow", diff --git a/Cargo.toml b/Cargo.toml index e91393b5c..d9dadc227 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ members = [ "full-node/db/sov-db", "full-node/sov-sequencer", "full-node/sov-ethereum", - "full-node/sov-ethereum-gas-oracle", + "full-node/sov-ethereum-gas-price", "full-node/sov-stf-runner", "utils/zk-cycle-macros", diff --git a/examples/demo-rollup/tests/evm/mod.rs b/examples/demo-rollup/tests/evm/mod.rs index b9942c14b..dd395919c 100644 --- a/examples/demo-rollup/tests/evm/mod.rs +++ b/examples/demo-rollup/tests/evm/mod.rs @@ -408,6 +408,22 @@ impl TestClient { self.send_publish_batch_request().await; + // second block + self.send_publish_batch_request().await; + + let first_block = self.eth_get_block_by_number(Some("0".to_owned())).await; + let second_block = self.eth_get_block_by_number(Some("1".to_owned())).await; + + println!("first_block: {:?}", first_block); + println!("second_block: {:?}", second_block); + + // assert parent hash + assert_eq!( + first_block.hash.unwrap(), + second_block.parent_hash, + "Parent hash should be the hash of the previous block" + ); + for req in requests { req.await.unwrap(); } diff --git a/full-node/sov-ethereum-gas-oracle/Cargo.toml b/full-node/sov-ethereum-gas-price/Cargo.toml similarity index 97% rename from full-node/sov-ethereum-gas-oracle/Cargo.toml rename to full-node/sov-ethereum-gas-price/Cargo.toml index b13350961..63be68694 100644 --- a/full-node/sov-ethereum-gas-oracle/Cargo.toml +++ b/full-node/sov-ethereum-gas-price/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "sov-ethereum-gas-oracle" +name = "sov-ethereum-gas-price" authors = { workspace = true } edition = { workspace = true } homepage = { workspace = true } diff --git a/full-node/sov-ethereum-gas-oracle/src/cache.rs b/full-node/sov-ethereum-gas-price/src/cache.rs similarity index 86% rename from full-node/sov-ethereum-gas-oracle/src/cache.rs rename to full-node/sov-ethereum-gas-price/src/cache.rs index 47ccf14e6..06422483b 100644 --- a/full-node/sov-ethereum-gas-oracle/src/cache.rs +++ b/full-node/sov-ethereum-gas-price/src/cache.rs @@ -37,12 +37,13 @@ impl BlockCache { let block = self .provider .get_block_by_hash(block_hash.into(), Some(true), working_set) - .unwrap() - .unwrap(); + .unwrap_or(None); - // Add block to cache - cache.insert(block_hash, block.clone()); + // Add block to cache if it exists + if let Some(block) = &block { + cache.insert(block_hash, block.clone()); + } - Ok(Some(block)) + Ok(block) } } diff --git a/full-node/sov-ethereum-gas-oracle/src/gas_oracle.rs b/full-node/sov-ethereum-gas-price/src/gas_oracle.rs similarity index 100% rename from full-node/sov-ethereum-gas-oracle/src/gas_oracle.rs rename to full-node/sov-ethereum-gas-price/src/gas_oracle.rs diff --git a/full-node/sov-ethereum-gas-oracle/src/lib.rs b/full-node/sov-ethereum-gas-price/src/lib.rs similarity index 95% rename from full-node/sov-ethereum-gas-oracle/src/lib.rs rename to full-node/sov-ethereum-gas-price/src/lib.rs index 31719bcad..9603e8b61 100644 --- a/full-node/sov-ethereum-gas-oracle/src/lib.rs +++ b/full-node/sov-ethereum-gas-price/src/lib.rs @@ -4,7 +4,6 @@ pub use experimental::{get_ethereum_gas_price_rpc, EthereumGasPrice}; mod cache; #[cfg(feature = "experimental")] mod gas_oracle; - #[cfg(feature = "experimental")] pub mod experimental { use jsonrpsee::types::ErrorObjectOwned; @@ -13,7 +12,9 @@ pub mod experimental { use sov_evm::Evm; use sov_modules_api::WorkingSet; - use crate::gas_oracle::{GasPriceOracle, GasPriceOracleConfig}; + use crate::gas_oracle::{GasPriceOracle}; + + pub use crate::gas_oracle::GasPriceOracleConfig; pub fn get_ethereum_gas_price_rpc( gas_price_oracle_config: GasPriceOracleConfig, diff --git a/module-system/module-implementations/sov-evm/src/call.rs b/module-system/module-implementations/sov-evm/src/call.rs index 09bbf879b..9c132d66f 100644 --- a/module-system/module-implementations/sov-evm/src/call.rs +++ b/module-system/module-implementations/sov-evm/src/call.rs @@ -3,6 +3,7 @@ use reth_primitives::TransactionSignedEcRecovered; use reth_revm::into_reth_log; use revm::primitives::{CfgEnv, EVMError, SpecId}; use sov_modules_api::{CallResponse, WorkingSet}; +use tracing::info; use crate::evm::db::EvmDb; use crate::evm::executor::{self}; @@ -42,6 +43,7 @@ impl Evm { let evm_db: EvmDb<'_, C> = self.get_db(working_set); let result = executor::execute_tx(evm_db, &block_env, &evm_tx_recovered, cfg_env); + info!("EVM call result: {:?}", result); let previous_transaction = self.pending_transactions.last(working_set); let previous_transaction_cumulative_gas_used = previous_transaction .as_ref() diff --git a/module-system/module-implementations/sov-evm/src/query.rs b/module-system/module-implementations/sov-evm/src/query.rs index 6f297c93f..076befc7a 100644 --- a/module-system/module-implementations/sov-evm/src/query.rs +++ b/module-system/module-implementations/sov-evm/src/query.rs @@ -65,6 +65,14 @@ impl Evm { ) -> RpcResult> { info!("evm module: eth_getBlockByHash"); + info!("block hash: {:?}", block_hash); + info!( + "all block hashes so far: {:?}", + self.blocks + .iter(&mut working_set.accessory_state()) + .collect::>() + ); + let block_number_hex = self .block_hashes .get(&block_hash, &mut working_set.accessory_state()) @@ -131,6 +139,8 @@ impl Evm { withdrawals: Default::default(), }; + info!("block: {:?}", block); + Ok(Some(block.into())) } @@ -553,13 +563,6 @@ impl Evm { Ok(U64::from(highest_gas_limit)) } - /// Handler for: `eth_gasPrice` - // TODO https://github.com/Sovereign-Labs/sovereign-sdk/issues/502 - #[rpc_method(name = "eth_gasPrice")] - pub fn gas_price(&self, _working_set: &mut WorkingSet) -> RpcResult { - unimplemented!("eth_gasPrice not implemented") - } - fn get_sealed_block_by_number( &self, block_number: Option, From 120a1f0d342445851784dcf79ac847d04cea8d35 Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Mon, 9 Oct 2023 12:54:10 +0300 Subject: [PATCH 08/26] fix conflicts --- examples/demo-rollup/Cargo.toml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/examples/demo-rollup/Cargo.toml b/examples/demo-rollup/Cargo.toml index 11cdaff68..dfac10f04 100644 --- a/examples/demo-rollup/Cargo.toml +++ b/examples/demo-rollup/Cargo.toml @@ -14,12 +14,8 @@ default-run = "sov-demo-rollup" [dependencies] # non-optional dependencies -<<<<<<< HEAD -borsh = { workspace = true, features = ["bytes"], optional = true } -======= - ->>>>>>> nightly -serde = { workspace = true, features = ["derive"], optional = true }sov-celestia-adapter = { path = "../../adapters/celestia" } +serde = { workspace = true, features = ["derive"], optional = true } +sov-celestia-adapter = { path = "../../adapters/celestia" } const-rollup-config = { path = "../const-rollup-config" } sov-stf-runner = { path = "../../full-node/sov-stf-runner" } sov-rollup-interface = { path = "../../rollup-interface" } @@ -35,10 +31,6 @@ jsonrpsee = { workspace = true, features = [ "http-client", "server", ], optional = true } -jsonrpsee = { workspace = true, features = [ - "http-client", - "server", -], optional = true } serde_json = { workspace = true, optional = true } tracing = { workspace = true, optional = true } hex = { workspace = true, optional = true } From ce240f27a394d407d34e19d4087a76cef3fc7114 Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Mon, 9 Oct 2023 12:55:44 +0300 Subject: [PATCH 09/26] update lock --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 4219654be..36c2d9c94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8437,7 +8437,7 @@ dependencies = [ "borsh", "demo-stf", "ethers", - "jsonrpsee", + "jsonrpsee 0.18.2", "reth-interfaces", "reth-primitives", "reth-rpc-types", From ca81c72bd2682f4ff5f77db6f50ee0a41357a68f Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Mon, 9 Oct 2023 13:41:23 +0300 Subject: [PATCH 10/26] add experimental --- examples/demo-rollup/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/demo-rollup/Cargo.toml b/examples/demo-rollup/Cargo.toml index dfac10f04..5f1728a25 100644 --- a/examples/demo-rollup/Cargo.toml +++ b/examples/demo-rollup/Cargo.toml @@ -92,6 +92,7 @@ default = [ experimental = [ "default", "sov-ethereum/experimental", + "sov-ethereum-gas-price/experimental", "reth-primitives", "secp256k1", "demo-stf/experimental", From ceb55878ffce5cb4c246c26c3f9bc1445ed5fd1c Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Mon, 9 Oct 2023 13:59:10 +0300 Subject: [PATCH 11/26] lint --- Cargo.lock | 1 - examples/demo-rollup/src/rollup.rs | 4 ++-- full-node/sov-ethereum-gas-price/Cargo.toml | 1 - full-node/sov-ethereum-gas-price/src/cache.rs | 6 +++--- full-node/sov-ethereum-gas-price/src/gas_oracle.rs | 5 ++--- full-node/sov-ethereum-gas-price/src/lib.rs | 3 +-- .../module-implementations/sov-evm/Cargo.toml | 1 - .../module-implementations/sov-evm/src/call.rs | 2 -- .../module-implementations/sov-evm/src/query.rs | 10 ---------- 9 files changed, 8 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6cd230143..18acc37cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8388,7 +8388,6 @@ dependencies = [ "anyhow", "borsh", "demo-stf", - "ethers", "jsonrpsee 0.18.2", "reth-interfaces", "reth-primitives", diff --git a/examples/demo-rollup/src/rollup.rs b/examples/demo-rollup/src/rollup.rs index 2880b7a6f..3e721954a 100644 --- a/examples/demo-rollup/src/rollup.rs +++ b/examples/demo-rollup/src/rollup.rs @@ -36,8 +36,8 @@ use tokio::sync::oneshot; use tracing::debug; #[cfg(feature = "experimental")] -use crate::register_rpc::register_ethereum; -use crate::register_rpc::{register_ethereum_gas_price, register_ledger, register_sequencer}; +use crate::register_rpc::{register_ethereum, register_ethereum_gas_price}; +use crate::register_rpc::{register_ledger, register_sequencer}; use crate::{initialize_ledger, ROLLUP_NAMESPACE}; #[cfg(feature = "experimental")] diff --git a/full-node/sov-ethereum-gas-price/Cargo.toml b/full-node/sov-ethereum-gas-price/Cargo.toml index 63be68694..ab2155e03 100644 --- a/full-node/sov-ethereum-gas-price/Cargo.toml +++ b/full-node/sov-ethereum-gas-price/Cargo.toml @@ -30,7 +30,6 @@ reth-primitives = { workspace = true } reth-rpc-types = { workspace = true } reth-interfaces = { workspace = true } -ethers = { workspace = true } schnellru = "0.2.1" [dev-dependencies] diff --git a/full-node/sov-ethereum-gas-price/src/cache.rs b/full-node/sov-ethereum-gas-price/src/cache.rs index 06422483b..5449a2837 100644 --- a/full-node/sov-ethereum-gas-price/src/cache.rs +++ b/full-node/sov-ethereum-gas-price/src/cache.rs @@ -1,9 +1,9 @@ use std::hash::Hash; -use std::sync::{Mutex, RwLock}; +use std::sync::Mutex; use reth_primitives::H256; -use reth_rpc_types::{Block, Rich, RichBlock}; -use schnellru::{ByLength, Limiter, LruMap}; +use reth_rpc_types::{Block, Rich}; +use schnellru::{ByLength, LruMap}; use sov_evm::EthResult; use sov_modules_api::WorkingSet; diff --git a/full-node/sov-ethereum-gas-price/src/gas_oracle.rs b/full-node/sov-ethereum-gas-price/src/gas_oracle.rs index f71187071..108ec0edd 100644 --- a/full-node/sov-ethereum-gas-price/src/gas_oracle.rs +++ b/full-node/sov-ethereum-gas-price/src/gas_oracle.rs @@ -4,11 +4,10 @@ use std::array::TryFromSliceError; use reth_primitives::constants::GWEI_TO_WEI; use reth_primitives::{H256, U256, U64}; -use reth_rpc_types::{Block, BlockTransactions}; -use schnellru::ByLength; +use reth_rpc_types::BlockTransactions; use serde::{Deserialize, Serialize}; use sov_evm::{EthApiError, EthResult, Evm, RpcInvalidTransactionError}; -use sov_modules_api::{AccessoryWorkingSet, WorkingSet}; +use sov_modules_api::WorkingSet; use tokio::sync::Mutex; use tracing::warn; diff --git a/full-node/sov-ethereum-gas-price/src/lib.rs b/full-node/sov-ethereum-gas-price/src/lib.rs index 9603e8b61..fb50068e2 100644 --- a/full-node/sov-ethereum-gas-price/src/lib.rs +++ b/full-node/sov-ethereum-gas-price/src/lib.rs @@ -12,8 +12,7 @@ pub mod experimental { use sov_evm::Evm; use sov_modules_api::WorkingSet; - use crate::gas_oracle::{GasPriceOracle}; - + use crate::gas_oracle::GasPriceOracle; pub use crate::gas_oracle::GasPriceOracleConfig; pub fn get_ethereum_gas_price_rpc( diff --git a/module-system/module-implementations/sov-evm/Cargo.toml b/module-system/module-implementations/sov-evm/Cargo.toml index c4838cfd6..ffa78cf1a 100644 --- a/module-system/module-implementations/sov-evm/Cargo.toml +++ b/module-system/module-implementations/sov-evm/Cargo.toml @@ -33,7 +33,6 @@ jsonrpsee = { workspace = true, features = [ ], optional = true } tracing = { workspace = true } derive_more = { workspace = true } -tokio = { workspace = true } lazy_static = "1.4.0" diff --git a/module-system/module-implementations/sov-evm/src/call.rs b/module-system/module-implementations/sov-evm/src/call.rs index c99395ead..b2ab7a87d 100644 --- a/module-system/module-implementations/sov-evm/src/call.rs +++ b/module-system/module-implementations/sov-evm/src/call.rs @@ -3,7 +3,6 @@ use reth_primitives::TransactionSignedEcRecovered; use reth_revm::into_reth_log; use revm::primitives::{CfgEnv, EVMError, SpecId}; use sov_modules_api::{CallResponse, WorkingSet}; -use tracing::info; use crate::evm::db::EvmDb; use crate::evm::executor::{self}; @@ -43,7 +42,6 @@ impl Evm { let evm_db: EvmDb<'_, C> = self.get_db(working_set); let result = executor::execute_tx(evm_db, &block_env, &evm_tx_recovered, cfg_env); - info!("EVM call result: {:?}", result); let previous_transaction = self.pending_transactions.last(working_set); let previous_transaction_cumulative_gas_used = previous_transaction .as_ref() diff --git a/module-system/module-implementations/sov-evm/src/query.rs b/module-system/module-implementations/sov-evm/src/query.rs index 076befc7a..762fea881 100644 --- a/module-system/module-implementations/sov-evm/src/query.rs +++ b/module-system/module-implementations/sov-evm/src/query.rs @@ -65,14 +65,6 @@ impl Evm { ) -> RpcResult> { info!("evm module: eth_getBlockByHash"); - info!("block hash: {:?}", block_hash); - info!( - "all block hashes so far: {:?}", - self.blocks - .iter(&mut working_set.accessory_state()) - .collect::>() - ); - let block_number_hex = self .block_hashes .get(&block_hash, &mut working_set.accessory_state()) @@ -139,8 +131,6 @@ impl Evm { withdrawals: Default::default(), }; - info!("block: {:?}", block); - Ok(Some(block.into())) } From 3420b022b0d27f29b9aa7419cde856d51e993399 Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Mon, 9 Oct 2023 14:03:37 +0300 Subject: [PATCH 12/26] add refs --- full-node/sov-ethereum-gas-price/src/cache.rs | 2 +- .../sov-ethereum-gas-price/src/gas_oracle.rs | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/full-node/sov-ethereum-gas-price/src/cache.rs b/full-node/sov-ethereum-gas-price/src/cache.rs index 5449a2837..1c5237d85 100644 --- a/full-node/sov-ethereum-gas-price/src/cache.rs +++ b/full-node/sov-ethereum-gas-price/src/cache.rs @@ -7,7 +7,7 @@ use schnellru::{ByLength, LruMap}; use sov_evm::EthResult; use sov_modules_api::WorkingSet; -// Create BlockCache +/// Block cache for gas oracle pub struct BlockCache { cache: Mutex, ByLength>>, provider: sov_evm::Evm, diff --git a/full-node/sov-ethereum-gas-price/src/gas_oracle.rs b/full-node/sov-ethereum-gas-price/src/gas_oracle.rs index 108ec0edd..3381d4947 100644 --- a/full-node/sov-ethereum-gas-price/src/gas_oracle.rs +++ b/full-node/sov-ethereum-gas-price/src/gas_oracle.rs @@ -1,5 +1,8 @@ //! An implementation of the eth gas price oracle, used for providing gas price estimates based on //! previous blocks. + +// Adopted from: https://github.com/paradigmxyz/reth/blob/main/crates/rpc/rpc/src/eth/gas_oracle.rs + use std::array::TryFromSliceError; use reth_primitives::constants::GWEI_TO_WEI; @@ -145,11 +148,11 @@ impl GasPriceOracle { let mut results = Vec::new(); let mut populated_blocks = 0; + let header_number = convert_u256_to_u64(header.number.unwrap()).unwrap(); + // we only check a maximum of 2 * max_block_history, or the number of blocks in the chain - let max_blocks = if self.oracle_config.max_block_history * 2 - > convert_u256_to_u64(header.number.unwrap()).unwrap() - { - convert_u256_to_u64(header.number.unwrap()).unwrap() + let max_blocks = if self.oracle_config.max_block_history * 2 > header_number { + header_number } else { self.oracle_config.max_block_history * 2 }; @@ -280,6 +283,7 @@ impl Default for GasPriceOracleResult { } } +// Adopted from: https://github.com/paradigmxyz/reth/blob/main/crates/primitives/src/transaction/mod.rs#L297 fn effective_gas_tip( transaction: &reth_rpc_types::Transaction, base_fee: Option, @@ -329,9 +333,3 @@ fn convert_u256_to_u64(u256: reth_primitives::U256) -> Result Result { - let bytes: [u8; 32] = u256.to_be_bytes(); - let bytes: [u8; 16] = bytes[16..].try_into()?; - Ok(u128::from_be_bytes(bytes)) -} From eabdea4fcefca57701346e8a24938735d0370fc3 Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Mon, 9 Oct 2023 14:17:20 +0300 Subject: [PATCH 13/26] tracing --- full-node/sov-ethereum-gas-price/src/cache.rs | 1 - full-node/sov-ethereum-gas-price/src/gas_oracle.rs | 5 ----- full-node/sov-ethereum-gas-price/src/lib.rs | 3 +++ 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/full-node/sov-ethereum-gas-price/src/cache.rs b/full-node/sov-ethereum-gas-price/src/cache.rs index 1c5237d85..aefc678f9 100644 --- a/full-node/sov-ethereum-gas-price/src/cache.rs +++ b/full-node/sov-ethereum-gas-price/src/cache.rs @@ -1,4 +1,3 @@ -use std::hash::Hash; use std::sync::Mutex; use reth_primitives::H256; diff --git a/full-node/sov-ethereum-gas-price/src/gas_oracle.rs b/full-node/sov-ethereum-gas-price/src/gas_oracle.rs index 3381d4947..fb76178ad 100644 --- a/full-node/sov-ethereum-gas-price/src/gas_oracle.rs +++ b/full-node/sov-ethereum-gas-price/src/gas_oracle.rs @@ -118,11 +118,6 @@ impl GasPriceOracle { } } - /// Returns the configuration of the gas price oracle. - pub fn config(&self) -> &GasPriceOracleConfig { - &self.oracle_config - } - /// Suggests a gas price estimate based on recent blocks, using the configured percentile. pub async fn suggest_tip_cap(&self, working_set: &mut WorkingSet) -> EthResult { let header = &self diff --git a/full-node/sov-ethereum-gas-price/src/lib.rs b/full-node/sov-ethereum-gas-price/src/lib.rs index fb50068e2..0fc06255d 100644 --- a/full-node/sov-ethereum-gas-price/src/lib.rs +++ b/full-node/sov-ethereum-gas-price/src/lib.rs @@ -11,6 +11,7 @@ pub mod experimental { use reth_primitives::U256; use sov_evm::Evm; use sov_modules_api::WorkingSet; + use tracing::info; use crate::gas_oracle::GasPriceOracle; pub use crate::gas_oracle::GasPriceOracleConfig; @@ -45,6 +46,8 @@ pub mod experimental { rpc: &mut RpcModule>, ) -> Result<(), jsonrpsee::core::Error> { rpc.register_async_method("eth_gasPrice", |_, ethereum| async move { + info!("evm gas price module: eth_gasPrice"); + let price = { let mut working_set = WorkingSet::::new(ethereum.storage.clone()); From dff4ded06292103b64f05b2a89fd60502a040af8 Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Tue, 10 Oct 2023 11:30:43 +0300 Subject: [PATCH 14/26] gas price oracle tests --- examples/demo-rollup/tests/evm/mod.rs | 30 +++++++++++++++++-- examples/demo-rollup/tests/evm/test_client.rs | 13 ++++++-- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/examples/demo-rollup/tests/evm/mod.rs b/examples/demo-rollup/tests/evm/mod.rs index 88762a2a1..252bcc38c 100644 --- a/examples/demo-rollup/tests/evm/mod.rs +++ b/examples/demo-rollup/tests/evm/mod.rs @@ -9,6 +9,7 @@ use ethers_signers::{LocalWallet, Signer}; use sov_evm::SimpleStorageContract; use sov_risc0_adapter::host::Risc0Host; use test_client::TestClient; +use tracing::info; use super::test_helpers::start_rollup; @@ -114,7 +115,9 @@ async fn execute(client: &TestClient) -> Result<(), Box> let set_arg = 923; let tx_hash = { - let set_value_req = client.set_value(contract_address, set_arg).await; + let set_value_req = client + .set_value(contract_address, set_arg, None, None) + .await; client.send_publish_batch_request().await; set_value_req.await.unwrap().unwrap().transaction_hash }; @@ -150,7 +153,7 @@ async fn execute(client: &TestClient) -> Result<(), Box> // Create a blob with multiple transactions. let mut requests = Vec::default(); for value in 100..103 { - let set_value_req = client.set_value(contract_address, value).await; + let set_value_req = client.set_value(contract_address, value, None, None).await; requests.push(set_value_req); } @@ -195,5 +198,28 @@ async fn execute(client: &TestClient) -> Result<(), Box> assert_eq!(value, get_arg.as_u32()); } + { + // get initial gas price + let initial_gas_price = client.eth_gas_price().await; + + // send 100 set transaction with high gas fee + let mut requests = Vec::default(); + for value in 200..300 { + let set_value_req = client + .set_value(contract_address, value, Some(20u64), Some(21u64)) + .await; + requests.push(set_value_req); + } + + client.send_publish_batch_request().await; + + // get gas price + let latest_gas_price = client.eth_gas_price().await; + + // assert gas price is higher + // TODO: emulate gas price oracle here to have exact value + assert!(latest_gas_price > initial_gas_price); + } + Ok(()) } diff --git a/examples/demo-rollup/tests/evm/test_client.rs b/examples/demo-rollup/tests/evm/test_client.rs index 8a7154b49..19c6d3e4b 100644 --- a/examples/demo-rollup/tests/evm/test_client.rs +++ b/examples/demo-rollup/tests/evm/test_client.rs @@ -123,6 +123,8 @@ impl TestClient { &self, contract_address: H160, set_arg: u32, + max_priority_fee_per_gas: Option, + max_fee_per_gas: Option, ) -> PendingTransaction<'_, Http> { let nonce = self.eth_get_transaction_count(self.from_addr).await; @@ -132,8 +134,8 @@ impl TestClient { .chain_id(self.chain_id) .nonce(nonce) .data(self.contract.set_call_data(set_arg)) - .max_priority_fee_per_gas(10u64) - .max_fee_per_gas(MAX_FEE_PER_GAS) + .max_priority_fee_per_gas(max_priority_fee_per_gas.unwrap_or(10u64)) + .max_fee_per_gas(max_fee_per_gas.unwrap_or(MAX_FEE_PER_GAS)) .gas(GAS); let typed_transaction = TypedTransaction::Eip1559(req); @@ -286,6 +288,13 @@ impl TestClient { count.as_u64() } + pub(crate) async fn eth_gas_price(&self) -> ethereum_types::U256 { + self.http_client + .request("eth_gasPrice", rpc_params![]) + .await + .unwrap() + } + pub(crate) async fn eth_get_block_by_number( &self, block_number: Option, From 8a6eefebd12816a4103b9bd57dbc880c24017ead Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Tue, 10 Oct 2023 11:33:49 +0300 Subject: [PATCH 15/26] lint --- examples/demo-rollup/tests/evm/mod.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/demo-rollup/tests/evm/mod.rs b/examples/demo-rollup/tests/evm/mod.rs index 252bcc38c..fdc74b92a 100644 --- a/examples/demo-rollup/tests/evm/mod.rs +++ b/examples/demo-rollup/tests/evm/mod.rs @@ -9,7 +9,6 @@ use ethers_signers::{LocalWallet, Signer}; use sov_evm::SimpleStorageContract; use sov_risc0_adapter::host::Risc0Host; use test_client::TestClient; -use tracing::info; use super::test_helpers::start_rollup; From b286b6a88940562c95ecf6c46360a8f88b1ea2c2 Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Tue, 10 Oct 2023 14:32:54 +0300 Subject: [PATCH 16/26] fix --- full-node/sov-ethereum-gas-price/src/cache.rs | 2 +- full-node/sov-ethereum-gas-price/src/gas_oracle.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/full-node/sov-ethereum-gas-price/src/cache.rs b/full-node/sov-ethereum-gas-price/src/cache.rs index aefc678f9..3d16ce036 100644 --- a/full-node/sov-ethereum-gas-price/src/cache.rs +++ b/full-node/sov-ethereum-gas-price/src/cache.rs @@ -35,7 +35,7 @@ impl BlockCache { // Get block from provider let block = self .provider - .get_block_by_hash(block_hash.into(), Some(true), working_set) + .get_block_by_hash(block_hash, Some(true), working_set) .unwrap_or(None); // Add block to cache if it exists diff --git a/full-node/sov-ethereum-gas-price/src/gas_oracle.rs b/full-node/sov-ethereum-gas-price/src/gas_oracle.rs index fb76178ad..bf0ab6510 100644 --- a/full-node/sov-ethereum-gas-price/src/gas_oracle.rs +++ b/full-node/sov-ethereum-gas-price/src/gas_oracle.rs @@ -25,7 +25,7 @@ pub const DEFAULT_MAX_PRICE: U256 = U256::from_limbs([500_000_000_000u64, 0, 0, /// The default minimum gas price, under which the sample will be ignored pub const DEFAULT_IGNORE_PRICE: U256 = U256::from_limbs([2u64, 0, 0, 0]); -/// Settings for the [GasPriceOracle] +/// Settings for the gas price oracle configured by node operators #[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GasPriceOracleConfig { From ca1a973e6a1dc82d4c8ff39e6f7cdaa169115f49 Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Tue, 10 Oct 2023 14:35:10 +0300 Subject: [PATCH 17/26] remove unnecessary line --- full-node/sov-ethereum-gas-price/src/gas_oracle.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/full-node/sov-ethereum-gas-price/src/gas_oracle.rs b/full-node/sov-ethereum-gas-price/src/gas_oracle.rs index bf0ab6510..c95d27667 100644 --- a/full-node/sov-ethereum-gas-price/src/gas_oracle.rs +++ b/full-node/sov-ethereum-gas-price/src/gas_oracle.rs @@ -97,8 +97,6 @@ pub struct GasPriceOracle { cache: BlockCache, } -//unsafe impl Send for GasPriceOracle {} - impl GasPriceOracle { /// Creates and returns the [GasPriceOracle]. pub fn new(provider: Evm, mut oracle_config: GasPriceOracleConfig) -> Self { From 8422891b3d8ffb89d6c3d315ce3d357b3e501290 Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Tue, 10 Oct 2023 15:31:02 +0300 Subject: [PATCH 18/26] move module into sov-ethereum --- full-node/sov-ethereum/Cargo.toml | 4 + full-node/sov-ethereum/src/gas_price/cache.rs | 48 +++ .../sov-ethereum/src/gas_price/gas_oracle.rs | 328 ++++++++++++++++++ full-node/sov-ethereum/src/gas_price/mod.rs | 2 + full-node/sov-ethereum/src/lib.rs | 38 ++ 5 files changed, 420 insertions(+) create mode 100644 full-node/sov-ethereum/src/gas_price/cache.rs create mode 100644 full-node/sov-ethereum/src/gas_price/gas_oracle.rs create mode 100644 full-node/sov-ethereum/src/gas_price/mod.rs diff --git a/full-node/sov-ethereum/Cargo.toml b/full-node/sov-ethereum/Cargo.toml index bf09e2907..ae13ea64c 100644 --- a/full-node/sov-ethereum/Cargo.toml +++ b/full-node/sov-ethereum/Cargo.toml @@ -13,6 +13,7 @@ publish = false [dependencies] anyhow = { workspace = true } +tracing = { workspace = true } jsonrpsee = { workspace = true, features = ["http-client", "server"] } sov-rollup-interface = { path = "../../rollup-interface" } @@ -21,12 +22,15 @@ demo-stf = { path = "../../examples/demo-stf", features = ["native"] } sov-modules-api = { path = "../../module-system/sov-modules-api" } borsh = { workspace = true } +serde = { workspace = true } serde_json = { workspace = true } reth-primitives = { workspace = true } reth-rpc-types = { workspace = true } ethers = { workspace = true } +tokio = { workspace = true } +schnellru = "0.2.1" [dev-dependencies] sov-rollup-interface = { path = "../../rollup-interface", features = ["mocks"] } diff --git a/full-node/sov-ethereum/src/gas_price/cache.rs b/full-node/sov-ethereum/src/gas_price/cache.rs new file mode 100644 index 000000000..3d16ce036 --- /dev/null +++ b/full-node/sov-ethereum/src/gas_price/cache.rs @@ -0,0 +1,48 @@ +use std::sync::Mutex; + +use reth_primitives::H256; +use reth_rpc_types::{Block, Rich}; +use schnellru::{ByLength, LruMap}; +use sov_evm::EthResult; +use sov_modules_api::WorkingSet; + +/// Block cache for gas oracle +pub struct BlockCache { + cache: Mutex, ByLength>>, + provider: sov_evm::Evm, +} + +impl BlockCache { + pub fn new(max_size: u32, provider: sov_evm::Evm) -> Self { + Self { + cache: Mutex::new(LruMap::new(ByLength::new(max_size))), + provider, + } + } + + /// Gets block from cache or from provider + pub fn get_block( + &self, + block_hash: H256, + working_set: &mut WorkingSet, + ) -> EthResult>> { + // Check if block is in cache + let mut cache = self.cache.lock().unwrap(); + if let Some(block) = cache.get(&block_hash) { + return Ok(Some(block.clone())); + } + + // Get block from provider + let block = self + .provider + .get_block_by_hash(block_hash, Some(true), working_set) + .unwrap_or(None); + + // Add block to cache if it exists + if let Some(block) = &block { + cache.insert(block_hash, block.clone()); + } + + Ok(block) + } +} diff --git a/full-node/sov-ethereum/src/gas_price/gas_oracle.rs b/full-node/sov-ethereum/src/gas_price/gas_oracle.rs new file mode 100644 index 000000000..1010b9965 --- /dev/null +++ b/full-node/sov-ethereum/src/gas_price/gas_oracle.rs @@ -0,0 +1,328 @@ +//! An implementation of the eth gas price oracle, used for providing gas price estimates based on +//! previous blocks. + +// Adopted from: https://github.com/paradigmxyz/reth/blob/main/crates/rpc/rpc/src/eth/gas_oracle.rs + +use std::array::TryFromSliceError; + +use reth_primitives::constants::GWEI_TO_WEI; +use reth_primitives::{H256, U256, U64}; +use reth_rpc_types::BlockTransactions; +use serde::{Deserialize, Serialize}; +use sov_evm::{EthApiError, EthResult, Evm, RpcInvalidTransactionError}; +use sov_modules_api::WorkingSet; +use tokio::sync::Mutex; +use tracing::warn; + +use super::cache::BlockCache; + +/// The number of transactions sampled in a block +pub const SAMPLE_NUMBER: u32 = 3; + +/// The default maximum gas price to use for the estimate +pub const DEFAULT_MAX_PRICE: U256 = U256::from_limbs([500_000_000_000u64, 0, 0, 0]); + +/// The default minimum gas price, under which the sample will be ignored +pub const DEFAULT_IGNORE_PRICE: U256 = U256::from_limbs([2u64, 0, 0, 0]); + +/// Settings for the gas price oracle configured by node operators +#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct GasPriceOracleConfig { + /// The number of populated blocks to produce the gas price estimate + pub blocks: u32, + + /// The percentile of gas prices to use for the estimate + pub percentile: u32, + + /// The maximum number of headers to keep in the cache + pub max_header_history: u32, + + /// The maximum number of blocks for estimating gas price + pub max_block_history: u64, + + /// The default gas price to use if there are no blocks to use + pub default: Option, + + /// The maximum gas price to use for the estimate + pub max_price: Option, + + /// The minimum gas price, under which the sample will be ignored + pub ignore_price: Option, +} + +impl Default for GasPriceOracleConfig { + fn default() -> Self { + GasPriceOracleConfig { + blocks: 20, + percentile: 60, + max_header_history: 1024, + max_block_history: 1024, + default: None, + max_price: Some(DEFAULT_MAX_PRICE), + ignore_price: Some(DEFAULT_IGNORE_PRICE), + } + } +} + +impl GasPriceOracleConfig { + /// Creating a new gpo config with blocks, ignoreprice, maxprice and percentile + pub fn new( + blocks: Option, + ignore_price: Option, + max_price: Option, + percentile: Option, + ) -> Self { + Self { + blocks: blocks.unwrap_or(20), + percentile: percentile.unwrap_or(60), + max_header_history: 1024, + max_block_history: 1024, + default: None, + max_price: max_price.map(U256::from).or(Some(DEFAULT_MAX_PRICE)), + ignore_price: ignore_price.map(U256::from).or(Some(DEFAULT_IGNORE_PRICE)), + } + } +} + +/// Calculates a gas price depending on recent blocks. +pub struct GasPriceOracle { + /// The type used to get block and tx info + provider: Evm, + /// The config for the oracle + oracle_config: GasPriceOracleConfig, + /// The latest calculated price and its block hash + last_price: Mutex, + /// Cache + cache: BlockCache, +} + +impl GasPriceOracle { + /// Creates and returns the [GasPriceOracle]. + pub fn new(provider: Evm, mut oracle_config: GasPriceOracleConfig) -> Self { + // sanitize the percentile to be less than 100 + if oracle_config.percentile > 100 { + warn!(prev_percentile = ?oracle_config.percentile, "Invalid configured gas price percentile, assuming 100."); + oracle_config.percentile = 100; + } + + let max_header_history = oracle_config.max_header_history; + + Self { + provider: provider.clone(), + oracle_config, + last_price: Default::default(), + cache: BlockCache::::new(max_header_history, provider), + } + } + + /// Suggests a gas price estimate based on recent blocks, using the configured percentile. + pub async fn suggest_tip_cap(&self, working_set: &mut WorkingSet) -> EthResult { + let header = &self + .provider + .get_block_by_number(None, None, working_set) + .unwrap() + .unwrap() + .header; + + let mut last_price = self.last_price.lock().await; + + // if we have stored a last price, then we check whether or not it was for the same head + if last_price.block_hash == header.hash.unwrap() { + return Ok(last_price.price); + } + + // if all responses are empty, then we can return a maximum of 2*check_block blocks' worth + // of prices + // + // we only return more than check_block blocks' worth of prices if one or more return empty + // transactions + let mut current_hash = header.hash.unwrap(); + let mut results = Vec::new(); + let mut populated_blocks = 0; + + let header_number = convert_u256_to_u64(header.number.unwrap()).unwrap(); + + // we only check a maximum of 2 * max_block_history, or the number of blocks in the chain + let max_blocks = if self.oracle_config.max_block_history * 2 > header_number { + header_number + } else { + self.oracle_config.max_block_history * 2 + }; + + for _ in 0..max_blocks { + let (parent_hash, block_values) = self + .get_block_values(current_hash, SAMPLE_NUMBER as usize, working_set) + .await? + .ok_or(EthApiError::UnknownBlockNumber)?; + + if block_values.is_empty() { + results.push(U256::from(last_price.price)); + } else { + results.extend(block_values); + populated_blocks += 1; + } + + // break when we have enough populated blocks + if populated_blocks >= self.oracle_config.blocks { + break; + } + + current_hash = parent_hash; + } + + // sort results then take the configured percentile result + let mut price = last_price.price; + if !results.is_empty() { + results.sort_unstable(); + price = *results + .get((results.len() - 1) * self.oracle_config.percentile as usize / 100) + .expect("gas price index is a percent of nonzero array length, so a value always exists; qed"); + } + + // constrain to the max price + if let Some(max_price) = self.oracle_config.max_price { + if price > max_price { + price = max_price; + } + } + + *last_price = GasPriceOracleResult { + block_hash: header.hash.unwrap(), + price, + }; + + Ok(price) + } + + /// Get the `limit` lowest effective tip values for the given block. If the oracle has a + /// configured `ignore_price` threshold, then tip values under that threshold will be ignored + /// before returning a result. + /// + /// If the block cannot be found, then this will return `None`. + /// + /// This method also returns the parent hash for the given block. + async fn get_block_values( + &self, + block_hash: H256, + limit: usize, + working_set: &mut WorkingSet, + ) -> EthResult)>> { + // check the cache (this will hit the disk if the block is not cached) + let block = match self.cache.get_block(block_hash, working_set)? { + Some(block) => block, + None => return Ok(None), + }; + + // sort the transactions by effective tip + // but first filter those that should be ignored + + // get the transactions (block.transactions is a enum but we only care about the 2nd arm) + let txs = match &block.transactions { + BlockTransactions::Full(txs) => txs, + _ => return Ok(None), + }; + + let mut txs = txs + .iter() + .filter(|tx| { + if let Some(ignore_under) = self.oracle_config.ignore_price { + let effective_gas_tip = effective_gas_tip(tx, block.header.base_fee_per_gas); + if effective_gas_tip < Some(ignore_under) { + return false; + } + } + + // check if coinbase + let sender = tx.from; + sender != block.header.miner + }) + // map all values to effective_gas_tip because we will be returning those values + // anyways + .map(|tx| effective_gas_tip(tx, block.header.base_fee_per_gas)) + .collect::>(); + + // now do the sort + txs.sort_unstable(); + + // fill result with the top `limit` transactions + let mut final_result = Vec::with_capacity(limit); + for tx in txs.iter().take(limit) { + // a `None` effective_gas_tip represents a transaction where the max_fee_per_gas is + // less than the base fee + let effective_tip = tx.ok_or(RpcInvalidTransactionError::FeeCapTooLow)?; + final_result.push(U256::from(effective_tip)); + } + + Ok(Some((block.header.parent_hash, final_result))) + } +} + +/// Stores the last result that the oracle returned +#[derive(Debug, Clone)] +pub struct GasPriceOracleResult { + /// The block hash that the oracle used to calculate the price + pub block_hash: H256, + /// The price that the oracle calculated + pub price: U256, +} + +impl Default for GasPriceOracleResult { + fn default() -> Self { + Self { + block_hash: H256::zero(), + price: U256::from(GWEI_TO_WEI), + } + } +} + +// Adopted from: https://github.com/paradigmxyz/reth/blob/main/crates/primitives/src/transaction/mod.rs#L297 +fn effective_gas_tip( + transaction: &reth_rpc_types::Transaction, + base_fee: Option, +) -> Option { + let priority_fee_or_price = U256::from(match transaction.transaction_type { + Some(U64([2])) => transaction.max_priority_fee_per_gas.unwrap(), + _ => transaction.gas_price.unwrap(), + }); + + if let Some(base_fee) = base_fee { + let max_fee_per_gas = U256::from(match transaction.transaction_type { + Some(U64([2])) => transaction.max_fee_per_gas.unwrap(), + _ => transaction.gas_price.unwrap(), + }); + + if max_fee_per_gas < base_fee { + None + } else { + let effective_max_fee = max_fee_per_gas - base_fee; + Some(std::cmp::min(effective_max_fee, priority_fee_or_price)) + } + } else { + Some(priority_fee_or_price) + } +} + +#[cfg(test)] +mod tests { + use reth_primitives::constants::GWEI_TO_WEI; + + use super::*; + + #[test] + fn max_price_sanity() { + assert_eq!(DEFAULT_MAX_PRICE, U256::from(500_000_000_000u64)); + assert_eq!(DEFAULT_MAX_PRICE, U256::from(500 * GWEI_TO_WEI)) + } + + #[test] + fn ignore_price_sanity() { + assert_eq!(DEFAULT_IGNORE_PRICE, U256::from(2u64)); + } +} + +fn convert_u256_to_u64(u256: reth_primitives::U256) -> Result { + let bytes: [u8; 32] = u256.to_be_bytes(); + let bytes: [u8; 8] = bytes[24..].try_into()?; + Ok(u64::from_be_bytes(bytes)) +} diff --git a/full-node/sov-ethereum/src/gas_price/mod.rs b/full-node/sov-ethereum/src/gas_price/mod.rs new file mode 100644 index 000000000..730e07f7a --- /dev/null +++ b/full-node/sov-ethereum/src/gas_price/mod.rs @@ -0,0 +1,2 @@ +pub(crate) mod cache; +pub(crate) mod gas_oracle; diff --git a/full-node/sov-ethereum/src/lib.rs b/full-node/sov-ethereum/src/lib.rs index 0a9e4bbe0..d6988c12b 100644 --- a/full-node/sov-ethereum/src/lib.rs +++ b/full-node/sov-ethereum/src/lib.rs @@ -1,8 +1,12 @@ #[cfg(feature = "experimental")] mod batch_builder; #[cfg(feature = "experimental")] +mod gas_price; +#[cfg(feature = "experimental")] pub use experimental::{get_ethereum_rpc, Ethereum}; #[cfg(feature = "experimental")] +pub use gas_price::gas_oracle::GasPriceOracleConfig; +#[cfg(feature = "experimental")] pub use sov_evm::DevSigner; #[cfg(feature = "experimental")] @@ -27,6 +31,9 @@ pub mod experimental { use sov_modules_api::{EncodeCall, WorkingSet}; use sov_rollup_interface::services::da::DaService; + use crate::gas_price::gas_oracle::GasPriceOracle; + use crate::GasPriceOracleConfig; + use super::batch_builder::EthBatchBuilder; #[cfg(feature = "local")] use super::DevSigner; @@ -36,6 +43,7 @@ pub mod experimental { pub struct EthRpcConfig { pub min_blob_size: Option, pub sov_tx_signer_priv_key: DefaultPrivateKey, + pub gas_price_oracle_config: GasPriceOracleConfig, #[cfg(feature = "local")] pub eth_signer: DevSigner, } @@ -61,6 +69,7 @@ pub mod experimental { nonces: Mutex>, da_service: Da, batch_builder: Arc>, + gas_price_oracle: GasPriceOracle, eth_rpc_config: EthRpcConfig, storage: C::Storage, } @@ -73,10 +82,14 @@ pub mod experimental { eth_rpc_config: EthRpcConfig, storage: C::Storage, ) -> Self { + let evm = Evm::::default(); + let gas_price_oracle_config = eth_rpc_config.gas_price_oracle_config.clone(); + let gas_price_oracle = GasPriceOracle::new(evm, gas_price_oracle_config); Self { nonces, da_service, batch_builder, + gas_price_oracle, eth_rpc_config, storage, } @@ -149,6 +162,31 @@ pub mod experimental { fn register_rpc_methods( rpc: &mut RpcModule>, ) -> Result<(), jsonrpsee::core::Error> { + rpc.register_async_method("eth_gasPrice", |_, ethereum| async move { + let price = { + let mut working_set = WorkingSet::::new(ethereum.storage.clone()); + + let suggested_tip = ethereum + .gas_price_oracle + .suggest_tip_cap(&mut working_set) + .await + .unwrap(); + + let evm = Evm::::default(); + let base_fee = evm + .get_block_by_number(None, None, &mut working_set) + .unwrap() + .unwrap() + .header + .base_fee_per_gas + .unwrap_or_default(); + + suggested_tip + base_fee + }; + + Ok::(price) + })?; + rpc.register_async_method("eth_publishBatch", |params, ethereum| async move { let mut params_iter = params.sequence(); From 3a2ff15d94f6487451e6cce27cf2c6caaa18bc3c Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Tue, 10 Oct 2023 15:31:14 +0300 Subject: [PATCH 19/26] move module into sov-ethereum --- Cargo.lock | 21 +- Cargo.toml | 1 - examples/demo-rollup/Cargo.toml | 2 - examples/demo-rollup/src/register_rpc.rs | 16 - examples/demo-rollup/src/rollup.rs | 19 +- full-node/sov-ethereum-gas-price/Cargo.toml | 44 --- full-node/sov-ethereum-gas-price/src/cache.rs | 48 --- .../sov-ethereum-gas-price/src/gas_oracle.rs | 328 ------------------ full-node/sov-ethereum-gas-price/src/lib.rs | 77 ---- 9 files changed, 5 insertions(+), 551 deletions(-) delete mode 100644 full-node/sov-ethereum-gas-price/Cargo.toml delete mode 100644 full-node/sov-ethereum-gas-price/src/cache.rs delete mode 100644 full-node/sov-ethereum-gas-price/src/gas_oracle.rs delete mode 100644 full-node/sov-ethereum-gas-price/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 93cbd00c1..354c75945 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8346,7 +8346,6 @@ dependencies = [ "sov-db", "sov-demo-rollup", "sov-ethereum", - "sov-ethereum-gas-price", "sov-evm", "sov-modules-api", "sov-modules-stf-template", @@ -8374,24 +8373,6 @@ dependencies = [ "jsonrpsee 0.18.2", "reth-primitives", "reth-rpc-types", - "serde_json", - "sov-evm", - "sov-modules-api", - "sov-rollup-interface", - "tokio", -] - -[[package]] -name = "sov-ethereum-gas-price" -version = "0.2.0" -dependencies = [ - "anyhow", - "borsh", - "demo-stf", - "jsonrpsee 0.18.2", - "reth-interfaces", - "reth-primitives", - "reth-rpc-types", "schnellru", "serde", "serde_json", @@ -9658,7 +9639,7 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 1.0.67", + "proc-macro2 1.0.69", "quote 1.0.33", "syn 1.0.109", "unicode-xid 0.2.4", diff --git a/Cargo.toml b/Cargo.toml index 5d7b22672..3347c1dfe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,6 @@ members = [ "full-node/db/sov-db", "full-node/sov-sequencer", "full-node/sov-ethereum", - "full-node/sov-ethereum-gas-price", "full-node/sov-stf-runner", "utils/zk-cycle-macros", diff --git a/examples/demo-rollup/Cargo.toml b/examples/demo-rollup/Cargo.toml index 5f1728a25..e9157e51b 100644 --- a/examples/demo-rollup/Cargo.toml +++ b/examples/demo-rollup/Cargo.toml @@ -43,7 +43,6 @@ tracing-subscriber = { version = "0.3.17", features = [ ], optional = true } sov-db = { path = "../../full-node/db/sov-db", optional = true } -sov-ethereum-gas-price = { path = "../../full-node/sov-ethereum-gas-price", optional = true } sov-ethereum = { path = "../../full-node/sov-ethereum", optional = true } sov-sequencer = { path = "../../full-node/sov-sequencer", optional = true } sov-risc0-adapter = { path = "../../adapters/risc0" } @@ -92,7 +91,6 @@ default = [ experimental = [ "default", "sov-ethereum/experimental", - "sov-ethereum-gas-price/experimental", "reth-primitives", "secp256k1", "demo-stf/experimental", diff --git a/examples/demo-rollup/src/register_rpc.rs b/examples/demo-rollup/src/register_rpc.rs index d990f30c5..9f119dc69 100644 --- a/examples/demo-rollup/src/register_rpc.rs +++ b/examples/demo-rollup/src/register_rpc.rs @@ -54,19 +54,3 @@ pub fn register_ethereum( .merge(ethereum_rpc) .context("Failed to merge Ethereum RPC modules") } - -#[cfg(feature = "experimental")] -/// register ethereum gas price methods. -pub fn register_ethereum_gas_price( - gas_price_oracle_config: sov_ethereum_gas_price::experimental::GasPriceOracleConfig, - storage: C::Storage, - methods: &mut jsonrpsee::RpcModule<()>, -) -> Result<(), anyhow::Error> { - let ethereum_gas_price_rpc = sov_ethereum_gas_price::experimental::get_ethereum_gas_price_rpc::< - C, - >(gas_price_oracle_config, storage); - - methods - .merge(ethereum_gas_price_rpc) - .context("Failed to merge Ethereum gas price RPC modules") -} diff --git a/examples/demo-rollup/src/rollup.rs b/examples/demo-rollup/src/rollup.rs index a7b34b7f5..dc2deba2b 100644 --- a/examples/demo-rollup/src/rollup.rs +++ b/examples/demo-rollup/src/rollup.rs @@ -17,8 +17,8 @@ use sov_cli::wallet_state::PrivateKeyAndAddress; use sov_db::ledger_db::LedgerDB; #[cfg(feature = "experimental")] use sov_ethereum::experimental::EthRpcConfig; +use sov_ethereum::GasPriceOracleConfig; #[cfg(feature = "experimental")] -use sov_ethereum_gas_price::experimental::GasPriceOracleConfig; use sov_modules_api::default_context::{DefaultContext, ZkDefaultContext}; #[cfg(feature = "experimental")] use sov_modules_api::default_signature::private_key::DefaultPrivateKey; @@ -35,7 +35,7 @@ use tokio::sync::oneshot; use tracing::debug; #[cfg(feature = "experimental")] -use crate::register_rpc::{register_ethereum, register_ethereum_gas_price}; +use crate::register_rpc::register_ethereum; use crate::register_rpc::{register_ledger, register_sequencer}; use crate::{initialize_ledger, ROLLUP_NAMESPACE}; @@ -59,9 +59,6 @@ pub struct Rollup { #[cfg(feature = "experimental")] /// Configuration for the Ethereum RPC. pub eth_rpc_config: EthRpcConfig, - #[cfg(feature = "experimental")] - /// Configuration for the gas price oracle. - pub gas_price_oracle_config: GasPriceOracleConfig, /// Prover for the rollup. #[allow(clippy::type_complexity)] pub prover: Option, Da, Vm>>, @@ -152,9 +149,8 @@ pub async fn new_rollup_with_celestia_da>( min_blob_size: Some(1), sov_tx_signer_priv_key: read_sov_tx_signer_priv_key()?, eth_signer, + gas_price_oracle_config: GasPriceOracleConfig::default(), }, - #[cfg(feature = "experimental")] - gas_price_oracle_config: GasPriceOracleConfig::default(), prover, }) } @@ -208,9 +204,8 @@ pub fn new_rollup_with_mock_da_from_config>( min_blob_size: Some(1), sov_tx_signer_priv_key: read_sov_tx_signer_priv_key()?, eth_signer, + gas_price_oracle_config: GasPriceOracleConfig::default(), }, - #[cfg(feature = "experimental")] - gas_price_oracle_config: GasPriceOracleConfig::default(), prover, }) } @@ -265,12 +260,6 @@ impl + Clone> Rollup storage.clone(), &mut methods, )?; - #[cfg(feature = "experimental")] - register_ethereum_gas_price::( - self.gas_price_oracle_config, - storage, - &mut methods, - )?; } let mut runner = StateTransitionRunner::new( diff --git a/full-node/sov-ethereum-gas-price/Cargo.toml b/full-node/sov-ethereum-gas-price/Cargo.toml deleted file mode 100644 index ab2155e03..000000000 --- a/full-node/sov-ethereum-gas-price/Cargo.toml +++ /dev/null @@ -1,44 +0,0 @@ -[package] -name = "sov-ethereum-gas-price" -authors = { workspace = true } -edition = { workspace = true } -homepage = { workspace = true } -license = { workspace = true } -repository = { workspace = true } -rust-version = { workspace = true } -version = { workspace = true } -readme = "README.md" -resolver = "2" -publish = false - -[dependencies] -anyhow = { workspace = true } -serde = { workspace = true } -tokio = { workspace = true } -tracing = { workspace = true } -jsonrpsee = { workspace = true, features = ["http-client", "server"] } -sov-rollup-interface = { path = "../../rollup-interface" } - -sov-evm = { path = "../../module-system/module-implementations/sov-evm" } -demo-stf = { path = "../../examples/demo-stf", features = ["native"] } -sov-modules-api = { path = "../../module-system/sov-modules-api" } - -borsh = { workspace = true } -serde_json = { workspace = true } - -reth-primitives = { workspace = true } -reth-rpc-types = { workspace = true } -reth-interfaces = { workspace = true } - -schnellru = "0.2.1" - -[dev-dependencies] -sov-rollup-interface = { path = "../../rollup-interface", features = ["mocks"] } -tokio = { workspace = true } - - -[features] -default = [] -local = [] -experimental = ["demo-stf/experimental", "sov-evm/experimental", "local"] -native = ["demo-stf/native", "sov-evm/native"] diff --git a/full-node/sov-ethereum-gas-price/src/cache.rs b/full-node/sov-ethereum-gas-price/src/cache.rs deleted file mode 100644 index 3d16ce036..000000000 --- a/full-node/sov-ethereum-gas-price/src/cache.rs +++ /dev/null @@ -1,48 +0,0 @@ -use std::sync::Mutex; - -use reth_primitives::H256; -use reth_rpc_types::{Block, Rich}; -use schnellru::{ByLength, LruMap}; -use sov_evm::EthResult; -use sov_modules_api::WorkingSet; - -/// Block cache for gas oracle -pub struct BlockCache { - cache: Mutex, ByLength>>, - provider: sov_evm::Evm, -} - -impl BlockCache { - pub fn new(max_size: u32, provider: sov_evm::Evm) -> Self { - Self { - cache: Mutex::new(LruMap::new(ByLength::new(max_size))), - provider, - } - } - - /// Gets block from cache or from provider - pub fn get_block( - &self, - block_hash: H256, - working_set: &mut WorkingSet, - ) -> EthResult>> { - // Check if block is in cache - let mut cache = self.cache.lock().unwrap(); - if let Some(block) = cache.get(&block_hash) { - return Ok(Some(block.clone())); - } - - // Get block from provider - let block = self - .provider - .get_block_by_hash(block_hash, Some(true), working_set) - .unwrap_or(None); - - // Add block to cache if it exists - if let Some(block) = &block { - cache.insert(block_hash, block.clone()); - } - - Ok(block) - } -} diff --git a/full-node/sov-ethereum-gas-price/src/gas_oracle.rs b/full-node/sov-ethereum-gas-price/src/gas_oracle.rs deleted file mode 100644 index c95d27667..000000000 --- a/full-node/sov-ethereum-gas-price/src/gas_oracle.rs +++ /dev/null @@ -1,328 +0,0 @@ -//! An implementation of the eth gas price oracle, used for providing gas price estimates based on -//! previous blocks. - -// Adopted from: https://github.com/paradigmxyz/reth/blob/main/crates/rpc/rpc/src/eth/gas_oracle.rs - -use std::array::TryFromSliceError; - -use reth_primitives::constants::GWEI_TO_WEI; -use reth_primitives::{H256, U256, U64}; -use reth_rpc_types::BlockTransactions; -use serde::{Deserialize, Serialize}; -use sov_evm::{EthApiError, EthResult, Evm, RpcInvalidTransactionError}; -use sov_modules_api::WorkingSet; -use tokio::sync::Mutex; -use tracing::warn; - -use crate::cache::BlockCache; - -/// The number of transactions sampled in a block -pub const SAMPLE_NUMBER: u32 = 3; - -/// The default maximum gas price to use for the estimate -pub const DEFAULT_MAX_PRICE: U256 = U256::from_limbs([500_000_000_000u64, 0, 0, 0]); - -/// The default minimum gas price, under which the sample will be ignored -pub const DEFAULT_IGNORE_PRICE: U256 = U256::from_limbs([2u64, 0, 0, 0]); - -/// Settings for the gas price oracle configured by node operators -#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct GasPriceOracleConfig { - /// The number of populated blocks to produce the gas price estimate - pub blocks: u32, - - /// The percentile of gas prices to use for the estimate - pub percentile: u32, - - /// The maximum number of headers to keep in the cache - pub max_header_history: u32, - - /// The maximum number of blocks for estimating gas price - pub max_block_history: u64, - - /// The default gas price to use if there are no blocks to use - pub default: Option, - - /// The maximum gas price to use for the estimate - pub max_price: Option, - - /// The minimum gas price, under which the sample will be ignored - pub ignore_price: Option, -} - -impl Default for GasPriceOracleConfig { - fn default() -> Self { - GasPriceOracleConfig { - blocks: 20, - percentile: 60, - max_header_history: 1024, - max_block_history: 1024, - default: None, - max_price: Some(DEFAULT_MAX_PRICE), - ignore_price: Some(DEFAULT_IGNORE_PRICE), - } - } -} - -impl GasPriceOracleConfig { - /// Creating a new gpo config with blocks, ignoreprice, maxprice and percentile - pub fn new( - blocks: Option, - ignore_price: Option, - max_price: Option, - percentile: Option, - ) -> Self { - Self { - blocks: blocks.unwrap_or(20), - percentile: percentile.unwrap_or(60), - max_header_history: 1024, - max_block_history: 1024, - default: None, - max_price: max_price.map(U256::from).or(Some(DEFAULT_MAX_PRICE)), - ignore_price: ignore_price.map(U256::from).or(Some(DEFAULT_IGNORE_PRICE)), - } - } -} - -/// Calculates a gas price depending on recent blocks. -pub struct GasPriceOracle { - /// The type used to get block and tx info - provider: Evm, - /// The config for the oracle - oracle_config: GasPriceOracleConfig, - /// The latest calculated price and its block hash - last_price: Mutex, - /// Cache - cache: BlockCache, -} - -impl GasPriceOracle { - /// Creates and returns the [GasPriceOracle]. - pub fn new(provider: Evm, mut oracle_config: GasPriceOracleConfig) -> Self { - // sanitize the percentile to be less than 100 - if oracle_config.percentile > 100 { - warn!(prev_percentile = ?oracle_config.percentile, "Invalid configured gas price percentile, assuming 100."); - oracle_config.percentile = 100; - } - - let max_header_history = oracle_config.max_header_history; - - Self { - provider: provider.clone(), - oracle_config, - last_price: Default::default(), - cache: BlockCache::::new(max_header_history, provider), - } - } - - /// Suggests a gas price estimate based on recent blocks, using the configured percentile. - pub async fn suggest_tip_cap(&self, working_set: &mut WorkingSet) -> EthResult { - let header = &self - .provider - .get_block_by_number(None, None, working_set) - .unwrap() - .unwrap() - .header; - - let mut last_price = self.last_price.lock().await; - - // if we have stored a last price, then we check whether or not it was for the same head - if last_price.block_hash == header.hash.unwrap() { - return Ok(last_price.price); - } - - // if all responses are empty, then we can return a maximum of 2*check_block blocks' worth - // of prices - // - // we only return more than check_block blocks' worth of prices if one or more return empty - // transactions - let mut current_hash = header.hash.unwrap(); - let mut results = Vec::new(); - let mut populated_blocks = 0; - - let header_number = convert_u256_to_u64(header.number.unwrap()).unwrap(); - - // we only check a maximum of 2 * max_block_history, or the number of blocks in the chain - let max_blocks = if self.oracle_config.max_block_history * 2 > header_number { - header_number - } else { - self.oracle_config.max_block_history * 2 - }; - - for _ in 0..max_blocks { - let (parent_hash, block_values) = self - .get_block_values(current_hash, SAMPLE_NUMBER as usize, working_set) - .await? - .ok_or(EthApiError::UnknownBlockNumber)?; - - if block_values.is_empty() { - results.push(U256::from(last_price.price)); - } else { - results.extend(block_values); - populated_blocks += 1; - } - - // break when we have enough populated blocks - if populated_blocks >= self.oracle_config.blocks { - break; - } - - current_hash = parent_hash; - } - - // sort results then take the configured percentile result - let mut price = last_price.price; - if !results.is_empty() { - results.sort_unstable(); - price = *results - .get((results.len() - 1) * self.oracle_config.percentile as usize / 100) - .expect("gas price index is a percent of nonzero array length, so a value always exists; qed"); - } - - // constrain to the max price - if let Some(max_price) = self.oracle_config.max_price { - if price > max_price { - price = max_price; - } - } - - *last_price = GasPriceOracleResult { - block_hash: header.hash.unwrap(), - price, - }; - - Ok(price) - } - - /// Get the `limit` lowest effective tip values for the given block. If the oracle has a - /// configured `ignore_price` threshold, then tip values under that threshold will be ignored - /// before returning a result. - /// - /// If the block cannot be found, then this will return `None`. - /// - /// This method also returns the parent hash for the given block. - async fn get_block_values( - &self, - block_hash: H256, - limit: usize, - working_set: &mut WorkingSet, - ) -> EthResult)>> { - // check the cache (this will hit the disk if the block is not cached) - let block = match self.cache.get_block(block_hash, working_set)? { - Some(block) => block, - None => return Ok(None), - }; - - // sort the transactions by effective tip - // but first filter those that should be ignored - - // get the transactions (block.transactions is a enum but we only care about the 2nd arm) - let txs = match &block.transactions { - BlockTransactions::Full(txs) => txs, - _ => return Ok(None), - }; - - let mut txs = txs - .iter() - .filter(|tx| { - if let Some(ignore_under) = self.oracle_config.ignore_price { - let effective_gas_tip = effective_gas_tip(tx, block.header.base_fee_per_gas); - if effective_gas_tip < Some(ignore_under) { - return false; - } - } - - // check if coinbase - let sender = tx.from; - sender != block.header.miner - }) - // map all values to effective_gas_tip because we will be returning those values - // anyways - .map(|tx| effective_gas_tip(tx, block.header.base_fee_per_gas)) - .collect::>(); - - // now do the sort - txs.sort_unstable(); - - // fill result with the top `limit` transactions - let mut final_result = Vec::with_capacity(limit); - for tx in txs.iter().take(limit) { - // a `None` effective_gas_tip represents a transaction where the max_fee_per_gas is - // less than the base fee - let effective_tip = tx.ok_or(RpcInvalidTransactionError::FeeCapTooLow)?; - final_result.push(U256::from(effective_tip)); - } - - Ok(Some((block.header.parent_hash, final_result))) - } -} - -/// Stores the last result that the oracle returned -#[derive(Debug, Clone)] -pub struct GasPriceOracleResult { - /// The block hash that the oracle used to calculate the price - pub block_hash: H256, - /// The price that the oracle calculated - pub price: U256, -} - -impl Default for GasPriceOracleResult { - fn default() -> Self { - Self { - block_hash: H256::zero(), - price: U256::from(GWEI_TO_WEI), - } - } -} - -// Adopted from: https://github.com/paradigmxyz/reth/blob/main/crates/primitives/src/transaction/mod.rs#L297 -fn effective_gas_tip( - transaction: &reth_rpc_types::Transaction, - base_fee: Option, -) -> Option { - let priority_fee_or_price = U256::from(match transaction.transaction_type { - Some(U64([2])) => transaction.max_priority_fee_per_gas.unwrap(), - _ => transaction.gas_price.unwrap(), - }); - - if let Some(base_fee) = base_fee { - let max_fee_per_gas = U256::from(match transaction.transaction_type { - Some(U64([2])) => transaction.max_fee_per_gas.unwrap(), - _ => transaction.gas_price.unwrap(), - }); - - if max_fee_per_gas < base_fee { - None - } else { - let effective_max_fee = max_fee_per_gas - base_fee; - Some(std::cmp::min(effective_max_fee, priority_fee_or_price)) - } - } else { - Some(priority_fee_or_price) - } -} - -#[cfg(test)] -mod tests { - use reth_primitives::constants::GWEI_TO_WEI; - - use super::*; - - #[test] - fn max_price_sanity() { - assert_eq!(DEFAULT_MAX_PRICE, U256::from(500_000_000_000u64)); - assert_eq!(DEFAULT_MAX_PRICE, U256::from(500 * GWEI_TO_WEI)) - } - - #[test] - fn ignore_price_sanity() { - assert_eq!(DEFAULT_IGNORE_PRICE, U256::from(2u64)); - } -} - -fn convert_u256_to_u64(u256: reth_primitives::U256) -> Result { - let bytes: [u8; 32] = u256.to_be_bytes(); - let bytes: [u8; 8] = bytes[24..].try_into()?; - Ok(u64::from_be_bytes(bytes)) -} diff --git a/full-node/sov-ethereum-gas-price/src/lib.rs b/full-node/sov-ethereum-gas-price/src/lib.rs deleted file mode 100644 index 0fc06255d..000000000 --- a/full-node/sov-ethereum-gas-price/src/lib.rs +++ /dev/null @@ -1,77 +0,0 @@ -#[cfg(feature = "experimental")] -pub use experimental::{get_ethereum_gas_price_rpc, EthereumGasPrice}; -#[cfg(feature = "experimental")] -mod cache; -#[cfg(feature = "experimental")] -mod gas_oracle; -#[cfg(feature = "experimental")] -pub mod experimental { - use jsonrpsee::types::ErrorObjectOwned; - use jsonrpsee::RpcModule; - use reth_primitives::U256; - use sov_evm::Evm; - use sov_modules_api::WorkingSet; - use tracing::info; - - use crate::gas_oracle::GasPriceOracle; - pub use crate::gas_oracle::GasPriceOracleConfig; - - pub fn get_ethereum_gas_price_rpc( - gas_price_oracle_config: GasPriceOracleConfig, - storage: C::Storage, - ) -> RpcModule> { - let mut rpc = RpcModule::new(EthereumGasPrice::new(gas_price_oracle_config, storage)); - - register_rpc_methods(&mut rpc).expect("Failed to register sequencer RPC methods"); - rpc - } - - pub struct EthereumGasPrice { - gas_price_oracle: GasPriceOracle, - storage: C::Storage, - } - - impl EthereumGasPrice { - fn new(gas_price_oracle_config: GasPriceOracleConfig, storage: C::Storage) -> Self { - let gas_price_oracle = - GasPriceOracle::new(Evm::::default(), gas_price_oracle_config); - Self { - gas_price_oracle, - storage, - } - } - } - - fn register_rpc_methods( - rpc: &mut RpcModule>, - ) -> Result<(), jsonrpsee::core::Error> { - rpc.register_async_method("eth_gasPrice", |_, ethereum| async move { - info!("evm gas price module: eth_gasPrice"); - - let price = { - let mut working_set = WorkingSet::::new(ethereum.storage.clone()); - - let suggested_tip = ethereum - .gas_price_oracle - .suggest_tip_cap(&mut working_set) - .await - .unwrap(); - - let evm = Evm::::default(); - let base_fee = evm - .get_block_by_number(None, None, &mut working_set) - .unwrap() - .unwrap() - .header - .base_fee_per_gas - .unwrap_or_default(); - - suggested_tip + base_fee - }; - - Ok::(price) - })?; - - Ok(()) - } -} From 6c16d9731bba94e348b8a3f3a244f397be5a14eb Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Tue, 10 Oct 2023 15:33:36 +0300 Subject: [PATCH 20/26] fix imports --- examples/demo-rollup/src/rollup.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/demo-rollup/src/rollup.rs b/examples/demo-rollup/src/rollup.rs index dc2deba2b..4fffb03d7 100644 --- a/examples/demo-rollup/src/rollup.rs +++ b/examples/demo-rollup/src/rollup.rs @@ -17,8 +17,8 @@ use sov_cli::wallet_state::PrivateKeyAndAddress; use sov_db::ledger_db::LedgerDB; #[cfg(feature = "experimental")] use sov_ethereum::experimental::EthRpcConfig; -use sov_ethereum::GasPriceOracleConfig; #[cfg(feature = "experimental")] +use sov_ethereum::GasPriceOracleConfig; use sov_modules_api::default_context::{DefaultContext, ZkDefaultContext}; #[cfg(feature = "experimental")] use sov_modules_api::default_signature::private_key::DefaultPrivateKey; @@ -257,7 +257,7 @@ impl + Clone> Rollup register_ethereum::( self.da_service.clone(), self.eth_rpc_config, - storage.clone(), + storage, &mut methods, )?; } From 771f2218917735548e8f09a664c3613f765a6b14 Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Tue, 17 Oct 2023 16:18:25 +0300 Subject: [PATCH 21/26] fix conflict --- examples/demo-rollup/Cargo.toml | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/examples/demo-rollup/Cargo.toml b/examples/demo-rollup/Cargo.toml index d78caa771..816e9e446 100644 --- a/examples/demo-rollup/Cargo.toml +++ b/examples/demo-rollup/Cargo.toml @@ -98,6 +98,8 @@ log4rs = "1.0" regex = "1.10" [features] +default = [ +] # Deviate from convention by making the "native" feature active by default. This aligns with how this package is meant to be used (as a binary first, library second). experimental = [ "default", "sov-ethereum/experimental", @@ -106,29 +108,15 @@ experimental = [ "demo-stf/experimental", "sov-ethereum/local", ] -native = [ - "anyhow", - "jsonrpsee", - "serde", - "serde_json", - "tracing", - "tokio", - "tracing-subscriber", - "demo-stf/native", - "sov-modules-stf-template/native", - "sov-risc0-adapter/native", - "sov-modules-api/native", - "sov-state/native", - "sov-cli", - "clap", - "sov-celestia-adapter/native", - "sov-db", - "sov-sequencer", - "sov-stf-runner/native", - "sov-modules-api/native", - "sov-rollup-interface/native", + +bench = [ + "async-trait", + "hex", + "sov-risc0-adapter/bench", + "sov-zk-cycle-macros/bench", + "risc0/bench", ] -bench = ["native", "async-trait", "hex"] +offchain = ["demo-stf/offchain"] [[bench]] name = "rollup_bench" From dc5ace00dbcf6f56ce5f56b345df4b6346d61220 Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Tue, 17 Oct 2023 16:40:55 +0300 Subject: [PATCH 22/26] update cargo lock --- Cargo.lock | 897 ++++++++++++++++++++++++++++------------------------- 1 file changed, 470 insertions(+), 427 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f3129c27d..f7679fa6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -44,7 +44,7 @@ dependencies = [ "memmap2", "object 0.31.1", "rustc-demangle", - "smallvec 1.11.0", + "smallvec 1.11.1", ] [[package]] @@ -134,9 +134,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -149,9 +149,9 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "alloy-rlp" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f938f00332d63a5b0ac687bd6f46d03884638948921d9f8b50c59563d421ae25" +checksum = "cc0fac0fc16baf1f63f78b47c3d24718f3619b0714076f6a02957d808d52cbef" dependencies = [ "arrayvec 0.7.4", "bytes", @@ -190,9 +190,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.5.0" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", @@ -204,15 +204,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b84bf0a05bbb2a83e5eb6fa36bb6e87baa08193c35ff52bbf6b38d8af2890e46" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -228,9 +228,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "2.1.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -461,13 +461,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -627,7 +627,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" name = "bashtestmd" version = "0.2.0" dependencies = [ - "clap 4.4.4", + "clap 4.4.6", "markdown", "shell-escape", ] @@ -652,9 +652,9 @@ dependencies = [ [[package]] name = "bcs" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bd3ffe8b19a604421a5d461d4a70346223e535903fbc3067138bddbebddcf77" +checksum = "85b6598a2f5d564fb7855dc6b06fd1c38cff5a72bd8b863a4d021938497b440a" dependencies = [ "serde", "thiserror", @@ -702,7 +702,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -711,7 +711,7 @@ version = "0.66.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "cexpr", "clang-sys", "lazy_static", @@ -724,7 +724,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.37", + "syn 2.0.38", "which", ] @@ -734,7 +734,7 @@ version = "0.68.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "cexpr", "clang-sys", "lazy_static", @@ -745,7 +745,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -771,9 +771,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" dependencies = [ "serde", ] @@ -873,25 +873,25 @@ dependencies = [ [[package]] name = "boa_ast" -version = "0.17.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c261398db3b2f9ba05f76872721d6a8a142d10ae6c0a58d3ddc5c2853cc02d" +checksum = "73498e9b2f0aa7db74977afa4d594657611e90587abf0dd564c0b55b4a130163" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "boa_interner", "boa_macros", - "indexmap 2.0.0", + "indexmap 2.0.2", "num-bigint 0.4.4", "rustc-hash", ] [[package]] name = "boa_engine" -version = "0.17.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31e7a37b855625f1615a07414fb341361475950e57bb9396afe1389bbc2ccdc" +checksum = "16377479d5d6d33896e7acdd1cc698d04a8f72004025bbbddf47558cd29146a6" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "boa_ast", "boa_gc", "boa_icu_provider", @@ -903,7 +903,7 @@ dependencies = [ "dashmap", "fast-float", "icu_normalizer", - "indexmap 2.0.0", + "indexmap 2.0.2", "itertools 0.11.0", "num-bigint 0.4.4", "num-integer", @@ -926,9 +926,9 @@ dependencies = [ [[package]] name = "boa_gc" -version = "0.17.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2346f8ac7b736236de0608a7c75a9a32bac0a1137b98574cfebde6343e4ff6b7" +checksum = "c97b44beaef9d4452342d117d94607fdfa8d474280f1ba0fd97853834e3a49b2" dependencies = [ "boa_macros", "boa_profiler", @@ -937,28 +937,29 @@ dependencies = [ [[package]] name = "boa_icu_provider" -version = "0.17.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07652c6f1ca97bbe16bd2ab1ebc39313ac81568d2671aeb24a4a45964d2291a4" +checksum = "b30e52e34e451dd0bfc2c654a9a43ed34b0073dbd4ae3394b40313edda8627aa" dependencies = [ "icu_collections", "icu_normalizer", "icu_properties", "icu_provider", + "icu_provider_adapters", + "icu_provider_blob", "once_cell", - "zerovec", ] [[package]] name = "boa_interner" -version = "0.17.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b968bd467737cace9723a5d01a3d32fe95471526d36db9654a1779c4b766fb6" +checksum = "f3e5afa991908cfbe79bd3109b824e473a1dc5f74f31fab91bb44c9e245daa77" dependencies = [ "boa_gc", "boa_macros", - "hashbrown 0.14.0", - "indexmap 2.0.0", + "hashbrown 0.14.1", + "indexmap 2.0.2", "once_cell", "phf", "rustc-hash", @@ -967,42 +968,46 @@ dependencies = [ [[package]] name = "boa_macros" -version = "0.17.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3de43b7806061fccfba716fef51eea462d636de36803b62d10f902608ffef4" +checksum = "005fa0c5bd20805466dda55eb34cd709bb31a2592bb26927b47714eeed6914d8" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", - "synstructure 0.13.0 0.13.0", + "syn 2.0.38", + "synstructure 0.13.0", ] [[package]] name = "boa_parser" -version = "0.17.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ff1108bda6d573049191b6452490844c5ba4b12f7bdcc512a33e5c3f5037196" +checksum = "9e09afb035377a9044443b598187a7d34cd13164617182a4d7c348522ee3f052" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "boa_ast", "boa_icu_provider", "boa_interner", "boa_macros", "boa_profiler", "fast-float", + "icu_locid", "icu_properties", + "icu_provider", + "icu_provider_macros", "num-bigint 0.4.4", "num-traits", "once_cell", "regress", "rustc-hash", + "tinystr", ] [[package]] name = "boa_profiler" -version = "0.17.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a24f6aa1ecc56e797506437b1f9a172e4a5f207894e74196c682cb656d2c2d60" +checksum = "3190f92dfe48224adc92881c620f08ccf37ff62b91a094bb357fe53bd5e84647" [[package]] name = "bonsai-sdk" @@ -1063,9 +1068,9 @@ dependencies = [ [[package]] name = "bounded-collections" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b05133427c07c4776906f673ccf36c21b102c9829c641a5b56bd151d44fd6" +checksum = "ca548b6163b872067dc5eb82fd130c56881435e30367d2073594a3d9744120dd" dependencies = [ "log", "parity-scale-codec", @@ -1085,7 +1090,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" dependencies = [ - "sha2 0.10.7", + "sha2 0.10.8", "tinyvec", ] @@ -1124,7 +1129,7 @@ checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1180,7 +1185,7 @@ dependencies = [ [[package]] name = "c-kzg" version = "0.1.0" -source = "git+https://github.com/ethereum/c-kzg-4844#fbef59a3f9e8fa998bdb5069d212daf83d586aa5" +source = "git+https://github.com/ethereum/c-kzg-4844#f3fffecd1ce7e8b6620cd5bac50c660efc20e48c" dependencies = [ "bindgen 0.66.1", "blst", @@ -1201,9 +1206,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" +checksum = "12024c4645c97566567129c204f65d5815a8c9aecf30fcbe682b2fe034996d36" dependencies = [ "serde", ] @@ -1216,7 +1221,7 @@ checksum = "e7daec1a2a2129eeba1644b220b4647ec537b0b5d4bfd6876fcc5a540056b592" dependencies = [ "camino", "cargo-platform", - "semver 1.0.18", + "semver 1.0.20", "serde", "serde_json", "thiserror", @@ -1258,7 +1263,7 @@ source = "git+https://github.com/eigerco/celestia-node-rs.git?rev=1fa61eb#1fa61e dependencies = [ "celestia-types", "http", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "serde", "thiserror", "tracing", @@ -1402,9 +1407,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.4" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d7b8d5ec32af0fadc644bf1fd509a688c2103b185644bb1e29d164e0703136" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" dependencies = [ "clap_builder", "clap_derive", @@ -1412,9 +1417,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.4" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5179bb514e4d7c2051749d8fcefa2ed6d06a9f4e6d69faf3805f5d80b8cf8d56" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" dependencies = [ "anstream", "anstyle", @@ -1431,7 +1436,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1456,7 +1461,7 @@ dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", "serde", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1471,7 +1476,7 @@ dependencies = [ "hmac 0.12.1", "k256", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "thiserror", ] @@ -1487,7 +1492,7 @@ dependencies = [ "once_cell", "pbkdf2 0.12.2", "rand 0.8.5", - "sha2 0.10.7", + "sha2 0.10.8", "thiserror", ] @@ -1506,7 +1511,7 @@ dependencies = [ "ripemd", "serde", "serde_derive", - "sha2 0.10.7", + "sha2 0.10.8", "sha3", "thiserror", ] @@ -1519,18 +1524,18 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "concurrent-queue" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" +checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" dependencies = [ "crossbeam-utils", ] [[package]] name = "const-hex" -version = "1.9.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa72a10d0e914cad6bcad4e7409e68d230c1c2db67896e19a37f758b1fcbdab5" +checksum = "c37be52ef5e3b394db27a2341010685ad5103c72ac15ce2e9420a7e8f93f342c" dependencies = [ "cfg-if", "cpufeatures", @@ -1550,18 +1555,18 @@ version = "0.2.0" [[package]] name = "const_format" -version = "0.2.31" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c990efc7a285731f9a4378d81aff2f0e85a2c8781a05ef0f8baa8dac54d0ff48" +checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" dependencies = [ "const_format_proc_macros", ] [[package]] name = "const_format_proc_macros" -version = "0.2.31" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e026b6ce194a874cb9cf32cd5772d1ef9767cc8fcb5765948d74f37a9d8b2bf6" +checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", @@ -1689,7 +1694,7 @@ dependencies = [ "anes", "cast", "ciborium", - "clap 4.4.4", + "clap 4.4.6", "criterion-plot", "is-terminal", "itertools 0.10.5", @@ -1805,9 +1810,9 @@ dependencies = [ [[package]] name = "csv" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "626ae34994d3d8d668f4269922248239db4ae42d538b14c398b74a52208e8086" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" dependencies = [ "csv-core", "itoa", @@ -1817,9 +1822,9 @@ dependencies = [ [[package]] name = "csv-core" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" dependencies = [ "memchr", ] @@ -1870,9 +1875,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.0" +version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622178105f911d937a42cdb140730ba4a3ed2becd8ae6ce39c7d28b5d75d4588" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" dependencies = [ "cfg-if", "cpufeatures", @@ -1893,7 +1898,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1978,7 +1983,7 @@ dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", "strsim 0.10.0", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -2011,7 +2016,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -2021,7 +2026,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown 0.14.0", + "hashbrown 0.14.1", "lock_api", "once_cell", "parking_lot_core 0.9.8", @@ -2068,9 +2073,9 @@ dependencies = [ [[package]] name = "deadpool-runtime" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaa37046cc0f6c3cc6090fbdbf73ef0b8ef4cfcc37f6befc0020f63e8cf121e1" +checksum = "63dfa964fe2a66f3fde91fc70b267fe193d822c7e603e2a675a49a7f46ad3f49" [[package]] name = "delay_map" @@ -2089,7 +2094,7 @@ dependencies = [ "anyhow", "hex", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "sov-rollup-interface", ] @@ -2099,10 +2104,10 @@ version = "0.2.0" dependencies = [ "anyhow", "borsh", - "clap 4.4.4", + "clap 4.4.6", "demo-stf", "hex", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "rand 0.8.5", "reth-primitives", "serde", @@ -2126,7 +2131,7 @@ dependencies = [ "sov-value-setter", "tempfile", "tokio", - "toml 0.8.0", + "toml 0.8.2", "tracing", ] @@ -2142,10 +2147,11 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" dependencies = [ + "powerfmt", "serde", ] @@ -2168,7 +2174,7 @@ checksum = "53e0efad4403bfc52dc201159c4b842a246a14b98c64b55dfd0f2d89729dfeb8" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -2323,7 +2329,7 @@ dependencies = [ "parking_lot 0.11.2", "rand 0.8.5", "rlp", - "smallvec 1.11.0", + "smallvec 1.11.1", "socket2 0.4.9", "tokio", "tracing", @@ -2340,7 +2346,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -2419,9 +2425,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "2.2.2" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ "pkcs8", "serde", @@ -2459,11 +2465,11 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ - "curve25519-dalek 4.1.0", - "ed25519 2.2.2", + "curve25519-dalek 4.1.1", + "ed25519 2.2.3", "rand_core 0.6.4", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "zeroize", ] @@ -2501,15 +2507,15 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "elf" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b183d6ce6ca4cf30e3db37abf5b52568b5f9015c97d9fbdd7026aa5dcdd758" +checksum = "7f6e7d85896690fe195447717af8eceae0593ac2196fd42fe88c184e904406ce" [[package]] name = "elliptic-curve" -version = "0.13.5" +version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" +checksum = "d97ca172ae9dc9f9b779a6e3a65d308f2af74e5b8c921299075bdb4a0370e914" dependencies = [ "base16ct", "crypto-bigint", @@ -2524,6 +2530,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + [[package]] name = "ena" version = "0.14.2" @@ -2588,15 +2600,15 @@ dependencies = [ [[package]] name = "enum-ordinalize" -version = "3.1.13" +version = "3.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4f76552f53cefc9a7f64987c3701b99d982f7690606fd67de1d09712fbf52f1" +checksum = "1bf1fa3f06bbff1ea5b1a9c7b14aa992a39657db60a2759457328d7e058f49ee" dependencies = [ "num-bigint 0.4.4", "num-traits", "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -2608,7 +2620,7 @@ dependencies = [ "once_cell", "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -2619,7 +2631,7 @@ checksum = "c2ad8cef1d801a4686bfd8919f0b30eac4c8e48968c437a6405ded4fb5272d2b" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -2645,25 +2657,14 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" dependencies = [ - "errno-dragonfly", "libc", "windows-sys 0.48.0", ] -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "eth-keystore" version = "0.5.0" @@ -2680,7 +2681,7 @@ dependencies = [ "scrypt", "serde", "serde_json", - "sha2 0.10.7", + "sha2 0.10.8", "sha3", "thiserror", "uuid", @@ -2800,7 +2801,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.37", + "syn 2.0.38", "toml 0.7.8", "walkdir", ] @@ -2818,7 +2819,7 @@ dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", "serde_json", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -2844,7 +2845,7 @@ dependencies = [ "serde", "serde_json", "strum 0.25.0", - "syn 2.0.37", + "syn 2.0.38", "tempfile", "thiserror", "tiny-keccak", @@ -2859,7 +2860,7 @@ checksum = "0e53451ea4a8128fbce33966da71132cf9e1040dcfd2a2084fd7733ada7b2045" dependencies = [ "ethers-core", "reqwest", - "semver 1.0.18", + "semver 1.0.20", "serde", "serde_json", "thiserror", @@ -2944,7 +2945,7 @@ dependencies = [ "eth-keystore", "ethers-core", "rand 0.8.5", - "sha2 0.10.7", + "sha2 0.10.8", "thiserror", "tracing", ] @@ -2968,7 +2969,7 @@ dependencies = [ "path-slash", "rayon", "regex", - "semver 1.0.18", + "semver 1.0.20", "serde", "serde_json", "solang-parser", @@ -3026,9 +3027,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fastrlp" @@ -3102,9 +3103,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide", @@ -3260,7 +3261,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -3563,9 +3564,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" dependencies = [ "ahash 0.8.3", "allocator-api2", @@ -3838,16 +3839,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.57" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows-core", ] [[package]] @@ -3872,7 +3873,7 @@ dependencies = [ "prost 0.11.9", "ripemd", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "sha3", ] @@ -3883,6 +3884,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef8302d8dfd6044d3ddb3f807a5ef3d7bbca9a574959c6d6e4dc39aa7012d0d5" dependencies = [ "displaydoc", + "serde", "yoke", "zerofrom", "zerovec", @@ -3896,8 +3898,10 @@ checksum = "3003f85dccfc0e238ff567693248c59153a46f4e6125ba4020b973cef4d1d335" dependencies = [ "displaydoc", "litemap", + "serde", "tinystr", "writeable", + "zerovec", ] [[package]] @@ -3910,7 +3914,8 @@ dependencies = [ "icu_collections", "icu_properties", "icu_provider", - "smallvec 1.11.0", + "serde", + "smallvec 1.11.1", "utf16_iter", "utf8_iter", "write16", @@ -3926,6 +3931,7 @@ dependencies = [ "displaydoc", "icu_collections", "icu_provider", + "serde", "tinystr", "zerovec", ] @@ -3939,6 +3945,7 @@ dependencies = [ "displaydoc", "icu_locid", "icu_provider_macros", + "postcard", "serde", "stable_deref_trait", "writeable", @@ -3947,6 +3954,34 @@ dependencies = [ "zerovec", ] +[[package]] +name = "icu_provider_adapters" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4ae1e2bd0c41728b77e7c46e9afdec5e2127d1eedacc684724667d50c126bd3" +dependencies = [ + "icu_locid", + "icu_provider", + "serde", + "tinystr", + "yoke", + "zerovec", +] + +[[package]] +name = "icu_provider_blob" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd364c9a01f791a4bc04a74cf2a1d01d9f6926a40fd5ae1c28004e1e70d8338b" +dependencies = [ + "icu_provider", + "postcard", + "serde", + "writeable", + "yoke", + "zerovec", +] + [[package]] name = "icu_provider_macros" version = "1.2.0" @@ -4059,12 +4094,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.1", "serde", ] @@ -4160,7 +4195,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi 0.3.3", - "rustix 0.38.13", + "rustix 0.38.19", "windows-sys 0.48.0", ] @@ -4205,16 +4240,16 @@ dependencies = [ "num-derive 0.3.3", "num-traits", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "thiserror", "tracing", ] [[package]] name = "jobserver" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" dependencies = [ "libc", ] @@ -4246,18 +4281,18 @@ dependencies = [ [[package]] name = "jsonrpsee" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ad9b31183a8bcbe843e32ca8554ad2936633548d95a7bb6a8e14c767dea6b05" +checksum = "de902baa44bf34a58b1a4906f8b840d7d60dcec5f41fe08b4dbc14cf9efa821c" dependencies = [ - "jsonrpsee-client-transport 0.20.1", - "jsonrpsee-core 0.20.1", - "jsonrpsee-http-client 0.20.1", - "jsonrpsee-proc-macros 0.20.1", + "jsonrpsee-client-transport 0.20.2", + "jsonrpsee-core 0.20.2", + "jsonrpsee-http-client 0.20.2", + "jsonrpsee-proc-macros 0.20.2", "jsonrpsee-server", - "jsonrpsee-types 0.20.1", - "jsonrpsee-wasm-client 0.20.1", - "jsonrpsee-ws-client 0.20.1", + "jsonrpsee-types 0.20.2", + "jsonrpsee-wasm-client 0.20.2", + "jsonrpsee-ws-client 0.20.2", "tokio", "tracing", ] @@ -4289,15 +4324,15 @@ dependencies = [ [[package]] name = "jsonrpsee-client-transport" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97f2743cad51cc86b0dbfe316309eeb87a9d96a3d7f4dd7a99767c4b5f065335" +checksum = "58d9851f8f5653e0433a898e9032bde4910b35d625bd9dcf33ef6e36e7c3d456" dependencies = [ "futures-channel", "futures-util", "gloo-net 0.4.0", "http", - "jsonrpsee-core 0.20.1", + "jsonrpsee-core 0.20.2", "pin-project", "rustls-native-certs", "soketto", @@ -4336,9 +4371,9 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35dc957af59ce98373bcdde0c1698060ca6c2d2e9ae357b459c7158b6df33330" +checksum = "51f45d37af23707750136379f6799e76ebfcf2d425ec4e36d0deb7921da5e65c" dependencies = [ "anyhow", "async-lock", @@ -4347,7 +4382,7 @@ dependencies = [ "futures-timer", "futures-util", "hyper", - "jsonrpsee-types 0.20.1", + "jsonrpsee-types 0.20.2", "parking_lot 0.12.1", "rand 0.8.5", "rustc-hash", @@ -4381,15 +4416,15 @@ dependencies = [ [[package]] name = "jsonrpsee-http-client" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd865d0072764cb937b0110a92b5f53e995f7101cb346beca03d93a2dea79de" +checksum = "02308562f2e8162a32f8d6c3dc19c29c858d5d478047c886a5c3c25b5f7fa868" dependencies = [ "async-trait", "hyper", "hyper-rustls", - "jsonrpsee-core 0.20.1", - "jsonrpsee-types 0.20.1", + "jsonrpsee-core 0.20.2", + "jsonrpsee-types 0.20.2", "serde", "serde_json", "thiserror", @@ -4414,9 +4449,9 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cef91b1017a4edb63f65239381c18de39f88d0e0760ab626d806e196f7f51477" +checksum = "f26b3675a943d083d0bf6e367ec755dccec56c41888afa13b191c1c4ff87c652" dependencies = [ "heck 0.4.1", "proc-macro-crate 1.1.3", @@ -4427,15 +4462,15 @@ dependencies = [ [[package]] name = "jsonrpsee-server" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24f4e2f3d223d810e363fb8b5616ec4c6254243ee7f452d05ac281cdc9cf76b2" +checksum = "2ed2bec9c76cee118c27138cc1c877938bcaa01207a5d902b80dbfc60466bc9c" dependencies = [ "futures-util", "http", "hyper", - "jsonrpsee-core 0.20.1", - "jsonrpsee-types 0.20.1", + "jsonrpsee-core 0.20.2", + "jsonrpsee-types 0.20.2", "route-recognizer", "serde", "serde_json", @@ -4464,9 +4499,9 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa9e25aec855b2a7d3ed90fded6c41e8c3fb72b63f071e1be3f0004eba19b625" +checksum = "05eaff23af19f10ba6fbb76519bed6da4d3b9bbaef13d39b7c2b6c14e532d27e" dependencies = [ "anyhow", "beef", @@ -4489,13 +4524,13 @@ dependencies = [ [[package]] name = "jsonrpsee-wasm-client" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "010306151579898dc1000bab239ef7a73a73f04cb8ef267ee28b9a000267e813" +checksum = "d7ae1c71afe02a21713e197438f1bcfaa171c3dfe533b9505a0990cb8297779e" dependencies = [ - "jsonrpsee-client-transport 0.20.1", - "jsonrpsee-core 0.20.1", - "jsonrpsee-types 0.20.1", + "jsonrpsee-client-transport 0.20.2", + "jsonrpsee-core 0.20.2", + "jsonrpsee-types 0.20.2", ] [[package]] @@ -4512,14 +4547,14 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-client" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d88e35e9dfa89248ae3e92f689c1f0a190ce12d377eba7d2d08e5a7f6cc5694a" +checksum = "cd34d3ab8c09f02fd4c432f256bc8b143b616b222b03050f941ee53f0e8d7b24" dependencies = [ "http", - "jsonrpsee-client-transport 0.20.1", - "jsonrpsee-core 0.20.1", - "jsonrpsee-types 0.20.1", + "jsonrpsee-client-transport 0.20.2", + "jsonrpsee-core 0.20.2", + "jsonrpsee-types 0.20.2", "url", ] @@ -4547,7 +4582,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "once_cell", - "sha2 0.10.7", + "sha2 0.10.8", "signature 2.1.0", ] @@ -4628,9 +4663,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.148" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libloading" @@ -4644,9 +4679,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "librocksdb-sys" @@ -4737,15 +4772,15 @@ checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "linux-raw-sys" -version = "0.4.7" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "litemap" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a04a5b2b6f54acba899926491d0a6c59d98012938ca2ab5befb281c034e8f94" +checksum = "77a1a2647d5b7134127971a6de0d533c49de2159167e7f259c427195f87168a1" [[package]] name = "lock_api" @@ -4861,9 +4896,9 @@ checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "matrixmultiply" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090126dc04f95dc0d1c1c91f61bdd474b3930ca064c1edc8a849da2c6cbe1e77" +checksum = "7574c1cf36da4798ab73da5b215bbf444f50718207754cb522201d78d1cd0ff2" dependencies = [ "autocfg", "rawpointer", @@ -4877,18 +4912,19 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "md-5" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ + "cfg-if", "digest 0.10.7", ] [[package]] name = "memchr" -version = "2.6.3" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memfd" @@ -4896,7 +4932,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix 0.38.13", + "rustix 0.38.19", ] [[package]] @@ -4966,7 +5002,7 @@ checksum = "ddece26afd34c31585c74a4db0630c376df271c285d682d1e55012197830b6df" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -5138,7 +5174,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" dependencies = [ - "smallvec 1.11.0", + "smallvec 1.11.1", ] [[package]] @@ -5149,7 +5185,7 @@ dependencies = [ "borsh", "bytes", "serde", - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] @@ -5243,13 +5279,13 @@ dependencies = [ [[package]] name = "num-derive" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6a0fd4f737c707bd9086cc16c925f294943eb62eb71499e9fd4cf71f8b9f4e" +checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -5297,9 +5333,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", "libm", @@ -5363,7 +5399,7 @@ dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -5375,7 +5411,7 @@ dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -5478,7 +5514,7 @@ version = "0.10.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "cfg-if", "foreign-types", "libc", @@ -5495,7 +5531,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -5524,9 +5560,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "ordered-float" -version = "2.10.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" dependencies = [ "num-traits", ] @@ -5576,9 +5612,9 @@ dependencies = [ [[package]] name = "parking" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" +checksum = "e52c774a4c39359c1d1c52e43f73dd91a75a614652c825408eec30c95a9b2067" [[package]] name = "parking_lot" @@ -5611,7 +5647,7 @@ dependencies = [ "instant", "libc", "redox_syscall 0.2.16", - "smallvec 1.11.0", + "smallvec 1.11.1", "winapi", ] @@ -5624,7 +5660,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall 0.3.5", - "smallvec 1.11.0", + "smallvec 1.11.1", "windows-targets 0.48.5", ] @@ -5669,7 +5705,7 @@ dependencies = [ "digest 0.10.7", "hmac 0.12.1", "password-hash", - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] @@ -5705,9 +5741,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.3" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a4d085fd991ac8d5b05a147b437791b4260b76326baf0fc60cf7c9c27ecd33" +checksum = "c022f1e7b65d6a24c0dbbd5fb344c66881bc01f3e5ae74a1c8100f2f985d98a4" dependencies = [ "memchr", "thiserror", @@ -5721,7 +5757,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.0.0", + "indexmap 2.0.2", ] [[package]] @@ -5764,7 +5800,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -5802,7 +5838,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -5902,11 +5938,12 @@ checksum = "31114a898e107c51bb1609ffaf55a0e011cf6a4d7f1170d0015a165082c0338b" [[package]] name = "postcard" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d534c6e61df1c7166e636ca612d9820d486fe96ddad37f7abc671517b297488e" +checksum = "a55c51ee6c0db07e68448e336cf8ea4131a620edefebf9893e759b2d793420f8" dependencies = [ "cobs", + "embedded-io", "heapless", "serde", ] @@ -5939,7 +5976,7 @@ dependencies = [ "md-5", "memchr", "rand 0.8.5", - "sha2 0.10.7", + "sha2 0.10.8", "stringprep", ] @@ -5954,6 +5991,12 @@ dependencies = [ "postgres-protocol", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -5973,7 +6016,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2 1.0.69", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -6102,7 +6145,7 @@ checksum = "7c003ac8c77cb07bb74f5f198bce836a689bcd5a42574612bf14d17bfd08c20e" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.4.0", + "bitflags 2.4.1", "lazy_static", "num-traits", "rand 0.8.5", @@ -6162,7 +6205,7 @@ dependencies = [ "prost 0.12.1", "prost-types 0.12.1", "regex", - "syn 2.0.37", + "syn 2.0.38", "tempfile", "which", ] @@ -6190,7 +6233,7 @@ dependencies = [ "itertools 0.11.0", "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -6448,7 +6491,7 @@ checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -6513,9 +6556,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.20" +version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ "base64 0.21.4", "bytes", @@ -6541,6 +6584,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "system-configuration", "tokio", "tokio-native-tls", "tokio-rustls", @@ -6651,7 +6695,7 @@ dependencies = [ "reth-primitives", "reth-rlp", "secp256k1 0.27.0", - "sha2 0.10.7", + "sha2 0.10.8", "sha3", "thiserror", "tokio", @@ -6717,10 +6761,10 @@ name = "reth-libmdbx" version = "0.1.0-alpha.8" source = "git+https://github.com/paradigmxyz/reth?rev=e83d3aa#e83d3aa704f87825ca8cab6f593ab4d4adbf6792" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "byteorder", "derive_more", - "indexmap 2.0.0", + "indexmap 2.0.2", "libc", "parking_lot 0.12.1", "reth-mdbx-sys", @@ -6755,7 +6799,7 @@ dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", "regex", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -6827,7 +6871,7 @@ dependencies = [ "serde", "serde_json", "serde_with", - "sha2 0.10.7", + "sha2 0.10.8", "strum 0.25.0", "sucds", "tempfile", @@ -6883,7 +6927,7 @@ source = "git+https://github.com/paradigmxyz/reth?rev=e83d3aa#e83d3aa704f87825ca dependencies = [ "boa_engine", "boa_gc", - "hashbrown 0.14.0", + "hashbrown 0.14.1", "reth-primitives", "reth-rpc-types", "revm", @@ -6924,7 +6968,7 @@ source = "git+https://github.com/paradigmxyz/reth?rev=e83d3aa#e83d3aa704f87825ca dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -6933,7 +6977,7 @@ version = "0.1.0-alpha.8" source = "git+https://github.com/paradigmxyz/reth?rev=e83d3aa#e83d3aa704f87825ca8cab6f593ab4d4adbf6792" dependencies = [ "itertools 0.11.0", - "jsonrpsee-types 0.20.1", + "jsonrpsee-types 0.20.2", "reth-primitives", "reth-rlp", "serde", @@ -7001,7 +7045,7 @@ dependencies = [ "revm-primitives", "ripemd", "secp256k1 0.27.0", - "sha2 0.10.7", + "sha2 0.10.8", "sha3", "substrate-bn", ] @@ -7012,14 +7056,14 @@ version = "1.1.2" source = "git+https://github.com/bluealloy/revm?rev=516f62cc#516f62ccc1c5f2a62e5fc58115213fe04c7f7a8c" dependencies = [ "auto_impl", - "bitflags 2.4.0", + "bitflags 2.4.1", "bitvec", "bytes", "c-kzg 0.1.0 (git+https://github.com/ethereum/c-kzg-4844)", "derive_more", "enumn", "fixed-hash", - "hashbrown 0.14.0", + "hashbrown 0.14.1", "hex", "hex-literal", "once_cell", @@ -7109,7 +7153,7 @@ dependencies = [ "directories", "glob", "hex", - "sha2 0.10.7", + "sha2 0.10.8", "tempfile", ] @@ -7195,7 +7239,7 @@ dependencies = [ "risc0-sys", "risc0-zkvm-platform", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "tracing", ] @@ -7219,7 +7263,7 @@ dependencies = [ "lazy-regex", "libm", "log", - "num-derive 0.4.0", + "num-derive 0.4.1", "num-traits", "prost 0.12.1", "prost-build", @@ -7233,7 +7277,7 @@ dependencies = [ "risc0-zkvm-platform", "rrs-lib", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "tempfile", "thiserror", "tracing", @@ -7356,14 +7400,14 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.18", + "semver 1.0.20", ] [[package]] name = "rustix" -version = "0.36.15" +version = "0.36.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c37f1bd5ef1b5422177b7646cba67430579cfe2ace80f284fee876bca52ad941" +checksum = "6da3636faa25820d8648e0e31c5d519bbb01f72fdf57131f0f5f7da5fed36eab" dependencies = [ "bitflags 1.3.2", "errno", @@ -7375,14 +7419,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.13" +version = "0.38.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662" +checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", - "linux-raw-sys 0.4.7", + "linux-raw-sys 0.4.10", "windows-sys 0.48.0", ] @@ -7394,7 +7438,7 @@ checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring", - "rustls-webpki 0.101.5", + "rustls-webpki 0.101.6", "sct", ] @@ -7431,9 +7475,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.5" +version = "0.101.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a27e3b59326c16e23d30aeb7a36a24cc0d29e71d68ff611cdfb4a01d013bed" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" dependencies = [ "ring", "untrusted", @@ -7520,7 +7564,7 @@ dependencies = [ "scale-bits", "scale-decode-derive", "scale-info", - "smallvec 1.11.0", + "smallvec 1.11.1", "thiserror", ] @@ -7548,7 +7592,7 @@ dependencies = [ "scale-bits", "scale-encode-derive", "scale-info", - "smallvec 1.11.0", + "smallvec 1.11.1", "thiserror", ] @@ -7688,7 +7732,7 @@ dependencies = [ "hmac 0.12.1", "pbkdf2 0.11.0", "salsa20", - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] @@ -7796,9 +7840,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" dependencies = [ "serde", ] @@ -7826,9 +7870,9 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" dependencies = [ "serde_derive", ] @@ -7865,13 +7909,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -7915,7 +7959,7 @@ checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -7949,7 +7993,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.0.0", + "indexmap 2.0.2", "serde", "serde_json", "serde_with_macros", @@ -7965,7 +8009,7 @@ dependencies = [ "darling 0.20.3", "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -7995,9 +8039,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -8031,9 +8075,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -8052,9 +8096,9 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] @@ -8103,7 +8147,7 @@ dependencies = [ "anyhow", "borsh", "clap 4.4.6", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "schemars", "serde", "serde_json", @@ -8152,9 +8196,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "smol_str" @@ -8226,7 +8270,7 @@ name = "sov-accessory-state" version = "0.2.0" dependencies = [ "borsh", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "serde", "sov-modules-api", "sov-state", @@ -8241,7 +8285,7 @@ dependencies = [ "arbitrary", "borsh", "clap 4.4.6", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "proptest", "proptest-derive", "schemars", @@ -8306,7 +8350,7 @@ dependencies = [ "anyhow", "borsh", "clap 4.4.6", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "schemars", "serde", "serde_json", @@ -8325,9 +8369,9 @@ dependencies = [ "anyhow", "bincode", "borsh", - "clap 4.4.4", + "clap 4.4.6", "hex", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "schemars", "serde", "serde_json", @@ -8355,7 +8399,7 @@ dependencies = [ "celestia-rpc", "celestia-types", "hex", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "nmt-rs", "postcard", "proptest", @@ -8364,7 +8408,7 @@ dependencies = [ "risc0-zkvm-platform", "serde", "serde_json", - "sha2 0.10.7", + "sha2 0.10.8", "sov-celestia-adapter", "sov-rollup-interface", "sov-zk-cycle-macros", @@ -8382,7 +8426,7 @@ version = "0.2.0" dependencies = [ "anyhow", "borsh", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "serde", "serde_json", "sov-chain-state", @@ -8402,7 +8446,7 @@ dependencies = [ "demo-stf", "directories", "hex", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "serde", "serde_json", "sov-accounts", @@ -8454,7 +8498,7 @@ dependencies = [ "async-trait", "bincode", "borsh", - "clap 4.4.4", + "clap 4.4.6", "const-rollup-config", "criterion", "demo-stf", @@ -8466,7 +8510,7 @@ dependencies = [ "ethers-providers", "ethers-signers", "hex", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "log", "log4rs", "prettytable-rs", @@ -8480,7 +8524,7 @@ dependencies = [ "secp256k1 0.27.0", "serde", "serde_json", - "sha2 0.10.7", + "sha2 0.10.8", "sov-bank", "sov-celestia-adapter", "sov-cli", @@ -8512,7 +8556,7 @@ dependencies = [ "borsh", "demo-stf", "ethers", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "reth-primitives", "reth-rpc-types", "schnellru", @@ -8532,7 +8576,7 @@ dependencies = [ "anyhow", "borsh", "bytes", - "clap 4.4.4", + "clap 4.4.6", "derive_more", "ethereum-types", "ethers", @@ -8541,7 +8585,7 @@ dependencies = [ "ethers-middleware", "ethers-signers", "hex", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "lazy_static", "reth-interfaces", "reth-primitives", @@ -8576,7 +8620,7 @@ version = "0.2.0" dependencies = [ "anyhow", "futures", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "serde", "serde_json", "sov-db", @@ -8610,12 +8654,12 @@ dependencies = [ "bech32", "bincode", "borsh", - "clap 4.4.4", + "clap 4.4.6", "derive_more", "ed25519-dalek 2.0.0", "hex", "jmt", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "proptest", "proptest-derive", "rand 0.8.5", @@ -8624,7 +8668,7 @@ dependencies = [ "schemars", "serde", "serde_json", - "sha2 0.10.7", + "sha2 0.10.8", "sov-bank", "sov-first-read-last-write-cache", "sov-modules-api", @@ -8643,7 +8687,7 @@ dependencies = [ "anyhow", "borsh", "clap 4.4.6", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "proc-macro2 1.0.69", "quote 1.0.33", "schemars", @@ -8684,7 +8728,7 @@ version = "0.2.0" dependencies = [ "anyhow", "borsh", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "postgres", "schemars", "serde", @@ -8751,7 +8795,7 @@ dependencies = [ "proptest-derive", "serde", "serde_json", - "sha2 0.10.7", + "sha2 0.10.8", "thiserror", "tokio", ] @@ -8763,7 +8807,7 @@ dependencies = [ "anyhow", "borsh", "clap 4.4.6", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "risc0-starter", "serde", "serde_json", @@ -8808,7 +8852,7 @@ dependencies = [ "async-trait", "borsh", "hex", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "rand 0.8.5", "serde", "sov-modules-api", @@ -8827,7 +8871,7 @@ dependencies = [ "anyhow", "borsh", "clap 4.4.6", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "risc0-zkvm", "risc0-zkvm-platform", "schemars", @@ -8849,7 +8893,7 @@ version = "0.2.0" dependencies = [ "anyhow", "arbitrary", - "bcs 0.1.5", + "bcs 0.1.6", "borsh", "hex", "jmt", @@ -8859,7 +8903,7 @@ dependencies = [ "risc0-zkvm-platform", "serde", "serde_json", - "sha2 0.10.7", + "sha2 0.10.8", "sov-db", "sov-first-read-last-write-cache", "sov-rollup-interface", @@ -8876,7 +8920,7 @@ dependencies = [ "borsh", "futures", "hex", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "serde", "serde_json", "sov-accounts", @@ -8891,7 +8935,7 @@ dependencies = [ "sov-state", "tempfile", "tokio", - "toml 0.8.0", + "toml 0.8.2", "tracing", ] @@ -8902,7 +8946,7 @@ dependencies = [ "anyhow", "borsh", "clap 4.4.6", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "schemars", "serde", "serde_json", @@ -8920,7 +8964,7 @@ dependencies = [ "anyhow", "borsh", "clap 4.4.6", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "schemars", "serde", "serde_json", @@ -9084,7 +9128,7 @@ dependencies = [ "blake2b_simd", "byteorder", "digest 0.10.7", - "sha2 0.10.7", + "sha2 0.10.8", "sha3", "sp-std 8.0.0", "twox-hash", @@ -9099,7 +9143,7 @@ dependencies = [ "blake2b_simd", "byteorder", "digest 0.10.7", - "sha2 0.10.7", + "sha2 0.10.8", "sha3", "twox-hash", ] @@ -9112,7 +9156,7 @@ checksum = "c7f531814d2f16995144c74428830ccf7d94ff4a7749632b83ad8199b181140c" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -9123,7 +9167,7 @@ checksum = "16f7d375610590566e11882bf5b5a4b8d0666a96ba86808b2650bbbd9be50bf8" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -9285,7 +9329,7 @@ dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -9298,7 +9342,7 @@ dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -9312,7 +9356,7 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", "rand 0.8.5", - "smallvec 1.11.0", + "smallvec 1.11.1", "sp-core 21.0.0", "sp-externalities 0.19.0", "sp-panic-handler", @@ -9449,7 +9493,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "smallvec 1.11.0", + "smallvec 1.11.1", "sp-arithmetic", "sp-core 21.0.0", "sp-debug-derive 8.0.0", @@ -9521,7 +9565,7 @@ dependencies = [ "anyhow", "borsh", "clap 4.4.6", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "serde", "serde_json", "sov-accounts", @@ -9617,7 +9661,7 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" dependencies = [ - "strum_macros 0.25.2", + "strum_macros 0.25.3", ] [[package]] @@ -9635,15 +9679,15 @@ dependencies = [ [[package]] name = "strum_macros" -version = "0.25.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ "heck 0.4.1", "proc-macro2 1.0.69", "quote 1.0.33", "rustversion", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -9674,9 +9718,9 @@ dependencies = [ [[package]] name = "subtle" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "subtle-encoding" @@ -9742,7 +9786,7 @@ dependencies = [ "quote 1.0.33", "scale-info", "subxt-metadata", - "syn 2.0.37", + "syn 2.0.38", "thiserror", "tokio", ] @@ -9756,7 +9800,7 @@ dependencies = [ "darling 0.20.3", "proc-macro-error", "subxt-codegen", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -9792,10 +9836,10 @@ dependencies = [ "hex", "once_cell", "reqwest", - "semver 1.0.18", + "semver 1.0.20", "serde", "serde_json", - "sha2 0.10.7", + "sha2 0.10.8", "thiserror", "url", "zip", @@ -9825,9 +9869,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.37" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", @@ -9848,13 +9892,13 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.12.6" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +checksum = "285ba80e733fac80aa4270fbcdf83772a79b80aa35c97075320abfee4a915b06" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 1.0.109", + "syn 2.0.38", "unicode-xid 0.2.4", ] @@ -9898,9 +9942,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", - "fastrand 2.0.0", + "fastrand 2.0.1", "redox_syscall 0.3.5", - "rustix 0.38.13", + "rustix 0.38.19", "windows-sys 0.48.0", ] @@ -9911,7 +9955,7 @@ source = "git+https://github.com/eigerco/celestia-tendermint-rs.git?rev=1f8b574# dependencies = [ "bytes", "digest 0.10.7", - "ed25519 2.2.2", + "ed25519 2.2.3", "ed25519-consensus", "flex-error", "futures", @@ -9940,7 +9984,7 @@ checksum = "3f0a7d05cf78524782337f8edd55cbc578d159a16ad4affe2135c92f7dbac7f0" dependencies = [ "bytes", "digest 0.10.7", - "ed25519 2.2.2", + "ed25519 2.2.3", "ed25519-consensus", "flex-error", "futures", @@ -9952,7 +9996,7 @@ dependencies = [ "serde_bytes", "serde_json", "serde_repr", - "sha2 0.10.7", + "sha2 0.10.8", "signature 2.1.0", "subtle", "subtle-encoding", @@ -10033,32 +10077,31 @@ checksum = "aac81b6fd6beb5884b0cf3321b8117e6e5d47ecb6fc89f414cfdcca8b2fe2dd8" [[package]] name = "thiserror" -version = "1.0.48" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" +checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.48" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" +checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] name = "thread-id" -version = "4.2.0" +version = "4.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79474f573561cdc4871a0de34a51c92f7f5a56039113fbb5b9c9f96bdb756669" +checksum = "f0ec81c46e9eb50deaa257be2f148adf052d1fb7701cfd55ccfab2525280b70b" dependencies = [ "libc", - "redox_syscall 0.2.16", "winapi", ] @@ -10083,14 +10126,15 @@ dependencies = [ [[package]] name = "time" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ "deranged", "itoa", "libc", "num_threads", + "powerfmt", "serde", "time-core", "time-macros", @@ -10098,15 +10142,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ "time-core", ] @@ -10123,7 +10167,7 @@ dependencies = [ "pbkdf2 0.11.0", "rand 0.8.5", "rustc-hash", - "sha2 0.10.7", + "sha2 0.10.8", "thiserror", "unicode-normalization", "wasm-bindgen", @@ -10141,11 +10185,12 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ac3f5b6856e931e15e07b478e98c8045239829a65f9156d4fa7e7788197a5ef" +checksum = "8faa444297615a4e020acb64146b0603c9c395c03a97c17fd9028816d3b4d63e" dependencies = [ "displaydoc", + "serde", "zerovec", ] @@ -10201,7 +10246,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -10264,9 +10309,9 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2dbec703c26b00d74844519606ef15d09a7d6857860f84ad223dec002ddea2" +checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ "futures-util", "log", @@ -10274,14 +10319,14 @@ dependencies = [ "tokio", "tokio-rustls", "tungstenite", - "webpki-roots 0.23.1", + "webpki-roots 0.25.2", ] [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" dependencies = [ "bytes", "futures-core", @@ -10316,14 +10361,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c226a7bba6d859b63c92c4b4fe69c5b6b72d0cb897dbc8e6012298e6154cb56e" +checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.20.0", + "toml_edit 0.20.2", ] [[package]] @@ -10341,7 +10386,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.2", "serde", "serde_spanned", "toml_datetime", @@ -10350,11 +10395,11 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.20.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ff63e60a958cefbb518ae1fd6566af80d9d4be430a33f3723dfc47d1d411d95" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.2", "serde", "serde_spanned", "toml_datetime", @@ -10390,11 +10435,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "ee2ef2af84856a50c1d430afce2fdded0a4ec7eda868db86409b4543df0797f9" dependencies = [ - "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -10403,20 +10447,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -10469,7 +10513,7 @@ dependencies = [ "serde", "serde_json", "sharded-slab", - "smallvec 1.11.0", + "smallvec 1.11.1", "thread_local", "tracing", "tracing-core", @@ -10488,7 +10532,7 @@ dependencies = [ "once_cell", "regex", "sharded-slab", - "smallvec 1.11.0", + "smallvec 1.11.1", "thread_local", "tracing", "tracing-core", @@ -10505,7 +10549,7 @@ dependencies = [ "hashbrown 0.13.2", "log", "rustc-hex", - "smallvec 1.11.0", + "smallvec 1.11.1", ] [[package]] @@ -10565,7 +10609,7 @@ dependencies = [ "lazy_static", "log", "rand 0.8.5", - "smallvec 1.11.0", + "smallvec 1.11.1", "thiserror", "tinyvec", "tokio", @@ -10661,7 +10705,7 @@ checksum = "bfc13d450dc4a695200da3074dacf43d449b968baee95e341920e47f61a3b40f" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -10862,9 +10906,9 @@ dependencies = [ [[package]] name = "waker-fn" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" +checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" [[package]] name = "walkdir" @@ -10918,7 +10962,7 @@ dependencies = [ "once_cell", "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", "wasm-bindgen-shared", ] @@ -10952,7 +10996,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -11086,7 +11130,7 @@ dependencies = [ "memoffset 0.8.0", "paste", "rand 0.8.5", - "rustix 0.36.15", + "rustix 0.36.16", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", @@ -11139,7 +11183,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.13", + "rustix 0.38.19", ] [[package]] @@ -11176,9 +11220,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -11190,10 +11234,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" -version = "0.48.0" +name = "windows-core" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ "windows-targets 0.48.5", ] @@ -11332,9 +11376,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.15" +version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" dependencies = [ "memchr", ] @@ -11379,9 +11423,9 @@ checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" [[package]] name = "writeable" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60e49e42bdb1d5dc76f4cd78102f8f0714d32edfa3efb82286eb0f0b1fc0da0f" +checksum = "c0af0c3d13faebf8dda0b5256fa7096a2d5ccb662f7b9f54a40fe201077ab1c2" [[package]] name = "ws_stream_wasm" @@ -11413,9 +11457,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.18" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab77e97b50aee93da431f2cee7cd0f43b4d1da3c408042f2d7d164187774f0a" +checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" [[package]] name = "xmltree" @@ -11449,9 +11493,9 @@ checksum = "e2a7eb6d82a11e4d0b8e6bda8347169aff4ccd8235d039bba7c47482d977dcf7" [[package]] name = "yoke" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1848075a23a28f9773498ee9a0f2cf58fcbad4f8c0ccf84a210ab33c6ae495de" +checksum = "61e38c508604d6bbbd292dadb3c02559aa7fff6b654a078a36217cad871636e4" dependencies = [ "serde", "stable_deref_trait", @@ -11461,34 +11505,34 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af46c169923ed7516eef0aa32b56d2651b229f57458ebe46b49ddd6efef5b7a2" +checksum = "d5e19fb6ed40002bab5403ffa37e53e0e56f914a4450c8765f533018db1db35f" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", "synstructure 0.13.0", ] [[package]] name = "zerofrom" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df54d76c3251de27615dfcce21e636c172dafb2549cd7fd93e21c66f6ca6bea2" +checksum = "655b0814c5c0b19ade497851070c640773304939a6c0fd5f5fb43da0696d05b7" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4eae7c1f7d4b8eafce526bc0771449ddc2f250881ae31c50d22c032b5a1c499" +checksum = "e6a647510471d372f2e6c2e6b7219e44d8c574d24fdc11c610a61455782f18c3" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", "synstructure 0.13.0", ] @@ -11509,15 +11553,16 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] name = "zerovec" -version = "0.9.4" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "198f54134cd865f437820aa3b43d0ad518af4e68ee161b444cdd15d8e567c8ea" +checksum = "591691014119b87047ead4dcf3e6adfbf73cb7c38ab6980d4f18a32138f35d46" dependencies = [ + "serde", "yoke", "zerofrom", "zerovec-derive", @@ -11525,14 +11570,13 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.9.4" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486558732d5dde10d0f8cb2936507c1bb21bc539d924c949baf5f36a58e51bac" +checksum = "7a4a1638a1934450809c2266a70362bfc96cd90550c073f5b8a55014d1010157" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", - "syn 1.0.109", - "synstructure 0.12.6", + "syn 2.0.38", ] [[package]] @@ -11595,11 +11639,10 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.8+zstd.1.5.5" +version = "2.0.9+zstd.1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" +checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" dependencies = [ "cc", - "libc", "pkg-config", ] From accdd6d1bc0892f21831d2e3e87276941acbe2fa Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Tue, 17 Oct 2023 16:46:24 +0300 Subject: [PATCH 23/26] lint --- full-node/sov-ethereum/src/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/full-node/sov-ethereum/src/lib.rs b/full-node/sov-ethereum/src/lib.rs index f603ad856..85ad0a8a7 100644 --- a/full-node/sov-ethereum/src/lib.rs +++ b/full-node/sov-ethereum/src/lib.rs @@ -29,12 +29,11 @@ pub mod experimental { use sov_modules_api::{EncodeCall, WorkingSet}; use sov_rollup_interface::services::da::DaService; - use crate::gas_price::gas_oracle::GasPriceOracle; - use crate::GasPriceOracleConfig; - use super::batch_builder::EthBatchBuilder; #[cfg(feature = "local")] use super::DevSigner; + use crate::gas_price::gas_oracle::GasPriceOracle; + use crate::GasPriceOracleConfig; const ETH_RPC_ERROR: &str = "ETH_RPC_ERROR"; From ef6dfbaae7cd83517e3dbc986da166b2bbbeaea7 Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Tue, 17 Oct 2023 17:18:42 +0300 Subject: [PATCH 24/26] fix test conflicts --- examples/demo-rollup/tests/evm/mod.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/examples/demo-rollup/tests/evm/mod.rs b/examples/demo-rollup/tests/evm/mod.rs index f2a878fed..4c9a35cb8 100644 --- a/examples/demo-rollup/tests/evm/mod.rs +++ b/examples/demo-rollup/tests/evm/mod.rs @@ -145,13 +145,8 @@ async fn execute(client: &TestClient) -> Result<(), Box> // Create a blob with multiple transactions. let mut requests = Vec::default(); -<<<<<<< HEAD - for value in 100..103 { - let set_value_req = client.set_value(contract_address, value, None, None).await; -======= for value in 150..153 { - let set_value_req = client.set_value(contract_address, value).await; ->>>>>>> nightly + let set_value_req = client.set_value(contract_address, value, None, None).await; requests.push(set_value_req); } @@ -207,7 +202,7 @@ async fn execute(client: &TestClient) -> Result<(), Box> // TODO: emulate gas price oracle here to have exact value assert!(latest_gas_price > initial_gas_price); } - + let first_block = client.eth_get_block_by_number(Some("0".to_owned())).await; let second_block = client.eth_get_block_by_number(Some("1".to_owned())).await; From 232c5893d22aad6cb329be0d370451523464ded9 Mon Sep 17 00:00:00 2001 From: orkunkilic Date: Wed, 18 Oct 2023 12:50:58 +0300 Subject: [PATCH 25/26] fix integration tests --- examples/demo-rollup/tests/evm/mod.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/examples/demo-rollup/tests/evm/mod.rs b/examples/demo-rollup/tests/evm/mod.rs index 4c9a35cb8..5c2b910c2 100644 --- a/examples/demo-rollup/tests/evm/mod.rs +++ b/examples/demo-rollup/tests/evm/mod.rs @@ -184,17 +184,18 @@ async fn execute(client: &TestClient) -> Result<(), Box> // get initial gas price let initial_gas_price = client.eth_gas_price().await; - // send 100 set transaction with high gas fee - let mut requests = Vec::default(); - for value in 200..300 { - let set_value_req = client - .set_value(contract_address, value, Some(20u64), Some(21u64)) - .await; - requests.push(set_value_req); + // send 100 set transaction with high gas fee in a four batch to increase gas price + for _ in 0..4 { + let mut requests = Vec::default(); + for value in 0..25 { + let set_value_req = client + .set_value(contract_address, value, Some(20u64), Some(21u64)) + .await; + requests.push(set_value_req); + } + client.send_publish_batch_request().await; } - client.send_publish_batch_request().await; - // get gas price let latest_gas_price = client.eth_gas_price().await; From b91845ba61d87394c579da63e6981a792939f44d Mon Sep 17 00:00:00 2001 From: bkolad Date: Wed, 18 Oct 2023 14:42:45 +0200 Subject: [PATCH 26/26] update cargo lock --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 633c2980e..9a417591a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8372,7 +8372,7 @@ dependencies = [ "clap 4.4.6", "hex", "jmt", - "jsonrpsee 0.20.1", + "jsonrpsee 0.20.2", "schemars", "serde", "serde_json",