Tweak Rococo Settings For Onboarding Testing (#2671)

* Tweak Rococo Settings

* rococo: use CurrentBlockRandomness wrapper in auctions

Co-authored-by: André Silva <andrerfosilva@gmail.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
Shawn Tabrizi
2021-03-23 14:35:27 +01:00
committed by GitHub
parent 82fa27d68a
commit fcb215332f
2 changed files with 20 additions and 2 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ pub mod time {
pub const MILLISECS_PER_BLOCK: Moment = 6000; pub const MILLISECS_PER_BLOCK: Moment = 6000;
pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK;
frame_support::parameter_types! { frame_support::parameter_types! {
pub storage EpochDurationInBlocks: BlockNumber = 1 * HOURS; pub storage EpochDurationInBlocks: BlockNumber = 30 * MINUTES;
} }
// These time units are defined in number of blocks. // These time units are defined in number of blocks.
+19 -1
View File
@@ -616,11 +616,29 @@ parameter_types! {
pub const EndingPeriod: BlockNumber = 15 * MINUTES; pub const EndingPeriod: BlockNumber = 15 * MINUTES;
} }
// A wrapper around `babe::CurrentBlockRandomness` that does not return `Option<Random>`.
pub struct CurrentBlockRandomness;
impl Randomness<Hash, BlockNumber> for CurrentBlockRandomness {
fn random(subject: &[u8]) -> (Hash, BlockNumber) {
let (randomness, block_number) =
pallet_babe::CurrentBlockRandomness::<Runtime>::random(subject);
let randomness = randomness.expect(
"only returns None when secondary VRF slots are not enabled; \
secondary VRF slots are enbaled for rococo runtime; \
qed.",
);
(randomness, block_number)
}
}
impl auctions::Config for Runtime { impl auctions::Config for Runtime {
type Event = Event; type Event = Event;
type Leaser = Slots; type Leaser = Slots;
type EndingPeriod = EndingPeriod; type EndingPeriod = EndingPeriod;
type Randomness = pallet_babe::RandomnessFromOneEpochAgo<Runtime>; type Randomness = CurrentBlockRandomness;
type InitiateOrigin = EnsureRoot<AccountId>; type InitiateOrigin = EnsureRoot<AccountId>;
type WeightInfo = auctions::TestWeightInfo; type WeightInfo = auctions::TestWeightInfo;
} }