Expose block number in seal_random (#8329)

* Allow contract callable functions to specify the module

* Add new version of `seal_random`

* Fix overlong lines

* Fix benchmarking code

* Update README.md

* Replace Module by Pallet
This commit is contained in:
Alexander Theißen authored and GitHub committed 2021-03-23 13:48:36 +00:00
1 parent f9b6c869a3
commit 1f911ddb61
7 files changed
+213 -95

No files matched your search

+3 -5
View File
@@ -243,7 +243,7 @@ pub trait Ext: sealing::Sealed {
fn tombstone_deposit(&self) -> BalanceOf<Self::T>;
/// Returns a random number for the current block with the given subject.
fn random(&self, subject: &[u8]) -> SeedOf<Self::T>;
fn random(&self, subject: &[u8]) -> (SeedOf<Self::T>, BlockNumberOf<Self::T>);
/// Deposit an event with the given topics.
///
@@ -845,10 +845,8 @@ where
self.value_transferred
}
fn random(&self, subject: &[u8]) -> SeedOf<T> {
// TODO: change API to expose randomness freshness
// https://github.com/paritytech/substrate/issues/8297
T::Randomness::random(subject).0
fn random(&self, subject: &[u8]) -> (SeedOf<T>, BlockNumberOf<T>) {
T::Randomness::random(subject)
}
fn now(&self) -> &MomentOf<T> {