diff --git a/evm/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/constants.asm b/evm/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/constants.asm index 014f4a9a..93878b57 100644 --- a/evm/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/constants.asm +++ b/evm/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/constants.asm @@ -1,3 +1,12 @@ +/// the following is defined by +/// (1) taking the binary expansion of N254, the order of the elliptic curve group +/// (2) popping the first and last elements, then appending a 0: +/// exp = bin(N254)[1:-1] + [0] +/// (3) counting the lengths of runs of 1s then 0s in exp, e.g. +/// if exp = 1100010011110, then EXP = [(2,3), (1,2), (4,1)] +/// (4) encoding each pair (n,m) as 0xnm: +/// miller_data = [(0x20)n + m for (n,m) in EXP] + global miller_data: BYTES 0xdc, 0x22, 0x42, 0x21 BYTES 0xa1, 0xa4, 0x24, 0x21 diff --git a/evm/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/miller_loop.asm b/evm/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/miller_loop.asm index 844b38a5..5d2104e6 100644 --- a/evm/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/miller_loop.asm +++ b/evm/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/miller_loop.asm @@ -25,15 +25,6 @@ /// 0xnm -= 1 /// mul_tangent() -/// Note: miller_data was defined by -/// (1) taking the binary expansion of N254, the size of the elliptic curve -/// (2) popping the first and last elements, then appending a 0: -/// exp = bin(N254)[1:-1] + [0] -/// (3) counting the lengths of runs of 1s then 0s in exp, e.g. -/// exp = 1100010011110 => EXP = [(2,3), (1,2), (4,1)] -/// (4) encoding each pair (n,m) as 0xnm: -/// miller_data = [(0x20)n + m for (n,m) in EXP] - global test_miller: // stack: ptr, P, Q, ptr, out, retdest %store_fp6