From d70c3d8534ff6ffee537b2749efb341f277fa969 Mon Sep 17 00:00:00 2001 From: nicolas <48695862+merklefruit@users.noreply.github.com> Date: Sun, 25 Feb 2024 19:20:19 +0100 Subject: [PATCH] chore: minor cleanup --- docker/docker-compose.yml | 2 -- docker/start-magi.sh | 4 ++-- src/derive/stages/attributes.rs | 2 +- src/l1/blob_fetcher.rs | 13 ++++++++++++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 8d1e89bf..2b63ac63 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -23,8 +23,6 @@ services: - op-geth env_file: - .env - environment: - - RUST_LOG=magi=debug ports: - 9200:9200 - "${RPC_PORT}:${RPC_PORT}" diff --git a/docker/start-magi.sh b/docker/start-magi.sh index d8d66a09..4b7d5c01 100755 --- a/docker/start-magi.sh +++ b/docker/start-magi.sh @@ -19,8 +19,8 @@ then --jwt-secret $JWT_SECRET \ --l1-rpc-url $L1_RPC_URL \ --l1-beacon-url $L1_BEACON_RPC_URL \ - --l2-rpc-url http://${EXECUTION_CLIENT}:8565 \ - --l2-engine-url http://${EXECUTION_CLIENT}:8561 \ + --l2-rpc-url http://${EXECUTION_CLIENT}:8545 \ + --l2-engine-url http://${EXECUTION_CLIENT}:8551 \ --rpc-port $RPC_PORT \ $DEVNET \ --sync-mode $SYNC_MODE diff --git a/src/derive/stages/attributes.rs b/src/derive/stages/attributes.rs index c05b6095..2ca8f978 100644 --- a/src/derive/stages/attributes.rs +++ b/src/derive/stages/attributes.rs @@ -137,7 +137,7 @@ impl Attributes { .chain .is_ecotone_activation_block(input.timestamp) { - tracing::debug!("found Ecotone activation block; Upgrade transactions added"); + tracing::info!("found Ecotone activation block; Upgrade transactions added"); let mut ecotone_upgrade_txs = get_ecotone_upgrade_transactions(); transactions.append(&mut ecotone_upgrade_txs); } diff --git a/src/l1/blob_fetcher.rs b/src/l1/blob_fetcher.rs index b0aa59ea..aea8ffbe 100644 --- a/src/l1/blob_fetcher.rs +++ b/src/l1/blob_fetcher.rs @@ -12,6 +12,8 @@ use serde_json::Value; use super::decode_blob_data; use crate::config::Config; +/// The transaction type used to identify transactions that carry blobs +/// according to EIP 4844. const BLOB_CARRYING_TRANSACTION_TYPE: u64 = 3; /// The data contained in a batcher transaction. @@ -117,6 +119,7 @@ impl BlobFetcher { Ok(batcher_transactions_data) } + /// Check if a transaction was sent from the batch sender to the batch inbox. #[inline] fn is_valid_batcher_transaction(&self, tx: &Transaction) -> bool { let batch_sender = self.config.chain.system_config.batch_sender; @@ -125,7 +128,12 @@ impl BlobFetcher { tx.from == batch_sender && tx.to.map(|to| to == batch_inbox).unwrap_or(false) } - #[inline] + /// Given a timestamp, return the slot number at which the timestamp + /// was included in the beacon chain. + /// + /// This method uses a cached genesis timestamp and seconds per slot + /// value to calculate the slot number. If the cache is empty, it fetches + /// the required data from the beacon RPC. async fn get_slot_from_time(&self, time: u64) -> Result { let mut genesis_timestamp = self.genesis_timestamp.load(Ordering::Relaxed); let mut seconds_per_slot = self.seconds_per_slot.load(Ordering::Relaxed); @@ -160,6 +168,7 @@ impl BlobFetcher { Ok((time - genesis_timestamp) / seconds_per_slot) } + /// Fetch the blob sidecars for a given slot. async fn fetch_blob_sidecars(&self, slot: u64) -> Result> { let base_url = format!("{}/eth/v1/beacon/blob_sidecars", self.config.l1_beacon_url); let full_url = format!("{}/{}", base_url, slot); @@ -173,6 +182,7 @@ impl BlobFetcher { Ok(blobs) } + /// Fetch the genesis timestamp from the beacon chain. async fn fetch_beacon_genesis_timestamp(&self) -> Result { let base_url = format!("{}/eth/v1/beacon/genesis", self.config.l1_beacon_url); @@ -187,6 +197,7 @@ impl BlobFetcher { Ok(genesis_time) } + /// Fetch the beacon chain spec. async fn fetch_beacon_spec(&self) -> Result { let base_url = format!("{}/eth/v1/config/spec", self.config.l1_beacon_url);