diff --git a/cmd/ethrex/ethrex.rs b/cmd/ethrex/ethrex.rs index c5eb55dd9..c4a0e0f83 100644 --- a/cmd/ethrex/ethrex.rs +++ b/cmd/ethrex/ethrex.rs @@ -219,11 +219,21 @@ async fn main() { let authrpc_jwtsecret = std::fs::read(authrpc_jwtsecret).expect("Failed to read JWT secret"); let head_block_hash = { let current_block_number = store.get_latest_block_number().unwrap(); - store.get_canonical_block_hash(current_block_number).unwrap().unwrap() + store + .get_canonical_block_hash(current_block_number) + .unwrap() + .unwrap() }; let max_tries = 3; let url = format!("http://{authrpc_socket_addr}"); - let block_producer_engine = ethrex_dev::block_producer::start_block_producer(url, authrpc_jwtsecret.into(), head_block_hash, max_tries, 1000, ethrex_core::Address::default()); + let block_producer_engine = ethrex_dev::block_producer::start_block_producer( + url, + authrpc_jwtsecret.into(), + head_block_hash, + max_tries, + 1000, + ethrex_core::Address::default(), + ); tracker.spawn(block_producer_engine); } else { let networking = ethrex_net::start_network( diff --git a/crates/blockchain/payload.rs b/crates/blockchain/payload.rs index 01ba173c5..2b430a4ae 100644 --- a/crates/blockchain/payload.rs +++ b/crates/blockchain/payload.rs @@ -1,5 +1,5 @@ use std::{ - cmp::{min, Ordering}, + cmp::{max, Ordering}, collections::HashMap, }; @@ -125,7 +125,7 @@ pub fn create_payload(args: &BuildPayloadArgs, storage: &Store) -> Result u64 { let delta = parent_gas_limit / GAS_LIMIT_BOUND_DIVISOR - 1; let mut limit = parent_gas_limit; - let desired_limit = min(desired_limit, MIN_GAS_LIMIT); + let desired_limit = max(desired_limit, MIN_GAS_LIMIT); if limit < desired_limit { limit = parent_gas_limit + delta; if limit > desired_limit { diff --git a/crates/l2/proposer/prover_server.rs b/crates/l2/proposer/prover_server.rs index b4b936358..551fab762 100644 --- a/crates/l2/proposer/prover_server.rs +++ b/crates/l2/proposer/prover_server.rs @@ -646,7 +646,7 @@ impl ProverServer { pub async fn main_logic_dev(&self) -> Result<(), ProverServerError> { loop { - thread::sleep(Duration::from_millis(200)); + thread::sleep(Duration::from_millis(1000)); let last_committed_block = EthClient::get_last_committed_block( &self.eth_client, @@ -660,18 +660,13 @@ impl ProverServer { ) .await?; - if last_committed_block == u64::MAX { - debug!("No blocks commited yet"); - continue; - } + info!("Last committed: {last_committed_block} - Last verified: {last_verified_block}"); if last_committed_block == last_verified_block { - debug!("No new blocks to prove"); + warn!("No new blocks to prove"); continue; } - info!("Last committed: {last_committed_block} - Last verified: {last_verified_block}"); - // IOnChainProposer // function verify(uint256,bytes,bytes32,bytes32,bytes32,bytes,bytes) // blockNumber, blockProof, imageId, journalDigest, programVKey, publicValues, proofBytes @@ -702,14 +697,18 @@ impl ProverServer { // offset of first bytes parameter calldata.extend(H256::from_low_u64_be(7 * 32).as_bytes()); // extend with bytes32, bytes32, bytes32 - for _ in 0..=3 { - calldata.extend(H256::zero().as_bytes()); - } - // offset of second bytes parameter calldata.extend(H256::zero().as_bytes()); + calldata.extend(H256::zero().as_bytes()); + calldata.extend(H256::zero().as_bytes()); + // offset of second bytes parameter + calldata.extend(H256::from_low_u64_be(9 * 32).as_bytes()); // offset of third bytes parameter + calldata.extend(H256::from_low_u64_be(11 * 32).as_bytes()); + // extend with size and bytes + calldata.extend(H256::from_low_u64_be(32).as_bytes()); + calldata.extend(H256::zero().as_bytes()); + calldata.extend(H256::from_low_u64_be(32).as_bytes()); calldata.extend(H256::zero().as_bytes()); - // extend with size of the third bytes variable -> 32bytes calldata.extend(H256::from_low_u64_be(32).as_bytes()); calldata.extend(H256::zero().as_bytes()); diff --git a/crates/networking/rpc/eth/transaction.rs b/crates/networking/rpc/eth/transaction.rs index d19b4c023..1a0744c65 100644 --- a/crates/networking/rpc/eth/transaction.rs +++ b/crates/networking/rpc/eth/transaction.rs @@ -474,6 +474,7 @@ impl RpcHandler for EstimateGasRequest { // Prepare binary search let mut highest_gas_limit = match transaction.gas { + Some(0) => block_header.gas_limit, Some(gas) => gas.min(block_header.gas_limit), None => block_header.gas_limit, }; @@ -539,7 +540,12 @@ fn recap_with_account_balances( .unwrap_or_default(); let account_gas = account_balance.saturating_sub(transaction.value) / U256::from(transaction.gas_price); - Ok(highest_gas_limit.min(account_gas.as_u64())) + let account_gas = if account_gas > u64::MAX.into() { + u64::MAX + } else { + account_gas.as_u64() + }; + Ok(highest_gas_limit.min(account_gas)) } fn simulate_tx(