Skip to content
This repository has been archived by the owner on Dec 10, 2020. It is now read-only.

Commit

Permalink
Merge pull request #129 from ethereumjs/upgrade-ethereumjs-util-to-v7
Browse files Browse the repository at this point in the history
Upgrade ethereumjs-util to v7.0.2
  • Loading branch information
holgerd77 committed Jun 10, 2020
2 parents 8a05f49 + 0fb51da commit cc81d4e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/rpc/modules/web3.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const { middleware, validators } = require('../validation')
const { addHexPrefix, keccak256 } = require('ethereumjs-util')
const { addHexPrefix, keccak, toBuffer } = require('ethereumjs-util')
const { platform } = require('os')

/**
Expand Down Expand Up @@ -45,7 +45,7 @@ class Web3 {
*/
sha3 (params, cb) {
try {
const rawDigest = keccak256(params[0])
const rawDigest = keccak(toBuffer(params[0]))
const hexEncodedDigest = addHexPrefix(rawDigest.toString('hex'))
cb(null, hexEncodedDigest)
} catch (err) {
Expand Down
4 changes: 2 additions & 2 deletions lib/util/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async function parseStorage (storage) {
const promises = []
for (let [address, value] of Object.entries(storage)) {
address = toBuffer(address)
value = util.rlp.encode(util.unpad(toBuffer(value)))
value = util.rlp.encode(util.unpadBuffer(toBuffer(value)))
promises.push(new Promise((resolve, reject) => {
trie.put(address, value, (err) => {
if (err) return reject(err)
Expand All @@ -70,7 +70,7 @@ async function parseGethState (alloc) {
account.balance = new util.BN(value.balance.slice(2), 16)
}
if (value.code) {
account.codeHash = util.keccak(value.code)
account.codeHash = util.keccak(util.toBuffer(value.code))
}
if (value.storage) {
account.stateRoot = (await parseStorage(value.storage)).root
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"ethereumjs-blockchain": "^3.4.0",
"ethereumjs-common": "^1.5.1",
"ethereumjs-devp2p": "^2.5.1",
"ethereumjs-util": "^6.1.0",
"ethereumjs-util": "^7.0.2",
"fs-extra": "^7.0.1",
"jayson": "^2.0.6",
"level": "^6.0.1",
Expand Down

0 comments on commit cc81d4e

Please sign in to comment.