contracts: Fix seal_call weights (#10796)

* Fix call weights

* Fix instantiate benchmark

* cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* Remove stale and superflous comments

* `decrement_refcount` should be infallible

* Don't hardcode increment_refcount, decrement_refcount

* Rename CopyIn/CopyOut

* Fix warning in tests

Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
Alexander Theißen
2022-02-15 09:56:22 +01:00
committed by GitHub
parent 47622d6912
commit b82cfbac4d
7 changed files with 816 additions and 895 deletions
+9 -39
View File
@@ -367,20 +367,14 @@ pub struct HostFnWeights<T: Config> {
/// Weight surcharge that is claimed if `seal_call` does a balance transfer.
pub call_transfer_surcharge: Weight,
/// Weight per input byte supplied to `seal_call`.
pub call_per_input_byte: Weight,
/// Weight per output byte received through `seal_call`.
pub call_per_output_byte: Weight,
/// Weight per byte that is cloned by supplying the `CLONE_INPUT` flag.
pub call_per_cloned_byte: Weight,
/// Weight of calling `seal_instantiate`.
pub instantiate: Weight,
/// Weight per input byte supplied to `seal_instantiate`.
pub instantiate_per_input_byte: Weight,
/// Weight per output byte received through `seal_instantiate`.
pub instantiate_per_output_byte: Weight,
/// Weight surcharge that is claimed if `seal_instantiate` does a balance transfer.
pub instantiate_transfer_surcharge: Weight,
/// Weight per salt byte supplied to `seal_instantiate`.
pub instantiate_per_salt_byte: Weight,
@@ -623,40 +617,16 @@ impl<T: Config> Default for HostFnWeights<T> {
transfer: cost_batched!(seal_transfer),
call: cost_batched!(seal_call),
delegate_call: cost_batched!(seal_delegate_call),
call_transfer_surcharge: cost_batched_args!(
seal_call_per_transfer_input_output_kb,
1,
0,
0
),
call_per_input_byte: cost_byte_batched_args!(
seal_call_per_transfer_input_output_kb,
0,
1,
0
),
call_per_output_byte: cost_byte_batched_args!(
seal_call_per_transfer_input_output_kb,
0,
0,
1
),
call_transfer_surcharge: cost_batched_args!(seal_call_per_transfer_clone_kb, 1, 0),
call_per_cloned_byte: cost_batched_args!(seal_call_per_transfer_clone_kb, 0, 1),
instantiate: cost_batched!(seal_instantiate),
instantiate_per_input_byte: cost_byte_batched_args!(
seal_instantiate_per_input_output_salt_kb,
1,
0,
0
),
instantiate_per_output_byte: cost_byte_batched_args!(
seal_instantiate_per_input_output_salt_kb,
0,
instantiate_transfer_surcharge: cost_byte_batched_args!(
seal_instantiate_per_transfer_salt_kb,
1,
0
),
instantiate_per_salt_byte: cost_byte_batched_args!(
seal_instantiate_per_input_output_salt_kb,
0,
seal_instantiate_per_transfer_salt_kb,
0,
1
),