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

This implementation violates the invariant that the VRGDA should never reach 0 #18

Open
0xAlcibiades opened this issue Nov 13, 2022 · 9 comments

Comments

@0xAlcibiades
Copy link

0xAlcibiades commented Nov 13, 2022

image

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.

Credit to @mevbandit @MarcusWentz @horsefacts for the help in discovering this.

image

@0xAlcibiades 0xAlcibiades 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 Nov 13, 2022
@transmissions11
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

we have finite precision, beyond a certain point both rounding up and rounding down are "wrong" behavior mathematically

@0xAlcibiades
Copy link
Author

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
Copy link
Owner

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
Copy link
Owner

also iirc this led to some weird behavior in lower elos of monaco

@transmissions11
Copy link
Owner

@0xAlcibiades if you want to make a PR for this i think i'd be willing to merge it thru 👍

@0xAlcibiades
Copy link
Author

Alright, let me take a look at that mañana :)

@transmissions11
Copy link
Owner

awesome <3

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

No branches or pull requests

2 participants