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 -12
View File
@@ -23,6 +23,7 @@ use frame_support::{
DispatchResultWithPostInfo, PostDispatchInfo, DispatchErrorWithPostInfo, DispatchError,
},
weights::Weight,
DefaultNoBound,
};
use sp_core::crypto::UncheckedFrom;
@@ -73,6 +74,7 @@ pub struct ErasedToken {
pub token: Box<dyn Any>,
}
#[derive(DefaultNoBound)]
pub struct GasMeter<T: Config> {
gas_limit: Weight,
/// Amount of gas left from initial gas limit. Can reach zero.
@@ -82,18 +84,6 @@ pub struct GasMeter<T: Config> {
tokens: Vec<ErasedToken>,
}
impl<T: Config> Default for GasMeter<T> {
fn default() -> Self {
Self {
gas_limit: Default::default(),
gas_left: Default::default(),
_phantom: Default::default(),
#[cfg(test)]
tokens: Default::default(),
}
}
}
impl<T: Config> GasMeter<T>
where
T::AccountId: UncheckedFrom<<T as frame_system::Config>::Hash> + AsRef<[u8]>