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

fix: shift with BigInt instead of JS number #7703

Merged
merged 3 commits into from Nov 16, 2023

Conversation

Tuditi
Copy link
Contributor

@Tuditi Tuditi commented Nov 10, 2023

Summary

Bloom team encountered a bug with certain numbers that are decoded as 32-bit numbers instead of 64 numbers due to how JS number bitwise operations work. The solution was to convert all the values to BigInt() before executing bitwise operations.

Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Left_shift#description

...

Changelog

- Bitwise operations on BigInt instead of numbers.

Testing

Platforms

Please select any platforms where your changes have been tested.

  • Desktop
    • MacOS
    • Linux
    • Windows

Instructions

Run tests and try to send 10000999999 glow from L1 to L2.

...

Checklist

Please tick the following boxes that are relevant to your changes.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or modified tests that prove my changes work as intended
  • I have verified that new and existing unit tests pass locally with my changes
  • I have verified that my latest changes pass CI workflows for testing and linting
  • I have made corresponding changes to the documentation

Copy link
Member

@begonaalvarezd begonaalvarezd left a comment

Choose a reason for hiding this comment

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

Hi @Tuditi thank you so much for submitting this PR ❤️
In this PR #7702 we already had the bigint fix but we dont have the code beautified as you do in packages/shared/lib/core/layer-2/classes/special-stream.class.ts, if you fix the conflicts we can merge your special stream changes as I see it passes the tests correctly 🌷
Thanks!

Copy link
Member

@begonaalvarezd begonaalvarezd left a comment

Choose a reason for hiding this comment

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

works 🚀

@begonaalvarezd begonaalvarezd merged commit a56001b into iotaledger:develop Nov 16, 2023
4 checks passed
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.

None yet

2 participants