Skip to content

StackMath#9881

Closed
daniellehrner wants to merge 27 commits intobesu-eth:mainfrom
daniellehrner:stack_long_array
Closed

StackMath#9881
daniellehrner wants to merge 27 commits intobesu-eth:mainfrom
daniellehrner:stack_long_array

Conversation

@daniellehrner
Copy link
Copy Markdown
Contributor

PR description

Fixed Issue(s)

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • spotless: ./gradlew spotlessApply
  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests
  • hive tests: Engine or other RPCs modified?

thomas-quadratic and others added 27 commits January 23, 2026 10:06
Before, limbs were stored in little-endian.
But to use Arrays.mismatch to our advantage, it is better to have it big-endian.
This commit makes UInt256.java big-endian in limbs.
We still need to migrate all tests and benchmark.

Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Also added tests that were failing and now pass.

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>
Small cleaning up of the private methods for addition and compareLimbs.
Should be easier for the compiler.

Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
UInt256 used int[] for limbs, primarily for simplicity, e.g. having the possibility to widen to long.
However, methods exists to work with long[] and no widening. This commit implements long limbs.

To avoid widening, we do:

  1. add: overflow check
  2. mul: native multiplyHigh (compiled to assembly mulq)
  3. div: more complicated, see the gnump division paper.

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>
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>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
@siladu siladu moved this to In Progress in Performance Mar 5, 2026
@daniellehrner
Copy link
Copy Markdown
Contributor Author

Production integrated has started with #10105

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants