Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion crates/op-rbuilder/src/primitives/bundle.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use alloy_primitives::Bytes;
use alloy_primitives::{Bytes, B256};
use alloy_rpc_types_eth::erc4337::TransactionConditional;
use serde::{Deserialize, Serialize};

Expand All @@ -24,3 +24,9 @@ impl Bundle {
}
}
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct BundleResult {
#[serde(rename = "bundleHash")]
pub bundle_hash: B256,
}
10 changes: 5 additions & 5 deletions crates/op-rbuilder/src/revert_protection.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::{
primitives::bundle::{Bundle, MAX_BLOCK_RANGE_BLOCKS},
primitives::bundle::{Bundle, BundleResult, MAX_BLOCK_RANGE_BLOCKS},
tx::{FBPooledTransaction, MaybeRevertingTransaction},
};
use alloy_primitives::B256;
use jsonrpsee::{
core::{async_trait, RpcResult},
proc_macros::rpc,
Expand All @@ -17,7 +16,7 @@ use reth_transaction_pool::{PoolTransaction, TransactionOrigin, TransactionPool}
#[cfg_attr(test, rpc(server, client, namespace = "eth"))]
pub trait EthApiOverride {
#[method(name = "sendBundle")]
async fn send_bundle(&self, tx: Bundle) -> RpcResult<B256>;
async fn send_bundle(&self, tx: Bundle) -> RpcResult<BundleResult>;
}

pub struct RevertProtectionExt<Pool, Provider> {
Expand All @@ -37,7 +36,7 @@ where
Pool: TransactionPool<Transaction = FBPooledTransaction> + Clone + 'static,
Provider: StateProviderFactory + Send + Sync + Clone + 'static,
{
async fn send_bundle(&self, mut bundle: Bundle) -> RpcResult<B256> {
async fn send_bundle(&self, mut bundle: Bundle) -> RpcResult<BundleResult> {
let last_block_number = self
.provider
.best_block_number()
Expand Down Expand Up @@ -92,6 +91,7 @@ where
.await
.map_err(EthApiError::from)?;

Ok(hash)
let result = BundleResult { bundle_hash: hash };
Ok(result)
}
}
9 changes: 6 additions & 3 deletions crates/op-rbuilder/src/tests/framework/txs.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use crate::{primitives::bundle::Bundle, tx_signer::Signer};
use crate::{
primitives::bundle::{Bundle, BundleResult},
tx_signer::Signer,
};
use alloy_consensus::TxEip1559;
use alloy_eips::{eip2718::Encodable2718, BlockNumberOrTag};
use alloy_primitives::{hex, Bytes};
Expand Down Expand Up @@ -154,14 +157,14 @@ impl TransactionBuilder {
block_number_max: bundle_opts.block_number_max,
};

let tx_hash = provider
let result: BundleResult = provider
.client()
.request("eth_sendBundle", (bundle,))
.await?;

return Ok(PendingTransactionBuilder::new(
provider.root().clone(),
tx_hash,
result.bundle_hash,
));
}

Expand Down
Loading