This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 684
feat: add miner.timestampIncrement
option
#3131
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
miner.timestampIncrement
option
jeffsmale90
suggested changes
May 29, 2022
Should we open a PR on https://github.com/mds1/convex-shutdown-simulation to use this new configuration? |
We will update it, yes. |
MicaiahReid
suggested changes
May 31, 2022
af662ab
to
bf9cfbd
Compare
jeffsmale90
approved these changes
May 31, 2022
MicaiahReid
approved these changes
May 31, 2022
miner.timestampIncrement
optionminer.timestampIncrement
option
e31e0d4
to
d23d2ff
Compare
MicaiahReid
suggested changes
Jun 2, 2022
Co-authored-by: Micaiah Reid <micaiahreid@gmail.com>
16d6c66
to
e51f359
Compare
jeffsmale90
reviewed
Jun 3, 2022
5e0a653
to
7afd2ab
Compare
MicaiahReid
approved these changes
Jun 3, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
By default ganache uses the system clock time for automatically mined blocks. This behavior is convenient, but results in nondeterminism, invalid block timestamps*, and can cause issues with relative block timestamp dependent contracts and tests. There were workarounds for all of these issues (by manually mining via
evm_mine({timestamp})
) but a built in solution was clearly necessary.Ganache now permits the use of a new
--miner.timestampIncrement
option which can be used to set the amount of seconds between consecutive blocks, regardless of how much system time has passed. The default value, "clock", retains the previous default behavior of using the system time for each block.The following example will start ganache instructing it to increment each new block's timestamp by
1
second from 1649736000000:$ ganache --time 1649736000000 --miner.timestampIncrement=1
* The Ethereum Yellowpaper defines:$H_S > P(H)_{H_S}$ where $H_S$ is the timestamp of Block $H$ and $P(H)$ is the parent block.