Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Use correct timestamp for the inherent #841

Closed
bkchr opened this issue Dec 8, 2021 · 1 comment · Fixed by #2573
Closed

Use correct timestamp for the inherent #841

bkchr opened this issue Dec 8, 2021 · 1 comment · Fixed by #2573
Assignees
Labels
I3-bug The node fails to follow expected behavior.

Comments

@bkchr
Copy link
Member

bkchr commented Dec 8, 2021

We are currently using the default sp_timestamp::InherentDataProvider::from_system_time() call to get the timestamp that will be passed into the runtime. The problem with that is that we are building blocks as the "relay chain" tells us, this means that we may start some time before the actual slot. This can lead to using the same slot two times, because we just do timestamp / slot_duration. The solution to this, is as we do it while validating the block. We should just use the relay chain slot to calculate the correct timestamp for the parachain (relay_chain_slot * relay_chain_slot_duration).

To implement this, we should create a trait:

trait TimestampInherentDataExt {
    fn from_relay_chain(relay_header: &Header) -> Self;
}

And implement it for the sp_timestamp::InherentDataProvider. Then we can use this in the service to construct the correct timestamp inherent.

@the-right-joyce the-right-joyce added I3-bug The node fails to follow expected behavior. and removed F2-bug 🐜 labels Aug 12, 2022
@rphmeier rphmeier self-assigned this May 17, 2023
@rphmeier
Copy link
Contributor

I will tackle the core issue but in a different way - amending the unstable_reimpl of Aura introduced in #2382 to draw the timestamp and slot out of the relay-parent.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I3-bug The node fails to follow expected behavior.
Projects
Status: done
Development

Successfully merging a pull request may close this issue.

3 participants