CIP-109 introduces an efficient built-in function for modular exponentiation. It has already been implemented in Plutus and is available locally through Plinth, but it is not yet supported in Aiken or available on-chain.
Once it is fully integrated into Cardano, the Halo2 verifier code should be updated to use it. Below is a list of the areas that will be affected:
aiken-verifier/aiken_halo2/lib/bls_utils.ak - follow TODOs to replace recip_eea with built-in expModInteger call for more efficient modular inversion
aiken-verifier/aiken_halo2/lib/lagrange.ak - follow TODOs to avoid using batch_inverses() in lagrange_polynomial_basis() and lagrange_evaluation(). It will be less efficient, then using expModInteger directly. Remove batch_inverses() function altogether and see where else it was used.
aiken-verifier/aiken_halo2/lib/halo2_kzg.ak - follow TODOs to revert compute_f_eval to not use batch inversion.
plutus-verifier/plutus-halo2/src/Plutus/Crypto/BlsTypes.hs - follow TODOs to use expModInteger built-in for powMod, recip, and modularExponentiationFp
plutus-verifier/plutus-halo2/src/Plutus/Crypto/Halo2/LagrangePolynomialEvaluation.hs - follow TODOs to remove batch inversion
CIP-109 introduces an efficient built-in function for modular exponentiation. It has already been implemented in Plutus and is available locally through Plinth, but it is not yet supported in Aiken or available on-chain.
Once it is fully integrated into Cardano, the Halo2 verifier code should be updated to use it. Below is a list of the areas that will be affected:
aiken-verifier/aiken_halo2/lib/bls_utils.ak- follow TODOs to replacerecip_eeawith built-inexpModIntegercall for more efficient modular inversionaiken-verifier/aiken_halo2/lib/lagrange.ak- follow TODOs to avoid usingbatch_inverses()inlagrange_polynomial_basis()andlagrange_evaluation(). It will be less efficient, then usingexpModIntegerdirectly. Removebatch_inverses()function altogether and see where else it was used.aiken-verifier/aiken_halo2/lib/halo2_kzg.ak- follow TODOs to revertcompute_f_evalto not use batch inversion.plutus-verifier/plutus-halo2/src/Plutus/Crypto/BlsTypes.hs- follow TODOs to useexpModIntegerbuilt-in forpowMod,recip, andmodularExponentiationFpplutus-verifier/plutus-halo2/src/Plutus/Crypto/Halo2/LagrangePolynomialEvaluation.hs- follow TODOs to remove batch inversion