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

Examine more carefully on the bound for UInt addmany implementation #23

Open
weikengchen opened this issue Nov 23, 2020 · 3 comments
Open
Labels
D-easy Difficulty: easy

Comments

@weikengchen
Copy link
Member

The current implementation of addmany has a number of bounds:

https://github.com/arkworks-rs/r1cs-std/blob/master/src/bits/uint.rs#L184

// Make some arbitrary bounds for ourselves to avoid overflows
// in the scalar field
assert!(F::Params::MODULUS_BITS >= 2 * $size);
assert!($size * operands.len() <= F::Params::MODULUS_BITS as usize);

However, these bounds seem to be too strict. This part of the code is supposed for additions. And the bounds here seem for multiplication.

@weikengchen weikengchen added D-easy Difficulty: easy help wanted labels Nov 23, 2020
@Pratyush
Copy link
Member

Hmm so it should $size + operands.len()?

@weikengchen
Copy link
Member Author

weikengchen commented Nov 23, 2020

or $size + log2(operands.len() + 1)?

@Pratyush
Copy link
Member

why the + 1?

Pratyush pushed a commit that referenced this issue Aug 8, 2021
* Use `ark_std::test_rng` instead

* Update bench.rs
tgodden pushed a commit to tgodden/r1cs-std that referenced this issue Nov 29, 2022
Pratyush added a commit that referenced this issue Jan 20, 2023
Co-authored-by: Tom Godden <[email protected]>
Co-authored-by: mmagician <[email protected]>
Co-authored-by: Pratyush Mishra <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D-easy Difficulty: easy
Projects
None yet
Development

No branches or pull requests

2 participants