Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modular exponentiation primitive #6154

Open
9 tasks
kwxm opened this issue May 30, 2024 · 0 comments
Open
9 tasks

Modular exponentiation primitive #6154

kwxm opened this issue May 30, 2024 · 0 comments

Comments

@kwxm
Copy link
Contributor

kwxm commented May 30, 2024

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants