Skip to content

Upgrade modular operations to use new Plutus built-in from CIP-109 #35

@dkaidalov

Description

@dkaidalov

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:

  1. aiken-verifier/aiken_halo2/lib/bls_utils.ak - follow TODOs to replace recip_eea with built-in expModInteger call for more efficient modular inversion
  2. 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.
  3. aiken-verifier/aiken_halo2/lib/halo2_kzg.ak - follow TODOs to revert compute_f_eval to not use batch inversion.
  4. plutus-verifier/plutus-halo2/src/Plutus/Crypto/BlsTypes.hs - follow TODOs to use expModInteger built-in for powMod, recip, and modularExponentiationFp
  5. plutus-verifier/plutus-halo2/src/Plutus/Crypto/Halo2/LagrangePolynomialEvaluation.hs - follow TODOs to remove batch inversion

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions