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

u128 and Scalar #364

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

ripa1995
Copy link

@ripa1995 ripa1995 commented Jan 17, 2023

Disclaimer: This pull request has been made against main and not develop 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 the u64 type with u128 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 with scalar_range_proof. Also in this case we had to modify the code such that Scalar could be accepted. To support Scalar we had to implement the extraction of a single bit from a Scalar.

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 with Scalar, because the range for the next eligible bitsize (i.e., [0, 2^256)), contains all possible Scalar values.

Changes

  • Update rust-toolchain to nightly-2023-01-01 and Rust edition in Cargo.toml to 2021.
  • Update dependencies versions: curve25519-dalek to 3.2.1, sha3 and digest to 0.9, and merlin to 3.
  • Add scalar_range_proof feature, which allows RangeProof to be used with Scalar.
  • Allow range proof with bitsize of 128 and make use of u128 instead of u64 in range proof.
  • Extend range proof benchmarks with u128 and Scalar as input.
  • Extend range proof tests with u128 and Scalar as input.
  • Make InnerProductProof and inner_product public.

Extras

This PR also solves issues #359 and #363.

@ripa1995 ripa1995 marked this pull request as ready for review January 21, 2023 09:09
@ripa1995
Copy link
Author

ripa1995 commented Jan 21, 2023

Dear @cathieyun, @hdevalence, @oleganza;
it looks like that we are not allowed to put reviewers, so I'm adding this comment as "request for review", tagging all of you, since you are the authors of the library. Thank you in advance, for your time and effort.

@ripa1995 ripa1995 mentioned this pull request Apr 24, 2023
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.

None yet

2 participants