contracts: Refactor the exec module (#8604)

* contracts: Add default implementation for Executable::occupied_storage()

* contracts: Refactor the exec module

* Let runtime specify the backing type of the call stack

This removes the need for a runtime check of the specified
`MaxDepth`. We can now garantuee that we don't need to
allocate when a new call frame is pushed.

* Fix doc typo

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

* cargo run --release --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

* Review nits

* Fix defect in contract info caching behaviour

* Add more docs

* Fix wording and typos

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
This commit is contained in:
Alexander Theißen
2021-05-07 14:37:30 +02:00
committed by GitHub
parent 17a1997d18
commit 9e894ce135
15 changed files with 2064 additions and 1862 deletions
@@ -137,7 +137,7 @@ where
// in the storage.
//
// We need to re-instrument the code with the latest schedule here.
gas_meter.charge(&(), InstrumentToken(prefab_module.original_code_len))?;
gas_meter.charge(InstrumentToken(prefab_module.original_code_len))?;
private::reinstrument(&mut prefab_module, schedule)?;
}
}
@@ -194,9 +194,7 @@ fn increment_64(refcount: &mut u64) {
struct InstrumentToken(u32);
impl<T: Config> Token<T> for InstrumentToken {
type Metadata = ();
fn calculate_amount(&self, _metadata: &Self::Metadata) -> Weight {
fn weight(&self) -> Weight {
T::WeightInfo::instrument(self.0 / 1024)
}
}