CIP-0109 proposes a new modular exponentiation builtin for Plutus Core. This will calculate a^k mod n for integers a and k and a positive integer n (not necessarily prime) and it should fail if k<0 and a is not invertible modulo n (ie, when gcd(a,n) > 1).
We need to do the following.
[ ] Identify a library function that provides the required functionality.
[ ] Add a new builtin called modExpInteger or similar to Plutus Core. This may require some wrapping of the library function to enforce the expected behaviour for non-invertible elements.
[ ] Cost the new function. This may need some new costing types.
[ ] Add a corresponding function to PlutusTx
[ ] Add some tests, perhaps including one or more realistic use cases to check that the costs are acceptable.
[ ] Add conformance tests
[ ] Add e2e tests
[ ] Add the new function to plutus-metatheory
[ ] Add the new function to the Plutus Core specification.
CIP-0109 proposes a new modular exponentiation builtin for Plutus Core. This will calculate
a^k mod n
for integersa
andk
and a positive integern
(not necessarily prime) and it should fail ifk<0
anda
is not invertible modulon
(ie, whengcd(a,n) > 1
).We need to do the following.
modExpInteger
or similar to Plutus Core. This may require some wrapping of the library function to enforce the expected behaviour for non-invertible elements.plutus-metatheory