You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
This implementation violates the invariant that the VRGDA should never reach 0 #18
Noticed this during invariant testing of an Art Gobblers adjacent project. As we approach infinity, this implementation rounds down. The conjecture is that it should round up to 1 wei.
changed the title [-]This implementation violates the invariant that the VGRDA should never reach 0[/-][+]This implementation violates the invariant that the VRGDA should never reach 0[/+]on Nov 13, 2022
Looking at the equation, the function should never reach zero. I noticed it because we hit divide by zeros during invariant test and that function rounding up was one of the invariants.
i am a little biased cuz its a bit scary changing things to differ from the gobbler implementation, but i do kinda agree with you
specifically if you, say, wanted to sell something only to people who can get access to some token (say the token is normally soulbound or something) if you round down you allow people without access to that token to purchase
Activity
[-]This implementation violates the invariant that the VGRDA should never reach 0[/-][+]This implementation violates the invariant that the VRGDA should never reach 0[/+]transmissions11 commentedon Nov 14, 2022
i dont think not reaching 0 is necessarily an invariant, whats the use case you have in mind where it needs to round up?
0xAlcibiades commentedon Nov 15, 2022
Looking at the equation, the function should never reach zero. I noticed it because we hit divide by zeros during invariant test and that function rounding up was one of the invariants.
transmissions11 commentedon Nov 15, 2022
we have finite precision, beyond a certain point both rounding up and rounding down are "wrong" behavior mathematically
0xAlcibiades commentedon Nov 15, 2022
Agree, but my conjecture is it's always a non-zero value, and so rounding up is more correct. Agree there is no right choice here though :).
transmissions11 commentedon Nov 16, 2022
i am a little biased cuz its a bit scary changing things to differ from the gobbler implementation, but i do kinda agree with you
specifically if you, say, wanted to sell something only to people who can get access to some token (say the token is normally soulbound or something) if you round down you allow people without access to that token to purchase
transmissions11 commentedon Nov 16, 2022
also iirc this led to some weird behavior in lower elos of monaco
transmissions11 commentedon Nov 16, 2022
@0xAlcibiades if you want to make a PR for this i think i'd be willing to merge it thru 👍
0xAlcibiades commentedon Nov 16, 2022
Alright, let me take a look at that mañana :)
transmissions11 commentedon Nov 16, 2022
awesome <3