restructure tate test

This commit is contained in:
Dmitry Vagner 2023-04-19 14:09:05 -07:00
parent 0df18d5ea8
commit d6584dcb7c
2 changed files with 16 additions and 14 deletions

View File

@ -5,16 +5,18 @@
/// return bn254_final_exponent(out)
global bn254_tate:
// stack: k, inp, out, retdest
// stack: k , inp, out, retdest
DUP1
ISZERO
// stack: end?, k, inp, out, retdest
// stack: end?, k , inp, out, retdest
%jumpi(bn254_final_exponent)
// stack: k, inp, out, retdest
// stack: k , inp, out, retdest
%sub_const(1)
// stack: k=k-1, inp, out, retdest
%stack (inp, out) -> (inp, out, bn254_final_exponent, out)
// stack: inp, out, bn254_final_exponent, out, retdest
%stack (k, inp, out) -> (k, inp, 200, mul_fp254_12, 200, out, out, bn254_tate, k, inp, out)
// stack: k, inp, 200, mul_fp254_12, 200, out, out, bn254_tate, k, inp, out retdest
%mul_const(6)
ADD
// stack: inp_k, 200, mul_fp254_12, 200, out, out, bn254_tate, k, inp, out retdest
%jump(bn254_miller)

View File

@ -276,9 +276,9 @@ fn test_miller() -> Result<()> {
}
#[test]
fn test_tate() -> Result<()> {
let ptr: usize = 200;
let out: usize = 206;
fn test_pairing() -> Result<()> {
let ptr: usize = 224;
let out: usize = 212;
let inputs: Vec<U256> = vec![
CURVE_GENERATOR.x.val,
CURVE_GENERATOR.y.val,
@ -289,10 +289,10 @@ fn test_tate() -> Result<()> {
];
let setup = InterpreterMemoryInitialization {
label: "bn254_tate".to_string(),
stack: vec![U256::from(ptr), U256::from(out), U256::from(0xdeadbeefu32)],
label: "bn254_pairing".to_string(),
stack: vec![U256::one(), U256::from(ptr), U256::from(out), U256::from(0xdeadbeefu32)],
segment: BnPairing,
memory: vec![(ptr, inputs)],
memory: vec![(ptr, inputs), (out, vec![U256::one()])],
};
let interpreter = run_interpreter_with_memory(setup).unwrap();
let output: Vec<U256> = interpreter.extract_kernel_memory(BnPairing, out..out + 12);