I helped contribute towards: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3298 We should have a modular exponentiation function as part of huff-math