feat: (levm) arithmetic operations#544
Conversation
| } | ||
|
|
||
| #[test] | ||
| fn addmod_op_for_zero() { |
There was a problem hiding this comment.
Can you check that ADDMOD works correctly when adding 2^256 - 2 and 2^256 - 3 modulo 2^256 - 1?
There was a problem hiding this comment.
Checked it and the code had a bug returning a wrong value, just fixed it and added a test 🫡
| } | ||
|
|
||
| #[test] | ||
| fn mulmod_op() { |
There was a problem hiding this comment.
Let's test this with big numbers that trigger the overflowing behaviour, and modules comparable to 2^256
There was a problem hiding this comment.
Should we add this tests for all the opcodes that could overflow?
There was a problem hiding this comment.
The PR looks good and I agree with @MegaRedHand comments. I'd also add a change in the naming. Let's use the formal operand names for the operations (both for implementation and tests if needed):
- Addition:
augend + addend = sum. - Subtraction:
minuend - subtrahend = difference. - Multiplication:
multiplicand × multiplier = product. - Division:
dividend ÷ divisor = quotient. - Modulus:
dividend % divisor = remainder. - Exponentiation:
base ^ exponent = power.
**Motivation** This PR adds the arithmetic operations for LEVM **Description** Adds the implementation of this group of opcodes with tests <!-- Link to issues: Resolves lambdaclass#111, Resolves lambdaclass#222 --> Closes lambdaclass#457 Closes lambdaclass#458 Closes lambdaclass#459 Closes lambdaclass#460 Closes lambdaclass#461 Closes lambdaclass#462 Closes lambdaclass#463 Closes lambdaclass#464 Closes lambdaclass#465 Closes lambdaclass#466 Closes lambdaclass#467
Motivation
This PR adds the arithmetic operations for LEVM
Description
Adds the implementation of this group of opcodes with tests
Closes #457
Closes #458
Closes #459
Closes #460
Closes #461
Closes #462
Closes #463
Closes #464
Closes #465
Closes #466
Closes #467