iden3 / circuits

Circom circuits used by the iden3 core protocol.
GNU General Public License v3.0
81 stars 14 forks source link

Can LessThan254 template be simplified? #92

Closed nedgar closed 4 months ago

nedgar commented 1 year ago

In the comparators, the LessThan254 template has a component hiBitGt = GreaterThan(4) for comparing the high two bits (not four) but it looks like this is redundant. The output is calculated as out <== (hiBitEq.out * lt.out) + (hiBitLt.out * 1) + (hiBitGt.out * 0), where hiBitGt.out * 0 will always be 0. Can this be simplified to just: out <== (hiBitEq.out * lt.out) + (hiBitLt.out * 1)?

FYI @OBrezhniev

nedgar commented 1 year ago

FYI @vmidyllic

vmidyllic commented 1 year ago

@OBrezhniev

OBrezhniev commented 1 year ago

@vmidyllic I talked with @nedgar on that matter. I will take a look on this in scope of coming circuit improvements.