Skip to content

Commit

Permalink
chore(sidecar): refactor excess gas check
Browse files Browse the repository at this point in the history
Co-authored-by: Lorenzo <[email protected]>
  • Loading branch information
namn-grg and thedevbirb authored Jul 19, 2024
1 parent 0a2d652 commit c36b542
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions bolt-sidecar/src/state/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,14 @@ impl<C: StateFetcher> ExecutionState<C> {
self.slot,
self.max_committed_gas_per_slot.get(),
));
}
} else if req.tx.gas_limit() >= self.max_committed_gas_per_slot.get() {
// Check if the committed gas limit itself exceeds the maximum when template is None
// Check if the committed gas exceeds the maximum
let template_committed_gas = self.get_block_template(target_slot).map(|t| t.committed_gas()).unwrap_or(0);
if template_committed_gas + req.tx.gas_limit() >= self.max_committed_gas_per_slot.get() {
return Err(ValidationError::MaxCommittedGasReachedForSlot(
self.slot,
self.max_committed_gas_per_slot.get(),
));
}

// Check if the transaction size exceeds the maximum
if req.tx.size() > self.validation_params.max_tx_input_bytes {
return Err(ValidationError::TransactionSizeTooHigh);
Expand Down

0 comments on commit c36b542

Please sign in to comment.