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
4 changes: 4 additions & 0 deletions crates/rbuilder/src/building/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ pub struct BlockBuildingContext {
pub mempool_tx_detector: Arc<MempoolTxsDetector>,
pub faster_finalize: bool,
pub adjustment_fee_payers: ahash::HashSet<Address>,
pub whitelisted_system_recipients: Vec<Address>,
/// Cached from evm_env.block_env.number but as BlockNumber. Avoid conversions all over the code.
block_number: BlockNumber,
}
Expand All @@ -142,6 +143,7 @@ impl BlockBuildingContext {
payload_id: InternalPayloadId,
evm_caching_enable: bool,
faster_finalize: bool,
whitelisted_system_recipients: Vec<Address>,
adjustment_fee_payers: ahash::HashSet<Address>,
) -> Option<BlockBuildingContext> {
let attributes = EthPayloadBuilderAttributes::try_new(
Expand Down Expand Up @@ -216,6 +218,7 @@ impl BlockBuildingContext {
max_blob_gas_per_block,
mempool_tx_detector: Arc::new(MempoolTxsDetector::new()),
faster_finalize,
whitelisted_system_recipients,
adjustment_fee_payers,
block_number,
})
Expand Down Expand Up @@ -321,6 +324,7 @@ impl BlockBuildingContext {
max_blob_gas_per_block,
mempool_tx_detector: Arc::new(MempoolTxsDetector::new()),
faster_finalize: true,
whitelisted_system_recipients: Default::default(),
adjustment_fee_payers: Default::default(),
block_number,
}
Expand Down
7 changes: 7 additions & 0 deletions crates/rbuilder/src/building/order_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,13 @@ impl<
Ok(ok) => {
let coinbase_profit = if !ok.tx_info.coinbase_profit.is_negative() {
ok.tx_info.coinbase_profit.unsigned_abs()
} else if tx.tx_with_blobs.signer() == self.ctx.builder_signer.address
&& tx.tx_with_blobs.to().is_some_and(|to| {
self.ctx.whitelisted_system_recipients.contains(&to)
})
{
// This is a system transaction which should not be counted towards the block profit.
U256::ZERO
} else {
return Ok(Err(OrderErr::NegativeProfit(
ok.tx_info.coinbase_profit.unsigned_abs(),
Expand Down
1 change: 1 addition & 0 deletions crates/rbuilder/src/building/testing/test_chain_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ impl TestBlockContextBuilder {
true,
true,
Default::default(),
Default::default(),
)
.unwrap()
}
Expand Down
5 changes: 5 additions & 0 deletions crates/rbuilder/src/live_builder/base_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ pub struct BaseConfig {
/// See [OrderPool::time_to_keep_mempool_txs]
pub time_to_keep_mempool_txs_secs: u64,

/// The array of senders incoming transactions from which will not be counted towards the coinbase profit.
pub whitelisted_system_recipients: Vec<Address>,

// backtest config
backtest_fetch_mempool_data_dir: EnvOrValue<String>,
pub backtest_fetch_eth_rpc_url: String,
Expand Down Expand Up @@ -220,6 +223,7 @@ impl BaseConfig {
coinbase_signer: self.coinbase_signer()?,
extra_data: self.extra_data.clone(),
blocklist_provider,
whitelisted_system_recipients: self.whitelisted_system_recipients.clone(),

global_cancellation: cancellation_token,

Expand Down Expand Up @@ -495,6 +499,7 @@ impl Default for BaseConfig {
evm_caching_enable: false,
faster_finalize: false,
time_to_keep_mempool_txs_secs: DEFAULT_TIME_TO_KEEP_MEMPOOL_TXS_SECS,
whitelisted_system_recipients: Vec::new(),
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions crates/rbuilder/src/live_builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ where
pub evm_caching_enable: bool,
pub faster_finalize: bool,
pub simulation_use_random_coinbase: bool,

pub whitelisted_system_recipients: Vec<Address>,
}

impl<P> LiveBuilder<P>
Expand Down Expand Up @@ -304,6 +306,7 @@ where
payload.payload_id,
self.evm_caching_enable,
self.faster_finalize,
self.whitelisted_system_recipients.clone(),
payload
.relay_registrations
.iter()
Expand Down
Loading