Skip to content

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

Open

Description

@0xAlcibiades

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

Activity

  1. 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
  2. transmissions11 commented on Nov 14, 2022

    @transmissions11
    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?

  3. 0xAlcibiades commented on Nov 15, 2022

    @0xAlcibiades
    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.

  4. transmissions11 commented on Nov 15, 2022

    @transmissions11
    Owner

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

  5. 0xAlcibiades commented on Nov 15, 2022

    @0xAlcibiades
    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 :).

  6. transmissions11 commented on Nov 16, 2022

    @transmissions11
    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

  7. transmissions11 commented on Nov 16, 2022

    @transmissions11
    Owner

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

  8. transmissions11 commented on Nov 16, 2022

    @transmissions11
    Owner

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

  9. 0xAlcibiades commented on Nov 16, 2022

    @0xAlcibiades
    Author

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

  10. transmissions11 commented on Nov 16, 2022

    @transmissions11
    Owner

    awesome <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions