-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Conversation
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!
(cherry picked from commit 34bc709)
Could be considered part of #1362.