-
Notifications
You must be signed in to change notification settings - Fork 14
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
[TOB] DEV-3794: Expiry Check on collateral reads via PCCSRouter #19
Open
preston4896
wants to merge
3
commits into
main
Choose a base branch
from
DEV-3794
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Comment on lines
+310
to
+316
function _loadDataIfNotExpired(bytes32 key, address dao, uint256 timestamp) private view returns (bool valid) { | ||
bytes4 COLLATERAL_VALIDITY_SELECTOR = 0x3e960426; | ||
(bool success, bytes memory ret) = dao.staticcall(abi.encodeWithSelector(COLLATERAL_VALIDITY_SELECTOR, key)); | ||
require(success, "Failed to determine collateral validity"); | ||
(uint64 issuedAt, uint64 expiredAt) = abi.decode(ret, (uint64, uint64)); | ||
valid = timestamp >= issuedAt || timestamp <= expiredAt; | ||
} |
Check notice
Code scanning / Slither
Block timestamp Low
PCCSRouter._loadDataIfNotExpired(bytes32,address,uint256) uses timestamp for comparisons
Dangerous comparisons:
- valid = timestamp >= issuedAt || timestamp <= expiredAt
Dangerous comparisons:
- valid = timestamp >= issuedAt || timestamp <= expiredAt
Comment on lines
+310
to
+316
function _loadDataIfNotExpired(bytes32 key, address dao, uint256 timestamp) private view returns (bool valid) { | ||
bytes4 COLLATERAL_VALIDITY_SELECTOR = 0x3e960426; | ||
(bool success, bytes memory ret) = dao.staticcall(abi.encodeWithSelector(COLLATERAL_VALIDITY_SELECTOR, key)); | ||
require(success, "Failed to determine collateral validity"); | ||
(uint64 issuedAt, uint64 expiredAt) = abi.decode(ret, (uint64, uint64)); | ||
valid = timestamp >= issuedAt || timestamp <= expiredAt; | ||
} |
Check warning
Code scanning / Slither
Low-level calls Warning
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes made in this PR:
block.timestamp
is used.block.timestamp
or with a specified timestamp by calling*withTimestamp()
methods.verifyAndAttestWithZKProof
no longer bypasses thetimestamp
value provided in the Output data.timestamp
is then passed onto*withTimestamp()
methods to check the expiration status of corresponding collaterals.This PR partially addresses issue ID-5.