You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some opcodes store data in storage, allowing the user to blow up the footprint.
Solution
The solution is to charge the user for the storage in addition to the execution. Because multi-dimensional resources require much adoption work, we will charge the user in terms of additional gas for now.
While we work on FuelLabs/fuel-core#1404 to find what value we need to charge, we also need to update opcodes and benchmarks to use gas_per_byte.
Implementation details
We need to find all opcodes that modify the storage first. For that, we can find all places where we use methods from the InterpreterStorage trait.
It's okay to charge the user for deploy_contract_with_id, because we store the contract's bytecode in two tables(transactions and contracts).
We need to charge the user only for adding new information. If the user overrides the already existing value, we only need to charge for newly added bytes(so if the size of the final value is the same or less, we don't charge).
Note
Inserting a new K/V into a state or asset into balances also has Sparse Merkle Tree storage overhead. You don't need to worry about that right now. Maybe later, we will have a separate functionality that charges for this overhead.
As a temporary solution, we may try to include this into gas_per_byte.
The text was updated successfully, but these errors were encountered:
Problem overview
Some opcodes store data in storage, allowing the user to blow up the footprint.
Solution
The solution is to charge the user for the storage in addition to the execution. Because multi-dimensional resources require much adoption work, we will charge the user in terms of additional gas for now.
While we work on FuelLabs/fuel-core#1404 to find what value we need to charge, we also need to update opcodes and benchmarks to use
gas_per_byte
.Implementation details
We need to find all opcodes that modify the storage first. For that, we can find all places where we use methods from the
InterpreterStorage
trait.It's okay to charge the user for
deploy_contract_with_id
, because we store the contract's bytecode in two tables(transactions and contracts).We need to charge the user only for adding new information. If the user overrides the already existing value, we only need to charge for newly added bytes(so if the size of the final value is the same or less, we don't charge).
Note
Inserting a new K/V into a state or asset into balances also has Sparse Merkle Tree storage overhead. You don't need to worry about that right now. Maybe later, we will have a separate functionality that charges for this overhead.
As a temporary solution, we may try to include this into
gas_per_byte
.The text was updated successfully, but these errors were encountered: