Using gas lanes as a potential solution to FEVM-related gas issues: Mechanism and potential alternatives #679
Replies: 14 comments 12 replies
-
Great proposal! Absolutely needed to secure SP's maintenance needs.
I think the bottom line for SPs is to have winning and windowPost go through without being burdened with extra gas cost from raised basefee from fevm related messages. |
Beta Was this translation helpful? Give feedback.
-
This matter is extremely urgent, SPs are no longer sealing due to gas fees being exorbitant. |
Beta Was this translation helpful? Give feedback.
-
This is a great idea and much needed for the network. |
Beta Was this translation helpful? Give feedback.
-
Why is PublishStorageDeal not included? |
Beta Was this translation helpful? Give feedback.
-
@juanpmcianci many thanks for putting together this proposal. Is this something you are actively working on? How soon do you think you can draft a FIP for this? Lastly - are you happy to present this at our next Core Devs call this week? |
Beta Was this translation helpful? Give feedback.
-
Is there a summary of this argument? It's not clear to me why it would have to be a particularly complex extension of FVM gas accounting. Here is a draft of a solution: privileged system actor methods could signal a context change and start accounting for gas in a different lane's context. Message limit applies over all lanes but block gas limit is accounted for given the current lane's context. At end of execution FVM returns gas used in each lane and different base fees are applied. It's not clear we'd even need to change message or header structure, though we'd probably want to modify receipts for GasUsed per lane. Where does this solution break down? |
Beta Was this translation helpful? Give feedback.
-
I feel like that argument has origin in the line of thinking expressed under "Difficulty":
What we'd want to see is which actions would give a message a cheaper "consensus" gas price. Here, the author is suggesting there are schemes where small insignificant methods could provide access to cheaper non-storage related execution. Essentially, gaming it. A solution needs to contain a crisp identification of what must be executed to get a different lane priority. For instance, start with only PSD and WindowPOST. This way, significant activity must be undertaken to even produce a valid message to begin with. I think the origin of the discussion is assigning the entire message to a gas lane. What it sounds like you're describing is a situation where only certain portions of the execution path get the discount? In this way, you're saying any such gaming wouldn't be rational as the discount would only go towards certain activities? |
Beta Was this translation helpful? Give feedback.
-
This would require modifying the message format to include multiple gas limits and base-fees (one per lane). Annoying, but doable. It also complicates message selection (we're effectively selecting for multiple blocks). But that's also doable. However, I'm confused by:
Doesn't this assume that demand is identical for all lanes? Otherwise, we're wasting chain bandwidth. E.g., with two lanes and one dedicated to windowed posts, we'd be wasting ~25% of chain bandwidth at all time (windowed posts only take 25% off chain bandwidth, not 50%). I don't think we want per-lane block gas maximums. Instead, we likely want a target block gas distribution. |
Beta Was this translation helpful? Give feedback.
-
That seems reasonable. However, we would need multiple gas limits if we want to have separate block gas limits per-lane (which we probably don't want anyways).
|
Beta Was this translation helpful? Give feedback.
-
Notes from a discussion between @AxCortesCubero @Kubuxu @ZenGround0 and @anorth. Problems
Approach 1 – require external but imperfect identification of message lanes
Approach 2 - single message multiple lanes
Approach 3 - base fee discounts
A specific, simplified instance of this approach 3 is 100% discount of gas consumed in a single storage-operations lane. Approach 4 - refunds for power (pseudo gas lanes)
Explicit proof fees
|
Beta Was this translation helpful? Give feedback.
-
Here's a comparison among the proposed implementations/alternatives of gas lanes. The full document can be found here
|
Beta Was this translation helpful? Give feedback.
-
according to @Kubuxu - "FEVM messages represent 0.48% of chain bandwidth over the last 7 days. "
|
Beta Was this translation helpful? Give feedback.
-
I would like to argue that DisputeWindowPoSt/ReportConsensusFault/sector recovery/window post message are more critical than new onboarding messages. Try to phrase in original post's language:
|
Beta Was this translation helpful? Give feedback.
-
Given the basefee system, this state is very transient. Competition on the mining tips (GasPremium) only happens when the basefee is lagging behind demand due to the rapid adaptability of the basefee, the basefee will quickly catch up. |
Beta Was this translation helpful? Give feedback.
-
Gas lanes & alternatives
This discussion is largely based on this writeup as well several discussions.
Problem statement.
The Filecoin Virtual Machine (FVM) is quickly rising in popularity and it is posed to attract a larger and much welcome user base to the Filecoin network. However, an as-of-now hypothetical (but serious) scenario that this larger user base might bring is what we call gas gentrification. In short, this refers to the phenomena where demand for FVM-related messages is so high that either
While the above scenarios are indication of success and adoption for the FVM, we would like to explore options to mitigate/avoid these scenarios. As such, we propose to introduce a version of the EIP1559 mechanism which allows for gas lanes, each with its own base fee and EIP1559-like price-discovery mechanism.
It is also worth mentioning that gas lanes have also been proposed as a solution to the potential gas sprawl issue, described here
Ideal proposed mechanism.
We describe here what would be a straighforward possible economic solution to the gas gentrification problem. As we later discuss, this version may not be the easiest or most feasible to implement, so we later present some alternatives that partly address these difficulties and criticisms.
More precisely, we propose to
with$p_{\ell}^\text{min}>0$ the minimum base fee to be paid per lane and $G_{\ell,t}$ the gas used on lane $\ell$ at epoch $t$ . The target block sizes are subject to the constraint $\sum_{l} B_{{\rm target},l}\le B_{\rm target}$ , where $B_{\rm target}$ is the current EIP-1559 target block size parameter. Generally the targets, $B_{{\rm target},l}$ could also change with time depending on network conditions.
Given this, the proposed multi-lane EIP1559 mechanism would proceed as follows:
Under the scenario outlined above, we would need to define$3\times L$ parameters, namely $w_\ell$ , $B_{\text{target},\ell},$ $p^\text{min}_\ell$ , $\ell=1,2,\dots,L$ . These parameters would need to be defined from the begining of the implementation, and might need to get adjusted over time.
Difficulty
It is not immediately clear whether gas lanes can be implemented. This is due to the fact that it is not always possible to identify the class of a message apriori and charge gas for it accordingly. This has been expanded upon by Anorth in the following bulletpoints:
A top-level Filecoin message has some
sender
,receiver
andmethod
. Thesender
of the top-level message pays gas for the whole message execution. So this top-level message is what needs to be assigned to a lane.With user-programmed contracts, a top-level message might go to some smart contract, which then makes an internal call to a storage method. But we can't tell that without actually executing the message.
Even if we did do some pre-execution to tell, this could then be abused to get cheap execution of non-storage work, by a contract that first called a trivial storage method (to get assigned to the cheap lane) and then did a bunch of expensive stuff that the user really wanted
An in-principle idea here is for every message to consume gas from various different lanes, however, core devs have expressed that the implementation of this is really complex.
Alternatives.
Here we summarize some of the alternatives that have already been discussed in private channels.
Dynamic internal fees.
One could, in pricinple, introduce a dynamic fee mechanism (EIP1559-like, or otherwise) to the amount of gas usage per method. This would not be a "gas lanes" approach, but rather a "resource pricing" mechanism, such as the one discussed by Diamandis et. Al.. In this setting, we would keep track of the gas used by each type of trasaction$\ell$ (internal or otherwise) and multiply the amount of gas used by an epoch-dependent factor $\alpha^\ell_t\in\mathbb{R}_{>0}$ , which can either be a discount factor $(\alpha^\ell_t<1)$ or a "penalty" $(\alpha^\ell_t>1)$ , with the understanding that $\alpha^\ell_t$ gets adjusted dynamically acording to some given criteria.
This would require carefully defining the update rule for$\alpha^\ell_t$ , based on the global state of the chain, and would be subject to various constraints, such as a (positive) minimum value for each method.
Proof separation.
Anorth has alternatively, proposed to separate proof fees from execution gas. This can read in more detail here and here. As originally proposed, the goal is to have dynamically-priced onboarding fees, separate from the current EIP1559-driven gas cost. That is, these fees are meant to be a function of, e.g., {time-weighted average of onboarding rate, duration, sector size, baseline}, but not base fee. In theory though, this separation could be extended to other methods.
One way to "simulate" a gas lane is by combining these two approaches together, providing a heavy discount factor to control plane messages, mostly excempting them from base fees, while compensating that discount with explicit proof fees. Non-control-plane messages will still be subject to paying standard base fees, creating a separate pricing for control-plane messages.
Fee reimbursement.
A third alternative idea is to introduce a "fee-reimbursement" mechanism. In this setting, instead of burning 100% of the fees from gas usage (as currently done in the EIP1559 mechanism), a fraction of them can be burned and then the rest is given back to SPs. In this setting:
This approach might require SPs to set up rather high limits on their
gasFeeCap
, which can potentially become problematic from a UX perspective. This mechanism also resembles that of token allowances from other networks (e.g., Ethereum), so there might be some security implications from it.Other critiques & considerations
Gas lanes and the alternatives presented above still present some issues that need to be discussed. We list some of these issues bellow.
1. Added complexity. One potential drawback of the gas lanes model is the added complexity it introduces, as miners and users need to manage lane-specific parameters, such as lane widths, base fees, and target consumptions. This complexity could make it more difficult for users to estimate transaction costs and for miners to efficiently select transactions. Additionally, the gas lanes model might require more frequent monitoring and updates to keep lane parameters in line with the network's current state. This could lead to increased overhead for network operators and a higher chance of suboptimal adjustments if the monitoring and updating processes are not executed effectively.
2. Lane definition. The number of lanes$L$ in the proposed model needs to be carefully defined. Indeed, one could consider having e.g., 2 lanes, one for FVM messages and one for non-FVM, or 3 lanes, one for onboarding, one for PoSt, and one for everything else (including FVM), or many other choices. Furthermore, the choice of $L$ can have a significant impact on the efficiency and flexibility of the network.
A larger number of lanes allows for finer granularity in segregating transactions based on factors such as gas prices or priority levels. This in turn could lead to a more efficient allocation of resources and better handling of congestion. However, increasing the number of lanes can also result in added complexity for both miners and users, making it more challenging to determine the optimal lane for a transaction or to adjust lane parameters effectively. Therefore, when choosing the number of lanes, it is essential to strike a balance between granularity and simplicity to maintain efficient network operation.
3. Non-identifiability. This is the scenario where it is not immediately obvious whether a message belongs to a given class or not. In the 2 lane case, for example (FVM Vs. Maintenace), a contract that takes care of submitting maintenance would be difficult to classify in either group. This distinction would need to be analyzed in detail.
4. Multi-dimensional knapsack problem solved by the miners. Introducing gas lanes results in a "multi-constraint" knapsack problem for the miners when deciding which blocks to pack (in the setting where they want to maximize miner tips). This problem is NP-hard, which means finding an optimal solution can be computationally intensive. However, miners can employ heuristic or approximation algorithms to obtain near-optimal solutions within reasonable time frames. These algorithms can consider factors such as transaction fees, gas prices, and priorities to create a balanced and profitable block, however, it is unclear to us if this would represent a significant techincal challenge.
5. A free market solution? It is important to mention that block-packing and hence, base fee, are largely miner-dependent. Thus, there is always possibility that miners will try to "self-preserve", becoming more selective of the messages they decide to include on each block. As a very simple example, miners (or a sizeable proportion of them) could, in principle, shift towards prioritizing messages that they can identify as being storage-related. This could, in principle, solve the gentrification problem by itself. However, there is a lot of nuance in this scenario, and the CEL is currently working at understanding this situation in more depth.
Beta Was this translation helpful? Give feedback.
All reactions