Skip to content

Add parameterised tests for UInt256#9264

Closed
siladu wants to merge 15 commits intobesu-eth:mainfrom
siladu:uint256-op-modulus-parameterised-tests
Closed

Add parameterised tests for UInt256#9264
siladu wants to merge 15 commits intobesu-eth:mainfrom
siladu:uint256-op-modulus-parameterised-tests

Conversation

@siladu
Copy link
Copy Markdown
Contributor

@siladu siladu commented Oct 2, 2025

and fix issues found by tests

Heavily inspired by https://github.com/NethermindEth/int256

PR is built on top of #9188

thomas-quadratic and others added 14 commits September 30, 2025 19:33
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Following Ameziane's review and benchmarking, we decided to reinclude two elements.
Firstly, ModOperation itself should check if the modulus is zero, shortcutting the UInt256 constructor for the numerator.
Secondly, benchmarks should reincorporate the fully random test: number of bytes are chosen uniformly at random, and then bytes are filled uniformly at random.

Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Benchmarks for different sizes and fully random inputs were added for addmod, similarly to mod's benchmarks.

Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
MulMod operation is accelerated using custom UInt256 custom implementation.

Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Adds mulmod benchmarks, fixes spotless and fixes random seed in UInt256Test.

Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Fix bugs found by tests

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
@siladu siladu force-pushed the uint256-op-modulus-parameterised-tests branch from f456ffc to 62c7946 Compare October 2, 2025 03:16
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants