Unverified Commit bc5fe36c authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

Make sure we generate a valid slot in tests (#2520)

Currently the first last timestamp is `0` and that leads to the first
slot being `0` which is reserved for genesis. There is some debug assert
in BABE that complains about this in Cumulus :D
parent 08370e9e
Pipeline #125697 canceled with stages
in 11 minutes and 35 seconds
......@@ -62,7 +62,13 @@ impl InitPolkadotBlockBuilder for Client {
let minimum_period = BasicExternalities::new_empty()
.execute_with(|| polkadot_test_runtime::MinimumPeriod::get());
let timestamp = last_timestamp + minimum_period;
let timestamp = if last_timestamp == 0 {
.expect("Time is always after UNIX_EPOCH; qed")
.as_millis() as u64
} else {
last_timestamp + minimum_period
// `SlotDuration` is a storage parameter type that requires externalities to access the value.
let slot_duration = BasicExternalities::new_empty()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment