Filecoin Virtual Machine (FVM) and potential gas economy outcomes

AX
CryptoEconLab
Published in
9 min readMar 14, 2023

How does FVM interact with the gas economy?

The Filecoin Virtual Machine (FVM) is about to launch, enabling user-programmable smart contracts (also called actors) to be deployed on the Filecoin blockchain. These smart contract will be able to interact with the data storage capabilities of Filecoin, opening the way for innovative applications, such as Data DAO’s and provable perpetual storage.

While the deployment of FVM on Filecoin will bring an exciting new era of innovation and utility, FVM also comes with economic risks. While these risks could have serious consequences if unattended in the long run, there are simple and effective cryptoeconomic solutions that can be implemented to protect the network against worst-case scenarios. We start with a summary of the main points:

  • Filecoin Storage Providers (SP’s) currently consume the majority of gas on network-essential tasks, like submitting expensive cryptographic proofs when new sectors are onboarded, as well as ongoing “maintenance” messages, or ongoing daily proofs that their sectors are still active.
  • Unregulated FVM demand for gas can pose a problem for network operations, where SP’s can be priced out of the gas economy.
  • The risk is not immediate, as Filecoin gas is currently underutilized, the network can accommodate approximately 40% increase in current gas usage before base fee starts steadily increasing. Once base fee has risen to around 10 nano FIL per gas unit, this can severely affect maintenance of sectors, pricing out SP’s from submitting sector proofs.
  • Total network revenue (through gas fee burn) could be maximized in many cases by reducing the block size. Since FVM also has potential to absorb demand for gas (through scaling solutions), scenarios are also possible, where the target block size is too large, for the level of demand.
  • The most direct solution CryptoEconLab is working on is to directly control the amount of gas available for SP usage and for general FVM usage, by separating into different gas lanes with their own target block sizes.

Quantifying risks of gas gentrification and sprawl

The rest of this article is a streamlined summary of the study conducted by CryptoEconLab on the quantification of FVM gas risk (by JP Madrigal-Cianci and AX).

Filecoin uses a fee market that adjusts the “base fee” based on demand for block space (EIP-1559). With the upcoming deployment of the Filecoin Virtual Machine (FVM), there could be increased demand for gas, for a variety of new uses. While the amount of base fee that SP’s are willing to pay for gas is constrained by the profitability of onboarding and maintaining sectors on Filecoin, what FVM users will be willing to pay for gas depends on the particular application and the subjective value of these transactions. If enough FVM users want to conduct high value transactions the market dictated base fee can become higher than what SP’s can afford, impacting basic Filecoin operations. We refer to the scenario where essential SP operations are “priced out” of Filecoin to make way for expensive FVM transactions as gas gentrification.

There also exist scenarios where demand for gas could be absorbed by scalability solutions (such as Interplanetary Consensus). The EIP 1559 formalism still encourages to send target-block-sized blocks even at times of low demand, leading to an inefficient sub-utilization of block space, we refer to as gas sprawl.

In this article, we’ll explore different hypothetical demand scenarios for gas in the Filecoin Virtual Machine (FVM) and how it affects the composition of a block.

Modeling Filecoin gas demand

We model demand as being driven by two main groups: SP’s and FVM users. Naturally, both FVM users and SP’s need to pay for sending messages on the network. In our model, each individual user assigns a personal valuation to their messages, and submits these messages to the Mempool with high probability whenever their valuation is high. Conversely, under our formulation, users submit fewer messages whenever their valuation is low. This valuation is given in terms of ,

Valuation = Expected Tokens Gains-Gas Expenses-Operational Expenses

Here, Gas Expenses are a function of the base fee (they increase as the base fee increases) and Operational Expenses include external costs such as electricity, floor space that SP’s need to pay, etc. This is a very subjective measure, and will vary greatly from SP to SP.

To take this subjectivity into account, our models use uncertainty quantification techniques to model demand for both SPs and FVM users. This way we can take into account how a range of different SPs and FVM users react to changes in price. An example demand curve (as a function of price) obtained using this methodology is shown below. The gray lines correspond to one of many, many possible versions of the demand functions. As we can see, our demand profiles decay very slowly for low values of base fee, but then decrease rapidly as this base fee approaches a threshold value; which corresponds to a base fee that can be roughly understood as being universally too large.

When could FVM pose a problem?

One important aspect of this study was to try to understand the composition of messages in a block; i.e., for a given level of demand for gas, what fraction of the total block will be used by FVM vs SP sector onboarding and maintenance? In the lack of real FVM gas usage data, we use a set of assumptions, and investigate over a wide range of possible future FVM gas demand scenarios, as well as assumptions on SP block preparation preference, that we believe are suitable for a first order understanding of the problem. We also plan to continue building more sophisticated Agent-Based models that will let us explore wider ranges of SP strategies, as they adjust to the new levels of FVM demand.

