Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Rename deprecated sha3 consts and func to keccak256 #91

Merged
merged 1 commit into from
Jun 24, 2019
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 benchmarks/random.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ function run (cb) {
return i <= ROUNDS
},
function (done) {
seed = ethUtil.sha3(seed)
seed = ethUtil.keccak256(seed)
if (SYMMETRIC) {
trie.put(seed, seed, genRoot)
} else {
let val = ethUtil.sha3(seed)
let val = ethUtil.keccak256(seed)
trie.put(seed, val, genRoot)
}

Expand Down
6 changes: 3 additions & 3 deletions src/baseTrie.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const { stringToNibbles, matchingNibbleLength, doKeysMatch } = require('./util/n
module.exports = class Trie {
constructor (db, root) {
const self = this
this.EMPTY_TRIE_ROOT = ethUtil.SHA3_RLP
this.EMPTY_TRIE_ROOT = ethUtil.KECCAK256_RLP
this.sem = semaphore(1)

this.db = db || new DB()
Expand Down Expand Up @@ -121,7 +121,7 @@ module.exports = class Trie {
cb = callTogether(cb, this.sem.leave)

this.sem.take(() => {
if (this.root.toString('hex') !== ethUtil.SHA3_RLP.toString('hex')) {
if (this.root.toString('hex') !== ethUtil.KECCAK256_RLP.toString('hex')) {
// first try to find the give key or its nearst node
this.findPath(key, (err, foundValue, keyRemainder, stack) => {
if (err) {
Expand Down Expand Up @@ -401,7 +401,7 @@ module.exports = class Trie {
let aborted = false
let returnValues = []

if (root.toString('hex') === ethUtil.SHA3_RLP.toString('hex')) {
if (root.toString('hex') === ethUtil.KECCAK256_RLP.toString('hex')) {
return onDone()
}

Expand Down
2 changes: 1 addition & 1 deletion src/trieNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ module.exports = class TrieNode {
}

hash () {
return ethUtil.sha3(this.serialize())
return ethUtil.keccak256(this.serialize())
}

toString () {
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ tape('it should create the genesis state root from ethereum', function (tester)
var startAmount = new Buffer(26)
startAmount.fill(0)
startAmount[0] = 1
var account = [startAmount, 0, stateRoot, ethUtil.sha3()]
var account = [startAmount, 0, stateRoot, ethUtil.keccak256()]
var rlpAccount = rlp.encode(account)
var cppRlp = 'f85e9a010000000000000000000000000000000000000000000000000080a00000000000000000000000000000000000000000000000000000000000000000a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'

Expand Down