diff --git a/evm/src/cpu/kernel/asm/moddiv.asm b/evm/src/cpu/kernel/asm/moddiv.asm index 3340faa9..630dcc54 100644 --- a/evm/src/cpu/kernel/asm/moddiv.asm +++ b/evm/src/cpu/kernel/asm/moddiv.asm @@ -28,13 +28,9 @@ // Computes the inverse modulo N by providing it non-deterministically. %macro inverse // stack: x - PROVER_INPUT + PROVER_INPUT(ff::bn254_base::inverse) // stack: x^-1, x - %bn_base - // stack: N, x^-1, x - DUP3 - // stack: x, N, x^-1, x - DUP3 + %stack (inv, x) -> (inv, x, @BN_BASE, inv, x) // stack: x^-1, x, N, x^-1, x MULMOD // stack: x^-1 * x, x^-1, x diff --git a/evm/src/cpu/kernel/evm_asm.pest b/evm/src/cpu/kernel/evm_asm.pest index 78938b64..943e8dae 100644 --- a/evm/src/cpu/kernel/evm_asm.pest +++ b/evm/src/cpu/kernel/evm_asm.pest @@ -29,6 +29,8 @@ local_label = { identifier ~ ":" } bytes_item = { ^"BYTES " ~ literal ~ ("," ~ literal)* } push_instruction = { ^"PUSH " ~ push_target } push_target = { literal | identifier | variable | constant } +prover_input_instruction = { ^"PROVER_INPUT " ~ "(" ~ prover_input_fn ~ ")" } // TODO: Can also support extra arguments. +prover_input_fn = { identifier ~ ("::" ~ identifier)*} nullary_instruction = { identifier } file = { SOI ~ item* ~ silent_eoi }