Skip to content

Commit b9f2668

Browse files
committed
Just pass bytes around
1 parent 4a442f2 commit b9f2668

File tree

2 files changed

+8
-23
lines changed

2 files changed

+8
-23
lines changed

searcher-api-types/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ serde_json = { workspace = true }
1010
alloy-primitives = "0.8"
1111
alloy-rlp = "0.3"
1212
alloy-rpc-types-mev = "0.8"
13-
reth-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "1e965caf5fa176f244a31c0d2662ba1b590938db" } # Reth 1.2
1413
eyre = "0.6.12"

searcher-api-types/src/beaver.rs

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! RPC types that are supported by Beaverbuild
2-
use alloy_primitives::{hex, Address, BlockNumber, TxHash};
3-
use alloy_rlp::Decodable;
4-
use eyre::eyre;
5-
use reth_primitives::TransactionSigned;
2+
use alloy_primitives::{
3+
hex::{self, FromHex},
4+
Address, BlockNumber, Bytes, TxHash,
5+
};
66
use serde::ser::{Serialize, SerializeStruct, Serializer};
77

88
/// Bundle as recognised by Beaverbuild
@@ -12,7 +12,7 @@ use serde::ser::{Serialize, SerializeStruct, Serializer};
1212
#[derive(Clone, Debug, Default)]
1313
pub struct BeaverBundle {
1414
/// List of hex-encoded, raw transactions. Can be empty for cancelling a bundle
15-
pub transactions: Vec<TransactionSigned>,
15+
pub transactions: Vec<Bytes>,
1616
/// The block that this bundle will be valid for. 0 means it's valid for the next block (and only this one)
1717
pub block_number: BlockNumber,
1818
/// If specified and >0, the bundle will only be valid if the block timestamp is greater or equal to `minTimestamp`
@@ -38,15 +38,8 @@ impl BeaverBundle {
3838
Ok(Self {
3939
transactions: txs
4040
.iter()
41-
.map(|hex_string| {
42-
hex::decode(hex_string)
43-
.map_err(|e| eyre!("Invalid hexadecimal string: {e:?}"))
44-
.and_then(|decoded_bytes| {
45-
TransactionSigned::decode(&mut decoded_bytes.as_slice())
46-
.map_err(|e| eyre!("Illegal RLP bytes for transaction: {e:?}"))
47-
})
48-
})
49-
.collect::<Result<Vec<TransactionSigned>, _>>()?,
41+
.map(|hex_string| Bytes::from_hex(hex_string))
42+
.collect::<Result<Vec<Bytes>, _>>()?,
5043
block_number,
5144
..Self::default()
5245
})
@@ -59,14 +52,7 @@ impl Serialize for BeaverBundle {
5952
S: Serializer,
6053
{
6154
let mut state = serializer.serialize_struct("BeaverBundle", 2)?;
62-
state.serialize_field(
63-
"txs",
64-
&self
65-
.transactions
66-
.iter()
67-
.map(|tx| hex::encode(alloy_rlp::encode(tx)))
68-
.collect::<Vec<String>>(),
69-
)?;
55+
state.serialize_field("txs", &self.transactions)?;
7056
state.serialize_field("blockNumber", &format!("0x{:x}", self.block_number))?;
7157

7258
if let Some(ref t) = self.min_timestamp {

0 commit comments

Comments
 (0)