This is only a blog, not a FLIP. The objective of this post is to brainstorm ideas and collect initial feedback from the community before we present a formal FLIP.
This post covers three changes to Flow computation charges and limits to reflect changes to Flow (most notably, the addition of EVM operations) and to improve the resiliency of Flow to denial-of-service attacks.
- We propose a mechanism to convert EVM gas costs into Flow computation costs so that EVM transactions and operations can be added into the standard Flow transaction fee calculations.
- We propose an increase in the computation limit for Flow transactions to reflect the performance improvements made to Cadence and the overall protocol, in order to allow each transaction to do more (when warranted).
- We propose an increase in the per-unit computation cost, to reflect the reality that the current cost of computation on Flow is many orders of magnitude below other chains, which opens the protocol up to a potential denial-of-service attack from a malicious entity sending cheap âjunk transactionsâ to clog up the network.
Recap: Transaction fees for EVM transactions on Flow
See this post for a description of how transaction fee of EVM transactions would be calculated once EVM is live on Flow Mainnet. Remember, with the addition of a new weight EVMGasUsage
, we would amend the calculation of execution effort on Flow Cadence in the following way-
Execution Effort =
0.0239 * function_or_loop_call +
0.0123 * GetValue +
0.0117 * SetValue +
43.2994 * CreateAccount +
**EVMGasUsageCost * EVMGasUsage**
While EVMGasUsage
is supplied by EVM (for instance 21K gas for a simple send transaction), EVMGasUsageCost
is the ratio of converting EVM gas to Flowâs computation units, which may also be called âGas-to-Compute ratioâ (or âG2C ratioâ). Note that in this previous post, a 1000:1 G2C ratio was mentioned as an example; this post explains why choosing a different ratio (5000:1) would be more effective.
Goal 1: Enabling Execution of the large EVM contracts and transactions on Flow
EVM launch on Flow presents an opportunity to better align with network objectives and user needs in terms of total computation required. The current execution effort (âcomputeâ) limit of 9999 on Flow Cadence may be inadequate for larger EVM transactions. Flow should be able to match or surpass the capabilities of Ethereum, allowing transactions of up to 30M gas to be executed seamlessly.
To attain this objective, two approaches can be employed: (1) Implementing a gas-to-compute conversion ratio (EVMGasUsageCost
) to ensure that larger contracts (30M gas) fit within the 9999 compute limit, and (2) raising the computation limit on Flow to accommodate larger transactions requiring higher compute. The most effective strategy would involve a combination of both methods.
- Gas to compute conversion ratio (
EVMGasUsageCost
)
Empirical data shows that G2C with the current computation limit of 9999 (or in other words, the current weights) should not be lower than 1000:1, otherwise we risk ETH transactions using up more computation time, than they pay for. Considering however that EVM transactions also consume compute units in cadence execution, the actual size of EVM transactions/ contracts that can be executed with the ratio of 1000:1 would be much less than 10M. To match Ethereumâs 30M gas limit, a 5000:1 gas to compute ratio could be adopted to calculate execution effort (compute units) on Flow. This ratio would allow for 30M gas, along with adequate compute allocation for cadence execution based on our test transactions. For instance, a 30M gas transaction with a 5000:1 conversion ratio may consume about 6000 compute units for EVM execution, leaving 3999 compute units for Cadence execution.
Itâs important to note that for such sizable contracts however, even these compute units (3999 in the above example) may prove insufficient for cadence execution. Therefore, we should also consider revising Flowâs computation limit of 9999 to ensure seamless execution of the largest Ethereum contracts.
- Computation Limit
Directly raising the computation limit entails substantial code modifications and collaboration with ecosystem developers. Alternatively, we can indirectly increase the limit by lowering the execution effort coefficients or weights (0.0239, 0.0123, 0.0117, and 43.2994 in the execution effort calculation). Decreasing these weights would effectively expand a transactionâs computation limit; in other words, more and larger operations would âfit withinâ the 9999 compute limit.
To determine the appropriate reduction factor for the weights, a thorough understanding of Flowâs execution capabilities in handling large transactions was necessary. This involved assessing how much âcomputationâ could currently be accommodated in a block (on Mainnet24) and how much additional time a transaction could consume before encountering complications. For instance, if transactions in a block exceed the available block time (1.25s), they might need to be split across multiple blocksâa feature not currently supported; also, single transactions can never be split further. After evaluating these factors, it became apparent that increasing the transaction time by more than 5 times may lead to execution issues. Therefore, it is proposed to reduce the computation weights by a factor of 5.
Goal 2: Increasing Transaction Fees to drive greater utility and minimizing risk of network attack
Transaction fees on Flow are low, posing risks of attack, necessitating continuous token issuance (inflation), and making FLOW utility seem peripheral vis-a-vis other networks. The FLIP to introduce 100x transaction fee was upvoted by most community members but has been pending for a while. Crescendo launch is a chance to take it through the final approval and implement it.
While this increase might seem large by itself, the cost of Flow transactions to date have been several orders of magnitude below the costs seen on alternative computation networks. With the proposed new fee structure, we estimate that Flow will be approximately ~16,000x less expensive than Ethereum and ~10x less expensive than popular L2s such as Optimism and Base (for typical transactions).
The Proposal
Combining the proposed adjustments outlined above, the following changes are suggested:
- Establishing the âGas to compute ratioâ at 5000:1 or setting
EVMGasUsageCost
to1/5000
. - Reducing the coefficients of execution effort by a factor of 5x, effectively increasing the computation limit by the same factor. This reduction in coefficients will be counterbalanced by an increase in the cost of execution unit on Flow. See this post to review the calculation method for transaction fees and to understand how a corresponding increase in the cost of execution units would negate any influence on the total transaction fee.
- Elevating the cost of execution units by 500x compared to the current rate, resulting in a value of ~
2.5 x 10E-5
. This overall increase results from combining a 5x increase to compensate for the reduction in coefficients (see the previous point) with the 100x increase proposed by FLIP-74 (see Goal 2, above). - Increasing inclusion unit cost by 100x, to
1E-4
for all transactions, also intended to correspond with the 100x increase in transaction fee across the board.
Execution effort or compute calculation would then become -
Execution Effort =
0.00478 * function_or_loop_call +
0.00246 * GetValue +
0.00234 * SetValue +
8.65988 * CreateAccount +
1/5000 * EVMGasUsage
Summary
Since Transaction fee = [inclusion fee + (execution effort units * execution effort unit cost)] x surge
, after these proposed changes -
- Inclusion Fee =
1E-4
(constant) - Execution effort units will be calculated as -
Execution effort units (or computation units) =
0.00478 * function_or_loop_call +
0.00246 * GetValue +
0.00234 * SetValue +
8.65988 * CreateAccount +
1/5000 * EVMGasUsage
- Execution effort unit cost = ~
2.5 x 10E-5
(constant) - Surge = 1 (constant and no change)
Next Steps
Following community discussion on this forum post, the next phase will involve the presentation of a formal FLIP (Flow Improvement Proposal), which will be shared with the community. Community members will receive updates and ample time to respond to these proposed changes, allowing for planning and preparation. Subsequently, the changes will undergo testing on the testnet before deployment on Mainnet, timed around the Crescendo mainnet launch.
Final Word
Overall, the proposed/implemented changes aim to simultaneously enhance the computation limit and increase transaction costs by 100x (thereby bolstering resilience against attacks by the same factor). For developers, the indirect increase in the compute limit eliminates any extra effort required to update their contracts for changes in the computation limit. Additionally, the 5000:1 gas-to-compute ratio would empower them to execute larger contracts on EVM on Flow. Although transaction fees would incur a slightly higher cost for parties responsible for transactions (developers, wallets, etc.), this adjustment brings the advantages of enhanced network security, increased utility, and lays the groundwork for potential reduction in token inflation in the future.