Skip to content

[backport][pallet-revive] block.timestamps should return seconds (#7784) #7792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 5, 2025
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_7784.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
title: '[pallet-revive] block.timestamps should return seconds'
doc:
- audience: Runtime Dev
description: |-
In solidity `block.timestamp` should be expressed in seconds
see https://docs.soliditylang.org/en/latest/units-and-global-variables.html#block-and-transaction-properties
crates:
- name: pallet-revive
bump: patch
- name: pallet-revive-uapi
bump: patch
4 changes: 2 additions & 2 deletions substrate/frame/revive/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ pub trait Ext: sealing::Sealed {
/// Returns the value transferred along with this call.
fn value_transferred(&self) -> U256;

/// Returns the timestamp of the current block
/// Returns the timestamp of the current block in seconds.
fn now(&self) -> U256;

/// Returns the minimum balance that is required for creating an account.
Expand Down Expand Up @@ -1796,7 +1796,7 @@ where
}

fn now(&self) -> U256 {
self.timestamp.into()
(self.timestamp / 1000u32.into()).into()
}

fn minimum_balance(&self) -> U256 {
Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/revive/uapi/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ pub trait HostFn: private::Sealed {
salt: Option<&[u8; 32]>,
) -> Result;

/// Load the latest block timestamp into the supplied buffer
/// Load the latest block timestamp in seconds into the supplied buffer
///
/// # Parameters
///
Expand Down
Loading