mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-03 06:13:07 +00:00
initialize out in asm
This commit is contained in:
parent
4e0be66432
commit
44a623d453
@ -1,8 +1,8 @@
|
||||
/// def bn254_pairing(pairs: List((Curve, TwistedCurve))) -> Fp12:
|
||||
///
|
||||
/// for P, Q in pairs:
|
||||
/// assert(is_valid(P))
|
||||
/// assert(is_valid(Q))
|
||||
/// assert(P.is_valid)
|
||||
/// assert(Q.is_valid)
|
||||
///
|
||||
/// out = 1
|
||||
/// for P, Q in pairs:
|
||||
@ -11,7 +11,12 @@
|
||||
/// return bn254_final_exponent(out)
|
||||
|
||||
global bn254_pairing:
|
||||
// stack: k, inp, out, retdest
|
||||
// stack: k, inp, out, retdest
|
||||
%stack (k, inp, out) -> (out, 1, k, inp, out)
|
||||
// stack: out, 1, k, inp, out, retdest
|
||||
%mstore_kernel_bn254_pairing
|
||||
// stack: k, inp, out, retdest
|
||||
|
||||
%jump(bn254_pairing_loop) // this short circuits the input checks
|
||||
DUP1
|
||||
// stack: k, k, inp, out, retdest
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Returns (range & curve) || ident
|
||||
// where
|
||||
// range = (x < N) & (x_ < N) & (y < N) & (y_ < N)
|
||||
// curve = Y^2 == X^3 + A
|
||||
// curve = Y^2 == X^3 + 3/(9+i)
|
||||
// ident = (X,Y) == (0,0)
|
||||
|
||||
%macro bn_check_twisted
|
||||
|
||||
@ -304,7 +304,7 @@ fn test_bn_pairing() -> Result<()> {
|
||||
U256::from(0xdeadbeefu32),
|
||||
],
|
||||
segment: BnPairing,
|
||||
memory: vec![(ptr, inputs), (out, vec![U256::from(acc)])],
|
||||
memory: vec![(ptr, inputs)],
|
||||
};
|
||||
let interpreter = run_interpreter_with_memory(setup).unwrap();
|
||||
let output: Vec<U256> = interpreter.extract_kernel_memory(BnPairing, out..out + 12);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user