Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Determine appropriate gas per byte #1404

Closed
xgreenx opened this issue Oct 5, 2023 · 0 comments · Fixed by #1478
Closed

Determine appropriate gas per byte #1404

xgreenx opened this issue Oct 5, 2023 · 0 comments · Fixed by #1478
Assignees

Comments

@xgreenx
Copy link
Collaborator

xgreenx commented Oct 5, 2023

Overview

Based on the research, we devised a temporary solution until we implement multi-dimensional resources.

Each byte should have an analog in the Gas units. All operations that increase the storage will be charged additionally according to this value(storage-related opcodes, witnesses, serialized transaction itself). This issue is intended to investigate what value it should be. The research report contains some ideas of how we can calculate this value.

The output of this issue is an updated gas_per_byte field of consensus parameters and the instruction on how to calculate this value in the future. If it depends on some other consensus parameters like block_gas_limit, it should be highlighted in the formula/instruction.

Potential problem

If, after finalization of the formula, the gas value for one byte is significantly less than 1(rounding it to 1 leads to a huge overcharge for the user), we need to update the code and consensus parameter to support fraction.

Note

Inserting a new K/V into a state or asset into balances also has Sparse Merkle Tree storage overhead. As a temporary solution, we may try to include this into gas_per_byte. We need to benchmark how the number of entries increases the size of the storage. Later, we can multiply the gas_per_byte by this value for some predefined number of entries.

It is an optional section, and later can be extracted into a separate issue, if we want to.

@xgreenx xgreenx self-assigned this Oct 5, 2023
@xgreenx xgreenx removed their assignment Oct 12, 2023
xgreenx added a commit that referenced this issue Nov 15, 2023
…torage (#1478)

Closes #1404

---------

Co-authored-by: Green Baneling <XgreenX9999@gmail.com>
crypto523 added a commit to crypto523/fuel-core that referenced this issue Oct 7, 2024
…torage (#1478)

Closes FuelLabs/fuel-core#1404

---------

Co-authored-by: Green Baneling <XgreenX9999@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants