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: attempt to encode uint with a negative value results in a crash #752

Merged

Conversation

JeneaVranceanu
Copy link
Collaborator

@JeneaVranceanu JeneaVranceanu commented Feb 1, 2023

Summary of Changes

Update

The initial bug was caught by mistake by using older version of the web3swift library.
But nonetheless an encoding bug was fixed: passing negative value to ABIEncoder.encodeSingleType with a type .uint must return nil.
For example, web3js produces Uncaught Error: value out-of-bounds for such cases. We are returning nil for now.


Attempts to encode a negative number with ParameterType .uint(...) resulted in a crash.
The fix is located in ABIEncoder.convertToBigUInt.

Test Data or Screenshots

By submitting this pull request, you are confirming the following:
  • I have reviewed the Contribution Guidelines.
  • I have performed a self-review of my own code.
  • I have updated my repository to match the develop branch.
  • I have included test data or screenshots that prove my fix is effective or that my feature works.
  • I have checked that all tests work and swiftlint is not throwing any errors/warnings.

@JeneaVranceanu JeneaVranceanu added the bug Something isn't working label Feb 1, 2023
Copy link
Collaborator

@janndriessen janndriessen left a comment

Choose a reason for hiding this comment

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

🌟

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants