aptos-core
aptos-core copied to clipboard
[WIP][aptos-vm] implement new gas metering system
Note: still a WIP
This implements a proper gas metering system for the Aptos blockchain. More specifically, this
- Defines a new extensible on-chain gas schedule
- Introduces an
aptos-gascrate a. Implements a new gas meter and defines the formulae the instruction costs b. Defines a bi-directional mapping between the on-chain gas schedule and the rust representation c. Defines an initial gas schedule (the values are currently just placeholders) - Made
frameworknatives customizable in terms of gas. - Moved
code::from_bytesinto a new moduleutilso it can be shared within the aptos framework - Moved the native functions
transaction_context::get_script_hashandcode::request_publishintoframeworkfor better organization a. This PR also fixescode::request_publishso that it properly returnsNativeResult::err(...)when given invalid user input, instead of raising an internal error.
TODOs:
- Documentation
- Code formatting
- Tests
- Lints
- Other cleanups
Any reason why this is still draft? Some folks may not look until you remove the draft status.
I'm suggesting that we land this now but then follow up on individual gas formulas with the folks responsible for the particular design area. The general design was discussed and approved by the Move maintainers already.
Can you give me a day to review as well? Will look through by end of Monday at the latest.
@movekevin please take your time! It'll take me some time to deal with test failures and resolve conflicts anyways. @wrwg these are also the main reason I'm still marking this as a draft. You can find a full list of TODOs in the summary.
@movekevin let me know if you have any concerns. Otherwise I'll try to land it soon.
@movekevin let me know if you have any concerns. Otherwise I'll try to land it soon.
Looking at it. I can finish the review in ~2 hours (1 hour after this current SEV review)
@movekevin I made some of the changes you requested to gas_schedule.move. Let me know if those changes look good to you and if I have answered all of your questions!
Again, thanks for the detailed review!
:white_check_mark: Forge test success on 47966eef0429f326ec80eb5fa87684936dd4cca0
all up : 7484 TPS, 3899 ms latency, 6000 ms p99 latency,no expired txns
- Grafana dashboard
- Validator 0 logs
- Humio Logs
- Test runner output
- Test run 1 is land-blocking