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

Upgrade ethereumjs-util to v7.0.2 #129

Merged
merged 1 commit into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]))
ryanio marked this conversation as resolved.
Show resolved Hide resolved
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