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

[P1] [Umbrella] Consistent gas metering #1122

Closed
8 tasks done
lxfind opened this issue Mar 29, 2022 · 1 comment
Closed
8 tasks done

[P1] [Umbrella] Consistent gas metering #1122

lxfind opened this issue Mar 29, 2022 · 1 comment

Comments

@lxfind
Copy link
Contributor

lxfind commented Mar 29, 2022

We would like to charge gas in a way that's consistent across the board.
To do so, we should use one global gas_status per transaction, pass it down on every operation, charge according to the same gas table. Move already has such as struct, that contains not only the gas cost for all instructions, but also for various storage operations and etc.
Below are what we need to do:

  • First of all, we should have a gas_budget for every transaction, including transfer transactions. This will allow us to also be able to create a gas status using that budget, and also able to check gas balance up-front early. (this will change the wallet/REST API too, cc @arun-koshy @patrickkuo @oxade ) For a batch transaction, instead of having a gas_budget per single transaction, we should just have one budget at the top level. Add gas budget to TransactionData #1133
  • Next we construct a gas status upfront, pass it everywhere for gas metering. For each place we are charging, we use the constants from the gas schedule table. Consistent gas metering #1219
  • We need to be more accurate when we compute the cost of an object based on its size. Right now, we just look at the data size. But we should also include the metadata size. [Gas Metering] More accurate object size calculation #1249
  • We need to keep track of the total storage cost (in Sui) for any object, so that when it's deleted, we give back that amount as rebate. When we are mutating an object, we should also give back rebate by deleting the old object, and re-charge the cost based on the new object. [Gas Metering] Add storage_rebate to Object and introduce gas price #1254
  • We need to be able to set gas price, which changes across epochs. There will be two separate gas prices, computation gas price and storage gas price. [Gas Metering] Add storage_rebate to Object and introduce gas price #1254
  • We need to come up with relatively reasonable gas constants for each gas parameter, relative to the Move instruction gas units.
  • We need to add a flat storage charge on any transaction based on the transaction size, because these transactions will need to be stored, too.
  • Gas metering for module verification process (especially around abstract interpretation) [Gas Mechanism] Gas metering for module verification during publish #1476
@patrickkuo
Copy link
Contributor

+1 on lifting gas budget from TransactonKind to TransactionData

@lxfind lxfind self-assigned this Apr 4, 2022
@todd-mystenlabs todd-mystenlabs modified the milestone: DevNet Apr 5, 2022
@gdanezis gdanezis added this to the DevNet milestone Apr 19, 2022
@lxfind lxfind removed this from the DevNet milestone May 9, 2022
@lxfind lxfind changed the title Consistent gas charging mechanism [P1] [Umbrella] Consistent gas metering May 9, 2022
@lxfind lxfind added the umbrella label May 9, 2022
@oxade oxade self-assigned this May 25, 2022
@oxade oxade closed this as completed Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants