mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 10:27:59 +00:00
contracts: Add set_code root dispatchable (#11451)
* Add `set_code` dispatchable * cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --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 Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
committed by
GitHub
parent
bd225c7938
commit
b3b7b4ddc7
@@ -391,6 +391,20 @@ benchmarks! {
|
||||
assert!(<Contract<T>>::code_removed(&hash));
|
||||
}
|
||||
|
||||
set_code {
|
||||
let instance = <Contract<T>>::with_caller(
|
||||
whitelisted_caller(), WasmModule::dummy(), vec![],
|
||||
)?;
|
||||
// we just add some bytes so that the code hash is different
|
||||
let WasmModule { code, hash, .. } = <WasmModule<T>>::dummy_with_bytes(128);
|
||||
<Contracts<T>>::store_code_raw(code, instance.caller.clone())?;
|
||||
let callee = instance.addr.clone();
|
||||
assert_ne!(instance.info()?.code_hash, hash);
|
||||
}: _(RawOrigin::Root, callee, hash)
|
||||
verify {
|
||||
assert_eq!(instance.info()?.code_hash, hash);
|
||||
}
|
||||
|
||||
seal_caller {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
|
||||
Reference in New Issue
Block a user