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

Conversation

@jimni1222
Copy link

Description

This PR introduces that modify the web3.eth.abi.encodeParameters logic to handle a fixed length tuple array.

I am a developer developing caver-js, a project that forked web3.js.
I was testing the encodeParameters function and found a bug that couldn't handle an array of fixed length tuples.

The problem was with coder.type.replace('[]','').
If the length is not fixed (i.e. tuple(string,string)[]), the coder.type.replace('[]','') can processe normally by obtaining the coder for the inner element as a tuple type.
However, if the length was fixed (i.e. tuple(string,string)[3]), coder.type.replace('[]','') cannot process.

To solve this, change to replace when n numbers inside [] parentheses come.

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:unit with success.
  • 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 and tested 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.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 765430808

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 12 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.004%) to 73.706%

Files with Coverage Reduction New Missed Lines %
packages/web3-eth-abi/lib/index.js 12 89.92%
Totals Coverage Status
Change from base Build 720288779: 0.004%
Covered Lines: 3278
Relevant Lines: 4209

💛 - Coveralls

@github-actions
Copy link

This PR has been automatically marked as stale beacause it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

@github-actions github-actions bot added the Stale Has not received enough activity label Jun 20, 2021
@github-actions github-actions bot closed this Jul 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Stale Has not received enough activity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants