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
3 changes: 2 additions & 1 deletion crates/rbuilder-operator/src/blocks_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ impl<HttpClientType: ClientT> BlocksProcessorClient<HttpClientType> {
eth_send_to_coinbase: U256::ZERO,
total_gas_used: res.inplace_sim.gas_used(),
original_bundle: encode_bundle_for_blocks_processor(bundle.clone()),
bundle_hash: bundle.hash,
bundle_hash: bundle.external_hash.unwrap_or(bundle.hash),
})
} else {
None
Expand Down Expand Up @@ -457,6 +457,7 @@ mod tests {
refund_recipient: None,
refund_tx_hashes: None,
delayed_refund: None,
bundle_hash: None,
},
txs: Vec::new(),
},
Expand Down
3 changes: 3 additions & 0 deletions crates/rbuilder-primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ pub struct Bundle {

/// Bundle refund data.
pub refund: Option<BundleRefund>,

/// Unique identifier for a bundle that was set by the sender of the bundle
pub external_hash: Option<B256>,
}

impl Bundle {
Expand Down
1 change: 1 addition & 0 deletions crates/rbuilder-primitives/src/order_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ impl BundleBuilder {
dropping_tx_hashes,
refund: self.refund,
version: LAST_BUNDLE_VERSION,
external_hash: None,
};
bundle.hash_slow();
bundle
Expand Down
5 changes: 5 additions & 0 deletions crates/rbuilder-primitives/src/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ pub struct RawBundleMetadata {
/// delayedRefund (Optional) `Boolean`, A flag indicating whether the refund should be delayed.
#[serde(skip_serializing_if = "Option::is_none")]
pub delayed_refund: Option<bool>,
/// bundleHash, externally set unique identifier for the bundle
#[serde(skip_serializing_if = "Option::is_none")]
pub bundle_hash: Option<B256>,
}

impl RawBundleMetadata {
Expand Down Expand Up @@ -381,6 +384,7 @@ impl RawBundle {
dropping_tx_hashes: metadata.dropping_tx_hashes,
refund,
version,
external_hash: metadata.bundle_hash,
};
bundle.hash_slow();
Ok(RawBundleDecodeResult::NewBundle(bundle))
Expand Down Expand Up @@ -418,6 +422,7 @@ impl RawBundle {
refund_tx_hashes: value.refund.as_ref().map(|br| vec![br.tx_hash]),
delayed_refund: value.refund.as_ref().map(|br| br.delayed),
version: Some(Self::encode_version(value.version)),
bundle_hash: value.external_hash,
},
}
}
Expand Down
2 changes: 2 additions & 0 deletions crates/rbuilder-primitives/src/test_data_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ impl TestDataGenerator {
dropping_tx_hashes: vec![],
refund: None,
version: LAST_BUNDLE_VERSION,
external_hash: None,
};
res.hash_slow();
res
Expand Down Expand Up @@ -166,6 +167,7 @@ impl TestDataGenerator {
dropping_tx_hashes: Default::default(),
refund: None,
version: LAST_BUNDLE_VERSION,
external_hash: None,
};
bundle.hash_slow();
bundle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ impl<ConfigType: LiveBuilderConfig> SyntheticOrdersSource<ConfigType> {
dropping_tx_hashes: Default::default(),
refund: None,
version: LAST_BUNDLE_VERSION,
external_hash: None,
};
bundle.hash_slow();
orders.push(OrdersWithTimestamp {
Expand Down
2 changes: 1 addition & 1 deletion crates/rbuilder/src/backtest/redistribute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ fn split_orders_by_identities(
for order in &block_data.available_orders {
let id = order.order.id();
if let Order::Bundle(bundle) = &order.order {
bundle_hash_by_id.insert(id, bundle.hash);
bundle_hash_by_id.insert(id, bundle.external_hash.unwrap_or(bundle.hash));
};
order_sender_by_id.insert(id, order_sender(&order.order));
let address = match order_redistribution_address(&order.order, protect_signers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ mod tests {
refund: Default::default(),
refund_identity: None,
version: LAST_BUNDLE_VERSION,
external_hash: None,
});
let expected = SimplifiedOrder::new(
OrderId::Bundle(uuid::uuid!("00000000-0000-0000-0000-ffff00000002")),
Expand Down Expand Up @@ -1004,6 +1005,7 @@ mod tests {
}),
refund_identity: None,
version: LAST_BUNDLE_VERSION,
external_hash: None,
});
let expected = SimplifiedOrder::new(
OrderId::Bundle(uuid::uuid!("00000000-0000-0000-0000-ffff00000002")),
Expand Down
1 change: 1 addition & 0 deletions crates/rbuilder/src/backtest/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ mod test {
delayed_refund: None,
refund_identity: None,
version: Some(RawBundle::encode_version(LAST_BUNDLE_VERSION)),
bundle_hash: None,
},
})),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ mod tests {
refund: None,
refund_identity: None,
version: LAST_BUNDLE_VERSION,
external_hash: None,
};

Arc::new(SimulatedOrder {
Expand Down
4 changes: 4 additions & 0 deletions crates/rbuilder/src/live_builder/order_input/rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ async fn handle_eth_send_bundle(
}
};

if raw_bundle.metadata.bundle_hash.is_none() {
warn!("Bundle hash is not set");
}

let bundle_res = match raw_bundle.decode(TxEncoding::WithBlobData) {
Ok(bundle_res) => bundle_res,
Err(err) => {
Expand Down
Loading