aurora-is-near / aurora-engine

⚙️ Aurora Engine implements an Ethereum Virtual Machine (EVM) on the NEAR Protocol.
https://doc.aurora.dev/develop/compat/evm
330 stars 82 forks source link

Fix(modexp): remove leading zeros when factoring modulus #760

Closed birchmd closed 1 year ago

birchmd commented 1 year ago

Description

There was a small bug in the new modexp implementation where sometimes factoring an even modulus into and odd number times a power of two left a leading zero on the odd number. This threw off some of the other parts of the algorithm, leading to incorrect results. This PR fixes the issue and adds test cases for it.