or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
L1 Gas Costs for the B52 and Fernet Proposals
Danilo Lessa Bernardineli (BlockScience), August 2023
Introduction
On this document, we break-down the B52 & Fernet coordination costs on L1 by introducing a mathematical formalism over their gas / blob-gas costs and using them to derive relevant metrics. Based on those, assumptions are made on the variables form (eg. constant vs dynamical function vs stochastic) and numerical values.
Preliminaries
Terminology
StoreBlockIdentifier
associated gasCallData
associated gas for proposal \(P\)StoreRewardReferences
associated gas for proposal \(P\)Linking Gas Units to Values
Gas & Blob Gas to Gwei
Let \(X\) be the transaction of interest, then we can define its costs in Gwei (or \(10^{-9} \text{ ETH}\)) as:
\[ \begin{align} & \text{Gas Units to Gwei: } & \bar{g}_X &= \text{GasQuantity}(X) * p_g(t) \\ & \text{Blob Gas Units to Gwei: } & \bar{b}_X &= \text{BlobBytes}(X) * p_b(t) \end{align} \]
Mapping the Gas Units to actual Gwei values can use a variety of approaches. The simpler one is to assume constant value (eg. \(p_g(t) = 34\) and \(p_b(t) = 1\)). Else it is possible to use: 1) univariate random distributions (eg. Gaussian or Laplacian distributions; 2) standard time-series analysis models (eg. ARIMA and/or VAR models) - in fact the Average Gas Price Fee has been documented to have properties that are similar to a
SARIMA(2,0,1)(0,1,1)
model; 3) Building explicit dynamical models, which can be particularly useful for the BlobGas price, as there's no data available for it and the price change obeys an exponential rule depending on the congestion after/before a threshold.Gwei to ETH and USD
The first step to compute \(g_X\) and \(b_X\) in terms of meaningful values is to convert from Gwei to ETH. This is done by multiplying them by \(10^{-9}\) so that \(g_{X}^{\text{ETH}}= g_X * 10^{-9}\) and \(b_{X}^{\text{ETH}}= b_X * 10^{-9}\)
Converting to USD requires again an variety of approaches. The simplest one is to adopt an constant value (eg.
1 ETH = 1650 USD
), and more complicated ones can involve sampling from univariate random distributions (eg. Gaussian & Laplace) and time-series models (eg. ARFIMA).Formal description of the gas costs across the proposals (B52 and Fernet)
The total gas per phase as denominated in Conventional and Blob Gas can be described through the below equations.
B52
\[ \begin{align} & \text{1. Block Proposal: } & g_1^{B52} &= \sum_{N_p} (T_0 + T_s +T_c^{\text{B52}}) & b_1^{B52} &= 0 \\ & \text{2. Block Submission: } & g_2^{B52} &= \sum_{N_s} T_0, & b_2^{B52} &= \sum_{N_s} (B_h + \sum_{N_t} B_t)\\ & \text{3. Block Reveal: } & g_3^{B52} &= \sum_{N_s} (T_0 + T_r^{B52} + T_v) & b_3^{B52} &= 0 \\ & \text{4. Finalization: } & g_4^{B52} &= T_0 + T_i + T_\pi^{B52} & b_4^{B52} &= 0 \end{align} \]
Fernet
\[ \begin{align} & \text{1. Block Proposal: } & g_1^{Fernet} &= \sum_{N_p} (T_0 + T_s +T_c^{\text{Fernet}}) & b_1^{Fernet} &= 0 \\ & \text{2. Proof Submission: } & g_2^{Fernet} &= \sum_{N_s} (T_0 + T_r^{Fernet} + T_v) & b_2^{Fernet} &= 0 \\ & \text{3. Block Submission: } & g_3^{Fernet} &= \sum_{N_s} T_0, & b_3^{Fernet} &= \sum_{N_s} (B_h + \sum_{N_t} B_t)\\ & \text{4. Finalization: } & g_4^{Fernet} &= T_0 + T_i + T_\pi^{\text{Fernet}} & b_4^{Fernet} &= 0 \end{align} \]
Converting Gas to Gwei
Converting Gas / Blob-Gas to Gwei (assuming average transaction fees) requires multiplying the summation terms by the average price term while taking into consideration the event time. As an example, the cost in Gwei for the B52 Phase 2 is formally expressed as: \(C_2^{B52} = \sum^{N_s}_i p_g(t_2(i)) T_0 + \sum^{N_s}_i p_s(t_2(i)) \sum_{N_s} (B_h + \sum_{N_t} B_t)\), where \(t_2(i)\) is the time on which Agent \(i\) has submited the L1 transaction for Phase 2.
We've omitted expressing explicitly the full expression in Gwei for sake of simplicity.
One simplifying assumption is to assume that the gas prices are equal for the entirety of an block cycle. In that case, the total costs in Gwei can be expressed as:
\[ \begin{align} C^{\text{B52}} &= p_g(t)(T_0 + T_i + T_\pi^{\text{B52}} +N_s(2T_0 + T_r^{\text{B52}}+T_v) + N_p(T_0 +T_s + T^{\text{B52}}_c)) +p_b N_s(B_h + N_t \langle B_t \rangle) \\ C^{\text{Fernet}} &= p_g(t)(T_0 + T_i + T_\pi^{\text{Fernet}} +N_s(2T_0 + T_r^{\text{Fernet}}+T_v) + N_p(T_0 +T_s + T^{\text{Fernet}}_c)) +p_b N_s(B_h + N_t \langle B_t \rangle) \end{align} \]
Metrics
\[ \begin{align} & \text{L1 Cost per Rollup: } & & C_1(N_p) + C_2(N_u) + C_3(N_u) + C_4 \\ & \text{L1 Cost per Transaction: } & & \frac{C(N_p, N_u)}{N_t} \\ & \text{L1 Cost per Proposer: } & & \frac{C(N_p, N_u)}{N_p} \\ & \text{L1 Cost per Submitter: } & & \frac{C(N_p, N_u)}{N_s} \\ & \text{L1 Cost for the Proposer: } & & c_1 \\ & \text{L1 Cost for the Submiter: } & & c_1 + c_2 + c_3 \\ & \text{L1 Cost for the Finalizer: } & & c_1 + c_2 + c_3 + c_4 \\ & \text{L1 Coordination Overhead for the Finalizer: } & & 1 - \frac{C - (c_1 + c_2 + c_3 + c_4)}{C} \\ & \text{B52 Relative Advantage over Fernet: } & & \frac{\Delta C}{C_{B52}} \\ \end{align} \]
Where the \(\Delta\) operator is defined such that \(\Delta f = f^{\text{B52}} - f^{\text{Fernet}}\), then by applying it on \(C\), we the Gas Costs difference between the B52 and Fernet proposals, which gives us:
\(\Delta C = p_g(\Delta T_\pi + N_s \Delta T_r + N_p \Delta T_c)\)
Putting Numbers on Variables
On this section, assumptions on the variables's form and point-like numbers will be provided to the best of our knowledge and intuition. For uncertain values, observations will be provided that could further inform evaluation through the usage of probability distributions.
Proposal Agnostic Numbers
Proposal Specific Numbers
Analysis
B52 vs Fernet Direct Comparison
By plugging the Section 4 numbers on Section 3 metrics, we're able to provide an direct comparison between both proposals in terms of L1 costs. An notebook for that can be found at this link.
The first numerical result is that under the baseline assumptions, Fernet is going to have 7.8% less coordination costs when compared to B52. Specifically, it is expected that Fernet will incur an 0.065 ETH in total cost and B52 will incur 0.070 ETH. When dividing per transaction count, then the value becomes 0.0000317 ETH/tx for Fernet and 0.0000344 ETH/tx for B52.
Additionally, by leaving an variable free while the others being fixed, it is possible to perform an limited sensitivity analysis of the Fernet advantage under various cirumcunstances, such as number of transactions, Blob Gas Price and Gas Price. We can observe the following: 1) Fernet relative advantage becomes smaller as the number of transactions go up, 2) Larger Blob Gas Prices tends to decrease Fernet's relative advantage and 3) Larger Gas Prices tends to increase Fernet's relative advantage.
Also, we can notice that Fernet's advantage only holds while the number of proposers is low, and it can quickly go down. In fact, under baseline assumptions B52 starts to be advantageous after the number of proposers is above circa 150. We can also observe that Fernet's advantage is highly dependent on the Rollup Scoring Logic gas costs.
Further analysis can explicit include the uncertainty ranges that are expressed on Section 4 as well as to include the stochastic effects of price.
Blob Storage
The Baseline Assumption expects a 4.10MB worth usage of Blob Bytes per Rollup. This is 11x the Target Blob Bytes, and 5.5x the Maximum Blob Bytes. This is somewhat problematic, as it means:
One reason for concern is that the available Blob Storage goes down, as the Blob Gas Price increases, as the Maximum Blob Gas Fee is capped. For instance, a Blob Gas Price of 10 Gwei implies that 78.4kB worth of maximum blob storage would be available. This is problematic for protocols that require predictable throughput, as it creates a reinforcing feedback loop of insuficient throughput increasing price which then reduces throughput even more. More details can be found on the EIP-4844 Research Notes document.
Assuming that the Blob Gas price is 1 Gwei per Blob-Byte, and assuming that the Blob Storage would always be at target, then the expected throughput is
32.0 kB/s
or1.9MB/min
or112.5 MB/hr
or2.6 GB/day
. The rollup blob storage throughput is only feasible if below those numbers (and conditional on usage from other actors)Assuming that time is not an concern (eg. rollups could be spread among infinitely many blocks), then Blob Storage Price is only going to be an relevant Coordination Cost after the Blob Gas Price price is above
30 Gwei
per Blob-Bytes, which maximally renders25.6 kB
worth of blobs per block, or an throughput of2.1 kB/s
.Key Learnings
CallData
for proposing is expected to be somewhat more expensive on Fernet (around ~3.7%)MaxBlobFee = 768kB equivalent of 1 Blob Gas = 1 Gwei
. If the Blob Price doubles, thenMaxBlobFee = 384kB equivalent of 1 Blob Gas = 2 Gwei
.Recommendations
200