Skip to content
Merged
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
10 changes: 8 additions & 2 deletions crates/execution-payload/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,11 @@ where
}

// ensure we still have capacity for this transaction
if cumulative_gas_used.saturating_add(pool_tx.gas_limit()) > block_gas_limit {
if block_gas_limit
< cumulative_gas_used
.checked_add(pool_tx.gas_limit())
.expect("total gas shouldn't overflow")
{
// we can't fit this transaction into the block, so we need to mark it as invalid
// which also removes all dependent transaction from the iterator before we can
// continue
Expand Down Expand Up @@ -662,7 +666,9 @@ where
{
total_fees += U256::from(miner_fee) * U256::from(gas_used);
}
cumulative_gas_used = cumulative_gas_used.saturating_add(gas_used);
cumulative_gas_used = cumulative_gas_used
.checked_add(gas_used)
.expect("total gas shouldn't overflow");
}

PayloadBuildMetrics::record_stage_tx_execution(loop_started.elapsed());
Expand Down
Loading