contracts: Remove weight pre charging (#8976)

* Remove pre-charging for code size

* Remove pre charging when reading values of fixed size

* Add new versions of API functions that leave out parameters

* Update CHANGELOG.md

* Apply suggestions from code review

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>

* Add v1 for seal_set_rent_allowance

* Remove unneeded trait bound

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
Alexander Theißen
2021-06-25 18:27:01 +02:00
committed by GitHub
parent bc0520913d
commit 0cccd282a1
18 changed files with 1238 additions and 1132 deletions
@@ -0,0 +1,5 @@
;; A valid contract which does nothing at all
(module
(func (export "deploy"))
(func (export "call"))
)
@@ -4,8 +4,8 @@
;; The rest of the input is forwarded to the constructor of the callee
(module
(import "seal0" "seal_input" (func $seal_input (param i32 i32)))
(import "seal0" "seal_instantiate" (func $seal_instantiate
(param i32 i32 i64 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) (result i32)
(import "seal1" "seal_instantiate" (func $seal_instantiate
(param i32 i64 i32 i32 i32 i32 i32 i32 i32 i32 i32) (result i32)
))
(import "seal0" "seal_return" (func $seal_return (param i32 i32 i32)))
(import "env" "memory" (memory 1 1))
@@ -29,10 +29,8 @@
(i32.const 8)
(call $seal_instantiate
(i32.const 16) ;; Pointer to the code hash.
(i32.const 32) ;; Length of the code hash.
(i64.const 0) ;; How much gas to devote for the execution. 0 = all.
(i32.const 0) ;; Pointer to the buffer with value to transfer
(i32.const 8) ;; Length of the buffer with value to transfer.
(i32.const 48) ;; Pointer to input data buffer address
(i32.const 4) ;; Length of input data buffer
(i32.const 0xffffffff) ;; u32 max sentinel value: do not copy address
@@ -32,4 +32,4 @@
;; 2 = trap
(unreachable)
)
)
)
@@ -1,9 +1,9 @@
(module
(import "seal0" "seal_set_storage" (func $seal_set_storage (param i32 i32 i32)))
(import "seal0" "seal_input" (func $seal_input (param i32 i32)))
(import "seal0" "seal_restore_to"
(import "seal1" "seal_restore_to"
(func $seal_restore_to
(param i32 i32 i32 i32 i32 i32 i32 i32)
(param i32 i32 i32 i32 i32)
)
)
(import "env" "memory" (memory 1 1))
@@ -27,15 +27,12 @@
)
)
(call $seal_restore_to
;; Pointer and length of the encoded dest buffer.
;; Pointer to the encoded dest buffer.
(i32.const 340)
(i32.const 32)
;; Pointer and length of the encoded code hash buffer
;; Pointer to the encoded code hash buffer
(i32.const 308)
(i32.const 32)
;; Pointer and length of the encoded rent_allowance buffer
;; Pointer to the encoded rent_allowance buffer
(i32.const 296)
(i32.const 8)
;; Pointer and number of items in the delta buffer.
;; This buffer specifies multiple keys for removal before restoration.
(i32.const 100)