Ganache-core and ganache-cli have options to set a specific time stamp on the genesis block, but there is no way to specify this in a truffle-config.js
Adding a genesis_time property as suggested below would enable truffle test to start the default ganache-core with the appropriate time.
module.exports = {
...
genesis_time: "2019-04-09T02:10:14Z"
...
};
Thanks for the suggestion @pieterhartel, we'll look into what this might entail!
genesis_time property in a given truffle-config.js.Example:
module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 8545,
genesis_time: "2019-04-09T02:10:14Z",
network_id: "*"
}
}
};
Error if genesis_time is not passed a valid Date.genesis_time value is passed as a configurable option internally within truffle before starting a default ganache-core chain for truffle test.Date and proper error handling when passed an invalid Date).ganache-core is expecting on its side for setting a genesis block time: https://github.com/trufflesuite/ganache-core#optionstruffle test: https://github.com/trufflesuite/truffle/blob/develop/packages/truffle-core/lib/commands/test.js, specifically these lines.ganache-core in testing: https://github.com/trufflesuite/truffle/blob/develop/packages/truffle-environment/chain.jstruffle test sequence): https://github.com/trufflesuite/truffle/blob/develop/packages/truffle-environment/environment.jstruffle test integration tests, i.e. https://github.com/trufflesuite/truffle/blob/develop/packages/truffle/test/scenarios/happy_path/happypath.js, particularly these lines.I'd love to take a look at adding this!
@krsnnik Let us know if you have any questions about this. Good luck!
Released the PR for this in v5.0.29! Try it out and let us know how it works for you!
Thanks! Closing this for housekeeping.
Most helpful comment
I'd love to take a look at adding this!