Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: improve LessThan and adds assert #48

Merged
merged 1 commit into from
Aug 24, 2020

Conversation

kobigurk
Copy link
Contributor

LessThan at the moment uses Num2Bits(2*n+1), while it practically needs just an extra bit, so it could use n+1 (h/t @jbaylina for noticing that). This is true because the inputs are assumed to be less than or equal to n bits, and so the difference of a and b + 2^n, if a < b, will have the n+1 bit off, which is what we check.

Additionally, n must be <= 252, since Num2Bits can have multiple correct witnesses for num bits >= 254.

@kobigurk kobigurk changed the title fix LessThan and adds assert fix: fix LessThan and adds assert Aug 24, 2020
@kobigurk kobigurk changed the title fix: fix LessThan and adds assert fix: improve LessThan and adds assert Aug 24, 2020
@jbaylina
Copy link
Member

Please add the assert.

@kobigurk
Copy link
Contributor Author

It's there!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants