# Should builder block submissions set a different gas limit than what proposer specified?

**URL:** https://collective.flashbots.net/t/should-builder-block-submissions-set-a-different-gas-limit-than-what-proposer-specified/2414
**Category:** Block Builders
**Tags:** brainstorming, question
**Created:** [September 18, 2023, 9:47pm UTC](https://collective.flashbots.net/t/should-builder-block-submissions-set-a-different-gas-limit-than-what-proposer-specified/2414 "2023-09-18T21:47:20Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![wasif](https://collective.flashbots.net/letter_avatar_proxy/v4/letter/w/ebca7d/32.png) [@wasif](https://collective.flashbots.net/u/wasif)
#### Post date: [September 18, 2023, 9:47pm UTC](https://collective.flashbots.net/t/should-builder-block-submissions-set-a-different-gas-limit-than-what-proposer-specified/2414/1 "2023-09-18T21:47:20Z")

</div>

**Should builder block submissions set a different gas limit than what proposer specified?**

## Context

- When Flashbots builder builds a block, it adheres strictly to proposer gas limit when setting the header for the built block.
  - For example, if on registration a proposer sets gas limit to `30_000_000`, Flashbots builder will set header gas limit to `30_000_000` for its built block.

- Strict adherence to proposer gas limit is problematic. If the proposer’s gas limit exceeds what’s allowed by the protocol, relays will reject the builders block.
  - For example, consider when a parent block has gas limit of `29_900_000`. The protocol would only allow child block gas limit up to `29_929_199`. If the proposer’s gas limit of `30_000_000` is used, builder block gets rejected

## Proposal

- Rather than strict adherence to proposer gas limit, we’d like to explore a “best-effort” approach where Flashbots builder attempts to **move towards** proposer’s gas limit while staying within protocol limits.
  - For example if proposer has gas limit of `30_000_000` and protocol allows up to `29_929_199`, builder would submit block with gas limit set to `29_929_199` instead of `30_000_000`

## Question

- **Should builder block submissions set a different gas limit than what proposer specified? Are there downsides or implications with this approach?**

We would appreciate feedback from the community on this proposal, and encourage all to voice their questions and concerns! Please let us know your thoughts - we’d like to make a decision in a week assuming there are no significant concerns.

![px](https://collective.flashbots.net/uploads/default/original/2X/c/ca60e38032b234ad59a56965fe98b2abf584da78.png)

---

<div class="post-metadata">

### Author: ![CalabashSquash](https://collective.flashbots.net/letter_avatar_proxy/v4/letter/c/9fc29f/32.png) [@CalabashSquash](https://collective.flashbots.net/u/CalabashSquash)
#### Post date: [September 18, 2023, 10:59pm UTC](https://collective.flashbots.net/t/should-builder-block-submissions-set-a-different-gas-limit-than-what-proposer-specified/2414/2 "2023-09-18T22:59:16Z")

</div>

For my own context: Do proposers often specify gas limits that are outside of protocol limits?

---

<div class="post-metadata">

### Author: ![ra](https://collective.flashbots.net/letter_avatar_proxy/v4/letter/r/5fc32e/32.png) [@ra](https://collective.flashbots.net/u/ra)
#### Post date: [September 19, 2023, 6:53am UTC](https://collective.flashbots.net/t/should-builder-block-submissions-set-a-different-gas-limit-than-what-proposer-specified/2414/3 "2023-09-19T06:53:58Z")

</div>

Some dump questions: Isn’t the block gas limit hardcoded in the protocol to 30 M gas? If not, why would a proposer lower it, and why would that affect a subsequent block?

---

<div class="post-metadata">

### Author: ![wasif](https://collective.flashbots.net/letter_avatar_proxy/v4/letter/w/ebca7d/32.png) [@wasif](https://collective.flashbots.net/u/wasif)
#### Post date: [September 19, 2023, 4:36pm UTC](https://collective.flashbots.net/t/should-builder-block-submissions-set-a-different-gas-limit-than-what-proposer-specified/2414/4 "2023-09-19T16:36:43Z")

</div>

> [@CalabashSquash](#):
>
> For my own context: Do proposers often specify gas limits that are outside of protocol limits?

Good question - in my experience, the proposer does not often change the default gas limit, which is typically set to `30_000_000`.

However, anecdotally I have observed a greater proportion of parent blocks with a different gas limit. There can be many reasons why, but one possibility is that other block builders are proposing blocks with a different gas limit than what the proposer set, causing greater fluctuations that lead to proposer’s gas limit being rejected from exceeding allowed limits.

---

<div class="post-metadata">

### Author: ![wasif](https://collective.flashbots.net/letter_avatar_proxy/v4/letter/w/ebca7d/32.png) [@wasif](https://collective.flashbots.net/u/wasif)
#### Post date: [September 19, 2023, 5:19pm UTC](https://collective.flashbots.net/t/should-builder-block-submissions-set-a-different-gas-limit-than-what-proposer-specified/2414/5 "2023-09-19T17:19:17Z")

</div>

> [@ra](#):
>
> Isn’t the block gas limit hardcoded in the protocol to 30 M gas

By default, proposers will use the hardcoded default of 30M for block gas limit.

However, the _target gas limit_ for a new block will follow a set of rules in order to ensure there isn’t large divergence in gas between blocks. The allowed or _target_ gas limit is based a few factors, including the parent’s gas limit, and the _desired_ gas limit, where the _desired_ gas limit is the proposer’s value.

> [@ra](#):
>
> If not, why would a proposer lower it, and why would that affect a subsequent block?

In my experience it isn’t the proposer that changes this value. What tends to happen is that the Flashbots builder creates a new block with a given parent block. The parent block has a specified gas limit set. The in-protocol rules restrict how much the gas limit for a new block can diverge from the parent block gas limit. If the proposer’s desired gas limit exceeds this boundary, a block built with their desired gas limit is rejected.

There can be numerous reasons why the parent block gas limit would be different, one hypothesis is described [here](https://collective.flashbots.net/t/should-builder-block-submissions-set-a-different-gas-limit-than-what-proposer-specified/2414/4)

tl;dr

- hardcoded default is 30M, but per-block limit is dynamic based on protocol rules
- proposers don’t typically change this value, but a parent block’s gas limit affects tolerable gas limits for child block
- we observe many parent blocks with values that cause rejection of child blocks that use proposer’s hardcoded value

---

<div class="post-metadata">

### Author: ![wasif](https://collective.flashbots.net/letter_avatar_proxy/v4/letter/w/ebca7d/32.png) [@wasif](https://collective.flashbots.net/u/wasif)
#### Post date: [September 19, 2023, 10:19pm UTC](https://collective.flashbots.net/t/should-builder-block-submissions-set-a-different-gas-limit-than-what-proposer-specified/2414/6 "2023-09-19T22:19:16Z")

</div>

Please note that I have updated the original post to request feedback within a week.

We have observed that competitive builders have already implemented the logic described in this proposal, and Flashbots builder suffers from a large number of rejected blocks without this change.

We encourage the community to voice feedback and concerns. If there are no significant concerns we’d like to reach a decision soon. Thank you!

---

<div class="post-metadata">

### Author: ![riposte](https://collective.flashbots.net/letter_avatar_proxy/v4/letter/r/2acd7d/32.png) [@riposte](https://collective.flashbots.net/u/riposte)
#### Post date: [September 23, 2023, 3:51pm UTC](https://collective.flashbots.net/t/should-builder-block-submissions-set-a-different-gas-limit-than-what-proposer-specified/2414/7 "2023-09-23T15:51:02Z")

</div>

I don’t think this is correct. I looked through your builder code - the validator’s gas limit gets passed to the miner.worker who uses it as a target (rather than setting directly)

---

<div class="post-metadata">

### Author: ![wasif](https://collective.flashbots.net/letter_avatar_proxy/v4/letter/w/ebca7d/32.png) [@wasif](https://collective.flashbots.net/u/wasif)
#### Post date: [September 23, 2023, 9:16pm UTC](https://collective.flashbots.net/t/should-builder-block-submissions-set-a-different-gas-limit-than-what-proposer-specified/2414/8 "2023-09-23T21:16:53Z")

</div>

The validator’s gas limit getting passed is exactly what I’m saying. That’s the problem. We don’t change it, and block gets rejected. I am quite confident because I have both verified and tested changing this behavior.

---

<div class="post-metadata">

### Author: ![riposte](https://collective.flashbots.net/letter_avatar_proxy/v4/letter/r/2acd7d/32.png) [@riposte](https://collective.flashbots.net/u/riposte)
#### Post date: [September 24, 2023, 7:08pm UTC](https://collective.flashbots.net/t/should-builder-block-submissions-set-a-different-gas-limit-than-what-proposer-specified/2414/9 "2023-09-24T19:08:16Z")

</div>

Am I tracing it wrong?

I see the validator’s gasLimit being passed through to here: [https://github.com/flashbots/builder/blob/c5985be43d4921798bc9afa3d6f33357f4f6daf6/miner/worker.go#L1234](https://github.com/flashbots/builder/blob/c5985be43d4921798bc9afa3d6f33357f4f6daf6/miner/worker.go#L1234)

CalcGasLimit takes into account the protocol rules and does not produce an invalid gas limit …

---

<div class="post-metadata">

### Author: ![riposte](https://collective.flashbots.net/letter_avatar_proxy/v4/letter/r/2acd7d/32.png) [@riposte](https://collective.flashbots.net/u/riposte)
#### Post date: [September 24, 2023, 7:59pm UTC](https://collective.flashbots.net/t/should-builder-block-submissions-set-a-different-gas-limit-than-what-proposer-specified/2414/10 "2023-09-24T19:59:08Z")

</div>

Should mention that I run a block builder which was ignoring the validator’s gas limit preference completely. Saw some occasional errors from the flashbots relay, so I plumbed the preference through CalcGasLimit, and the validation errors disappeared.

Validation code also seems to agree with this method: [https://github.com/flashbots/builder/blob/c5985be43d4921798bc9afa3d6f33357f4f6daf6/core/blockchain.go#L2518](https://github.com/flashbots/builder/blob/c5985be43d4921798bc9afa3d6f33357f4f6daf6/core/blockchain.go#L2518)

---

<div class="post-metadata">

### Author: ![wasif](https://collective.flashbots.net/letter_avatar_proxy/v4/letter/w/ebca7d/32.png) [@wasif](https://collective.flashbots.net/u/wasif)
#### Post date: [September 24, 2023, 8:35pm UTC](https://collective.flashbots.net/t/should-builder-block-submissions-set-a-different-gas-limit-than-what-proposer-specified/2414/11 "2023-09-24T20:35:02Z")

</div>

> [@riposte](#):
>
> Am I tracing it wrong?

Yes, unfortunately. The code paths are complex, we initially thought the same thing as you in that the calculated gas limit was being passed in. However, you can think of the code path you’re tracing as the “commit path” - where worker “commits” to their block for submission

However, there is a separate path, we can consider it as the “submit” path - in this path, we directly reference the validator’s hardcoded gas limit value and submit with that value to the relay: [builder/builder/builder.go at c5985be43d4921798bc9afa3d6f33357f4f6daf6 · flashbots/builder · GitHub](https://github.com/flashbots/builder/blob/c5985be43d4921798bc9afa3d6f33357f4f6daf6/builder/builder.go#L328)

The problem is that the “commit” path is dependent on the “submit” path - if the submit path fails, you can essentially end up with an “empty” commit path, which would use a valid header but without transactions.

You can see it setting to the hardcoded validator value here: [builder/builder/builder.go at c5985be43d4921798bc9afa3d6f33357f4f6daf6 · flashbots/builder · GitHub](https://github.com/flashbots/builder/blob/c5985be43d4921798bc9afa3d6f33357f4f6daf6/builder/builder.go#L350)

Which gets propagated down the “submit” path

---

<div class="post-metadata">

### Author: ![wasif](https://collective.flashbots.net/letter_avatar_proxy/v4/letter/w/ebca7d/32.png) [@wasif](https://collective.flashbots.net/u/wasif)
#### Post date: [September 24, 2023, 8:41pm UTC](https://collective.flashbots.net/t/should-builder-block-submissions-set-a-different-gas-limit-than-what-proposer-specified/2414/12 "2023-09-24T20:41:02Z")

</div>

> [@riposte](#):
>
> Saw some occasional errors from the flashbots relay, so I plumbed the preference through CalcGasLimit, and the validation errors disappeared.
> 
> Validation code also seems to agree with this method: [builder/core/blockchain.go at c5985be43d4921798bc9afa3d6f33357f4f6daf6 · flashbots/builder · GitHub](https://github.com/flashbots/builder/blob/c5985be43d4921798bc9afa3d6f33357f4f6daf6/core/blockchain.go#L2518)

This pretty much describes my thought process and experience as well - the proposal is suggesting pretty much what you’re doing, and just re-using gas limit calculation from validation code on the “submit” path for builder block submissions.

---

<div class="post-metadata">

### Author: ![riposte](https://collective.flashbots.net/letter_avatar_proxy/v4/letter/r/2acd7d/32.png) [@riposte](https://collective.flashbots.net/u/riposte)
#### Post date: [September 24, 2023, 9:38pm UTC](https://collective.flashbots.net/t/should-builder-block-submissions-set-a-different-gas-limit-than-what-proposer-specified/2414/13 "2023-09-24T21:38:41Z")

</div>

> [@wasif](#):
>
> You can see it setting to the hardcoded validator value here: [builder/builder/builder.go at c5985be43d4921798bc9afa3d6f33357f4f6daf6 · flashbots/builder · GitHub](https://github.com/flashbots/builder/blob/c5985be43d4921798bc9afa3d6f33357f4f6daf6/builder/builder.go#L350)

Hmmm … still don’t see this getting directly set as a header.GasLimit anywhere, but I’ll take your word for it.

Glad I spun up my own builder now! 😉