As demand for gas and base fee increase, it provides less utiliy to SP’s to onboard and maintain sectors. Gas gentrification occurs when gas demand is so high that SP operations provide negative utility. We plot the Data onboarding network utility, a measure defined in more detail in the long technical report , which quantifies how much network data onboarding is affected by rising base fees and gas demand. We see here, if we maintain all other current Filecoin network conditions, network onboarding starts to be affected when base fee reaches around 10 nanoFIL per unit of gas

For our model, divided messages into two general categories: FVM and Sector maintenance-type messages, each with unique gas fee valuation profiles. At the moment, about 70% of a block’s gas usage is due to SP-maintenance messages, which averages out to about 3.5 billion gas units per block. As we increase FVM demand for gas, base fee is driven upwards, and we estimate the proportion of gas used in the block as a function of base fee and on the amount of gas brought in by FVM as a function of current gas usage.

We simulated a range of FVM gas demand scenarios, where FVM brings in demand that is: one tenth, one half, about the same, twice, five times, and ten times as much as the current demand for SP maintenance (this is labeled as the parameter α in the plots below).

Assuming that miners do not discriminate amongst messages, and simply accept those messages that are able to cover the base fee and offer the higher tips, we would see a block composition as shown in the figures below. Here, the faint-colored lines represent a several possible block compositions, while the solid, colored one represent the average composition. Under our assumptions, we can see that in this case the proportion of block usage depends heavily on the initial FVM demand, and that this proportion decreases as as the base fee increases. This is because as base fee increases, the valuation of each message decreases, which causes users to submit less and less messages.

We also investigated the case where SPs give preference to their own messages by only including FVM-related messages if there is sufficient space. In this scenario we get a curve that looks like the one below. Once again, we observe the proportion of block usage decreases as as the base fee increases, however, the maximum amount of FVM demand gets capped at around 1.5 Billion gas units, per block. This strategy, however requires SPs to work collaborately, and in unison reject messages that would give them much larger tips. It is then unclear, and the subject of a futured planned CryptoEconLab study, how viable it is for SP’s to self-regulate the gas market.

Total network revenue, and suboptimal block size

Is EIP 1559 optimal?

The EIP 1559 base fee mechanism adjusts the base fee with the goal of keeping all blocks close to the fixed target block size. This creates pressure to send suboptimally priced blocks, even if there is not sufficient demand to fill the entire block. If demand for gas usage is lower than dictated by this target block size, base fee will drop, in a way that can harm total network revenue. This is particularly a risk given tht FVM opens the door to numerous L2 scaling solutions, which could end up absorbing too much demand for gas usage.

If we had the goal of maximizing total network revenue, from our previous results, it is possible to infer what should be the optimal block size to fill, for a given level of demand.

We re-interpret our previous results by assuming that the reason the a fraction of the block is empty is because the target block size has been reduced to (1-prop empty)*B, where B is the current target block size. We then find the optimal block size, such that the corresponding total network revenue (base fee* reduced target block size) is maximized. This optimal block size is labeled in the above figures as B* . We find that in many cases, network revenue could be maximized by reducing the size of the block.

What can be done?

The most direct tool that CryptoEconLab is exploring to protect against FVM gas demand risks, is to have separate lanes for SP and for FVM gas usage.

Individual gas lanes can help protect against gas gentrification, by guaranteeing SP’s a minimum amount of block space that will be available for essential network operations, regardless of how high FVM gas demand becomes.

At the same time, individual gas lanes can protect the network against gas sprawl, as they would allow us to maximize network revenue from FVM messages, by optimizing the blockspace allocated for FVM messages. These gas lanes would also allow us to upgrade the batch balancer mechanism for a more general mechanism that allows us to more accurately match the amount of gas supply to the existing level of gas demand.

Currently the base fee is dictated by demand for gas and the chosen target block size, through the EIP 1559 mechanism. Limiting the overall target block size could enable several desirable outcomes, such as: optimizing network revenue to be made from FVM messages, upgrading the batch balancer mechanism in favor charging explcit onboarding fees to SP’s, regulate supply of gas in a way that accurately matches demand for gas.

As well as the total target block size, second important lever is the introduction of “gas lanes”, where in our case, a fraction of the total block gas can be reserved exclusively for network-essential SP messages, exempting them from FVM driven base fee hikes.

Next steps from CryptoEconLab

  • In the next week we will publish a FIP discussion introducing separate gas lanes for SP messages and general FVM messages, as a tool to hedge FVM-related gas risks
  • We will continue building more sophisticaded agent based simulations, which will enable us to simulate the efficacy of the proposed solutions, as well as the efficacy of letting SP’s self regulate without any protocol changes.
  • We will start collecting and reviewing real FVM data after launch on March 14th, 2023, and use this to improve our models through better informed priors.

If you want to read more about CryptoEconLab and our work, you can visit our website at cryptoeconlab.io or read our HackMD Almanac

--

--