-
Notifications
You must be signed in to change notification settings - Fork 17
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
Safe cast stragglers #978
Safe cast stragglers #978
Conversation
# Conflicts: # pkg/vault/test/.contract-sizes/VaultAdmin
# Conflicts: # pkg/pool-weighted/test/gas/.hardhat-snapshots/[WeightedPool - ERC4626 - BatchRouter] swapExactIn - no buffer liquidity - warm slots # pkg/pool-weighted/test/gas/.hardhat-snapshots/[WeightedPool - Standard] add liquidity single token exact out - warm slots # pkg/pool-weighted/test/gas/.hardhat-snapshots/[WeightedPool - Standard] add liquidity unbalanced - warm slots # pkg/vault/test/.contract-sizes/VaultAdmin
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.
Thanks @EndymionJkb; just one question, otherwise LGTM.
@@ -14,6 +16,8 @@ pragma solidity ^0.8.24; | |||
* When the buffer period expires, it will unpause automatically, and remain permissionless forever after. | |||
*/ | |||
contract FactoryWidePauseWindow { | |||
using SafeCast for *; |
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.
Hmm where are we using this?
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.
Removed... it was used to case the timestamp in the getNewPoolPauseWindowEndTime
function, but then I realized that would revert when it overflowed (in 2106, but still...), but the inequality would still work, so as it is now it will return 0 after 2106 instead of reverting, as it should. No longer needed the cast, but forgot to remove it.
Truncating is worse - it could re-pause itself after 2106.
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.
LGTM!
Description
Looking through the issues, was about to close 181 (since the comment it references is long gone), and thought I'd check for any unsafe casts. We'd recently gone through and added SafeCasts as a result of auditor comments. There were a couple very obscure cases still uncovered (outside tests).
Type of change
Checklist:
main
, or there's a description of how to mergeIssue Resolution
Closes #181