Skip to content

Conversation

@thomas-quadratic
Copy link
Contributor

PR description

UInt256 implementation is currently using int limbs (big-endian) ordered from least significant (little-endian).
This is standard and has several advantages. However, using big-endian order for limbs opens the possibility to use the optimised method Arrays.mismatch for several compare tasks.

This PR migrates UInt256 from little-endian limbs to big-endian limbs.

Fixed Issue(s)

#9475

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?

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 <[email protected]>
Also added tests that were failing and now pass.

Signed-off-by: Thomas Zamojski <[email protected]>
Signed-off-by: Thomas Zamojski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Open PRs

Development

Successfully merging this pull request may close these issues.

1 participant