question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`block.timestamp` value varies within block

See original GitHub issue

@vzts reported this behavior in truffle 921 - there’s more detail there. In summary it’s unclear what the expected behavior is and @benjamincburns suggested we follow the other major clients, favoring static timestamps if there’s no agreement.

Have just tested intra-block time values on geth dev and Parity POA over 4 calls at 1 second intervals: both have static timestamps.

Will send a PR fixing this at processCall - just opening here in the meantime in case this change would impact any other timing related issues or there are implementation details to consider.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
rudolfixcommented, Sep 24, 2018

Ganache CLI v6.1.8 (ganache-core: 2.2.1) this problem still persists, I’m logging timestamps via events in quite complex transaction and I’m getting different timestamps. apparently they are taken from the system clock each time

2reactions
davidqhrcommented, Jul 3, 2019

@haltman-at Sure. Will create a PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

`block.timestamp` value varies within block · Issue #111 - GitHub
Just wanted to note, just encountered this while adding support for globally-available variables to the debugger. If the transaction was run ...
Read more >
Can block.timestamp value change during execution?
Values such as block.timestamp and block.number are, as expected, based on the block. So one block always has the same data.
Read more >
Block timestamp manipulation attack - Crypto Market Pool
Prevent block timestamp attacks​​ If the scale of your time-dependent event can vary by 15 seconds and maintain integrity, it is safe to...
Read more >
Units and Globally Available Variables - Solidity
The current block timestamp must be strictly larger than the timestamp of the last block, but the only guarantee is that it will...
Read more >
What Is Timestamp Dependence? - Halborn
Block timestamps are flexible, and nodes will accept any timestamp within a certain window. This means that when a smart contract transfers ETH ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found