mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 19:47:59 +00:00
Fix flaky staking test (#5812)
* Fix flaky staking test * Better doc * Update frame/staking/src/tests.rs Co-Authored-By: Benjamin Kampmann <ben@gnunicorn.org> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
This commit is contained in:
@@ -74,6 +74,8 @@ pub struct OffchainState {
|
||||
pub local_storage: InMemOffchainStorage,
|
||||
/// Current timestamp (unix millis)
|
||||
pub timestamp: u64,
|
||||
/// A supposedly random seed.
|
||||
pub seed: [u8; 32],
|
||||
}
|
||||
|
||||
impl OffchainState {
|
||||
@@ -165,12 +167,7 @@ impl offchain::Externalities for TestOffchainExt {
|
||||
}
|
||||
|
||||
fn random_seed(&mut self) -> [u8; 32] {
|
||||
use rand::{SeedableRng, RngCore};
|
||||
use rand::rngs::SmallRng;
|
||||
let mut seed = [0u8; 32];
|
||||
let mut small_rng = SmallRng::from_entropy();
|
||||
small_rng.fill_bytes(&mut seed);
|
||||
seed
|
||||
self.0.read().seed
|
||||
}
|
||||
|
||||
fn local_storage_set(&mut self, kind: StorageKind, key: &[u8], value: &[u8]) {
|
||||
|
||||
Reference in New Issue
Block a user