BadBoiLabs / Cannon-rs

Tooling to develop and emulate verifyable programs compatible with Optimism Cannon and the OP Stack 🦀🎆
GNU Lesser General Public License v3.0
50 stars 6 forks source link

Fixed division operations. #15

Closed RIg410 closed 1 year ago

RIg410 commented 1 year ago

Hi. Great project! I ran into a problem with division. Some division operation caused an 'invalid instruction' error. After looking into it, I discovered that the issue is related to Rust using a specific instruction called 'teq'. However, this instruction, along with other trap instructions, is not supported in cannon. To fix this, I added a flag that tells LLVM, the compiler, to avoid using traps for division checks.

willemolding commented 1 year ago

Hey @RIg410 thanks for the contribution!