A Detailed Explanation of the Close Relationship Between Filecoin Virtual Machine (FVM) and Gas Economy
Author: Filecoin Network
How FVM is Closely Related to Gas Economics
The launch of the Filecoin Virtual Machine (FVM) allows users to deploy programmable smart contracts (actors) on the Filecoin blockchain. These smart contracts will interact with Filecoin's data storage capabilities, creating conditions for innovative applications such as Data DAOs and provable perpetual storage.
While the deployment of FVM on Filecoin heralds an exciting era of innovation and practicality, it may also bring economic risks. If these risks are not addressed in the long term, they could have serious consequences. Fortunately, some simple and effective cryptoeconomic solutions can be integrated to protect the network against the worst outcomes. Let's summarize the key points:
The Gas consumed by Filecoin storage providers mainly comes from critical network tasks (such as submitting expensive cryptographic proofs when uploading new sectors, as well as ongoing "maintenance" messages or daily confirmations that their sectors remain active).
If the demand for Gas from FVM is not regulated, it could pose a problem for network operations, as storage providers may be pushed out of the Gas economy by high prices.
This risk is not immediate, as the current Gas demand rate on Filecoin is still low. Before the base fee stabilizes and increases, the network's Gas usage can still increase by 40%. When the base fee reaches 10 nano FIL/Gas unit, it could severely impact sector maintenance, making it difficult for storage providers to afford the costs of submitting sector proofs.
Often, by reducing block size, the total revenue of the network (from Gas fees burned) can be maximized. Since FVM has the potential to absorb the demand for Gas (through scaling solutions), scenarios may arise when the target block size is too large for the level of demand.
The most direct solution currently being researched by CryptoEconLab is to set different Gas parameters and target block sizes for storage providers and general FVM users, allowing each to have different available Gas.
Gas Gentrification and Risk Quantification
The next part of this article is simplified from CryptoEconLab's quantitative assessment of FVM Gas risks.
The fee market used by Filecoin adjusts the "base fee" based on the demand for block space. With the deployment of the Filecoin Virtual Machine (FVM), various new use cases may increase the demand for Gas. The base fee that storage providers are willing to pay for Gas is constrained by the profitability of uploading data and maintaining sectors on Filecoin, while the Gas that FVM users are willing to pay depends on the specific application and the subjective value of those transactions. If many FVM users want to conduct high-value transactions, the market-determined base fee may rise to a level that storage providers cannot bear. We refer to the situation where the critical operations of storage providers are pushed out of the market by more expensive FVM transactions as Gas gentrification.
There are also scenarios where the demand for Gas may be absorbed by scaling solutions (such as interstellar consensus). The formalism of EIP 1559 encourages sending blocks that match the target block size even when demand is low, leading to waste of block space. We refer to this as Gas sprawl.
In this article, we will explore different scenarios to cover the demand for Filecoin Virtual Machine Gas and how it affects the composition of blocks.
Modeling Filecoin Gas Demand
Our demand modeling is based on two main drivers: storage providers and FVM users. Naturally, both FVM users and storage providers need to pay fees when sending messages on this network. In our model, each individual user will individually value their information, being more likely to send these messages to the Mempool (memory pool) when the valuation is high. Conversely, when the valuation is low, users will submit fewer messages. This valuation is based on:
Valuation = Expected token gain - Gas fee - Operational costs
Here, Gas fee is a function of the base fee (increasing with the base fee), while operational costs include external costs (computers, office expenses, etc.). This is a very subjective measure, and each storage provider may differ.
To cover this subjectivity, our model uses "uncertainty quantification" techniques to model the demand of storage providers and FVM users. This way, we can incorporate the different responses of storage providers and FVM users to price changes. Below is the demand curve (price function) generated by this methodology. The gray line corresponds to one version among many demand curves. We can see that when the base fee is relatively low, our demand situation declines slowly; after the base fee reaches a certain threshold value, the demand situation declines rapidly. This corresponds to a base fee level—simply understood as "too expensive for anyone."
When Will FVM Become a Problem?
One important goal of this research is to try to understand the composition of messages in blocks; for example, at a given level of Gas demand, how much of the block will be used by FVM and how much will be used by storage providers for uploading and maintaining data? Due to the current lack of actual FVM Gas usage data, we have made a series of assumptions and investigated many possible future demand scenarios for FVM Gas, as well as assumptions about storage providers' block scheduling preferences.
We believe these assumptions are suitable for a first-order understanding of the problem. We also plan to continue building more complex agent-based models that will allow us to explore a broader range of storage provider strategies—these will adjust according to new levels of FVM demand.
As Gas demand and base fees increase, the practicality left for storage providers to upload data and maintain sectors will decrease. When Gas demand is too high, the operations provided by storage providers offer negative practicality, leading to increased Gas gentrification. We depict the Data Onboarding Network Utility, a metric defined in detail in this long technical report, to measure how network data uploads are affected by rising base fees and Gas demand. It can be seen that if we assume the current conditions of the Filecoin network remain unchanged, network uploads will be affected when the base fee reaches 10 nanoFIL/Gas unit.
Our model categorizes messages into two types: FVM messages and sector maintenance messages, each with different Gas fee assessment characteristics. Currently, 70% of block Gas usage comes from storage provider maintenance messages, averaging 3.5 billion Gas units per block. As we increase the demand for Gas from FVM, Gas fees are also pushed higher. Therefore, we estimate the proportion of Gas usage in blocks as a function of the base fee, while the amount of Gas usage brought by FVM is a function of current Gas usage.
We simulated a range of FVM Gas demand scenarios, where the demand brought by FVM is: 1/10, 1/2, approximately the same, two times, five times, and ten times the current storage provider maintenance demand (represented as parameter α in the charts below).
Assuming storage providers do not pick and choose messages but simply accept those that allow them to cover the base fee and provide higher tips, we will see the block composition shown in the chart below. The light-colored line represents one of several possible block compositions, while the solid color line represents the average composition. Based on our assumptions, we can see that in this example, the proportion of block usage is highly dependent on the initial FVM demand, and this proportion decreases as the base fee increases. This is because as the base fee increases, the valuation of each message decreases, leading to fewer messages submitted by users.
We also investigated a scenario where storage providers only include FVM-related messages when there is sufficient block space, preferring to include their own messages.
In this scenario, the curve we obtain looks like the one shown below. We again observe that as the base fee increases, the proportion of block usage decreases, but the maximum limit of FVM demand is about 1.5 billion Gas units per block. However, this strategy requires storage providers to cooperate and collectively reject messages that might offer them higher tips. Therefore, how likely is it that storage providers will self-regulate the Gas market? This situation is currently unclear and is a topic that CryptoEconLab will research in the future.
Total Network Revenue and Suboptimal Block Size
Is EIP 1559 the optimal result?
The EIP 1559 base fee mechanism aims to adjust the base fee to keep all blocks at a fixed target level. This increases the chances of suboptimally priced blocks being sent out, even when there is insufficient demand to fill the entire block. If Gas usage demand is below the level specified by this target block size, the base fee will decrease, potentially affecting total network revenue. This is especially a risk when FVM opens the door to various L2 scaling solutions, which may ultimately absorb too much Gas usage demand.
If our goal is to maximize total network revenue, based on previous results, it may be possible to derive the optimal block size that needs to be filled to accommodate specific demand levels.
We reinterpret the previous results: assuming that part of the block is empty because the target block size has decreased to (1-prop empty)*B, where B is the current target block size. Then we can find the optimal block size that maximizes the corresponding total network revenue (base fee * reduced target block size). This optimal block size is represented as B* in the chart above. We find that in many cases, total network revenue can be maximized by reducing block size.
What Can Be Done?
In exploring some solutions to address the risks of FVM Gas demand, the most direct tool is to design different Gas channels for FVM users and storage providers.
Independent Gas channels can combat the issue of Gas gentrification. Regardless of how high the Gas demand from FVM is, this solution ensures that storage providers have a minimum amount of block space to meet critical network operations.
At the same time, independent Gas channels can prevent the problem of Gas sprawl. By optimizing the allocation of block space for FVM messages, we can maximize network revenue from FVM messages. These independent Gas channels can also allow us to upgrade the batch balancer mechanism to a more general mechanism, thereby more accurately matching the current Gas demand level with the corresponding Gas supply.
Currently, the base fee is determined by the Gas demand specified by EIP 1559 and the chosen target block size. By limiting the overall block size, several desired outcomes can be achieved, such as optimizing the network revenue that can be obtained from FVM messages, upgrading the batch balancer mechanism (favoring clear upload fees from storage provider revenue), and adjusting Gas supply (to accurately match Gas demand).
In addition to the target block size, another important lever is the introduction of "Gas channels." In our case, a portion of the total Gas in blocks can be reserved specifically for critical network messages from storage providers, thus not being affected by the increase in base fees brought by FVM.
Next Steps for CryptoEconLab
In the coming weeks, we will release a FIP improvement proposal discussion, introducing different Gas pathways for storage providers and general FVM messages as a hedge against FVM-related Gas risks.
We will continue to build more complex agent-based simulation schemes that will allow us to simulate the effectiveness of the proposed solutions and the possibility of storage providers self-regulating without changing the protocol.
After the release of FVM on March 14, 2023, we will begin collecting and evaluating real FVM data and use this meaningful data to improve our models.
If you want to learn more about CryptoEconLab and our work, you can visit our website cryptoeconlab.io or read our HackMD Almanac.