Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Disclaimer: This pull request has been made against
main
and notdevelop
since the latter is unmaintained, while the former has recent updates.Motivations
Allowing bigger inputs increases the landscape of domains in which
bulletproofs
can be used.We increased the
bitsize
to 128 and replaced theu64
type withu128
in many places within the code.We also decided to support
Scalar
as input value, and we decided to implement it as a feature of the library, which can be enabled withscalar_range_proof
. Also in this case we had to modify the code such thatScalar
could be accepted. To supportScalar
we had to implement the extraction of a single bit from aScalar
.Our implementation of the above consists in an indexing of the
Scalar
's underlying array of bytes, followed by a shift and mask of the appropriate byte. In both cases where this operation is used, the index is not secret, so the timing and memory access patterns of this operation shouldn't enable any side-channel attack.We think that at the moment there is no bigger
bitsize
value that can be used together withScalar
, because the range for the next eligiblebitsize
(i.e.,[0, 2^256)
), contains all possibleScalar
values.Changes
rust-toolchain
tonightly-2023-01-01
and Rust edition inCargo.toml
to2021
.curve25519-dalek
to3.2.1
,sha3
anddigest
to0.9
, andmerlin
to3
.scalar_range_proof
feature, which allowsRangeProof
to be used withScalar
.bitsize
of 128 and make use ofu128
instead ofu64
in range proof.u128
andScalar
as input.u128
andScalar
as input.InnerProductProof
andinner_product
public.Extras
This PR also solves issues #359 and #363.