-
Notifications
You must be signed in to change notification settings - Fork 41
fix(contract): make mock attestations cleanable via expiry #3785
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
Merged
Changes from 6 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a4dc1bd
docs(contract): ignore README doctest with undefined attestation types
barakeinav1 7257900
fix(contract): make mock attestations cleanable via expiry
barakeinav1 7ab2904
fix(node): recognize expiry-stamped mock attestations across upgrade
barakeinav1 42b6ead
chore(node): link mock-identity fallback to follow-up #3786
barakeinav1 36e7177
refactor(contract): simplify legacy-mock migration and add with_expir…
barakeinav1 5f2eb20
Merge origin/main into fix/3293-mock-attestation-cleanup
barakeinav1 f7f0d1f
fix(contract): cap accepted mock expiry at the contract default
barakeinav1 907a5a2
test(contract): submitting an oversized mock expiry is capped and sta…
barakeinav1 a874994
docs(mock-attestation): address AI review comments
barakeinav1 edb73f6
test(contract): fix get_attestation sandbox tests for capped mock expiry
barakeinav1 14b14d2
docs(mock-attestation): note mock expiry only caps (vs Dstack full ow…
barakeinav1 1330b2f
docs(mock-attestation): point deferred-alignment TODO at tracking iss…
barakeinav1 d994389
refactor(mock-attestation): address review
barakeinav1 ad85d0b
fix(mock-attestation): restore TODO(#3978) and fix todo-format check
barakeinav1 1e4b663
refactor(mock-attestation): rename with_expiry -> with_expiry_capped_at
barakeinav1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
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 definitely not a fan of overwriting the inner expiry timestamp on the
verifycall. This feels like it opens the door to bugs and risks, but I see you raised #4005 to tackle this so I won't consider it a hard blocker.Uh oh!
There was an error while loading. Please reload this page.
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.
I don't think the location of this is wrong.
After verifying an attestation, we store it. In this case we cap the expiry at our default
now + DEFAULT_EXPIRATION_DURATION_SECONDS(if the submitted one was larger). This is deliberate: it stops a submitter from storing an arbitrarily long, uncleanable expiry (the goal of this PR).For dstack we always set
now + DEFAULT_EXPIRATION_DURATION_SECONDS, since extracting the actual expiry from the cert chain was hard (#1639).#4005 is meant to align both dstack/mock to the same logic.
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.
Ah right I see the
.with_expirymethod performs a min between the existing expiry and the cap. That's a bit confusing though. I'd expect.with_expiryto be a plain setter. Perhaps worth renaming it to.cap_expiry()or something similar?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 call — renamed
with_expiry→with_expiry_capped_atin 1e4b663 (method + both call sites + tests), so it no longer reads as a pure setter. If #4005 later makes it a true override (contract owns the expiry outright, Dstack-style), it'd go back to a plainwith_expiry.