Skip to content

Commit

Permalink
chore: minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
merklefruit committed Feb 25, 2024
1 parent 46a71eb commit d70c3d8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 0 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ services:
- op-geth
env_file:
- .env
environment:
- RUST_LOG=magi=debug
ports:
- 9200:9200
- "${RPC_PORT}:${RPC_PORT}"
Expand Down
4 changes: 2 additions & 2 deletions docker/start-magi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/derive/stages/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
13 changes: 12 additions & 1 deletion src/l1/blob_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand All @@ -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<u64> {
let mut genesis_timestamp = self.genesis_timestamp.load(Ordering::Relaxed);
let mut seconds_per_slot = self.seconds_per_slot.load(Ordering::Relaxed);
Expand Down Expand Up @@ -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<Vec<BlobSidecar>> {
let base_url = format!("{}/eth/v1/beacon/blob_sidecars", self.config.l1_beacon_url);
let full_url = format!("{}/{}", base_url, slot);
Expand All @@ -173,6 +182,7 @@ impl BlobFetcher {
Ok(blobs)
}

/// Fetch the genesis timestamp from the beacon chain.
async fn fetch_beacon_genesis_timestamp(&self) -> Result<u64> {
let base_url = format!("{}/eth/v1/beacon/genesis", self.config.l1_beacon_url);

Expand All @@ -187,6 +197,7 @@ impl BlobFetcher {
Ok(genesis_time)
}

/// Fetch the beacon chain spec.
async fn fetch_beacon_spec(&self) -> Result<Value> {
let base_url = format!("{}/eth/v1/config/spec", self.config.l1_beacon_url);

Expand Down

0 comments on commit d70c3d8

Please sign in to comment.