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

Missing Spec Challenge #7

Open
imsrybr0 opened this issue Sep 27, 2023 · 5 comments
Open

Missing Spec Challenge #7

imsrybr0 opened this issue Sep 27, 2023 · 5 comments
Labels
Acknowledged valid solution - eligible for reward

Comments

@imsrybr0
Copy link

@Czar102
Copy link

Czar102 commented Sep 27, 2023

That's a cool idea, but the spec doesn't pass for me for the original Borda contract (in case above a sanity check failed, those happen weirdly too often with advanced sanity checks…)

@imsrybr0
Copy link
Author

imsrybr0 commented Sep 27, 2023

You're right, my bad, I ended up pushing a version of the spec where I was testing a bidirectional assertion. Can you try it again with one direction ?

EDIT :

Alternatively, you can also make the bidirectional assertion work by excluding the scenario where one of the voted addresses is the current winner :

rule drawFavorsWinner(env e, address f, address s, address t) {
    address w1 = winner(e);

    require w1 != f;
    require w1 != s;
    require w1 != t;
    
    uint256 w1Points = points(e, w1);
    
    vote(e, f, s, t);
    
    address w2 = winner(e);

    assert w1 != w2 <=> points(e, f) > w1Points || points(e, s) > w1Points || points(e, t) > w1Points;
}

BordaMissingRule.spec on BordaNewBug.sol : https://prover.certora.com/output/33434/66897f307df7434dbcdbfeb03b7449d7/?anonymousKey=2251d7073b13a48c5b2c0a0a15a761e6fbb13e77

BordaMissingRule.spec on the original Borda.sol : https://prover.certora.com/output/33434/5dab7bac84e84517b3a8a11da7d0060b/?anonymousKey=c0fc2b49c30730275a24f1b0ccfba0b6d83677f3

@Czar102
Copy link

Czar102 commented Sep 28, 2023

Because this didn't work for me, I made #12 instead. Would you agree that it's more general?

@imsrybr0
Copy link
Author

Both of the rules above work (you can check the runs for more details). Can you share links to runs where it didn't work for you?

As for your rule set, I tried it and it seems to catch the bug introduced by my mutation as well 👍

@nd-certora
Copy link
Contributor

Nice work, this is missing spec #2.

@nd-certora nd-certora added the Acknowledged valid solution - eligible for reward label Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Acknowledged valid solution - eligible for reward
Projects
None yet
Development

No branches or pull requests

3 participants