--- tags: eip1559 --- # merge1559 We study proposals for [EIP-1559 post-merge](https://github.com/quilt/EIPs/blob/time-aware-basefee/EIPS/eip-4396.md#persistent-multi-slot-buffer), written up by Ansgar Dietrichs as EIP-4396. Given realised gases used $(g_1, g_2, \dots, g_n)$, where $g_i = \emptyset$ whenever the block $i$ is missed and $(t_1, t_2, \dots, t_n)$ the block timestamps, with $t_i = \emptyset$ whenever block $i$ is missed and $t_{-i}$ the latest timestamp $t_j$ before $t_i$ such that $t_j \neq \emptyset$. The recurring message is that the sum of gas targets over a series of blocks should give you an idea of what the total throughput in these blocks tends to. Pre-merge, 1559 targets 15M gas per block, and achieves this target for the rough reason that over a series of `n` blocks, the sum of targets is `15M * n` gas, so the throughput should tend to `15M` per block. While this sounds tautological, it's not actually completely trivial, as the throughput (how much gas is used) is mediated by the user behaviour and their inclusion in blocks. ## Flexible rule With the flexible rule, the block gas limit is always set to twice the block gas target, while the gas target is set to `(number of previous consecutive missed blocks + 1) * 15,000,000` (this can lead to "giga-blocks" if many consecutive blocks are missed, although this issue can be mitigated with [buffering extra capacity](https://github.com/quilt/EIPs/blob/time-aware-basefee/EIPS/eip-4396.md#persistent-multi-slot-buffer)). Using the exponential formula for updates (for simplicity of calculation, but without loss of generality): $$ b_1 = b_0 \exp \Big( \frac{g_1 - \frac{t_1 - t_0}{T}G}{dG} \Big)$$ $$ \begin{aligned} b_n & = b_0 \prod_{g_i \neq \emptyset} \exp \Big( \frac{g_i - \frac{t_i-t_{-i}}{T}G}{dG} \Big) \\ & = b_0 \exp \Big( \sum_{g_i \neq \emptyset} \frac{g_i - \frac{t_i-t_{-i}}{T}G}{dG} \Big) \\ & = b_0 \exp \Big(\frac{1}{dG} \big(\sum_{g_i \neq \emptyset} g_i - \frac{G}{T} \sum_{g_i \neq \emptyset} (t_i-t_{-i}) \big) \Big) \\ & = b_0 \exp \Big(\frac{1}{dG} \big(\sum_{g_i \neq \emptyset} g_i - \frac{G}{T} t_n \big) \Big) \\ \end{aligned} $$ Assume $t_n = nT$. $$b_n = b_0 \exp \Big(\frac{1}{dG} \big(\sum_{g_i \neq \emptyset} g_i - G \times n \big) \Big)$$ In other words, at slot $n$, the total capacity up to $n$ (i.e., $\sum_{g_i \neq \emptyset} g_i$) will converge to $G \times n$, which is what we want :) ## Capped rule Here the target is capped, but once again the block limit is autoset to twice the gas target. $$ \begin{aligned} b_n & = b_0 \prod_{g_i \neq \emptyset} \exp \Big( \frac{g_i - \frac{\min(t_i-t_{-i}, T_{max})}{T}G}{dG} \Big) \\ & = b_0 \exp \Big( \sum_{g_i \neq \emptyset} \frac{g_i - \frac{\min(t_i-t_{-i}, T_{max})}{T}G}{dG} \Big) \\ & = b_0 \exp \Big(\frac{1}{dG} \big(\sum_{g_i \neq \emptyset} g_i - \frac{G}{T} \sum_{g_i \neq \emptyset} \min(t_i-t_{-i}, T_{max}) \big) \Big) \\ & \leq b_0 \exp \Big(\frac{1}{dG} \big(\sum_{g_i \neq \emptyset} g_i - \frac{G}{T} \sum_{g_i \neq \emptyset} (t_i-t_{-i}) \big) \Big) \\ & = b_0 \exp \Big(\frac{1}{dG} \big(\sum_{g_i \neq \emptyset} g_i - \frac{G}{T} t_n \big) \Big) \\ & = b_0 \exp \Big(\frac{1}{dG} \big(\sum_{g_i \neq \emptyset} g_i - G \times n \big) \Big) \end{aligned} $$ In other words, the total capacity up to $n$ converges to $\frac{G}{T} \sum_{g_i \neq \emptyset} \min(t_i-t_{-i}, T_{max})$, which may be less than $G \times n$. However, in the worst case, the total capacity would be at least $\frac{G}{T} \sum_{g_i \neq \emptyset} T_{max}$. Suppose for instance 2 out of 3 blocks are skipped and $T_{max} = 24$ seconds, then the total capacity would converge to $\frac{G}{T} \times \frac{n}{3} \times T_{max}$, i.e., $\frac{2}{3} \times G \times n$, two thirds of the target capacity $G \times n$. ## Synthetic empty blocks Suppose missed slots are "filled" with synthetic empty blocks, such that basefee is updated (downwards) after each such synthetic empty block. We now have: $$ \begin{aligned} b_n & = b_0 \prod_{g_i \neq \emptyset} \exp \Big( \frac{g_i - G}{dG} \Big) \prod_{g_i = \emptyset} \exp \Big( \frac{0 - G}{dG} \Big) \\ & = b_0 \exp \Big( \sum_{g_i \neq \emptyset} \frac{g_i - G}{dG} - \sum_{g_i = \emptyset} \frac{G}{dG} \Big) \\ & = b_0 \exp \Big(\frac{1}{dG} \big(\sum_{g_i \neq \emptyset} g_i - G \times n \big) \Big) \end{aligned} $$ In other words, the total capacity up to $n$ converges to the desired throughput $G \times n$ (modulo the availability of supply... if more than 50% of blocks are missing and the gas limit is kept fixed, there is no way to fit $G \times n$ gas in the available blocks). ### Counterargument It's useful to think about the simplest case: users come in at a constant rate, their values for transacting are drawn from the same distribution (e.g., uniform between 0 and 200 Gwei). Suppose twice as many users come in every slot as the gas target of 15M. Then the "market price" (price at which only a target-sized demand is included) is 100 Gwei, as on average it would price out half of the user set, which is twice too large. Suppose the first slot is missed. Then there are 4 times as many users who come in over the two slots as the gas target for one slot. Assuming the supply is increased (e.g., we set the target for the block at slot 2 to be twice the target of a single slot), then the market price is again 100 Gwei, as we want to price out half of the 4x set of users, so that 2x are included and fill 2x the target. Note that the market price has not changed from the two scenarios. Adding "synthetic empty blocks" would drive basefee, which corresponds to the market price, away from its correct value in this model, as it would decrease even though increased demand would justify keeping it constant. So synthetic empty blocks satisfy the supply constraint (keeping throughput at 15M gas per slot), but could lead to worse price signals that affect market performance. ## Status quo: fixed throughput per block We don't change the target, we don't have synthetic empty blocks, missing blocks are just missed and don't participate in the basefee calculation. Then $$ \begin{aligned} b_n & = b_0 \prod_{g_i \neq \emptyset} \exp \Big( \frac{g_i - G}{dG} \Big) \\ & = b_0 \exp \Big( \sum_{g_i \neq \emptyset} \frac{g_i - G}{dG} \Big) \\ & = b_0 \exp \Big(\frac{1}{dG} \big(\sum_{g_i \neq \emptyset} g_i - \sum_{g_i \neq \emptyset} G \big) \Big) \end{aligned} $$ In other words, the total throughput should tend to $\sum_{g_i \neq \emptyset} G$, i.e., the number of non-missed blocks times the gas target for a slot, which is the same as today ("fixed throughput _per block_"). Note that since in general $\sum_{g_i \neq \emptyset} G < G \times n$, there is as much "lost capacity" as there are missed slots. ## Summary-ish | | Flexible target | Capped target | Synthetic empty | Status quo | |-|-|-|-|-| | Fixed throughput per block | ❌ | ❌ | ❌ | ✅ | | Fixed throughput per slot | ✅ | ❌ varies according to how much clipping there is | ✅ | ❌ | | "Good price signal" | ✅ | ✅ ~ local optimum given the mechanism | ❌ | ? |