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 for intToBuffer method #9

Merged
merged 1 commit into from
Jun 10, 2018
Merged

Conversation

vpulim
Copy link
Contributor

@vpulim vpulim commented Jun 8, 2018

Fix for #8

In the intToBuffer() method, we now call padToEven() on the hex string generated by intToHex() to ensure the new Buffer object can parse the hex string correctly.

NOTE: This fix is compatible with PR #7 and still maintains the fix for issue #6

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 951e383 on vpulim:fix-int-to-buffer into e1ea887 on ethjs:master.

@SilentCicero
Copy link
Member

SilentCicero commented Jun 8, 2018 via email

@SilentCicero
Copy link
Member

SilentCicero commented Jun 8, 2018 via email

@vpulim
Copy link
Contributor Author

vpulim commented Jun 8, 2018

@SilentCicero This module is used in ethereumjs-util to convert integers to Buffers (https://github.com/ethereumjs/ethereumjs-util/blob/master/index.js#L170). Its also used in tests for ethereumjs-blockchain (https://github.com/ethereumjs/ethereumjs-blockchain/blob/master/test/index.js#L61).

However, simply calling intToBuffer() on ethjs-util fails when you pass in an integer < 16 (it returns an empty Buffer)

@SilentCicero
Copy link
Member

SilentCicero commented Jun 8, 2018 via email

@vpulim
Copy link
Contributor Author

vpulim commented Jun 8, 2018

Great! Thanks

@SilentCicero SilentCicero merged commit e9aede6 into ethjs:master Jun 10, 2018
@SilentCicero
Copy link
Member

@vpulim should be up in NPM [email protected]

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.

3 participants