Skip to content

Commit

Permalink
Revert "[Easy] Set max gas_limit for a settlement at 1/2 block gas li…
Browse files Browse the repository at this point in the history
…mit (#2526)"

This reverts commit 8b6bc89.
  • Loading branch information
mfw78 committed Mar 20, 2024
1 parent 8b6bc89 commit e76978c
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions crates/driver/src/domain/competition/solution/settlement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,21 +418,16 @@ impl Gas {
eth::U256::from_f64_lossy(eth::U256::to_f64_lossy(estimate.into()) * GAS_LIMIT_FACTOR)
.into();

// We don't allow for solutions to take up more than half of the block's gas
// limit. This is to ensure that block producers attempt to include the
// settlement transaction in the next block as long as it is reasonably
// priced. If we were to allow for solutions very close to the block
// gas limit, validators may discard the settlement transaction unless it is
// paying a very high priority fee. This is because the default block
// building algorithm picks the highest paying transaction whose gas limit
// will not exceed the remaining space in the block next and ignore transactions
// whose gas limit exceed the remaining space (without simulating the actual
// gas required).
let max_gas = eth::Gas(block_limit.0 / 2);
// The block gas limit may fluctuate between blocks (validators trying to
// upvote/downvote the limit), thus add a bit margin to not run into
// GasLimitExceeded errors. The maximum deviation per block is 1/1024 so using
// 1% buffer will make that even with 10 consecutive blocks in which the gas
// limit decreased maximally will not exceed the limit.
let block_limit = eth::Gas(block_limit.0 * 99 / 100);

Self {
estimate,
limit: std::cmp::min(max_gas, estimate_with_buffer),
limit: std::cmp::min(block_limit, estimate_with_buffer),
price,
}
}
Expand Down

0 comments on commit e76978c

Please sign in to comment.