-
Couldn't load subscription status.
- Fork 31
chore(marketplace): use canMarkProofAsMissing #1188
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -189,7 +189,46 @@ ethersuite "On-Chain Market": | |
| let missingPeriod = | ||
| periodicity.periodOf((await ethProvider.currentTime()).truncate(uint64)) | ||
| await advanceToNextPeriod() | ||
| check (await market.canProofBeMarkedAsMissing(slotId, missingPeriod)) == true | ||
| check (await market.canMarkProofAsMissing(slotId, missingPeriod)) == true | ||
|
|
||
| test "can check whether a proof cannot be marked as missing when the slot is free": | ||
| let slotId = slotId(request, slotIndex) | ||
| await market.requestStorage(request) | ||
| await market.reserveSlot(request.id, slotIndex) | ||
| await market.fillSlot(request.id, slotIndex, proof, request.ask.collateralPerSlot) | ||
| await waitUntilProofRequired(slotId) | ||
|
|
||
| await market.freeSlot(slotId(request.id, slotIndex)) | ||
|
|
||
| let missingPeriod = | ||
| periodicity.periodOf((await ethProvider.currentTime()).truncate(uint64)) | ||
| await advanceToNextPeriod() | ||
| check (await market.canMarkProofAsMissing(slotId, missingPeriod)) == false | ||
|
|
||
| test "can check whether a proof cannot be marked as missing before a proof is required": | ||
| let slotId = slotId(request, slotIndex) | ||
|
Comment on lines
+208
to
+209
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Considering that each test starts off at the exact same point and assuming that the block hashes will always be deterministic, this test SHOULD work every time, but there may be a chance that there is a proof required as soon as the slot is filled. |
||
| await market.requestStorage(request) | ||
| await market.reserveSlot(request.id, slotIndex) | ||
| await market.fillSlot(request.id, slotIndex, proof, request.ask.collateralPerSlot) | ||
|
|
||
| let missingPeriod = | ||
| periodicity.periodOf((await ethProvider.currentTime()).truncate(uint64)) | ||
| await advanceToNextPeriod() | ||
| check (await market.canMarkProofAsMissing(slotId, missingPeriod)) == false | ||
|
|
||
| test "can check whether a proof cannot be marked as missing if the proof was submitted": | ||
| let slotId = slotId(request, slotIndex) | ||
| await market.requestStorage(request) | ||
| await market.reserveSlot(request.id, slotIndex) | ||
| await market.fillSlot(request.id, slotIndex, proof, request.ask.collateralPerSlot) | ||
| await waitUntilProofRequired(slotId) | ||
|
|
||
| await market.submitProof(slotId(request.id, slotIndex), proof) | ||
|
|
||
| let missingPeriod = | ||
| periodicity.periodOf((await ethProvider.currentTime()).truncate(uint64)) | ||
| await advanceToNextPeriod() | ||
| check (await market.canMarkProofAsMissing(slotId, missingPeriod)) == false | ||
|
|
||
| test "supports slot filled subscriptions": | ||
| await market.requestStorage(request) | ||
|
|
||
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.
Maybe we should add a test that checks if a proof is required before the slot is filled (also free)
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'm not sure it's really useful, because if a slot isn't filled, we are not able to call
waitUntilProofRequiredwhich is almost the same situation as in the test "can check whether a proof cannot be marked as missing before a proof is required", no ?