diff --git a/src/evmasm.js b/src/evmasm.js index d68f791..351201b 100644 --- a/src/evmasm.js +++ b/src/evmasm.js @@ -3,7 +3,7 @@ // -const Web3 = require("web3"); +const Web3Utils = require("web3-utils"); const assert = require("assert"); class Contract { @@ -39,7 +39,7 @@ class Contract { genLoadedLength = C.code.length; } - return Web3.utils.bytesToHex(C.code.concat(this.code)); + return Web3Utils.bytesToHex(C.code.concat(this.code)); } stop() { this.code.push(0x00); } @@ -149,7 +149,7 @@ class Contract { } push(data) { - const d = Web3.utils.hexToBytes(Web3.utils.toHex(data)); + const d = Web3Utils.hexToBytes(Web3Utils.toHex(data)); assert(d.length>0); assert(d.length<=32); this.code = this.code.concat([0x5F + d.length], d); diff --git a/src/mimc7.js b/src/mimc7.js index dda4b07..47291d8 100644 --- a/src/mimc7.js +++ b/src/mimc7.js @@ -1,6 +1,6 @@ const bn128 = require("snarkjs").bn128; const bigInt = require("snarkjs").bigInt; -const Web3 = require("web3"); +const Web3Utils = require("web3-utils"); const F = bn128.Fr; const SEED = "mimc"; @@ -8,8 +8,8 @@ const NROUNDS = 91; exports.getIV = (seed) => { if (typeof seed === "undefined") seed = SEED; - const c = Web3.utils.keccak256(seed+"_iv"); - const cn = bigInt(Web3.utils.toBN(c).toString()); + const c = Web3Utils.keccak256(seed+"_iv"); + const cn = bigInt(Web3Utils.toBN(c).toString()); const iv = cn.mod(F.q); return iv; }; @@ -18,13 +18,13 @@ exports.getConstants = (seed, nRounds) => { if (typeof seed === "undefined") seed = SEED; if (typeof nRounds === "undefined") nRounds = NROUNDS; const cts = new Array(nRounds); - let c = Web3.utils.keccak256(SEED); + let c = Web3Utils.keccak256(SEED); for (let i=1; i