contracts: Add seal_rent_status (#8780)

* Move public functions up in rent.rs

* Added RentStatus

* Fix test name for consistency

Co-authored-by: Michael Müller <michi@parity.io>

* Mark rent functions as unstable

* Add unstable interfaces to README

* Fix doc typos

Co-authored-by: Andrew Jones <ascjones@gmail.com>

* Use DefaultNoBound

* Simplify calc_share(1)

* Don't output empty debug messages

* Make `seal_debug_message` unstable

Co-authored-by: Michael Müller <michi@parity.io>
Co-authored-by: Andrew Jones <ascjones@gmail.com>
This commit is contained in:
Alexander Theißen
2021-05-20 14:01:43 +02:00
committed by GitHub
parent f29a6fdad3
commit 0057c0b53f
17 changed files with 1380 additions and 1109 deletions
+2 -16
View File
@@ -23,7 +23,7 @@ use crate::{Config, weights::WeightInfo};
#[cfg(feature = "std")]
use serde::{Serialize, Deserialize};
use pallet_contracts_proc_macro::{ScheduleDebug, WeightDebug};
use frame_support::weights::Weight;
use frame_support::{DefaultNoBound, weights::Weight};
use sp_std::{marker::PhantomData, vec::Vec};
use codec::{Encode, Decode};
use parity_wasm::elements;
@@ -46,7 +46,7 @@ pub const INSTR_BENCHMARK_BATCH_SIZE: u32 = 1_000;
/// should rely on public functions of this type.
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "std", serde(bound(serialize = "", deserialize = "")))]
#[derive(Clone, Encode, Decode, PartialEq, Eq, ScheduleDebug)]
#[derive(Clone, Encode, Decode, PartialEq, Eq, ScheduleDebug, DefaultNoBound)]
pub struct Schedule<T: Config> {
/// Describes the upper limits on various metrics.
pub(crate) limits: Limits,
@@ -388,9 +388,6 @@ pub struct HostFnWeights<T: Config> {
/// Weight per byte hashed by `seal_hash_blake2_128`.
pub hash_blake2_128_per_byte: Weight,
/// Weight of calling `seal_rent_params`.
pub rent_params: Weight,
/// The type parameter is used in the default implementation.
#[codec(skip)]
pub _phantom: PhantomData<T>
@@ -473,16 +470,6 @@ macro_rules! cost_byte_batched {
}
}
impl<T: Config> Default for Schedule<T> {
fn default() -> Self {
Self {
limits: Default::default(),
instruction_weights: Default::default(),
host_fn_weights: Default::default(),
}
}
}
impl Default for Limits {
fn default() -> Self {
Self {
@@ -619,7 +606,6 @@ impl<T: Config> Default for HostFnWeights<T> {
hash_blake2_256_per_byte: cost_byte_batched!(seal_hash_blake2_256_per_kb),
hash_blake2_128: cost_batched!(seal_hash_blake2_128),
hash_blake2_128_per_byte: cost_byte_batched!(seal_hash_blake2_128_per_kb),
rent_params: cost_batched!(seal_rent_params),
_phantom: PhantomData,
}
}