aptos-labs / aptos-core

Aptos is a layer 1 blockchain built to support the widespread use of blockchain through better technology and user experience.
https://aptosfoundation.org
Other
6.18k stars 3.65k forks source link

[VM] Gas model #619

Closed davidiw closed 2 years ago

davidiw commented 2 years ago

The existing gas schedule in Move is from 2019. There is no code to generate a new gas schedule. There is no formula or way to predict gas for a given transaction There are no estimations for what might be an upper bound for gas The gas schedule is part of upstream move Integration with storage is murky (storing resources is expensive, modules is cheap) There's no gas estimation api.

Let's fix all of these! And also give folks an API to validate their transaction with their own fullnode without going through consensus!

Manahip commented 2 years ago

We made a transaction simulation feature here which gives relatively accurate gas estimate (gets the entire write set, actually): https://github.com/hippospace/aptos-core/commit/f0015a4b96b1455c58ca274a775a8a83a55b3998. Totally agree that borrow_global is way too expensive.

davidiw commented 2 years ago

@Manahip, WOW, submit a PR, please?

Manahip commented 2 years ago

Will do once I figure out how you guys generate stuffs under ecosystem/typescript/api

davidiw commented 2 years ago

Will do once I figure out how you guys generate stuffs under ecosystem/typescript/api

No worries about that as long as it doesn't result in any broken tests and it can make it through our CI :). I'd like to make this available on the next devnet cut.

Manahip commented 2 years ago

here it is: https://github.com/aptos-labs/aptos-core/pull/1358

davidiw commented 2 years ago

New gas model on the way, closing this out.