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
+7 -6
View File
@@ -25,11 +25,8 @@ mod prepare;
mod runtime;
#[cfg(feature = "runtime-benchmarks")]
pub use self::code_cache::reinstrument;
pub use self::{
code_cache::{decrement_refcount, increment_refcount},
runtime::{ReturnCode, Runtime, RuntimeCosts},
};
pub use crate::wasm::code_cache::reinstrument;
pub use crate::wasm::runtime::{CallFlags, ReturnCode, Runtime, RuntimeCosts};
use crate::{
exec::{ExecResult, Executable, ExportedFunction, Ext},
gas::GasMeter,
@@ -201,7 +198,11 @@ where
code_cache::load(code_hash, schedule, gas_meter)
}
fn remove_user(code_hash: CodeHash<T>) -> Result<(), DispatchError> {
fn add_user(code_hash: CodeHash<T>) -> Result<(), DispatchError> {
code_cache::increment_refcount::<T>(code_hash)
}
fn remove_user(code_hash: CodeHash<T>) {
code_cache::decrement_refcount::<T>(code_hash)
}