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

replace toBuffer => toArrayLike #163

Merged
merged 1 commit into from
Aug 1, 2017
Merged

Conversation

yann300
Copy link
Contributor

@yann300 yann300 commented Aug 1, 2017

here is more details about the issue indutny/bn.js#147

here is more details about the issue indutny/bn.js#147
@axic
Copy link
Member

axic commented Aug 1, 2017

Oh seems like this is the only case left using toBuffer directly.

@@ -71,7 +71,7 @@ module.exports = function (opts, cb) {
stateManager.getAccount(createdAddress, function (err, account) {
toAccount = account
const NONCE_OFFSET = 1
toAccount.nonce = new BN(toAccount.nonce).addn(NONCE_OFFSET).toBuffer()
toAccount.nonce = new BN(toAccount.nonce).addn(NONCE_OFFSET).toArrayLike(Buffer)
Copy link
Member

Choose a reason for hiding this comment

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

Actually, hold on a second. We need to define the endianess and size of the nonce field. Probably toArrayLike(Buffer, 'be') is the correct one, because RLP will remove the zeroes anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

@axic I think if toBuffer worked correct, toArrayLike(Buffer) also will work correct

Copy link
Member

Choose a reason for hiding this comment

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

Right, because it defualts to be and RLP will remove any leading zeroes.

@cdetrio cdetrio merged commit 06e5c85 into ethereumjs:master Aug 1, 2017
holgerd77 pushed a commit that referenced this pull request Dec 1, 2020
holgerd77 added a commit that referenced this pull request Mar 11, 2021
Pin ethjs-util version exactly
holgerd77 added a commit that referenced this pull request May 26, 2023
Added verifyPublicKey to verify publicKey, privateKey pair.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants