-
Notifications
You must be signed in to change notification settings - Fork 0
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(core): add timestamp check #72
Conversation
Also make the deployProxyContract task typed, so it's more explicit about the contracts we're supporting and what constructor arguments they need.
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.
The implementation allows for backwards compatibility by not enforcing validation for requests not tracked by this contract (where requestTimestamp = 0). Is this what we want?
This makes sense to me for our reference implementation. If people want to add additional 'freshness' constraints they can implement that in their own core contract or another contract in between.
Motivation
To enhance the security and integrity of the SEDA protocol, we need to ensure that results cannot be posted with timestamps that precede their corresponding requests. This validation prevents potential temporal inconsistencies in the DR (Data Request) lifecycle.
Explanation of Changes
The changes introduce timestamp validation in the SedaCoreV1 contract:
InvalidResultTimestamp
for cases where result timestamps precede request timestampsrequestTimestamps
mapping to track timestamps of pending requestspostRequest
to store the request timestamppostResult
to:InvalidResultTimestamp
if validation failsImportant
The implementation allows for backwards compatibility by not enforcing validation for requests not tracked by this contract (where requestTimestamp = 0). Is this what we want?
Testing
Added new test cases in
test/core/SedaCoreV1.test.ts
:should reject results with invalid timestamps
that:InvalidResultTimestamp
errorRelated PRs and Issues