Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use BN for large uints #95

Merged
merged 2 commits into from
Feb 11, 2019
Merged

Use BN for large uints #95

merged 2 commits into from
Feb 11, 2019

Conversation

wemeetagain
Copy link
Member

@wemeetagain wemeetagain commented Feb 8, 2019

  • uint64/uint384 to BN
  • change all helpers/tests to suit

re #94
resolves #89
aligns with ssz-js

Some comments:

  • RE Numbers design decision #94, it looks like bn.js does support operations with vanilla js bignumbers in some/most cases (see this section of the bn readme and this PR with methods ending in n)
  • isPowerOfTwo was rewritten algorithmically (because no log2 bn method exists)
  • the num.umod(new BN(x)) sections could be rewritten as num.modn(x) since we're not expecting negative numbers in those places (I was just cautious with this first pass)

@wemeetagain
Copy link
Member Author

@JonathanLorimer since it doesn't look like I can make him a reviewer

Copy link
Contributor

@JonathanLorimer JonathanLorimer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, lots of heavy lifting in this PR 🎉🎉🎉. Just check my comments about using BN math with non-BN numbers. I am pretty sure that you need to create new BN's in those places, but I might be wrong, its been a week or two since I used BN.js.

@JonathanLorimer
Copy link
Contributor

@wemeetagain just read your comment about methods postfixed with n. Ignore my comments on those methods. However, you still might want to check that comparison operations work fine without BNs.

GregTheGreek
GregTheGreek previously approved these changes Feb 9, 2019
@wemeetagain wemeetagain requested a review from a team February 10, 2019 18:14
@GregTheGreek
Copy link
Member

@wemeetagain we have a merge conflict!

@GregTheGreek GregTheGreek dismissed their stale review February 10, 2019 18:39

Merge conflicts

@wemeetagain
Copy link
Member Author

rebased off latest master

@GregTheGreek GregTheGreek merged commit 6bca1aa into master Feb 11, 2019
wemeetagain added a commit that referenced this pull request Aug 2, 2019
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.

Supporting Ints >2**53 -1
5 participants