Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions prdoc/pr_5055.prdoc
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be renamed to pr_5459 so satisfy the prdoc check?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, it is better to leave the original prdoc name, otherwise it leads to the conflicts, when the changes are backported back to master

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is already on master, so we don't need to backport it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I also don't see any problem to link to the original pr.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the change itself, I usually move the prdocs into release related folder like prdoc/1.15.1 so that those changes does not appear in the next release. And push it back to master with the version bumps.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then maybe we should disable the PRDoc check on backport (stable*) branches as it's expected to fail.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
title: Only log error in `UnixTime::now` call of the pallet-timestamp implementation if called at genesis

doc:
- audience: Runtime Dev
description: |
This minor patch re-introduces a check to ensure that the `UnixTime::now` implementation in the timestamp only
logs an error if called at the genesis block.

crates:
- name: pallet-timestamp
bump: patch
10 changes: 6 additions & 4 deletions substrate/frame/timestamp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,12 @@ impl<T: Config> UnixTime for Pallet<T> {
// `sp_timestamp::InherentDataProvider`.
let now = Now::<T>::get();

log::error!(
target: "runtime::timestamp",
"`pallet_timestamp::UnixTime::now` is called at genesis, invalid value returned: 0",
);
if now == T::Moment::zero() {
log::error!(
target: "runtime::timestamp",
"`pallet_timestamp::UnixTime::now` is called at genesis, invalid value returned: 0",
);
}

core::time::Duration::from_millis(now.saturated_into::<u64>())
}
Expand Down