mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
Independence of Slot-based algorithms from system Timestamp (#12224)
* Remove timestamp from SlotInfo * Expose as millis instead of secs * Nits * Fix test after field removal * Yet another test fix * On the fly timestamp computation * Removed slot timestamp from logs * Removed reference to timestamp from slots subsystem * Slot based algorithm tests do not require timstamp inherent anymore * Remove junk files * Further tests cleanup * Trigger pipeline * Apply code suggestions * Trigger pipeline Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
@@ -43,7 +43,7 @@ use sp_runtime::{
|
||||
generic::{Digest, DigestItem},
|
||||
traits::Block as BlockT,
|
||||
};
|
||||
use sp_timestamp::InherentDataProvider as TimestampInherentDataProvider;
|
||||
use sp_timestamp::Timestamp;
|
||||
use std::{cell::RefCell, task::Poll, time::Duration};
|
||||
|
||||
type Item = DigestItem;
|
||||
@@ -68,6 +68,8 @@ type Mutator = Arc<dyn Fn(&mut TestHeader, Stage) + Send + Sync>;
|
||||
type BabeBlockImport =
|
||||
PanickingBlockImport<crate::BabeBlockImport<TestBlock, TestClient, Arc<TestClient>>>;
|
||||
|
||||
const SLOT_DURATION_MS: u64 = 1000;
|
||||
|
||||
#[derive(Clone)]
|
||||
struct DummyFactory {
|
||||
client: Arc<TestClient>,
|
||||
@@ -239,7 +241,7 @@ pub struct TestVerifier {
|
||||
dyn CreateInherentDataProviders<
|
||||
TestBlock,
|
||||
(),
|
||||
InherentDataProviders = (TimestampInherentDataProvider, InherentDataProvider),
|
||||
InherentDataProviders = (InherentDataProvider,),
|
||||
>,
|
||||
>,
|
||||
>,
|
||||
@@ -321,13 +323,11 @@ impl TestNetFactory for BabeTestNet {
|
||||
client: client.clone(),
|
||||
select_chain: longest_chain,
|
||||
create_inherent_data_providers: Box::new(|_, _| async {
|
||||
let timestamp = TimestampInherentDataProvider::from_system_time();
|
||||
let slot = InherentDataProvider::from_timestamp_and_slot_duration(
|
||||
*timestamp,
|
||||
SlotDuration::from_millis(6000),
|
||||
Timestamp::current(),
|
||||
SlotDuration::from_millis(SLOT_DURATION_MS),
|
||||
);
|
||||
|
||||
Ok((timestamp, slot))
|
||||
Ok((slot,))
|
||||
}),
|
||||
config: data.link.config.clone(),
|
||||
epoch_changes: data.link.epoch_changes.clone(),
|
||||
@@ -433,13 +433,11 @@ fn run_one_test(mutator: impl Fn(&mut TestHeader, Stage) + Send + Sync + 'static
|
||||
env: environ,
|
||||
sync_oracle: DummyOracle,
|
||||
create_inherent_data_providers: Box::new(|_, _| async {
|
||||
let timestamp = TimestampInherentDataProvider::from_system_time();
|
||||
let slot = InherentDataProvider::from_timestamp_and_slot_duration(
|
||||
*timestamp,
|
||||
SlotDuration::from_millis(6000),
|
||||
Timestamp::current(),
|
||||
SlotDuration::from_millis(SLOT_DURATION_MS),
|
||||
);
|
||||
|
||||
Ok((timestamp, slot))
|
||||
Ok((slot,))
|
||||
}),
|
||||
force_authoring: false,
|
||||
backoff_authoring_blocks: Some(BackoffAuthoringOnFinalizedHeadLagging::default()),
|
||||
|
||||
Reference in New Issue
Block a user