Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

replaces full bit decomposition by rshift in emulated/assertIsEqual #354

Merged
merged 1 commit into from
Aug 3, 2022

Conversation

gbotrel
Copy link
Collaborator

@gbotrel gbotrel commented Aug 3, 2022

In emulated/assertLimbEquality, previously we had:

		diffBits := bits.ToBinary(api, diff, bits.WithNbDigits(int(nbBits+nbCarryBits+1)), bits.WithUnconstrainedOutputs())
		for j := uint(0); j < nbBits; j++ {
			api.AssertIsEqual(diffBits[j], 0)
		}
		carry = bits.FromBinary(api, diffBits[nbBits:nbBits+nbCarryBits+1])

but the bits in the binary decomposition comes from a hint; so having the "lowest bits" always constrain to 0 and not using them later on in the circuit, is a waste; it's "we have a input wire in the circuit that must always be 0" --> we don't need it.

Instead this PR replaces this by a "clean" rshift; it is essentially the same code but discard the low bits in the binary decomposition.

@gbotrel gbotrel added consolidate strengthen an existing feature perf labels Aug 3, 2022
@gbotrel gbotrel added this to the v0.8.0 milestone Aug 3, 2022
@gbotrel gbotrel requested a review from ivokub August 3, 2022 14:06
Copy link
Collaborator

@ivokub ivokub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks 👍.

@gbotrel gbotrel merged commit 8e80058 into develop Aug 3, 2022
@gbotrel gbotrel deleted the feat/emulated/rshift branch August 3, 2022 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consolidate strengthen an existing feature perf
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants