Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Conversation

@luu-alex
Copy link
Contributor

@luu-alex luu-alex commented May 25, 2022

Description

#5072
Please include a summary of the changes and be sure to follow our Contribution Guidelines.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run dtslint with success and extended the tests and types if necessary.
  • I ran npm run test:cov and my test cases cover all the lines and branches of the added code.
  • I ran npm run build with success.
  • I have tested the built dist/web3.min.js in a browser.
  • I have tested my code on the live network.
  • I have checked the Deploy Preview and it looks correct.
  • I have updated the CHANGELOG.md file in the root folder.

@render
Copy link

render bot commented May 25, 2022

@coveralls
Copy link

coveralls commented May 25, 2022

Pull Request Test Coverage Report for Build 2455976180

  • 1 of 5 (20.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.05%) to 72.159%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/web3-utils/src/utils.js 1 5 20.0%
Totals Coverage Status
Change from base Build 2337627991: -0.05%
Covered Lines: 3378
Relevant Lines: 4411

💛 - Coveralls

Copy link
Contributor

@jdevcs jdevcs left a comment

Choose a reason for hiding this comment

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

We will also need to update https://github.com/ChainSafe/web3.js/blob/2c0324af2da467ee1acb72452f20000e916e4306/packages/web3-utils/src/utils.js#L273 and might need to remove number-to-bn dependency. also update ethers to 5.6.8

@jdevcs jdevcs added the 1.x 1.0 related issues label May 25, 2022
@luu-alex
Copy link
Contributor Author

luu-alex commented May 25, 2022

@jdevcs the dependancy number-to-bn uses bigNumber.js so that should be fine? will update the others

@luu-alex
Copy link
Contributor Author

The failing testcase that is commented is related to this issue #5071. will need to investigate further

Copy link
Contributor

@nikoulai nikoulai left a comment

Choose a reason for hiding this comment

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

Awesome!

In 4.x I saw something like that for the handling negative hex:

 if (typeof value == "string" && value.includes("0x")) {
        const [negative, hexValue] = value.toLocaleLowerCase().startsWith('-') ? ["-", value.slice(3)] : ["", value.slice(2)];
        return new BN(negative + hexValue, 16);
    }
    else {
        return new BN(value);
    }

What would you say to refactor?

@nikoulai nikoulai requested review from avkos, jdevcs and nazarhussain June 7, 2022 09:44
@luu-alex
Copy link
Contributor Author

luu-alex commented Jun 7, 2022

Added an extra test, works properly as in 4.x as well.

@wbt
Copy link
Contributor

wbt commented Jun 22, 2022

FYI, this turned out to be a breaking change on nonbreaking semver, as discussed in more detail in the above-linked comment, and possibly foreshadowed here.

@arijoon
Copy link

arijoon commented Aug 16, 2022

As @wbt noted, this was a breaking change. When exposing deps directly (such as BN), please bump major version on web3 if any of these deps have a major upgrade

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

Labels

1.x 1.0 related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants