Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Tutorial 8 - invariant doesn't hold in Sparta protocol #5

Open
Roy-Certora opened this issue Mar 31, 2022 · 0 comments
Open

Tutorial 8 - invariant doesn't hold in Sparta protocol #5

Roy-Certora opened this issue Mar 31, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Roy-Certora
Copy link

If one tries to check the invariant:
"For both token0 and token1 the balance of the system is at least as much as the reserves.",
in the Sparta pool protocol, one will get failure after invoking the "remove_liquidity" function.
The bug described in the tutorial is fixed by adding a sync() invocation at the beginning of the function,
yet it is not enough to ensure the invariant holds.
My solution was adding a second sync() in the end of "remove_liquidity" as well.

It is probably wise to add the sync() invocation at the end of "swap" as well, to solve the same issue (invariant won't pass).

@Roy-Certora Roy-Certora added the bug Something isn't working label Mar 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant