Truffle: Feature Request: add time property to truffle-config.js

Created on 9 Apr 2019  路  5Comments  路  Source: trufflesuite/truffle

Issue

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

Expected Behavior

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"
 ...
};
enhancement help wanted

Most helpful comment

I'd love to take a look at adding this!

All 5 comments

Thanks for the suggestion @pieterhartel, we'll look into what this might entail!

Requirements

  1. Enable the usage of a 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: "*"
    }
  }
};
  1. Throw a helpful Error if genesis_time is not passed a valid Date.
  2. Ensure that the valid genesis_time value is passed as a configurable option internally within truffle before starting a default ganache-core chain for truffle test.
  3. Add an integration mocha test to proper functionality (proper behavior when passed a valid Date and proper error handling when passed an invalid Date).

Prerequisite Context

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.

Was this page helpful?
0 / 5 - 0 ratings