-
Notifications
You must be signed in to change notification settings - Fork 8
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
fix: fixed reduction parameter error #31
Conversation
redc_param previously was only large enough to cover barrett reductions whose input was < 2^{modulus_bits * 2 + 2} this was insufficient for elliptic curve arithmetic in bignum redc_param is now large enough to cover barrett reduction inputs of at least 16 * modulus^2 additonally, library upgraded to not trigger compiler warnings for nargo 0.35.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, mostly nits
let Y1: BigNum<$N, $typ> = unsafe{ bn.__derive_from_seed([i as u8,i as u8,6,7]) }; | ||
let Z1: BigNum<$N, $typ> = BigNum::one(); | ||
|
||
let (_, YY_mul_2): (BigNum<$N, $typ>, BigNum<$N, $typ> ) = unsafe{BigNum::__compute_quadratic_expression([[Y1]], [[false]], [[Y1, Y1]], [[false, false]], [], [])}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file could use a nargo fmt
. Although, I know the formatter struggles with macros.
}; | ||
let result = unsafe { | ||
bn.__mul(u, v) | ||
}; | ||
let expected: BigNum<N, Params> = BigNum::one(); | ||
assert(result.limbs == expected.limbs); | ||
} | ||
} | ||
|
||
fn assert_is_not_equal<let N: u32, Params>(bn: BigNumInstance<N, Params>) where Params: BigNumParamsTrait<N> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this func used anywhere now that we have assert_is_not_equal
in the macro test with
#[make_test(quote{3},quote{BNParams})]
pub struct BNTests{}
Seems we can delete some of these functions that take in a BigNumInstance
as inputs.
Co-authored-by: Maxim Vezenov <[email protected]>
Co-authored-by: Maxim Vezenov <[email protected]>
Co-authored-by: Maxim Vezenov <[email protected]>
redc_param previously was only large enough to cover barrett reductions whose input was < 2^{modulus_bits * 2 + 2}
this was insufficient for elliptic curve arithmetic in bignum
redc_param is now large enough to cover barrett reduction inputs of at least 16 * modulus^2
additonally, library upgraded to not trigger compiler warnings for nargo 0.35.0
Description
Problem*
Resolves
Summary*
Additional Context
PR Checklist*
cargo fmt
on default settings.