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:
Davide Galassi
2022-09-23 19:51:57 +02:00
committed by GitHub
parent 71438160a1
commit bf97f2a702
9 changed files with 56 additions and 97 deletions
+1 -13
View File
@@ -50,8 +50,6 @@ pub fn time_until_next_slot(slot_duration: Duration) -> Duration {
pub struct SlotInfo<B: BlockT> {
/// The slot number as found in the inherent data.
pub slot: Slot,
/// Current timestamp as found in the inherent data.
pub timestamp: sp_timestamp::Timestamp,
/// The instant at which the slot ends.
pub ends_at: Instant,
/// The inherent data.
@@ -72,7 +70,6 @@ impl<B: BlockT> SlotInfo<B> {
/// `ends_at` is calculated using `timestamp` and `duration`.
pub fn new(
slot: Slot,
timestamp: sp_timestamp::Timestamp,
inherent_data: InherentData,
duration: Duration,
chain_head: B::Header,
@@ -80,7 +77,6 @@ impl<B: BlockT> SlotInfo<B> {
) -> Self {
Self {
slot,
timestamp,
inherent_data,
duration,
chain_head,
@@ -175,7 +171,6 @@ where
);
}
let timestamp = inherent_data_providers.timestamp();
let slot = inherent_data_providers.slot();
let inherent_data = inherent_data_providers.create_inherent_data()?;
@@ -183,14 +178,7 @@ where
if slot > self.last_slot {
self.last_slot = slot;
break Ok(SlotInfo::new(
slot,
timestamp,
inherent_data,
self.slot_duration,
chain_head,
None,
))
break Ok(SlotInfo::new(slot, inherent_data, self.slot_duration, chain_head, None))
}
}
}