This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
contracts: switch to wasmi gas metering (#14084)
* upgrade to wasmi 0.29 * prepare cleanup * sync ref_time w engine from the stack frame * proc_macro: sync gas in host funcs save: compiles, only gas pushing left to macro WIP proc macro proc macro: done * clean benchmarks & schedule: w_base = w_i64const * scale gas values btw engine and gas meter * (re)instrumentation & code_cache removed * remove gas() host fn, continue clean-up save * address review comments * move from CodeStorage&PrefabWasmModule to PristineCode&WasmBlob * refactor: no reftime_limit&schedule passes, no CodeStorage * bugs fixing * fix tests: expected deposit amount * fix prepare::tests * update tests and fix bugs tests::run_out_of_gas_engine, need 2 more save: 2 bugs with gas syncs: 1 of 2 tests done gas_syncs_no_overcharge bug fixed, test passes! cleaned out debug prints second bug is not a bug disabled_chain_extension test fix (err msg) tests run_out_of_fuel_host, chain_extension pass all tests pass * update docs * bump wasmi 0.30.0 * benchmarks updated, tests pass * refactoring * s/OwnerInfo/CodeInfo/g; * migration: draft, compiles * migration: draft, runs * migration: draft, runs (fixing) * deposits repaid non pro rata * deposits repaid pro rata * better try-runtime output * even better try-runtime output * benchmark migration * fix merge leftover * add forgotten fixtures, fix docs * address review comments * ci fixes * cleanup * benchmarks::prepare to return DispatchError * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts * store memory limits to CodeInfo * ci: roll back weights * ".git/.scripts/commands/bench-vm/bench-vm.sh" pallet dev pallet_contracts * drive-by: update Readme and pallet rustdoc * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts * use wasmi 0.29 * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts * use wasmi 0.30 again * query memory limits from wasmi * better migration types * ci: pull weights from master * refactoring * ".git/.scripts/commands/bench-vm/bench-vm.sh" pallet dev pallet_contracts * addressing review comments * refactor * address review comments * optimize migration * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts * another review round comments addressed * ci fix one * clippy fix * ci fix two --------- Co-authored-by: command-bot <>
- Loading branch information
Showing
23 changed files
with
3,076 additions
and
4,878 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
;; Everything prepared for the host function call, but no call is performed. | ||
(module | ||
(import "seal0" "seal_input" (func $seal_input (param i32 i32))) | ||
(import "env" "memory" (memory 1 1)) | ||
|
||
;; [0, 8) buffer to write input | ||
|
||
;; [8, 12) size of the input buffer | ||
(data (i32.const 8) "\04") | ||
|
||
(func (export "call")) | ||
|
||
(func (export "deploy")) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
;; Stores a value of the passed size. The host function is called once. | ||
(module | ||
(import "seal0" "seal_input" (func $seal_input (param i32 i32))) | ||
(import "env" "memory" (memory 1 1)) | ||
|
||
;; [0, 8) buffer to write input | ||
|
||
;; [8, 12) size of the input buffer | ||
(data (i32.const 8) "\04") | ||
|
||
(func (export "call") | ||
;; instructions to consume engine fuel | ||
(drop | ||
(i32.const 42) | ||
) | ||
|
||
(call $seal_input (i32.const 0) (i32.const 8)) | ||
|
||
) | ||
|
||
(func (export "deploy")) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
;; Stores a value of the passed size. The host function is called twice. | ||
(module | ||
(import "seal0" "seal_input" (func $seal_input (param i32 i32))) | ||
(import "env" "memory" (memory 1 1)) | ||
|
||
;; [0, 8) buffer to write input | ||
|
||
;; [8, 12) size of the input buffer | ||
(data (i32.const 8) "\04") | ||
|
||
(func (export "call") | ||
;; instructions to consume engine fuel | ||
(drop | ||
(i32.const 42) | ||
) | ||
|
||
(call $seal_input (i32.const 0) (i32.const 8)) | ||
|
||
;; instructions to consume engine fuel | ||
(drop | ||
(i32.const 42) | ||
) | ||
|
||
(call $seal_input (i32.const 0) (i32.const 8)) | ||
) | ||
|
||
(func (export "deploy")) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.