This commit is contained in:
Dmitry Vagner 2022-12-05 22:50:45 -08:00
parent 97f90b2266
commit 48149f93d1
4 changed files with 17 additions and 3 deletions

View File

@ -29,7 +29,7 @@ pub(crate) fn combined_kernel() -> Kernel {
include_str!("asm/curve/bn254/curve_arithmetic/curve_mul.asm"),
include_str!("asm/curve/bn254/curve_arithmetic/miller_loop.asm"),
include_str!("asm/curve/bn254/curve_arithmetic/tate_pairing.asm"),
include_str!("asm/curve/bn254/field_arithmetic/moddiv.asm"),
include_str!("asm/curve/bn254/field_arithmetic/inverse.asm"),
include_str!("asm/curve/bn254/field_arithmetic/field_macros.asm"),
include_str!("asm/curve/bn254/field_arithmetic/fp6_mul.asm"),
include_str!("asm/curve/bn254/field_arithmetic/fp12_mul.asm"),

View File

@ -70,7 +70,7 @@ miller_end:
miller_one:
// stack: 0xnm, times, O, P, Q, out, retdest
PUSH 0x10 DUP2 LT
DUP1 %gt_const(0x10)
// stack: skip?, 0xnm, times, O, P, Q, out, retdest
%jumpi(miller_zero)
// stack: 0xnm, times, O, P, Q, out, retdest

View File

@ -20,3 +20,16 @@
%assert_eq_const(1)
// stack: x^-1
%endmacro
// Non-deterministically provide the inverse modulo N.
%macro inverse
// stack: x
PROVER_INPUT(ff::bn254_base::inverse)
// stack: x^-1 , x
SWAP1 DUP2
// stack: x^-1 , x, x^-1
MULFP254
// stack: x^-1 * x, x^-1
%assert_eq_const(1)
// stack: x^-1
%endmacro

View File

@ -388,7 +388,8 @@ impl<'a> Interpreter<'a> {
// should be changed to the proper implementation prime
fn bn_base_order_() -> U256 {
U256::from_str("0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47").unwrap()
U256::from_str("0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47")
.unwrap()
}
fn run_addfp254(&mut self) {