Skip to content
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

[WIP] spec: The contract has enough funds to pay back everything #169

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gravityblast
Copy link
Collaborator

@gravityblast gravityblast commented Aug 27, 2024

Part of #127

Add a spec to check that the contract balance increases when new storage requests are added.

certora run started from local command:

https://prover.certora.com/output/27938/7c09c206648f4d8d9e26ed839d14f0b1?anonymousKey=40b24d364cac6b8df280b8b9e2bc62551c3bdfdc

@gravityblast gravityblast marked this pull request as draft August 27, 2024 09:15
@gravityblast gravityblast force-pushed the contract-balance-spec branch 3 times, most recently from 412a285 to 854ad2d Compare August 27, 2024 09:42
@@ -191,6 +228,9 @@ invariant cancelledSlotAlwaysHasCancelledRequest(env e, Marketplace.SlotId slotI
currentContract.slotState(e, slotId) == Marketplace.SlotState.Cancelled =>
currentContract.requestState(e, currentContract.slots(e, slotId).requestId) == Marketplace.RequestState.Cancelled;

invariant requestsCountIsGreaterOrEqualToZero()
requestsCount >= 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gravityblast did we see counter examples where we had a negative request count?
Wondering otherwise how useful this invariant is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0x-r4bbit yes we had a run with requestsCount starting with -1 because the init_state axiom works only with invariants, so as discussed with the Certora team we need this invariant to make sure it's not a negative number in the rule

@0x-r4bbit
Copy link
Collaborator

@gravityblast can you rebase this on top of latest master?
It has some fixes now and CI so properly report errors.

@gravityblast gravityblast force-pushed the contract-balance-spec branch from 854ad2d to 0d0215e Compare August 27, 2024 14:15
@gravityblast gravityblast force-pushed the contract-balance-spec branch from 0d0215e to 1e5c8df Compare August 27, 2024 14:38
@gravityblast gravityblast marked this pull request as ready for review August 27, 2024 14:38
@AuHau
Copy link
Member

AuHau commented Aug 29, 2024

Is this ready for review or not? On one hand it is marked as ready for review but at the same time there is [WIP] in the title - I am confused 😅 I would suggest sticking to using the Github draft/ready PR's status to signal if PR is ready for review or not.

@AuHau AuHau marked this pull request as draft December 2, 2024 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants