Skip to content

Commit 3e178cf

Browse files
authored
reject negative profit mempool txs (#701)
## 📝 Summary Reject mempool txs with negative profit. This can happen if our proposer payment tx gets to the mempool and we include it. Instead if anyone wants builder to withdraw eth we should add a list of allowed addresses instead. ## 💡 Motivation and Context <!--- (Optional) Why is this change required? What problem does it solve? Remove this section if not applicable. --> --- ## ✅ I have completed the following steps: * [ ] Run `make lint` * [ ] Run `make test` * [ ] Added tests (if applicable)
1 parent 86f0dcd commit 3e178cf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

crates/rbuilder/src/building/order_commit.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,10 +1216,12 @@ impl<
12161216
let res = self.commit_tx(&tx.tx_with_blobs, space_state)?;
12171217
match res {
12181218
Ok(ok) => {
1219-
let coinbase_profit = if ok.tx_info.coinbase_profit.is_positive() {
1219+
let coinbase_profit = if !ok.tx_info.coinbase_profit.is_negative() {
12201220
ok.tx_info.coinbase_profit.unsigned_abs()
12211221
} else {
1222-
U256::ZERO
1222+
return Ok(Err(OrderErr::NegativeProfit(
1223+
ok.tx_info.coinbase_profit.unsigned_abs(),
1224+
)));
12231225
};
12241226
Ok(Ok(OrderOk {
12251227
coinbase_profit,

0 commit comments

Comments
 (0)