diff --git a/cmd/ethrex/l2/options.rs b/cmd/ethrex/l2/options.rs index 1cd351ec61..b893a4db87 100644 --- a/cmd/ethrex/l2/options.rs +++ b/cmd/ethrex/l2/options.rs @@ -49,6 +49,7 @@ impl From for SequencerConfig { block_producer: BlockProducerConfig { block_time_ms: opts.proposer_opts.block_time_ms, coinbase_address: opts.proposer_opts.coinbase_address, + elasticity_multiplier: opts.proposer_opts.elasticity_multiplier, }, l1_committer: CommitterConfig { on_chain_proposer_address: opts.committer_opts.on_chain_proposer_address, @@ -63,6 +64,10 @@ impl From for SequencerConfig { }, eth: EthConfig { rpc_url: opts.eth_opts.rpc_url, + max_number_of_retries: opts.eth_opts.max_number_of_retries, + backoff_factor: opts.eth_opts.backoff_factor, + min_retry_delay: opts.eth_opts.min_retry_delay, + max_retry_delay: opts.eth_opts.max_retry_delay, maximum_allowed_max_fee_per_gas: opts.eth_opts.maximum_allowed_max_fee_per_gas, maximum_allowed_max_fee_per_blob_gas: opts .eth_opts @@ -115,6 +120,38 @@ pub struct EthOptions { help_heading = "Eth options" )] pub maximum_allowed_max_fee_per_blob_gas: u64, + #[arg( + long = "eth-max-number-of-retries", + default_value = "10", + value_name = "UINT64", + env = "ETHREX_MAX_NUMBER_OF_RETRIES", + help_heading = "Eth options" + )] + pub max_number_of_retries: u64, + #[arg( + long = "eth-backoff-factor", + default_value = "2", + value_name = "UINT64", + env = "ETHREX_BACKOFF_FACTOR", + help_heading = "Eth options" + )] + pub backoff_factor: u64, + #[arg( + long = "eth-min-retry-delay", + default_value = "96", + value_name = "UINT64", + env = "ETHREX_MIN_RETRY_DELAY", + help_heading = "Eth options" + )] + pub min_retry_delay: u64, + #[arg( + long = "eth-max-retry-delay", + default_value = "1800", + value_name = "UINT64", + env = "ETHREX_MAX_RETRY_DELAY", + help_heading = "Eth options" + )] + pub max_retry_delay: u64, } #[derive(Parser)] @@ -187,6 +224,14 @@ pub struct ProposerOptions { help_heading = "Proposer options" )] pub coinbase_address: Address, + #[arg( + long, + default_value = "2", + value_name = "UINT64", + env = "ETHREX_PROPOSER_ELASTICITY_MULTIPLIER", + help_heading = "Proposer options" + )] + pub elasticity_multiplier: u64, } #[derive(Parser)] diff --git a/crates/blockchain/blockchain.rs b/crates/blockchain/blockchain.rs index 6854bc0932..0304af06d7 100644 --- a/crates/blockchain/blockchain.rs +++ b/crates/blockchain/blockchain.rs @@ -16,7 +16,7 @@ use ethrex_common::types::{ validate_prague_header_fields, validate_pre_cancun_header_fields, Block, BlockHash, BlockHeader, BlockNumber, ChainConfig, EIP4844Transaction, Receipt, Transaction, }; -use ethrex_common::types::{BlobsBundle, Fork}; +use ethrex_common::types::{BlobsBundle, Fork, ELASTICITY_MULTIPLIER}; use ethrex_common::{Address, H256}; use mempool::Mempool; @@ -75,7 +75,7 @@ impl Blockchain { let chain_config = self.storage.get_chain_config()?; // Validate the block pre-execution - validate_block(block, &parent_header, &chain_config)?; + validate_block(block, &parent_header, &chain_config, ELASTICITY_MULTIPLIER)?; let mut vm = Evm::new( self.evm_engine, @@ -102,7 +102,7 @@ impl Blockchain { vm: &mut Evm, ) -> Result { // Validate the block pre-execution - validate_block(block, parent_header, chain_config)?; + validate_block(block, parent_header, chain_config, ELASTICITY_MULTIPLIER)?; let execution_result = vm.execute_block(block)?; @@ -560,9 +560,11 @@ pub fn validate_block( block: &Block, parent_header: &BlockHeader, chain_config: &ChainConfig, + elasticity_multiplier: u64, ) -> Result<(), ChainError> { // Verify initial header validity against parent - validate_block_header(&block.header, parent_header).map_err(InvalidBlockError::from)?; + validate_block_header(&block.header, parent_header, elasticity_multiplier) + .map_err(InvalidBlockError::from)?; if chain_config.is_prague_activated(block.header.timestamp) { validate_prague_header_fields(&block.header, parent_header, chain_config) diff --git a/crates/blockchain/payload.rs b/crates/blockchain/payload.rs index f817194bcc..9a5c10eb61 100644 --- a/crates/blockchain/payload.rs +++ b/crates/blockchain/payload.rs @@ -49,6 +49,7 @@ pub struct BuildPayloadArgs { pub withdrawals: Option>, pub beacon_root: Option, pub version: u8, + pub elasticity_multiplier: u64, } impl BuildPayloadArgs { @@ -111,6 +112,7 @@ pub fn create_payload(args: &BuildPayloadArgs, storage: &Store) -> Result Option { // Check gas limit, if the check passes we can also rest assured that none of the // following divisions will have zero as a divider @@ -439,7 +440,7 @@ pub fn calculate_base_fee_per_gas( return None; } - let parent_gas_target = parent_gas_limit / ELASTICITY_MULTIPLIER; + let parent_gas_target = parent_gas_limit / elasticity_multiplier; Some(match parent_gas_used.cmp(&parent_gas_target) { Ordering::Equal => parent_base_fee_per_gas, @@ -513,6 +514,7 @@ pub enum InvalidBlockHeaderError { pub fn validate_block_header( header: &BlockHeader, parent_header: &BlockHeader, + elasticity_multiplier: u64, ) -> Result<(), InvalidBlockHeaderError> { if header.gas_used > header.gas_limit { return Err(InvalidBlockHeaderError::GasUsedGreaterThanGasLimit); @@ -523,6 +525,7 @@ pub fn validate_block_header( parent_header.gas_limit, parent_header.gas_used, parent_header.base_fee_per_gas.unwrap_or(INITIAL_BASE_FEE), + elasticity_multiplier, ) { base_fee } else { @@ -669,7 +672,7 @@ pub fn calc_excess_blob_gas( #[cfg(test)] mod test { use super::*; - use crate::types::EMPTY_KECCACK_HASH; + use crate::types::{ELASTICITY_MULTIPLIER, EMPTY_KECCACK_HASH}; use ethereum_types::H160; use hex_literal::hex; use std::str::FromStr; @@ -787,7 +790,7 @@ mod test { parent_beacon_block_root: Some(H256::zero()), requests_hash: Some(*EMPTY_KECCACK_HASH), }; - assert!(validate_block_header(&block, &parent_block).is_ok()) + assert!(validate_block_header(&block, &parent_block, ELASTICITY_MULTIPLIER).is_ok()) } #[test] diff --git a/crates/l2/contracts/bin/deployer/cli.rs b/crates/l2/contracts/bin/deployer/cli.rs index 13ebea7245..69bd84b4d1 100644 --- a/crates/l2/contracts/bin/deployer/cli.rs +++ b/crates/l2/contracts/bin/deployer/cli.rs @@ -42,6 +42,38 @@ pub struct DeployerOptions { help = "Private key corresponding of a funded account that will be used for L1 contract deployment.", )] pub private_key: SecretKey, + #[arg( + long, + default_value = "10", + value_name = "UINT64", + env = "ETHREX_ETH_MAX_NUMBER_OF_RETRIES", + help_heading = "Eth options" + )] + pub max_number_of_retries: u64, + #[arg( + long, + default_value = "2", + value_name = "UINT64", + env = "ETHREX_ETH_BACKOFF_FACTOR", + help_heading = "Eth options" + )] + pub backoff_factor: u64, + #[arg( + long, + default_value = "96", + value_name = "UINT64", + env = "ETHREX_ETH_MIN_RETRY_DELAY", + help_heading = "Eth options" + )] + pub min_retry_delay: u64, + #[arg( + long, + default_value = "1800", + value_name = "UINT64", + env = "ETHREX_ETH_MAX_RETRY_DELAY", + help_heading = "Eth options" + )] + pub max_retry_delay: u64, #[arg( long, value_name = "PATH", @@ -181,6 +213,10 @@ impl Default for DeployerOptions { rpc_url: "http://localhost:8545".to_string(), maximum_allowed_max_fee_per_gas: 10_000_000_000, maximum_allowed_max_fee_per_blob_gas: 10_000_000_000, + max_number_of_retries: 10, + backoff_factor: 2, + min_retry_delay: 96, + max_retry_delay: 1800, #[allow(clippy::unwrap_used)] private_key: SecretKey::from_slice( H256([ diff --git a/crates/l2/contracts/bin/deployer/main.rs b/crates/l2/contracts/bin/deployer/main.rs index 3ba5555330..d597f39213 100644 --- a/crates/l2/contracts/bin/deployer/main.rs +++ b/crates/l2/contracts/bin/deployer/main.rs @@ -35,10 +35,14 @@ const BRIDGE_INITIALIZER_SIGNATURE: &str = "initialize(address)"; async fn main() -> Result<(), DeployerError> { let opts = DeployerOptions::parse(); - let eth_client = EthClient::new_with_maximum_fees( + let eth_client = EthClient::new_with_config( &opts.rpc_url, - opts.maximum_allowed_max_fee_per_gas, - opts.maximum_allowed_max_fee_per_blob_gas, + opts.max_number_of_retries, + opts.backoff_factor, + opts.min_retry_delay, + opts.max_retry_delay, + Some(opts.maximum_allowed_max_fee_per_gas), + Some(opts.maximum_allowed_max_fee_per_blob_gas), ); download_contract_deps(&opts)?; diff --git a/crates/l2/prover/src/backends/exec.rs b/crates/l2/prover/src/backends/exec.rs index c717d1d455..e5f0307ba0 100644 --- a/crates/l2/prover/src/backends/exec.rs +++ b/crates/l2/prover/src/backends/exec.rs @@ -42,6 +42,7 @@ fn execution_program(input: ProgramInput) -> Result Result (ProgramInput, Block) { .await .unwrap(); + // This is just a test, so we can use the default value for the elasticity multiplier. + let elasticity_multiplier = ELASTICITY_MULTIPLIER; + let input = ProgramInput { blocks: vec![block_to_prove.clone()], parent_block_header, db, + elasticity_multiplier, }; (input, block_to_prove.clone()) } diff --git a/crates/l2/prover/zkvm/interface/pico/src/main.rs b/crates/l2/prover/zkvm/interface/pico/src/main.rs index c128cbd817..71af8c8ffb 100644 --- a/crates/l2/prover/zkvm/interface/pico/src/main.rs +++ b/crates/l2/prover/zkvm/interface/pico/src/main.rs @@ -5,6 +5,7 @@ use pico_sdk::io::{commit, read_as}; use ethrex_blockchain::{validate_block, validate_gas_used}; use ethrex_common::Address; use ethrex_storage::AccountUpdate; +use ethrex_vm::backends::revm::{db::EvmState, REVM}; use ethrex_vm::Evm; use std::collections::HashMap; use zkvm_interface::{ @@ -19,6 +20,7 @@ pub fn main() { blocks, parent_block_header, mut db, + elasticity_multiplier, } = read_as(); // Tries used for validating initial and final state root let (mut state_trie, mut storage_tries) = db @@ -41,7 +43,13 @@ pub fn main() { for block in blocks { // Validate the block - validate_block(&block, &parent_header, &db.chain_config).expect("invalid block"); + validate_block( + &block, + &parent_header, + &db.chain_config, + elasticity_multiplier, + ) + .expect("invalid block"); // Execute block let mut vm = Evm::from_execution_db(db.clone()); diff --git a/crates/l2/prover/zkvm/interface/sp1/src/main.rs b/crates/l2/prover/zkvm/interface/sp1/src/main.rs index 200cde56d7..dd1aad6926 100644 --- a/crates/l2/prover/zkvm/interface/sp1/src/main.rs +++ b/crates/l2/prover/zkvm/interface/sp1/src/main.rs @@ -17,6 +17,7 @@ pub fn main() { blocks, parent_block_header, mut db, + elasticity_multiplier, } = sp1_zkvm::io::read::(); // Tries used for validating initial and final state root let (mut state_trie, mut storage_tries) = db @@ -41,7 +42,13 @@ pub fn main() { for block in blocks { // Validate the block - validate_block(&block, &parent_header, &db.chain_config).expect("invalid block"); + validate_block( + &block, + &parent_header, + &db.chain_config, + elasticity_multiplier, + ) + .expect("invalid block"); // Execute block let mut vm = Evm::from_execution_db(db.clone()); diff --git a/crates/l2/prover/zkvm/interface/src/lib.rs b/crates/l2/prover/zkvm/interface/src/lib.rs index 02a57306e2..78f9043b49 100644 --- a/crates/l2/prover/zkvm/interface/src/lib.rs +++ b/crates/l2/prover/zkvm/interface/src/lib.rs @@ -40,6 +40,8 @@ pub mod io { pub parent_block_header: BlockHeader, /// database containing only the data necessary to execute pub db: ExecutionDB, + /// value used to calculate base fee + pub elasticity_multiplier: u64, } /// Public output variables exposed by the zkVM execution program. Some of these are part of diff --git a/crates/l2/sequencer/block_producer.rs b/crates/l2/sequencer/block_producer.rs index b929ebb90a..fc5d68e687 100644 --- a/crates/l2/sequencer/block_producer.rs +++ b/crates/l2/sequencer/block_producer.rs @@ -27,6 +27,7 @@ use super::{ pub struct BlockProducer { block_time_ms: u64, coinbase_address: Address, + elasticity_multiplier: u64, } pub async fn start_block_producer( @@ -47,10 +48,12 @@ impl BlockProducer { let BlockProducerConfig { block_time_ms, coinbase_address, + elasticity_multiplier, } = config; Self { block_time_ms: *block_time_ms, coinbase_address: *coinbase_address, + elasticity_multiplier: *elasticity_multiplier, } } @@ -103,6 +106,7 @@ impl BlockProducer { withdrawals: Default::default(), beacon_root: Some(head_beacon_block_root), version, + elasticity_multiplier: self.elasticity_multiplier, }; let payload = create_payload(&args, &store)?; @@ -116,7 +120,12 @@ impl BlockProducer { // Blockchain stores block let block = payload_build_result.payload; let chain_config = store.get_chain_config()?; - validate_block(&block, &head_header, &chain_config)?; + validate_block( + &block, + &head_header, + &chain_config, + self.elasticity_multiplier, + )?; let account_updates = payload_build_result.account_updates; diff --git a/crates/l2/sequencer/configs.rs b/crates/l2/sequencer/configs.rs index 581b10cbaf..2ad30e5ed2 100644 --- a/crates/l2/sequencer/configs.rs +++ b/crates/l2/sequencer/configs.rs @@ -16,6 +16,7 @@ pub struct SequencerConfig { pub struct BlockProducerConfig { pub block_time_ms: u64, pub coinbase_address: Address, + pub elasticity_multiplier: u64, } #[derive(Clone, Debug)] @@ -33,6 +34,10 @@ pub struct EthConfig { pub rpc_url: String, pub maximum_allowed_max_fee_per_gas: u64, pub maximum_allowed_max_fee_per_blob_gas: u64, + pub max_number_of_retries: u64, + pub backoff_factor: u64, + pub min_retry_delay: u64, + pub max_retry_delay: u64, } #[derive(Clone, Debug)] diff --git a/crates/l2/sequencer/l1_committer.rs b/crates/l2/sequencer/l1_committer.rs index c75d159c00..6c01a46b4a 100644 --- a/crates/l2/sequencer/l1_committer.rs +++ b/crates/l2/sequencer/l1_committer.rs @@ -78,10 +78,14 @@ impl Committer { execution_cache: Arc, ) -> Self { Self { - eth_client: EthClient::new_with_maximum_fees( + eth_client: EthClient::new_with_config( ð_config.rpc_url, - eth_config.maximum_allowed_max_fee_per_gas, - eth_config.maximum_allowed_max_fee_per_blob_gas, + eth_config.max_number_of_retries, + eth_config.backoff_factor, + eth_config.min_retry_delay, + eth_config.max_retry_delay, + Some(eth_config.maximum_allowed_max_fee_per_gas), + Some(eth_config.maximum_allowed_max_fee_per_blob_gas), ), on_chain_proposer_address: committer_config.on_chain_proposer_address, store, diff --git a/crates/l2/sequencer/proof_coordinator.rs b/crates/l2/sequencer/proof_coordinator.rs index b97db0b4b1..a907e408ad 100644 --- a/crates/l2/sequencer/proof_coordinator.rs +++ b/crates/l2/sequencer/proof_coordinator.rs @@ -3,7 +3,9 @@ use crate::utils::prover::proving_systems::ProofCalldata; use crate::utils::prover::save_state::{ batch_number_has_state_file, write_state, StateFileType, StateType, }; -use crate::{CommitterConfig, EthConfig, ProofCoordinatorConfig, SequencerConfig}; +use crate::{ + BlockProducerConfig, CommitterConfig, EthConfig, ProofCoordinatorConfig, SequencerConfig, +}; use ethrex_common::{ types::{Block, BlockHeader}, Address, @@ -29,6 +31,7 @@ pub struct ProverInputData { pub blocks: Vec, pub parent_block_header: BlockHeader, pub db: ExecutionDB, + pub elasticity_multiplier: u64, } #[derive(Clone)] @@ -38,6 +41,7 @@ struct ProofCoordinator { store: Store, eth_client: EthClient, on_chain_proposer_address: Address, + elasticity_multiplier: u64, rollup_store: StoreRollup, } @@ -115,6 +119,7 @@ pub async fn start_proof_coordinator( &cfg.proof_coordinator, &cfg.l1_committer, &cfg.eth, + &cfg.block_producer, store, rollup_store, ) @@ -129,13 +134,18 @@ impl ProofCoordinator { config: &ProofCoordinatorConfig, committer_config: &CommitterConfig, eth_config: &EthConfig, + proposer_config: &BlockProducerConfig, store: Store, rollup_store: StoreRollup, ) -> Result { - let eth_client = EthClient::new_with_maximum_fees( + let eth_client = EthClient::new_with_config( ð_config.rpc_url, - eth_config.maximum_allowed_max_fee_per_blob_gas, - eth_config.maximum_allowed_max_fee_per_blob_gas, + eth_config.max_number_of_retries, + eth_config.backoff_factor, + eth_config.min_retry_delay, + eth_config.max_retry_delay, + Some(eth_config.maximum_allowed_max_fee_per_gas), + Some(eth_config.maximum_allowed_max_fee_per_blob_gas), ); let on_chain_proposer_address = committer_config.on_chain_proposer_address; @@ -145,6 +155,7 @@ impl ProofCoordinator { store, eth_client, on_chain_proposer_address, + elasticity_multiplier: proposer_config.elasticity_multiplier, rollup_store, }) } @@ -335,6 +346,7 @@ impl ProofCoordinator { db, blocks, parent_block_header, + elasticity_multiplier: self.elasticity_multiplier, }) } diff --git a/crates/l2/utils/error.rs b/crates/l2/utils/error.rs index 624f2e13c2..916a9abc3f 100644 --- a/crates/l2/utils/error.rs +++ b/crates/l2/utils/error.rs @@ -3,6 +3,8 @@ use ethrex_storage::error::StoreError; use ethrex_vm::ExecutionDBError; use keccak_hash::H256; +use super::config::errors::ConfigError; + #[derive(Debug, thiserror::Error)] pub enum ProverInputError { #[error("Invalid block number: {0}")] @@ -15,6 +17,8 @@ pub enum ProverInputError { ChainError(#[from] ChainError), #[error("ExecutionDB error: {0}")] ExecutionDBError(#[from] ExecutionDBError), + #[error("Invalid Environment variable: {0}")] + InvalidEnvVar(#[from] ConfigError), } #[derive(Debug, thiserror::Error)] diff --git a/crates/l2/utils/test_data_io.rs b/crates/l2/utils/test_data_io.rs index d2cc9bc873..4bb80b3ee2 100644 --- a/crates/l2/utils/test_data_io.rs +++ b/crates/l2/utils/test_data_io.rs @@ -2,7 +2,7 @@ #![allow(clippy::expect_used)] use ethrex_blockchain::Blockchain; -use ethrex_common::types::{Block, Genesis}; +use ethrex_common::types::{Block, Genesis, ELASTICITY_MULTIPLIER}; use ethrex_rlp::{decode::RLPDecode, encode::RLPEncode}; use ethrex_storage::{EngineType, Store}; use ethrex_vm::Evm; @@ -15,7 +15,7 @@ use std::{ path::PathBuf, }; -use super::error::ProverInputError; +use super::{config::read_env_file_by_config, error::ProverInputError}; // From cmd/ethrex pub fn read_chain_file(chain_rlp_path: &str) -> Vec { @@ -84,7 +84,8 @@ pub async fn generate_program_input( let parent_block_header = store .get_block_header_by_hash(block.header.parent_hash)? .ok_or(ProverInputError::InvalidParentBlock(parent_hash))?; - + read_env_file_by_config().map_err(ProverInputError::InvalidEnvVar)?; + let elasticity_multiplier = ELASTICITY_MULTIPLIER; let blocks = vec![block]; let db = Evm::to_execution_db(&store, &blocks).await?; @@ -92,6 +93,7 @@ pub async fn generate_program_input( db, blocks, parent_block_header, + elasticity_multiplier, }) } diff --git a/crates/networking/rpc/clients/eth/mod.rs b/crates/networking/rpc/clients/eth/mod.rs index a223b6f361..5211b41268 100644 --- a/crates/networking/rpc/clients/eth/mod.rs +++ b/crates/networking/rpc/clients/eth/mod.rs @@ -44,6 +44,10 @@ pub enum RpcResponse { pub struct EthClient { client: Client, pub url: String, + pub max_number_of_retries: u64, + pub backoff_factor: u64, + pub min_retry_delay: u64, + pub max_retry_delay: u64, pub maximum_allowed_max_fee_per_gas: Option, pub maximum_allowed_max_fee_per_blob_gas: Option, } @@ -100,24 +104,35 @@ pub struct WithdrawalProof { impl EthClient { pub fn new(url: &str) -> Self { - Self { - client: Client::new(), - url: url.to_string(), - maximum_allowed_max_fee_per_gas: None, - maximum_allowed_max_fee_per_blob_gas: None, - } + Self::new_with_config( + url, + MAX_NUMBER_OF_RETRIES, + BACKOFF_FACTOR, + MIN_RETRY_DELAY, + MAX_RETRY_DELAY, + None, + None, + ) } - pub fn new_with_maximum_fees( + pub fn new_with_config( url: &str, - max_fee_per_gas: u64, - max_fee_per_blob_gas: u64, + max_number_of_retries: u64, + backoff_factor: u64, + min_retry_delay: u64, + max_retry_delay: u64, + maximum_allowed_max_fee_per_gas: Option, + maximum_allowed_max_fee_per_blob_gas: Option, ) -> Self { Self { client: Client::new(), url: url.to_string(), - maximum_allowed_max_fee_per_gas: Some(max_fee_per_gas), - maximum_allowed_max_fee_per_blob_gas: Some(max_fee_per_blob_gas), + max_number_of_retries, + backoff_factor, + min_retry_delay, + max_retry_delay, + maximum_allowed_max_fee_per_gas, + maximum_allowed_max_fee_per_blob_gas, } } @@ -215,7 +230,7 @@ impl EthClient { ) -> Result { let mut number_of_retries = 0; - 'outer: while number_of_retries < MAX_NUMBER_OF_RETRIES { + 'outer: while number_of_retries < self.max_number_of_retries { if let Some(max_fee_per_gas) = self.maximum_allowed_max_fee_per_gas { let tx_max_fee = match wrapped_tx { WrappedTransaction::EIP4844(tx) => &mut tx.tx.max_fee_per_gas, @@ -245,15 +260,16 @@ impl EthClient { .await?; if number_of_retries > 0 { - warn!("Resending Transaction after bumping gas, attempts [{number_of_retries}/{MAX_NUMBER_OF_RETRIES}]\nTxHash: {tx_hash:#x}"); + warn!("Resending Transaction after bumping gas, attempts [{number_of_retries}/{}]\nTxHash: {tx_hash:#x}", self.max_number_of_retries); } let mut receipt = self.get_transaction_receipt(tx_hash).await?; let mut attempt = 1; - let attempts_to_wait_in_seconds = BACKOFF_FACTOR + let attempts_to_wait_in_seconds = self + .backoff_factor .pow(number_of_retries as u32) - .clamp(MIN_RETRY_DELAY, MAX_RETRY_DELAY); + .clamp(self.min_retry_delay, self.max_retry_delay); while receipt.is_none() { if attempt >= (attempts_to_wait_in_seconds / WAIT_TIME_FOR_RECEIPT_SECONDS) { // We waited long enough for the receipt but did not find it, bump gas diff --git a/crates/networking/rpc/engine/fork_choice.rs b/crates/networking/rpc/engine/fork_choice.rs index 235f57a5d6..1da1e8878a 100644 --- a/crates/networking/rpc/engine/fork_choice.rs +++ b/crates/networking/rpc/engine/fork_choice.rs @@ -4,7 +4,7 @@ use ethrex_blockchain::{ latest_canonical_block_hash, payload::{create_payload, BuildPayloadArgs}, }; -use ethrex_common::types::BlockHeader; +use ethrex_common::types::{BlockHeader, ELASTICITY_MULTIPLIER}; use ethrex_p2p::sync::SyncMode; use serde_json::Value; use tracing::{debug, info, warn}; @@ -423,6 +423,7 @@ async fn build_payload( withdrawals: attributes.withdrawals.clone(), beacon_root: attributes.parent_beacon_block_root, version, + elasticity_multiplier: ELASTICITY_MULTIPLIER, }; let payload_id = args.id(); let payload = match create_payload(&args, &context.storage) { diff --git a/crates/networking/rpc/eth/fee_market.rs b/crates/networking/rpc/eth/fee_market.rs index c27e3f74cd..030002c8eb 100644 --- a/crates/networking/rpc/eth/fee_market.rs +++ b/crates/networking/rpc/eth/fee_market.rs @@ -3,7 +3,7 @@ use ethrex_common::{ constants::GAS_PER_BLOB, types::{ calc_excess_blob_gas, calculate_base_fee_per_blob_gas, calculate_base_fee_per_gas, Block, - BlockHeader, Transaction, + BlockHeader, Transaction, ELASTICITY_MULTIPLIER, }, }; use serde::Serialize; @@ -202,6 +202,7 @@ fn project_next_block_base_fee_values( header.gas_limit, header.gas_used, header.base_fee_per_gas.unwrap_or_default(), + ELASTICITY_MULTIPLIER, ) .unwrap_or_default(); let next_excess_blob_gas = calc_excess_blob_gas(