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

feat: standardized timestamp comparison #72

Merged
merged 4 commits into from
Nov 4, 2024

Conversation

0xShaito
Copy link
Member

@0xShaito 0xShaito commented Oct 23, 2024

🤖 Linear

Closes OPO-668
Closes OPO-664

Copy link

linear bot commented Oct 23, 2024

if (block.timestamp <= _revealStartTime) revert PrivateERC20ResolutionModule_OnGoingCommittingPhase();
if (block.timestamp > _revealEndTime) revert PrivateERC20ResolutionModule_RevealingPhaseOver();
if (block.timestamp < _revealStartTime) revert PrivateERC20ResolutionModule_OnGoingCommittingPhase();
if (block.timestamp >= _revealEndTime) revert PrivateERC20ResolutionModule_RevealingPhaseOver();
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about forcing the use of < and inverting this comparison?

if (_revealEndTime < block.timestamp) revert PrivateERC20ResolutionModule_RevealingPhaseOver();

Copy link
Member Author

Choose a reason for hiding this comment

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

I decided to leave it like this to always have the timestamp in the left side of the comparison. I think it's easier to read like that

Copy link
Contributor

Choose a reason for hiding this comment

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

Understandable.

I agree it's easier to read, but it also forces me to think properly.

xorsal
xorsal previously approved these changes Oct 23, 2024
@@ -173,7 +177,7 @@ contract PrivateERC20ResolutionModule_Unit_CommitVote is BaseTest {
votingToken: token,
minVotesForQuorum: 1,
committingTimeWindow: 40_000,
Copy link
Contributor

Choose a reason for hiding this comment

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

would it make sense to use a constant for the committing window as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added

Copy link

linear bot commented Oct 24, 2024

@gas1cent gas1cent requested a review from xorsal November 4, 2024 19:44
@gas1cent gas1cent merged commit 7d7a76d into dev Nov 4, 2024
3 checks passed
@gas1cent gas1cent deleted the feat/standardized-timestamp-comparison branch November 4, 2024 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants