Skip to content

fix: improve LessThan and adds assert#48

Merged
jbaylina merged 1 commit into
iden3:masterfrom
kobigurk:kobigurk/fix_and_assert_less_than
Aug 24, 2020
Merged

fix: improve LessThan and adds assert#48
jbaylina merged 1 commit into
iden3:masterfrom
kobigurk:kobigurk/fix_and_assert_less_than

Conversation

@kobigurk

Copy link
Copy Markdown
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
Copy Markdown
Member

Please add the assert.

@kobigurk

Copy link
Copy Markdown
Contributor Author

It's there!

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

Successfully merging this pull request may close these issues.

2 participants