Skip to content
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 latestTime, increaseTime and duration into a single time helper. #1364

Merged
merged 1 commit into from
Oct 2, 2018

Conversation

nventuro
Copy link
Contributor

Could be considered part of #1362.

@nventuro nventuro added tests Test suite and helpers. breaking change Changes that break backwards compatibility of the public API. labels Sep 28, 2018
@nventuro nventuro added this to the v2.1 milestone Sep 28, 2018
@nventuro nventuro changed the title Merged latestTime, increaseTime and duration into a time helper. Merged latestTime, increaseTime and duration into a single time helper. Sep 28, 2018
this.start = (await latestTime()) + duration.minutes(1); // +1 minute so it starts after contract instantiation
this.cliffDuration = duration.years(1);
this.duration = duration.years(2);
// +1 minute so it starts after contract instantiation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sort of thing feels brittle. I'm not saying we change it here, but now that our eyes are on it, can we think of alternative ways to achieve the same thing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also thinking about how we can make the whole time testing work on an actual node at some point... Perhaps the more robust thing would be to have a mock of a timestamp ts for which ts.greaterThan(now) is always true.

Copy link
Contributor Author

@nventuro nventuro Oct 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't the mock thing need to happen at the node, though? I'm not sure how we can get around the contract executing the TIMESTAMP instruction from the suite.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One idea that's been going around is to have a Time base contract that all contracts inherit which can be swapped out for a mock... See #355.

Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

@nventuro nventuro merged commit 34bc709 into OpenZeppelin:master Oct 2, 2018
@nventuro nventuro deleted the time-helper branch October 2, 2018 10:07
come-maiz pushed a commit that referenced this pull request Oct 21, 2018
@come-maiz come-maiz modified the milestones: v2.1, v2.0 Oct 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Changes that break backwards compatibility of the public API. tests Test suite and helpers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants