Make Truffle provider creation lazy (#1526)

* make provider creation lazy

* change getter for function

* remove unused networks from truffle config

* remove unused dotenv package

* remove truffle-hdwallet-provider dependency

* install ethereumjs-util

* replace sha3 with keccak256 for ethereumjs-util v6
This commit is contained in:
Francisco Giordano
2018-12-02 00:09:58 -03:00
committed by GitHub
parent c0bda4db88
commit e7d6e86395
6 changed files with 1762 additions and 3166 deletions

View File

@ -1,9 +1,9 @@
const { sha3, bufferToHex } = require('ethereumjs-util');
const { keccak256, bufferToHex } = require('ethereumjs-util');
class MerkleTree {
constructor (elements) {
// Filter empty strings and hash elements
this.elements = elements.filter(el => el).map(el => sha3(el));
this.elements = elements.filter(el => el).map(el => keccak256(el));
// Deduplicate elements
this.elements = this.bufDedup(this.elements);
@ -45,7 +45,7 @@ class MerkleTree {
if (!first) { return second; }
if (!second) { return first; }
return sha3(this.sortAndConcat(first, second));
return keccak256(this.sortAndConcat(first, second));
}
getRoot () {
@ -97,7 +97,7 @@ class MerkleTree {
// Convert element to 32 byte hash if it is not one already
if (el.length !== 32 || !Buffer.isBuffer(el)) {
hash = sha3(el);
hash = keccak256(el);
} else {
hash = el;
}