From 20dc2f3ab56d8725ba37bcfcb6b9857ccaad77ca Mon Sep 17 00:00:00 2001 From: dylan Date: Thu, 18 Dec 2025 20:38:15 -0700 Subject: [PATCH 1/5] fix: update to eip 7954 blob handling --- src/tasks/submit/flashbots.rs | 14 ++++++++------ src/tasks/submit/prep.rs | 19 ++++++++++--------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/tasks/submit/flashbots.rs b/src/tasks/submit/flashbots.rs index 70e5744..51b7aee 100644 --- a/src/tasks/submit/flashbots.rs +++ b/src/tasks/submit/flashbots.rs @@ -6,16 +6,19 @@ use crate::{ tasks::{block::sim::SimResult, submit::SubmitPrep}, }; use alloy::{ - eips::Encodable2718, + consensus::{EthereumTxEnvelope, TxEip4844Variant}, + eips::{Encodable2718, eip7594::BlobTransactionSidecarEip7594}, primitives::{Bytes, TxHash}, providers::ext::MevApi, rpc::types::mev::EthSendBundle, }; -use eyre::OptionExt; use init4_bin_base::{deps::metrics::counter, utils::signer::LocalOrAws}; use tokio::{sync::mpsc, task::JoinHandle}; use tracing::{Instrument, debug, debug_span, error, instrument}; +/// Type alias for a EIP 7594 compatible blob sidecar transaction envelope. +type SubmitEnvelope7594 = EthereumTxEnvelope>; + /// Handles preparation and submission of simulated rollup blocks to the /// Flashbots relay as MEV bundles. #[derive(Debug)] @@ -84,7 +87,6 @@ impl FlashbotsTask { let txs = self.build_bundle_body(sim_result, tx_bytes); // Create the MEV bundle (valid only in the specific host block) - Ok(EthSendBundle { txs, block_number: sim_result.host_block_number(), @@ -100,7 +102,7 @@ impl FlashbotsTask { async fn prepare_signed_transaction( &self, sim_result: &SimResult, - ) -> eyre::Result { + ) -> eyre::Result { let prep = SubmitPrep::new( &sim_result.block, self.host_provider(), @@ -115,14 +117,14 @@ impl FlashbotsTask { .instrument(tracing::debug_span!("fill_tx").or_current()) .await?; - sendable.as_envelope().ok_or_eyre("failed to get envelope from filled tx").cloned() + sendable.try_into_envelope()?.try_into_7594().map_err(|e| eyre::eyre!(format!("{e:?}"))) } /// Tracks the outbound transaction hash and increments submission metrics. /// /// Sends the transaction hash to the outbound channel for monitoring. /// Logs a debug message if the channel is closed. - fn track_outbound_tx(&self, envelope: &alloy::consensus::TxEnvelope) { + fn track_outbound_tx(&self, envelope: &SubmitEnvelope7594) { counter!("signet.builder.flashbots.").increment(1); let hash = *envelope.tx_hash(); if self.outbound.send(hash).is_err() { diff --git a/src/tasks/submit/prep.rs b/src/tasks/submit/prep.rs index 4be2941..9d48c64 100644 --- a/src/tasks/submit/prep.rs +++ b/src/tasks/submit/prep.rs @@ -4,7 +4,7 @@ use crate::{ utils, }; use alloy::{ - consensus::{Header, SimpleCoder}, + consensus::{BlobTransactionSidecar, Header, SimpleCoder}, network::{TransactionBuilder, TransactionBuilder4844}, primitives::{B256, Bytes, U256}, providers::{Provider, WalletProvider}, @@ -92,8 +92,8 @@ impl<'a> SubmitPrep<'a> { self.quincey_resp().await.map(|resp| &resp.sig).map(utils::extract_signature_components) } - /// Encodes the sidecar and then builds the 4844 blob transaction from the provided header and signature values. - async fn build_blob_tx(&self) -> eyre::Result { + /// Build the sidecar and input data for the transaction. + async fn build_sidecar_and_data(&self) -> eyre::Result<(BlobTransactionSidecar, Vec)> { let (v, r, s) = self.quincey_signature().await?; let header = Zenith::BlockHeader { @@ -106,22 +106,23 @@ impl<'a> SubmitPrep<'a> { debug!(?header.hostBlockNumber, "built zenith block header"); let data = Zenith::submitBlockCall { header, v, r, s, _4: Bytes::new() }.abi_encode(); - let sidecar = self.block.encode_blob::().build()?; - Ok(TransactionRequest::default().with_blob_sidecar(sidecar).with_input(data)) + Ok((sidecar, data)) } + /// Create a new transaction request for the host chain. async fn new_tx_request(&self) -> eyre::Result { let nonce = self.provider.get_transaction_count(self.provider.default_signer_address()).await?; debug!(nonce, "assigned nonce to rollup block transaction"); - // Create a blob transaction with the blob header and signature values and return it - let tx = self - .build_blob_tx() - .await? + let (sidecar, data) = self.build_sidecar_and_data().await?; + + let tx = TransactionRequest::default() + .with_blob_sidecar(sidecar) + .with_input(data) .with_to(self.config.constants.host_zenith()) .with_nonce(nonce); From b21f4b92cac17a60785b764a627265786b45a799 Mon Sep 17 00:00:00 2001 From: dylan Date: Thu, 18 Dec 2025 21:32:47 -0700 Subject: [PATCH 2/5] logs --- src/tasks/submit/flashbots.rs | 9 ++++++++- src/tasks/submit/prep.rs | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/tasks/submit/flashbots.rs b/src/tasks/submit/flashbots.rs index 51b7aee..935dfc5 100644 --- a/src/tasks/submit/flashbots.rs +++ b/src/tasks/submit/flashbots.rs @@ -116,8 +116,15 @@ impl FlashbotsTask { .fill(tx.into_request()) .instrument(tracing::debug_span!("fill_tx").or_current()) .await?; + debug!(?sendable, "prepared signed rollup block transaction"); - sendable.try_into_envelope()?.try_into_7594().map_err(|e| eyre::eyre!(format!("{e:?}"))) + let tx_envelope = sendable + .try_into_envelope()? + .try_into_7594() + .map_err(|e| eyre::eyre!(format!("{e:?}")))?; + debug!(?tx_envelope, "prepared signed rollup block transaction envelope"); + + Ok(tx_envelope) } /// Tracks the outbound transaction hash and increments submission metrics. diff --git a/src/tasks/submit/prep.rs b/src/tasks/submit/prep.rs index 9d48c64..92a80d3 100644 --- a/src/tasks/submit/prep.rs +++ b/src/tasks/submit/prep.rs @@ -12,6 +12,7 @@ use alloy::{ sol_types::SolCall, }; use init4_bin_base::deps::metrics::counter; +use serde::de; use signet_sim::BuiltBlock; use signet_types::{SignRequest, SignResponse}; use signet_zenith::Zenith; @@ -115,16 +116,15 @@ impl<'a> SubmitPrep<'a> { async fn new_tx_request(&self) -> eyre::Result { let nonce = self.provider.get_transaction_count(self.provider.default_signer_address()).await?; - debug!(nonce, "assigned nonce to rollup block transaction"); let (sidecar, data) = self.build_sidecar_and_data().await?; - let tx = TransactionRequest::default() .with_blob_sidecar(sidecar) .with_input(data) .with_to(self.config.constants.host_zenith()) .with_nonce(nonce); + debug!(?tx, "constructed rollup block transaction request"); Ok(tx) } From acd3782ee250948ebda193612ce4c5d69e251790 Mon Sep 17 00:00:00 2001 From: dylan Date: Thu, 18 Dec 2025 21:43:57 -0700 Subject: [PATCH 3/5] moar logs --- src/tasks/submit/flashbots.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tasks/submit/flashbots.rs b/src/tasks/submit/flashbots.rs index 935dfc5..3653969 100644 --- a/src/tasks/submit/flashbots.rs +++ b/src/tasks/submit/flashbots.rs @@ -121,7 +121,7 @@ impl FlashbotsTask { let tx_envelope = sendable .try_into_envelope()? .try_into_7594() - .map_err(|e| eyre::eyre!(format!("{e:?}")))?; + .map_err(|e| eyre::eyre!("failed to map 4844 to 7594: {e:?}"))?; debug!(?tx_envelope, "prepared signed rollup block transaction envelope"); Ok(tx_envelope) From 9982dac1af731a753c8cbba0d64fc062da75c2ac Mon Sep 17 00:00:00 2001 From: dylan Date: Thu, 18 Dec 2025 23:11:53 -0700 Subject: [PATCH 4/5] clippy --- src/tasks/submit/prep.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tasks/submit/prep.rs b/src/tasks/submit/prep.rs index 92a80d3..ecc2abf 100644 --- a/src/tasks/submit/prep.rs +++ b/src/tasks/submit/prep.rs @@ -12,7 +12,6 @@ use alloy::{ sol_types::SolCall, }; use init4_bin_base::deps::metrics::counter; -use serde::de; use signet_sim::BuiltBlock; use signet_types::{SignRequest, SignResponse}; use signet_zenith::Zenith; From 99c409ef04e28c8ab850abd63c6b31c31768d5a6 Mon Sep 17 00:00:00 2001 From: dylan Date: Fri, 19 Dec 2025 11:56:48 -0700 Subject: [PATCH 5/5] deps: unpin and update alloy to 1.0.40 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d89fef3..e6ab9eb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -97,9 +97,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy" -version = "1.0.35" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d8f4cc1a6f6e5d3adf05f93123932bfd5168078a556d90dd9897bc0a75dee24" +checksum = "f07655fedc35188f3c50ff8fc6ee45703ae14ef1bc7ae7d80e23a747012184e3" dependencies = [ "alloy-consensus", "alloy-contract", diff --git a/Cargo.toml b/Cargo.toml index e36b70c..0465148 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ signet-genesis = { git = "https://github.com/init4tech/node-components", tag = " trevm = { version = "0.31.2", features = ["concurrent-db", "test-utils"] } -alloy = { version = "=1.0.35", features = [ +alloy = { version = "1.0.40", features = [ "full", "json-rpc", "signer-aws",