TL;DR: A visual summary of the gas-related topics currently being investigated by the CryptoEconLab, their relation with each other, and their use base is shown below.
A table containing short descriptions of these topics is presented in Section 3.
As suggested by ZX, I will likely split this into several documents (one per section). I will do this once we are done discussing here, to avoid having to jump through multiple docs
Currently, there are several unresolved questions, potential issues, and research directions related to gas consumption and behavior in the Filecoin network. In light of this, the CryptoEconLab (CEL) has decided to collect a list describing these problems, and detailing how we intend to solve them. The purpose of this document is two-fold. On the one hand, it would serve as a single source of truth for gas-related questions, thus facilitating and streamlining research and research directions for the CEL. On the other hand, we hope that such a document can be helpful for other teams, such that they can plan around the development of these issues, as well as contribute to their unresolved questions regarding gas consumption.
We list these issues and research opportunities in the next Section and present a summarised version of such a list in Section 3.
We now present a list of potential issues and research opportunities regarding gas consumption in the network.
We classify our progress in three categories 🟢,🟡,🔴:
Similarly, we also classify our research directions on three categories:
Remark: this section is a condensed version of these notes.
Description.
A potentially harmful, purely hypothetical (yet possible) scenario stemming from the release of the Filecoin Virtual Machine (FVM) is that an increase in block space demand due to the FVM results in some valuable block space taken away from the core functioning of the network. This situation could negatively affect the network, making it more expensive for storage providers to onboard data and submit storage proofs. We refer to this scenario as block space gentrification.
Potential solutions.
A potential, short-term solution is implementing gas lanes (c.f. Section 2.6). The main idea behind this solution is to classify messages in groups according to, e.g., their perceived importance and then to preallocate a given amount of block space to each of these categories. A long-term solution would be to use IPC dedicating one subnet to FVM-related messages.
Proposed steps and related questions.
We remark that we will discuss points 2 and 3 with the FVM team and other network stakeholders.
Related projects
Related Documents
At the time of writing, the CEL is actively investigating this issue. Some of our documents on this matter are listed below.
Work plan for the FVM gas consumption (CEL). Here we aim to address these previous 5 points. We are actively working on that document at the current time.
A mathematical model for Mpool dynamics. (CEL) (2022). In progress. This document (in progress) presents a mathematical model for how a Mpool will behave under different demand levels. This proposed model can simulate the process under which *(i) users submit messages to the Mpool and (ii) these messages are then included in the blockchain. This process, in turn, also simulates quantities derived from such a process, such as gas usage and base fee, as well as other network quantities that depend on them.
TODO: @7JfXCEujQwWCaFm8acpJ7A could you pls review this subsection?
Description.
IPC proposes a protocol to scale the network horizontally. This scaling, in turn, presents a significant opportunity to realize the Filecoin mission. The crypto-economic implications of these proposed changes require careful analysis to both (1) encourage innovation on the network and (2) protect the main net from unintended consequences.
Use case
Once a Crypto economic model for the IPC has been designed and tested, one could use such a protocol to scale the network horizontally. In addition, IPC could also be a potential long-term solution to the gas gentrification problem; in this setting, one could, e.g., dedicate a subnet to all FVM-related transactions and use the parent network for all storage-related messages. Unfortunately, however, the timelines for these projects are separate.
Proposed steps.
Related projects
Related Documents.
TODO @ 7JfXCEujQwWCaFm8acpJ7A Please include here a list of relevant documents. I couldn't find them on HackMD. Can also ping me on slack with them
Description.
The Filecoin network utilizes the EIP1559 transaction fee mechanism to compute the base fee \(b_t\) at every epoch \(t\). Under the current version of such a model, the protocol updates the base fee according to the following formula:
\[b_{t+1}=b_t\left(1+c_t\frac{G_t-G^\text{target}_t}{G^\text{target}_t}\right),\]
where, \(G_t\in[0,G^\text{max}]\) is the gas consumption at epoch \(t\), which can take values between \(0\) and the maximum block-size \(G_\text{max}\), \(G^\text{target}_t\) is the target block-size at the current epoch, currently fixed to be \(G^\text{max}/2\) for any \(t\), and \(c_t\) is the so-called step-size, which is currently set to be \(c_t=1/8\) for any epoch \(t\). Thus, an epoch where the gas usage is above the target gas usage will create a congestion on the network and will increase the base fee (up to \(12.5\%\) for \(c_t=1/8\)). This increase in base fee is intended to drive demand down in the next epochs. The opposite effect occurs whenever gas usage at a given epoch is below the target gas consumption \(G^\text{target}_t\).
Adjustable block size
Although conceptually simple, this base fee-updating mechanism is not necessarily optimal; indeed, one could argue that in low-demand periods, the block usage dynamics would deviate from what rational miners would do in a first price auction mechanism. Our proposal addresses this issue by adjusting the target block size by maximizing a target function that can be chosen to maximize the miner utility or any other quantity of interest. 🟢
Adjustable step size
TODO: @1dR0N2W7SQyZWg7DGB8Vfw Shyam, would you mind reviewing here, as you're listed as a co-author in one of the references?
Another point of contention regarding EIP1559 mechanisms is that, while empirical findings suggest that the EIP–1559 mechanism achieves its goals on average (c.f. Empirical results for Ethereum and Filecoin ), short-term behavior is marked by intense, chaotic oscillations in block sizes, and slow adjustments during periods of large bursts in demand. Monnot et al. (2022), suggest to alleviate this with a variable step-size \(c_t\), allowing it to take the form of an Additive-Increase, Multiplicative Decrease (AIMD) control term, however, there are quite a few research avenues to explore in this regard. 🔴
Use case
Improving upon the current EIP1559-based TFM would simultaneously benefit users and the network, as these improvements aim at having a base fee that more accurately reflects the demand levels on the network.
Proposed steps.
Notice that one could, in principle, work simultaneously on tasks 1-4 and 5.
Related projects
Related Documents.
Description.
Hyperdrive (FIP0013) introduced a new, much more efficient, method to process proofs for sectors (the batch balancer), in which proofs can be aggregated as a batch of proofs. This technological advance promised to increase the capacity of the Filecoin blockchain by 10X to 25X. This resulted in a sudden increase in blockchain capacity, however, without a corresponding change in demand. The sudden increase in capacity lead to a steep decrease in the base fee, which meant the total amount of tokens burnt to process transactions decreased after hyperdrive in June 2021 (c.f. A. Cortes-Cubero, (2022, in preparation)). This meant that such a mechanism had to be (manually) updated through a FIP (FIP0024). This evidences the need of having a self-calibrating batch balancer, or a different mechanism that is sufficiently robust to network growth that could replace it.
Proposed steps.
Related Projects
Related Documents.
BatchBalancer
and BatchDiscount
to match observed network growth rate post-HyperDrive & apply mechanism consistently to both ProveCommitAggregate
& PreCommitBatch
.Description.
Recall that under the EIP1559 mechanism, users submit messages accompanied by a bid given by
\begin{aligned} \mathsf{UserBid}=\underbrace{\left(\mathsf{gasPremium + baseFee_t}\right)}_\mathsf{gasFeeCap}\times \mathsf{gasLimit}, \end{aligned}
where \(\mathsf{baseFee}_t\) is the base fee at epoch \(t\), \(\mathsf{gasPremium}\) is the miner tip, \(\mathsf{gasLimit}\) is an estimated upper bound on the number of gas units (computational resources) that a given message should be allowed to consume and \(\mathsf{gasFeeCap}\) is the sum of \(\mathsf{gasPremium}\) and \(\mathsf{baseFee}_t.\) Typically, miners will prioritise the messages that have \(\mathsf{userBids}\). that would maximise their profits. In periods of low demand for block space (roughly equivalent to having comparatively few messages in the Mpool), the optimal user strategy is to set \(\mathsf{gasFeeCap}\) so that it barely covers the \(\mathsf{baseFee}_t\), since in this case, it would be quite likely that their message will be included relatively fast. In periods of mid or high demand, however, the sender of a transaction faces a trade-off between timely inclusion and the cost of this transaction, since the higher the miner tip is, the more inclined these actors will be in including such a message. For both the Ethereum and the Filecoin network, existing recommendation mechanisms aggregate recent gas price data on a per-block basis to suggest a gas price, however, it can be shown that these recommendations are far from optimal, rely upon fairly unsophisticated estimators (c.f. this medium post), and could be subject to large variations (c.f. Werner et. al. (2020), Laurent et. al, (2022) for a discussion of this phenomena on the Ethereum network, and this post for an equivalent discussion for the Filecoin network).
Proposed steps.
gasToolBox
library of sorts. Potential methodologies include Exponentially-weighted moving average, Time series forecasting, LSTM, or Bayesian forecasting.Related projects.
Related Documents.
Description.
One issue that has been brought up on several occasions is the need for and viability of so-called "gas lanes". By gas lanes, we refer to the process of (i) grouping messages into several different classes (or lanes), and (ii) allocating a given proportion of the block space to each different class of messages. In this setting, each lane could be equipped, at least in theory, with its own base fee updating mechanism, or even more generally, with a different transaction fee mechanism together. While the current state of the IPC project (c.f. Section 2.2) relies upon very similar ideas, this research direction as a standalone feature needs to be understood in more detail, as it is, at the moment, unclear whether such a construction is beneficial or even necessary.
Proposed steps.
SubmitWindwedPoSt
), and one for everything else. In theory, one could even consider sub-lanes, i.e., scenarios where each class of messages is subdivided into sub-classes and so on.Related Projects.
Related Documents.
TODO: if anyone is aware of other docs, could you pls add them or let me know?
Description.
The idea behind this project is to present a probabilistic model for the dynamics of the Message/Memory pool (Mpool) dynamics of an arbitrary blockchain. This model can be understood as a formalisation of the process under which messages arrive at the Mpool, and are later removed from it, by being included in blocks by some miner.
We argue that under certain reasonable conditions, messages that arrive to the Mpool follow a non-homogeneous Poisson process, with an intensity parameter directly proportional to the demand for such a type of messages. Furthermore, we argue that, under certain conditions on the bidding behaviour of message-sending users and miners, the Mpool follows an M/G/1 process.
Proposed steps.
Related projects.
This is a model/simulation environment, so it could be of used in most if not all gas-related projects that require some simulation. At time of writing, we are pushing towards this direction to incorporate this modeling in the upcoming FVM-related work.
Related documents.
A mathematical model for Mpool dynamics. (CEL) (2022). In progress. This document (in progress) presents a mathematical model for how a Mpool will behave under different demand levels. This proposed model can simulate the process under which *(i) users submit messages to the Mpool and (ii) these messages are then included in the blockchain. This process, in turn, also simulates quantities derived from such a process, such as gas usage and base fee, as well as other network quantities that depend on them.
We present a table heavily summarising the discussion above. Here, The priority level \(P_i\) is to be understood in decreasing order of \(i\), that is, \(P_0\) is an extremely high or top priority task, \(P_1\) has a high priority, but is not as urgent as \(P_0\), \(P_2\) is not as urgent as \(P_1\), and so on.
TODO Update and this table look nicer
Name | Description | Proposed Steps | Use case | Priority | References |
---|---|---|---|---|---|
FVM and block space gentrification | Understand how the (likely) increase in demand for block space stemming from the FVM will affect other network quantities. | 1. Identify QoIs likely to be affected by FVM. 2. Identify tools needed to investigate the effect of FVM-induced demand in 1. 3. Identify potential problems and problematic scenarios that a sustained increase in demand could present. 4. Propose and test relevant solutions. Iterate with the community in steps 1,3 and 4. | mainly Filecoin, but some methodologies developed here can be extended to other blockchains. | \(P_0\) | FVM1, FVM2 |
Gas usage and the InterPlanetary Consensus (IPC) | Propose gas models for the IPC. | 1. Agree on the objectives and model. 2. Identify the tunable parameters. 3. Simulation and fine-tuning. 4. Decide best mechanisms for IPC economics | Initially only Filecoin, but could in theory be extended to any network with a hierarchical consensus. | \(P_1\) | TBD TBD |
Price-discovery mechanisms. | Improve the way that the base fee is computed so that it optimizes some pre-defined targets. This could mean: 1. Adjusting target block size dynamically. 2. Adjusting the step-size \(c_t\) in the base fee formula. | 1. Motivate and formulate proposed models 2. Iterate with the wider community. 3. Define a simulation environment and run several tests. 4. Present FIPs as appropiate. Iterate with community steps 1-3. | Any EIP1559-based blockchain (including Filecoin). | \(P_2\) | PD1. PD2. PD3 PD4 |
Batch balancer. | Improve or replace batch balancer. | 1. Identify QoIs 2. Survey of control systems. Propose models. 3. Simulate these models on several scenarios. 4. Write down the findings. Iterate with the wider community. 5. Present FIPs as appropriate. | Filecoin network. | \(P_1\) | BB1 BB2 BB3 BB4 |
Improving Gas Premium predictions. | Improve predictions for how much a user should bid in terms of tokens per gas unit. | 1. Literature review of state-of-the-art on this topic. Learn what could be improved. 2. Implement relevant methods, and publish them as a toolbox. (No FIP required) 3. Improve upon relevant methods using cutting-edge tools & methodologies from several scientific fields. | Any EIP1559-based blockchain (including Filecoin). | \(P_3\) | GP1 GP2 GP3 |
On the implementation of gas lanes | investigate the need for and efficiency of gas lanes. | 1. Determine QoI. 2. Determine No. of lanes, and TFM on each lane. 3. Simulate the effects of this implementation. 4. Share results with the community. Iterate. 5. Present FIP as appropriate. | Any EIP1559-based blockchain (including Filecoin). | \(P_1\) | GL1. GL2. |