Skip to content

Conversation

@yueawang
Copy link
Owner

Make some changes according to doc description:

specifically, x is negative if the (b − 1)-bit encoding of x is lexicographically larger than the (b − 1)-bit encoding of −x.

and

This encoding is also used to define a b-bit encoding of each element (x, y) ∈ E as a b-bit string (x, y), namely the (b − 1)-bit encoding of y followed by a sign bit; the sign bit is 1 if and only if x is negative.

Signed-off-by: yue.wang <yue.wang@loopring>
@Brechtpd
Copy link

Brechtpd commented Sep 30, 2020

Looks correct to me.

Seems like the ethsnarks code depends on x being odd/even for the compression instead of positive/negative but I don't know what the theory behind that would be and I don't know if that would work. I remember trying a couple of things out that didn't work out, not sure if this is one of them. I guess safer in any case to just follow the paper.

@yueawang
Copy link
Owner Author

yueawang commented Oct 1, 2020

Let me ask Harry for the reason. HarryR#165

Signed-off-by: yue.wang <yue.wang@loopring>
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.

3 participants