aptos-labs / aptos-core

Aptos is a layer 1 blockchain built to support the widespread use of blockchain through better technology and user experience.
https://aptosfoundation.org
Other
6.03k stars 3.61k forks source link

[Feature Request][modulo operator] support native addmod and mulmod operator natively #13910

Open duongnd-183902 opened 2 months ago

duongnd-183902 commented 2 months ago

🚀 Feature Request

The mulmod operator, performing modular multiplication with modulo reduction, is a cornerstone of cryptographic protocols. Its absence in Aptos Move hinders the development of robust cryptographic functionalities within Aptos applications.

Motivation

The mulmod and addmod operator is essential for secure and efficient implementations of various cryptographic operations, including:

Including the mulmod operator would significantly empower Aptos developers to build applications with strong cryptographic foundations.

Pitch

I propose the implementation of a mulmod and addmod operator that efficiently calculates a * b mod m for unsigned integer within Aptos Move

zk-steve commented 3 weeks ago

This feature is super important for our project as well as the self-implemented u256 mulmod approach would consume too much gas, leading to the EXECUTION_LIMIT_REACHED error. Can I ask when this will be implemented?