mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 05:11:09 +00:00
contracts: Expose rent parameter to contracts (#8231)
* contracts: Expose rent parameter to contracts * 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 * Fix typos * Improve comments * Add rent parameter weights * Allow deploying a new schedule with the same version * Add storage migration for new schedule * Only decode the schedule version in storage migration * Remove confusing docs * Replace original_code_len() by aggregate_code_len() Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
This commit is contained in:
committed by
GitHub
parent
3743cec9bd
commit
a4e8875897
@@ -90,6 +90,7 @@ mod wasm;
|
||||
mod rent;
|
||||
mod benchmarking;
|
||||
mod schedule;
|
||||
mod migration;
|
||||
|
||||
pub mod chain_extension;
|
||||
pub mod weights;
|
||||
@@ -265,6 +266,10 @@ pub mod pallet {
|
||||
Storage::<T>::process_deletion_queue_batch(weight_limit)
|
||||
.saturating_add(T::WeightInfo::on_initialize())
|
||||
}
|
||||
|
||||
fn on_runtime_upgrade() -> Weight {
|
||||
migration::migrate::<T>()
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
@@ -275,14 +280,17 @@ pub mod pallet {
|
||||
{
|
||||
/// Updates the schedule for metering contracts.
|
||||
///
|
||||
/// The schedule must have a greater version than the stored schedule.
|
||||
/// The schedule's version cannot be less than the version of the stored schedule.
|
||||
/// If a schedule does not change the instruction weights the version does not
|
||||
/// need to be increased. Therefore we allow storing a schedule that has the same
|
||||
/// version as the stored one.
|
||||
#[pallet::weight(T::WeightInfo::update_schedule())]
|
||||
pub fn update_schedule(
|
||||
origin: OriginFor<T>,
|
||||
schedule: Schedule<T>
|
||||
) -> DispatchResultWithPostInfo {
|
||||
ensure_root(origin)?;
|
||||
if <Module<T>>::current_schedule().version >= schedule.version {
|
||||
if <Module<T>>::current_schedule().version > schedule.version {
|
||||
Err(Error::<T>::InvalidScheduleVersion)?
|
||||
}
|
||||
Self::deposit_event(Event::ScheduleUpdated(schedule.version));
|
||||
|
||||
Reference in New Issue
Block a user