From 62f4fb93ce78362e56e76c4b9307405a67a50cb2 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 15 Apr 2021 15:22:24 +0200 Subject: [PATCH 01/29] use last ethereumjs-vm for berlin fork --- apps/remix-ide/src/app/panels/file-panel.js | 4 +- .../src/app/tabs/runTab/model/recorder.js | 2 +- apps/remix-ide/src/blockchain/blockchain.js | 4 +- .../src/blockchain/providers/injected.js | 3 +- .../src/blockchain/providers/node.js | 3 +- apps/remix-ide/src/blockchain/providers/vm.js | 3 +- libs/remix-analyzer/package.json | 6 +- libs/remix-astwalker/package.json | 6 +- libs/remix-debug/package.json | 8 +- .../src/solidity-decoder/types/Mapping.ts | 3 +- .../src/solidity-decoder/types/util.ts | 4 +- libs/remix-debug/src/trace/traceCache.ts | 2 +- libs/remix-debug/test/decoder/vmCall.ts | 44 +- libs/remix-debug/test/vmCall.ts | 31 +- libs/remix-lib/package.json | 7 +- .../src/execution/execution-context.ts | 110 +- libs/remix-lib/src/execution/txRunner.ts | 83 +- libs/remix-lib/src/universalDapp.ts | 23 +- libs/remix-lib/src/util.ts | 3 +- .../src/web3Provider/web3VmProvider.ts | 29 +- libs/remix-simulator/package.json | 8 +- libs/remix-simulator/src/genesis.ts | 19 +- libs/remix-simulator/src/methods/accounts.ts | 34 +- .../src/methods/transactions.ts | 9 +- libs/remix-solidity/package.json | 6 +- libs/remix-solidity/src/compiler/types.ts | 2 +- libs/remix-tests/package.json | 6 +- package-lock.json | 1400 ++++++++++------- package.json | 9 +- 29 files changed, 1059 insertions(+), 812 deletions(-) diff --git a/apps/remix-ide/src/app/panels/file-panel.js b/apps/remix-ide/src/app/panels/file-panel.js index e760f6b91c..893ec084f9 100644 --- a/apps/remix-ide/src/app/panels/file-panel.js +++ b/apps/remix-ide/src/app/panels/file-panel.js @@ -4,7 +4,7 @@ import * as packageJson from '../../../../../package.json' import React from 'react' // eslint-disable-line import ReactDOM from 'react-dom' import { Workspace } from '@remix-ui/workspace' // eslint-disable-line -import * as ethutil from 'ethereumjs-util' +import { bufferToHex, keccakFromString } from 'ethereumjs-util' import { checkSpecialChars, checkSlash } from '../../lib/helper' var EventManager = require('../../lib/events') var { RemixdHandle } = require('../files/remixd-handle.js') @@ -154,7 +154,7 @@ module.exports = class Filepanel extends ViewPlugin { try { await this.processCreateWorkspace('code-sample') this._deps.fileProviders.workspace.setWorkspace('code-sample') - var hash = ethutil.bufferToHex(ethutil.keccak(params.code)) + var hash = bufferToHex(keccakFromString(params.code)) const fileName = 'contract-' + hash.replace('0x', '').substring(0, 10) + '.sol' const path = fileName await this._deps.fileProviders.workspace.set(path, atob(params.code)) diff --git a/apps/remix-ide/src/app/tabs/runTab/model/recorder.js b/apps/remix-ide/src/app/tabs/runTab/model/recorder.js index d30791a3e6..126b354927 100644 --- a/apps/remix-ide/src/app/tabs/runTab/model/recorder.js +++ b/apps/remix-ide/src/app/tabs/runTab/model/recorder.js @@ -25,7 +25,7 @@ class Recorder { var record = { value, parameters: payLoad.funArgs } if (!to) { var abi = payLoad.contractABI - var keccak = ethutil.bufferToHex(ethutil.keccak(JSON.stringify(abi))) + var keccak = ethutil.bufferToHex(ethutil.keccakFromString(JSON.stringify(abi))) record.abi = keccak record.contractName = payLoad.contractName record.bytecode = payLoad.contractBytecode diff --git a/apps/remix-ide/src/blockchain/blockchain.js b/apps/remix-ide/src/blockchain/blockchain.js index f9000a8c6b..1ee396ea3d 100644 --- a/apps/remix-ide/src/blockchain/blockchain.js +++ b/apps/remix-ide/src/blockchain/blockchain.js @@ -439,7 +439,7 @@ class Blockchain { function (error, result) { if (error) return next(error) - const rawAddress = self.executionContext.isVM() ? result.result.createdAddress : result.result.contractAddress + const rawAddress = self.executionContext.isVM() ? result.result.createdAddress.buf : result.result.contractAddress const eventName = (tx.useCall ? 'callExecuted' : 'transactionExecuted') self.event.trigger(eventName, [error, tx.from, tx.to, tx.data, tx.useCall, result, timestamp, payLoad, rawAddress]) @@ -470,7 +470,7 @@ class Blockchain { let address = null let returnValue = null if (txResult && txResult.result) { - address = isVM ? txResult.result.createdAddress : txResult.result.contractAddress + address = isVM ? txResult.result.createdAddress.buf : txResult.result.contractAddress // if it's not the VM, we don't have return value. We only have the transaction, and it does not contain the return value. returnValue = (txResult.result.execResult && isVM) ? txResult.result.execResult.returnValue : txResult.result } diff --git a/apps/remix-ide/src/blockchain/providers/injected.js b/apps/remix-ide/src/blockchain/providers/injected.js index ce4c2273a0..074fcfbf2a 100644 --- a/apps/remix-ide/src/blockchain/providers/injected.js +++ b/apps/remix-ide/src/blockchain/providers/injected.js @@ -1,5 +1,5 @@ const Web3 = require('web3') -const { stripHexPrefix, hashPersonalMessage } = require('ethereumjs-util') +const { hashPersonalMessage } = require('ethereumjs-util') class InjectedProvider { constructor (executionContext) { @@ -20,7 +20,6 @@ class InjectedProvider { } getBalanceInEther (address, cb) { - address = stripHexPrefix(address) this.executionContext.web3().eth.getBalance(address, (err, res) => { if (err) { return cb(err) diff --git a/apps/remix-ide/src/blockchain/providers/node.js b/apps/remix-ide/src/blockchain/providers/node.js index 134783b6d9..abe407c3f3 100644 --- a/apps/remix-ide/src/blockchain/providers/node.js +++ b/apps/remix-ide/src/blockchain/providers/node.js @@ -1,5 +1,5 @@ const Web3 = require('web3') -const { stripHexPrefix, hashPersonalMessage } = require('ethereumjs-util') +const { hashPersonalMessage } = require('ethereumjs-util') const Personal = require('web3-eth-personal') class NodeProvider { @@ -28,7 +28,6 @@ class NodeProvider { } getBalanceInEther (address, cb) { - address = stripHexPrefix(address) this.executionContext.web3().eth.getBalance(address, (err, res) => { if (err) { return cb(err) diff --git a/apps/remix-ide/src/blockchain/providers/vm.js b/apps/remix-ide/src/blockchain/providers/vm.js index d1bc64f9b6..8ec6583ff7 100644 --- a/apps/remix-ide/src/blockchain/providers/vm.js +++ b/apps/remix-ide/src/blockchain/providers/vm.js @@ -1,5 +1,5 @@ const Web3 = require('web3') -const { BN, privateToAddress, stripHexPrefix, hashPersonalMessage } = require('ethereumjs-util') +const { BN, privateToAddress, hashPersonalMessage } = require('ethereumjs-util') const RemixSimulator = require('@remix-project/remix-simulator') class VMProvider { @@ -39,7 +39,6 @@ class VMProvider { } getBalanceInEther (address, cb) { - address = stripHexPrefix(address) this.web3.eth.getBalance(address, (err, res) => { if (err) { return cb(err) diff --git a/libs/remix-analyzer/package.json b/libs/remix-analyzer/package.json index 890f2e7937..3c1f81f4f3 100644 --- a/libs/remix-analyzer/package.json +++ b/libs/remix-analyzer/package.json @@ -21,9 +21,9 @@ "dependencies": { "@remix-project/remix-astwalker": "^0.0.26", "@remix-project/remix-lib": "^0.4.34", - "ethereumjs-block": "^2.2.2", - "ethereumjs-tx": "^2.1.2", - "ethereumjs-vm": "4.1.3" + "@ethereumjs/vm": "^5.3.2", + "@ethereumjs/block": "^3.2.1", + "@ethereumjs/tx": "^3.1.3" }, "publishConfig": { "access": "public" diff --git a/libs/remix-astwalker/package.json b/libs/remix-astwalker/package.json index ee7aad071a..51663ad1e6 100644 --- a/libs/remix-astwalker/package.json +++ b/libs/remix-astwalker/package.json @@ -36,9 +36,9 @@ "dependencies": { "@remix-project/remix-lib": "^0.4.34", "@types/tape": "^4.2.33", - "ethereumjs-block": "^2.2.2", - "ethereumjs-tx": "^2.1.2", - "ethereumjs-vm": "4.1.3", + "@ethereumjs/vm": "^5.3.2", + "@ethereumjs/block": "^3.2.1", + "@ethereumjs/tx": "^3.1.3", "nyc": "^13.3.0", "tape": "^4.10.1", "ts-node": "^8.0.3", diff --git a/libs/remix-debug/package.json b/libs/remix-debug/package.json index e0563ca2a4..fd42914a63 100644 --- a/libs/remix-debug/package.json +++ b/libs/remix-debug/package.json @@ -21,10 +21,10 @@ "@remix-project/remix-astwalker": "^0.0.26", "@remix-project/remix-lib": "^0.4.34", "commander": "^2.19.0", - "ethereumjs-block": "^2.2.2", - "ethereumjs-tx": "^2.1.2", - "ethereumjs-util": "^6.2.0", - "ethereumjs-vm": "4.1.3", + "@ethereumjs/vm": "^5.3.2", + "@ethereumjs/block": "^3.2.1", + "@ethereumjs/tx": "^3.1.3", + "ethereumjs-util": "^7.0.10", "web3": "^1.2.4" }, "devDependencies": { diff --git a/libs/remix-debug/src/solidity-decoder/types/Mapping.ts b/libs/remix-debug/src/solidity-decoder/types/Mapping.ts index a6fa6240b6..0d8b9e643a 100644 --- a/libs/remix-debug/src/solidity-decoder/types/Mapping.ts +++ b/libs/remix-debug/src/solidity-decoder/types/Mapping.ts @@ -69,8 +69,7 @@ function getMappingLocation (key, position) { let mappingP = intToBuffer(position) mappingP = setLengthLeft(mappingP, 32) const mappingKeyBuf = concatTypedArrays(mappingK, mappingP) - const mappingKeyPreimage: string = '0x' + mappingKeyBuf.toString('hex') - const mappingStorageLocation: Buffer = keccak(mappingKeyPreimage) + const mappingStorageLocation: Buffer = keccak(mappingKeyBuf) const mappingStorageLocationinBn: BN = new BN(mappingStorageLocation, 16) return mappingStorageLocationinBn } diff --git a/libs/remix-debug/src/solidity-decoder/types/util.ts b/libs/remix-debug/src/solidity-decoder/types/util.ts index fed6ea44f8..3229533ca8 100644 --- a/libs/remix-debug/src/solidity-decoder/types/util.ts +++ b/libs/remix-debug/src/solidity-decoder/types/util.ts @@ -1,5 +1,5 @@ 'use strict' -import { BN, bufferToHex, unpad } from 'ethereumjs-util' +import { BN, bufferToHex, unpadHexString } from 'ethereumjs-util' export function decodeIntFromHex (value, byteLength, signed) { let bigNumber = new BN(value, 16) @@ -57,7 +57,7 @@ export function toBN (value) { if (value instanceof BN) { return value } else if (value.match && value.match(/^(0x)?([a-f0-9]*)$/)) { - value = unpad(value.replace(/^(0x)/, '')) + value = unpadHexString(value.replace(/^(0x)/, '')) value = new BN(value === '' ? '0' : value, 16) } else if (!isNaN(value)) { value = new BN(value) diff --git a/libs/remix-debug/src/trace/traceCache.ts b/libs/remix-debug/src/trace/traceCache.ts index 313953b6cf..7c2d381ccc 100644 --- a/libs/remix-debug/src/trace/traceCache.ts +++ b/libs/remix-debug/src/trace/traceCache.ts @@ -104,7 +104,7 @@ export class TraceCache { address: address, key: key, value: value, - hashedKey: sha3_256(key) + hashedKey: key && sha3_256(key) } this.storageChanges.push(index) } diff --git a/libs/remix-debug/test/decoder/vmCall.ts b/libs/remix-debug/test/decoder/vmCall.ts index a8afadb5e5..b797797699 100644 --- a/libs/remix-debug/test/decoder/vmCall.ts +++ b/libs/remix-debug/test/decoder/vmCall.ts @@ -1,10 +1,11 @@ 'use strict' var utileth = require('ethereumjs-util') -var Tx = require('ethereumjs-tx').Transaction -var Block = require('ethereumjs-block') +var Tx = require('@ethereumjs/tx').Transaction +import { Block, BlockHeader } from '@ethereumjs/block' var BN = require('ethereumjs-util').BN var remixLib = require('@remix-project/remix-lib') -var EthJSVM = require('ethereumjs-vm').default +import VM from '@ethereumjs/vm' +import Common from '@ethereumjs/common' export function sendTx (vm, from, to, value, data, cb) { var tx = new Tx({ @@ -16,14 +17,14 @@ export function sendTx (vm, from, to, value, data, cb) { data: Buffer.from(data, 'hex') }) tx.sign(from.privateKey) - var block = new Block({ - header: { - timestamp: new Date().getTime() / 1000 | 0, - number: 0 - }, - transactions: [], - uncleHeaders: [] + + var header = BlockHeader.fromHeaderData({ + timestamp: new Date().getTime() / 1000 | 0, + number: 0 }) + + var block = new Block(header, [], []) + try { vm.runTx({block: block, tx: tx, skipBalance: true, skipNonce: true}).then(function (result) { setTimeout(() => { @@ -39,13 +40,9 @@ export function sendTx (vm, from, to, value, data, cb) { } function createVm (hardfork) { - // const stateManager = new StateManagerCommonStorageDump({}) - // stateManager.checkpoint(() => {}) - const vm = new EthJSVM({ - activatePrecompiles: true, - hardfork - }) - vm.blockchain.validate = false + const common = new Common({ chain: 'mainnet', hardfork }) + const vm = new VM({ common }) + // vm.blockchain.validate = false return { vm, stateManager: vm.stateManager } } @@ -53,17 +50,18 @@ function createVm (hardfork) { Init VM / Send Transaction */ export function initVM (st, privateKey) { - var VM = createVm('muirGlacier') + var VM = createVm('berlin') const vm = VM.vm var address = utileth.privateToAddress(privateKey) - vm.stateManager.getAccount(address, (error, account) => { - if (error) return console.log(error) - account.balance = '0xf00000000000000001' - vm.stateManager.putAccount(address, account, function cb (error) { - if (error) console.log(error) + vm.stateManager.getAccount(address).then((account) => { + account.balance = new BN('f00000000000000001', 16) + vm.stateManager.putAccount(address, account).catch((error) => { + console.log(error) }) + }).catch((error) => { + console.log(error) }) var web3Provider = new remixLib.vm.Web3VMProvider() diff --git a/libs/remix-debug/test/vmCall.ts b/libs/remix-debug/test/vmCall.ts index 1a0c74c148..57d9a960ff 100644 --- a/libs/remix-debug/test/vmCall.ts +++ b/libs/remix-debug/test/vmCall.ts @@ -1,7 +1,8 @@ 'use strict' +import { Block, BlockHeader } from '@ethereumjs/block' +import VM from '@ethereumjs/vm' var utileth = require('ethereumjs-util') -var Tx = require('ethereumjs-tx').Transaction -var Block = require('ethereumjs-block') +var Tx = require('@ethereumjs/tx').Transaction var BN = require('ethereumjs-util').BN var remixLib = require('@remix-project/remix-lib') @@ -15,14 +16,13 @@ function sendTx (vm, from, to, value, data, cb) { data: Buffer.from(data, 'hex') }) tx.sign(from.privateKey) - var block = new Block({ - header: { - timestamp: new Date().getTime() / 1000 | 0, - number: 0 - }, - transactions: [], - uncleHeaders: [] + + var header = BlockHeader.fromHeaderData({ + timestamp: new Date().getTime() / 1000 | 0, + number: 0 }) + + var block = new Block(header, [], []) vm.runTx({block: block, tx: tx, skipBalance: true, skipNonce: true}).then(function (result) { setTimeout(() => { cb(null, utileth.bufferToHex(tx.hash())) @@ -37,19 +37,18 @@ function sendTx (vm, from, to, value, data, cb) { Init VM / Send Transaction */ function initVM (privateKey) { - var VM = require('ethereumjs-vm').default var address = utileth.privateToAddress(privateKey) var vm = new VM({ - enableHomestead: true, activatePrecompiles: true }) - vm.stateManager.getAccount(address, (error, account) => { - if (error) return console.log(error) - account.balance = '0xf00000000000000001' - vm.stateManager.putAccount(address, account, function cb (error) { - if (error) console.log(error) + vm.stateManager.getAccount(address).then((account) => { + account.balance = new BN('f00000000000000001', 16) + vm.stateManager.putAccount(address, account).catch((error) => { + console.log(error) }) + }).catch((error) => { + console.log(error) }) var web3Provider = new remixLib.vm.Web3VMProvider() diff --git a/libs/remix-lib/package.json b/libs/remix-lib/package.json index 3bfe70d0d9..5ded9d4ff4 100644 --- a/libs/remix-lib/package.json +++ b/libs/remix-lib/package.json @@ -15,10 +15,9 @@ "main": "src/index.js", "dependencies": { "async": "^2.1.2", - "ethereumjs-block": "^2.2.2", - "ethereumjs-tx": "^2.1.2", - "ethereumjs-util": "^6.2.0", - "ethereumjs-vm": "4.1.3", + "@ethereumjs/block": "^3.2.1", + "@ethereumjs/tx": "^3.1.3", + "ethereumjs-util": "^7.0.10", "ethers": "^4.0.40", "events": "^3.0.0", "solc": "^0.7.4", diff --git a/libs/remix-lib/src/execution/execution-context.ts b/libs/remix-lib/src/execution/execution-context.ts index 24225acd30..98d16ae415 100644 --- a/libs/remix-lib/src/execution/execution-context.ts +++ b/libs/remix-lib/src/execution/execution-context.ts @@ -5,8 +5,10 @@ import { EventManager } from '../eventManager' import { rlp, keccak, bufferToHex } from 'ethereumjs-util' import { Web3VmProvider } from '../web3Provider/web3VmProvider' import { LogsManager } from './logsManager' -const EthJSVM = require('ethereumjs-vm').default -const StateManager = require('ethereumjs-vm/dist/state/stateManager').default +import VM from '@ethereumjs/vm' +import Common from '@ethereumjs/common' +import StateManager from '@ethereumjs/vm/dist/state/stateManager' +import { StorageDump } from '@ethereumjs/vm/dist/state/interface' declare let ethereum: any let web3 @@ -23,21 +25,21 @@ if (typeof window !== 'undefined' && typeof window['ethereum'] !== 'undefined') */ class StateManagerCommonStorageDump extends StateManager { - constructor (arg) { - super(arg) + keyHashes + constructor () { + super() this.keyHashes = {} } - putContractStorage (address, key, value, cb) { - this.keyHashes[keccak(key).toString('hex')] = bufferToHex(key) - super.putContractStorage(address, key, value, cb) - } +S +putContractStorage (address, key, value) { + this.keyHashes[keccak(key).toString('hex')] = bufferToHex(key) + return super.putContractStorage(address, key, value) +} - dumpStorage (address, cb) { - this._getStorageTrie(address, (err, trie) => { - if (err) { - return cb(err) - } +dumpStorage (address) { + return new Promise((resolve, reject) => { + this._getStorageTrie(address).then((trie) => { const storage = {} const stream = trie.createReadStream() stream.on('data', (val) => { @@ -48,28 +50,52 @@ class StateManagerCommonStorageDump extends StateManager { } }) stream.on('end', function () { - cb(storage) + resolve(storage) }) + }).catch((error) => { + reject(error) }) + }) +} + +async getStateRoot (force: boolean = false): Promise { + if (!force && this._checkpointCount !== 0) { + // throw new Error('Cannot get state root with uncommitted checkpoints') } - getStateRoot (cb) { - const checkpoint = this._checkpointCount - this._checkpointCount = 0 - super.getStateRoot((err, stateRoot) => { - this._checkpointCount = checkpoint - cb(err, stateRoot) - }) + try { + await this._cache.flush() + } catch (e) { + console.error(e) } - setStateRoot (stateRoot, cb) { - const checkpoint = this._checkpointCount - this._checkpointCount = 0 - super.setStateRoot(stateRoot, (err) => { - this._checkpointCount = checkpoint - cb(err) - }) + const stateRoot = this._trie.root + return stateRoot +} + +async setStateRoot (stateRoot: Buffer): Promise { + if (this._checkpointCount !== 0) { + // throw new Error('Cannot set state root with uncommitted checkpoints') } + + await this._cache.flush() + + if (stateRoot === this._trie.EMPTY_TRIE_ROOT) { + this._trie.root = stateRoot + this._cache.clear() + this._storageTries = {} + return + } + + const hasRoot = await this._trie.checkRoot(stateRoot) + if (!hasRoot) { + throw new Error('State trie does not contain state root') + } + + this._trie.root = stateRoot + this._cache.clear() + this._storageTries = {} +} } /* @@ -96,7 +122,7 @@ export class ExecutionContext { this.executionContext = null this.blockGasLimitDefault = 4300000 this.blockGasLimit = this.blockGasLimitDefault - this.currentFork = 'muirGlacier' + this.currentFork = 'berlin' this.vms = { /* byzantium: createVm('byzantium'), @@ -104,7 +130,7 @@ export class ExecutionContext { petersburg: createVm('petersburg'), istanbul: createVm('istanbul'), */ - muirGlacier: this.createVm('muirGlacier') + berlin: this.createVm('berlin') } this.mainNetGenesisHash = '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3' this.customNetWorks = {} @@ -123,18 +149,18 @@ export class ExecutionContext { } createVm (hardfork) { - const stateManager = new StateManagerCommonStorageDump({}) - stateManager.checkpoint(() => {}) - const vm = new EthJSVM({ + const stateManager = new StateManagerCommonStorageDump() + stateManager.checkpoint() + const common = new Common({ chain: 'mainnet', hardfork }) + const vm = new VM({ + common, activatePrecompiles: true, - blockchain: stateManager.blockchain, - stateManager: stateManager, - hardfork: hardfork + stateManager: stateManager }) - vm.blockchain.validate = false + const web3vm = new Web3VmProvider() web3vm.setVM(vm) - return { vm, web3vm, stateManager } + return { vm, web3vm, stateManager, common } } askPermission () { @@ -210,6 +236,10 @@ export class ExecutionContext { return this.vms[this.currentFork].vm } + vmObject () { + return this.vms[this.currentFork] + } + setContext (context, endPointUrl, confirmCb, infoCb) { this.executionContext = context this.executionContextChange(context, endPointUrl, confirmCb, infoCb, null) @@ -221,8 +251,8 @@ export class ExecutionContext { if (!infoCb) infoCb = () => {} if (context === 'vm') { this.executionContext = context - this.vms[this.currentFork].stateManager.revert(() => { - this.vms[this.currentFork].stateManager.checkpoint(() => {}) + this.vms[this.currentFork].stateManager.revert().then(() => { + this.vms[this.currentFork].stateManager.checkpoint() }) this.event.trigger('contextChanged', ['vm']) return cb() diff --git a/libs/remix-lib/src/execution/txRunner.ts b/libs/remix-lib/src/execution/txRunner.ts index d2aa690d61..f8835cb6ee 100644 --- a/libs/remix-lib/src/execution/txRunner.ts +++ b/libs/remix-lib/src/execution/txRunner.ts @@ -1,7 +1,7 @@ 'use strict' -import { Transaction } from 'ethereumjs-tx' -import Block from 'ethereumjs-block' -import { BN, bufferToHex } from 'ethereumjs-util' +import { Transaction } from '@ethereumjs/tx' +import { Block, BlockHeader } from '@ethereumjs/block' +import { BN, bufferToHex, Address } from 'ethereumjs-util' import { ExecutionContext } from './execution-context' import { EventManager } from '../eventManager' @@ -15,11 +15,13 @@ export class TxRunner { vmaccounts queusTxs blocks + commonContext constructor (vmaccounts, api, executionContext) { this.event = new EventManager() // has a default for now for backwards compatability this.executionContext = executionContext || new ExecutionContext() + this.commonContext = this.executionContext.vmObject().common this._api = api this.blockNumber = 0 this.runAsync = true @@ -109,48 +111,45 @@ export class TxRunner { return callback('Invalid account selected') } - this.executionContext.vm().stateManager.getAccount(Buffer.from(from.replace('0x', ''), 'hex'), (err, res) => { - if (err) { - callback('Account not found') + this.executionContext.vm().stateManager.getAccount(Address.fromString(from)).then((res) => { + // See https://github.com/ethereumjs/ethereumjs-tx/blob/master/docs/classes/transaction.md#constructor + // for initialization fields and their types + value = value ? parseInt(value) : 0 + const tx = Transaction.fromTxData({ + nonce: new BN(res.nonce), + gasPrice: '0x1', + gasLimit: gasLimit, + to: to, + value: value, + data: Buffer.from(data.slice(2), 'hex') + }, { common: this.commonContext }).sign(account.privateKey) + + const coinbases = ['0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', '0x8945a1288dc78a6d8952a92c77aee6730b414778', '0x94d76e24f818426ae84aa404140e8d5f60e10e7e'] + const difficulties = [new BN('69762765929000', 10), new BN('70762765929000', 10), new BN('71762765929000', 10)] + + const header: BlockHeader = BlockHeader.fromHeaderData({ + timestamp: timestamp || (new Date().getTime() / 1000 | 0), + number: self.blockNumber, + coinbase: coinbases[self.blockNumber % coinbases.length], + difficulty: difficulties[self.blockNumber % difficulties.length], + gasLimit: new BN(gasLimit.replace('0x', ''), 16).imuln(2) + }, { common: this.commonContext }) + + const block = new Block(header, [tx], []) + if (!useCall) { + ++self.blockNumber + this.runBlockInVm(tx, block, callback) } else { - // See https://github.com/ethereumjs/ethereumjs-tx/blob/master/docs/classes/transaction.md#constructor - // for initialization fields and their types - value = value ? parseInt(value) : 0 - const tx = new Transaction({ - nonce: new BN(res.nonce), - gasPrice: '0x1', - gasLimit: gasLimit, - to: to, - value: value, - data: Buffer.from(data.slice(2), 'hex') - }) - tx.sign(account.privateKey) - const coinbases = ['0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', '0x8945a1288dc78a6d8952a92c77aee6730b414778', '0x94d76e24f818426ae84aa404140e8d5f60e10e7e'] - const difficulties = [new BN('69762765929000', 10), new BN('70762765929000', 10), new BN('71762765929000', 10)] - const block = new Block({ - header: { - timestamp: timestamp || (new Date().getTime() / 1000 | 0), - number: self.blockNumber, - coinbase: coinbases[self.blockNumber % coinbases.length], - difficulty: difficulties[self.blockNumber % difficulties.length], - gasLimit: new BN(gasLimit, 10).imuln(2) - }, - transactions: [tx], - uncleHeaders: [] - }) - if (!useCall) { - ++self.blockNumber - this.runBlockInVm(tx, block, callback) - } else { - this.executionContext.vm().stateManager.checkpoint(() => { - this.runBlockInVm(tx, block, (err, result) => { - this.executionContext.vm().stateManager.revert(() => { - callback(err, result) - }) + this.executionContext.vm().stateManager.checkpoint().then(() => { + this.runBlockInVm(tx, block, (err, result) => { + this.executionContext.vm().stateManager.revert().then(() => { + callback(err, result) }) }) - } + }) } + }).catch(() => { + callback('Account not found') }) } @@ -167,7 +166,7 @@ export class TxRunner { result: result, transactionHash: bufferToHex(Buffer.from(tx.hash())) }) - }).catch(function (err) { + }).catch((err) => { callback(err) }) } diff --git a/libs/remix-lib/src/universalDapp.ts b/libs/remix-lib/src/universalDapp.ts index e526f10f78..030a8da811 100644 --- a/libs/remix-lib/src/universalDapp.ts +++ b/libs/remix-lib/src/universalDapp.ts @@ -1,6 +1,5 @@ import { waterfall } from 'async' -import { BN, privateToAddress, isValidPrivate, toChecksumAddress } from 'ethereumjs-util' -import { stripHexPrefix } from 'ethjs-util' +import { BN, privateToAddress, isValidPrivate, toChecksumAddress, Address } from 'ethereumjs-util' import { randomBytes } from 'crypto' import { EventEmitter } from 'events' import { TxRunner } from './execution/txRunner' @@ -124,12 +123,13 @@ export class UniversalDApp { // FIXME: we don't care about the callback, but we should still make this proper const stateManager = this.executionContext.vm().stateManager - stateManager.getAccount(address, (error, account) => { - if (error) return console.log(error) - account.balance = balance || '0xf00000000000000001' - stateManager.putAccount(address, account, function cb (error) { - if (error) console.log(error) + stateManager.getAccount(address).then((account) => { + account.balance = new BN(balance.replace('0x', '') || 'f00000000000000001', 16) + stateManager.putAccount(address, account).catch((error) => { + console.log(error) }) + }).catch((error) => { + console.log(error) }) this.accounts[toChecksumAddress('0x' + address.toString('hex'))] = { privateKey, nonce: 0 } @@ -177,8 +177,6 @@ export class UniversalDApp { /** Get the balance of an address */ getBalance (address, cb) { - address = stripHexPrefix(address) - if (!this.executionContext.isVM()) { return this.executionContext.web3().eth.getBalance(address, (err, res) => { if (err) { @@ -191,11 +189,10 @@ export class UniversalDApp { return cb('No accounts?') } - this.executionContext.vm().stateManager.getAccount(Buffer.from(address, 'hex'), (err, res) => { - if (err) { - return cb('Account not found') - } + this.executionContext.vm().stateManager.getAccount(Address.fromString(address)).then((res) => { cb(null, new BN(res.balance).toString(10)) + }).catch(() => { + cb('Account not found') }) } diff --git a/libs/remix-lib/src/util.ts b/libs/remix-lib/src/util.ts index 5654b55234..1895930890 100644 --- a/libs/remix-lib/src/util.ts +++ b/libs/remix-lib/src/util.ts @@ -168,8 +168,7 @@ export function sha3_256 (value) { if (typeof value === 'string' && value.indexOf('0x') !== 0) { value = '0x' + value } - const ret: string = bufferToHex(setLengthLeft(value, 32)) - const retInBuffer: Buffer = keccak(ret) + const retInBuffer: Buffer = keccak(setLengthLeft(Buffer.from(value.replace('0x', ''), 'hex'), 32)) return bufferToHex(retInBuffer) } diff --git a/libs/remix-lib/src/web3Provider/web3VmProvider.ts b/libs/remix-lib/src/web3Provider/web3VmProvider.ts index 99c5d9f51e..9a5fd82a20 100644 --- a/libs/remix-lib/src/web3Provider/web3VmProvider.ts +++ b/libs/remix-lib/src/web3Provider/web3VmProvider.ts @@ -1,6 +1,6 @@ import { hexConvert, hexListFromBNs, formatMemory } from '../util' import { normalizeHexAddress } from '../helpers/uiHelper' -import { toChecksumAddress, BN, toBuffer } from 'ethereumjs-util' +import { toChecksumAddress, BN, toBuffer, Address } from 'ethereumjs-util' import Web3 from 'web3' export class Web3VmProvider { @@ -101,23 +101,23 @@ export class Web3VmProvider { } const tx = {} tx['hash'] = this.processingHash - tx['from'] = toChecksumAddress(hexConvert(data.getSenderAddress())) + tx['from'] = toChecksumAddress(hexConvert(data.getSenderAddress().buf)) if (data.to && data.to.length) { - tx['to'] = toChecksumAddress(hexConvert(data.to)) + tx['to'] = toChecksumAddress(hexConvert(data.to.buf)) } this.processingAddress = tx['to'] - tx['data'] = hexConvert(data.data) - tx['input'] = hexConvert(data.input) - tx['gas'] = (new BN(hexConvert(data.gas).replace('0x', ''), 16)).toString(10) + // tx['data'] = hexConvert(data.data) + tx['input'] = hexConvert(data.data) + tx['gas'] = data.gasLimit.toString(10) if (data.value) { - tx['value'] = hexConvert(data.value) + tx['value'] = data.value.toString(10) } this.txs[this.processingHash] = tx this.txsReceipt[this.processingHash] = tx this.storageCache[this.processingHash] = {} if (tx['to']) { const account = toBuffer(tx['to']) - this.vm.stateManager.dumpStorage(account, (storage) => { + this.vm.stateManager.dumpStorage(account).then((storage) => { this.storageCache[this.processingHash][tx['to']] = storage this.lastProcessedStorageTxHash[tx['to']] = this.processingHash }) @@ -155,8 +155,8 @@ export class Web3VmProvider { const status = data.execResult.exceptionError ? 0 : 1 this.txsReceipt[this.processingHash].status = `0x${status}` - if (data.createdAddress) { - const address = hexConvert(data.createdAddress) + if (data.createdAddress && data.createdAddress.buf) { + const address = hexConvert(data.createdAddress.buf) this.vmTraces[this.processingHash].return = toChecksumAddress(address) this.txsReceipt[this.processingHash].contractAddress = toChecksumAddress(address) } else if (data.execResult.returnValue) { @@ -206,7 +206,7 @@ export class Web3VmProvider { this.processingAddress = toChecksumAddress(this.processingAddress) if (!this.storageCache[this.processingHash][this.processingAddress]) { const account = toBuffer(this.processingAddress) - this.vm.stateManager.dumpStorage(account, (storage) => { + this.vm.stateManager.dumpStorage(account).then((storage) => { this.storageCache[this.processingHash][this.processingAddress] = storage this.lastProcessedStorageTxHash[this.processingAddress] = this.processingHash }) @@ -227,9 +227,10 @@ export class Web3VmProvider { getCode (address, cb) { address = toChecksumAddress(address) - const account = toBuffer(address) - this.vm.stateManager.getContractCode(account, (error, result) => { - cb(error, hexConvert(result)) + this.vm.stateManager.getContractCode(Address.fromString(address)).then((result) => { + cb(null, hexConvert(result)) + }).catch((error) => { + cb(error) }) } diff --git a/libs/remix-simulator/package.json b/libs/remix-simulator/package.json index 02d2e7d432..eb09b20106 100644 --- a/libs/remix-simulator/package.json +++ b/libs/remix-simulator/package.json @@ -21,10 +21,10 @@ "color-support": "^1.1.3", "commander": "^2.19.0", "cors": "^2.8.5", - "ethereumjs-block": "^2.2.2", - "ethereumjs-tx": "^2.1.2", - "ethereumjs-util": "^6.2.0", - "ethereumjs-vm": "4.1.3", + "@ethereumjs/vm": "^5.3.2", + "@ethereumjs/block": "^3.2.1", + "@ethereumjs/tx": "^3.1.3", + "ethereumjs-util": "^7.0.10", "express": "^4.16.3", "express-ws": "^4.0.0", "merge": "^1.2.0", diff --git a/libs/remix-simulator/src/genesis.ts b/libs/remix-simulator/src/genesis.ts index 85795c0d83..b8e99af54e 100644 --- a/libs/remix-simulator/src/genesis.ts +++ b/libs/remix-simulator/src/genesis.ts @@ -1,18 +1,15 @@ -import EthJSBlock from 'ethereumjs-block' +import { Block, BlockHeader } from '@ethereumjs/block' import { BN } from 'ethereumjs-util' export function generateBlock (executionContext) { - const block: EthJSBlock = new EthJSBlock({ - header: { - timestamp: (new Date().getTime() / 1000 | 0), - number: 0, - coinbase: '0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', - difficulty: (new BN('69762765929000', 10)), - gasLimit: new BN('8000000').imuln(1) - }, - transactions: [], - uncleHeaders: [] + const header: BlockHeader = BlockHeader.fromHeaderData({ + timestamp: (new Date().getTime() / 1000 | 0), + number: 0, + coinbase: '0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', + difficulty: new BN('69762765929000', 10), + gasLimit: new BN('8000000').imuln(1) }) + const block: Block = new Block(header, [], []) executionContext.vm().runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false }).then(() => { executionContext.addBlock(block) diff --git a/libs/remix-simulator/src/methods/accounts.ts b/libs/remix-simulator/src/methods/accounts.ts index 347b002115..1bda2e9de3 100644 --- a/libs/remix-simulator/src/methods/accounts.ts +++ b/libs/remix-simulator/src/methods/accounts.ts @@ -1,5 +1,4 @@ -import { BN, privateToAddress, toChecksumAddress, isValidPrivate } from 'ethereumjs-util' -import { stripHexPrefix } from 'ethjs-util' +import { BN, privateToAddress, toChecksumAddress, isValidPrivate, Address } from 'ethereumjs-util' import Web3 from 'web3' import * as crypto from 'crypto' @@ -44,19 +43,21 @@ export class Accounts { return new Promise((resolve, reject) => { privateKey = Buffer.from(privateKey, 'hex') const address: Buffer = privateToAddress(privateKey) - - this.accounts[toChecksumAddress('0x' + address.toString('hex'))] = { privateKey, nonce: 0 } - this.accountsKeys[toChecksumAddress('0x' + address.toString('hex'))] = '0x' + privateKey.toString('hex') + const addressStr = toChecksumAddress('0x' + address.toString('hex')) + this.accounts[addressStr] = { privateKey, nonce: 0 } + this.accountsKeys[addressStr] = '0x' + privateKey.toString('hex') const stateManager = this.executionContext.vm().stateManager - stateManager.getAccount(address, (error, account) => { - if (error) { - console.log(error) + stateManager.getAccount(Address.fromString(addressStr)).then((account) => { + account.balance = new BN(balance.replace('0x', '') || 'f00000000000000001', 16) + stateManager.putAccount(Address.fromString(addressStr), account).catch((error) => { reject(error) - return - } - account.balance = balance || '0xf00000000000000001' - resolve() + }).then(() => { + resolve({}) + }) + }).catch((error) => { + reject(error) + return }) }) } @@ -84,13 +85,12 @@ export class Accounts { eth_getBalance (payload, cb) { let address = payload.params[0] - address = stripHexPrefix(address) + - this.executionContext.vm().stateManager.getAccount(Buffer.from(address, 'hex'), (err, account) => { - if (err) { - return cb(err) - } + this.executionContext.vm().stateManager.getAccount(Address.fromString(address)).then((account) => { cb(null, new BN(account.balance).toString(10)) + }).catch((error) => { + cb(error) }) } diff --git a/libs/remix-simulator/src/methods/transactions.ts b/libs/remix-simulator/src/methods/transactions.ts index ca4a33c3f8..f3e8ca3f43 100644 --- a/libs/remix-simulator/src/methods/transactions.ts +++ b/libs/remix-simulator/src/methods/transactions.ts @@ -1,5 +1,5 @@ import Web3 from 'web3' -import { toChecksumAddress, BN } from 'ethereumjs-util' +import { toChecksumAddress, BN, Address } from 'ethereumjs-util' import { processTx } from './txProcess' export class Transactions { @@ -98,12 +98,11 @@ export class Transactions { eth_getTransactionCount (payload, cb) { const address = payload.params[0] - this.executionContext.vm().stateManager.getAccount(address, (err, account) => { - if (err) { - return cb(err) - } + this.executionContext.vm().stateManager.getAccount(Address.fromString(address)).then((account) => { const nonce = new BN(account.nonce).toString(10) cb(null, nonce) + }).catch((error) => { + cb(error) }) } diff --git a/libs/remix-solidity/package.json b/libs/remix-solidity/package.json index 1700195aa3..ddb834e951 100644 --- a/libs/remix-solidity/package.json +++ b/libs/remix-solidity/package.json @@ -17,9 +17,9 @@ "dependencies": { "@remix-project/remix-lib": "^0.4.34", "eslint-scope": "^5.0.0", - "ethereumjs-block": "^2.2.2", - "ethereumjs-tx": "^2.1.2", - "ethereumjs-vm": "4.1.3", + "@ethereumjs/vm": "^5.3.2", + "@ethereumjs/block": "^3.2.1", + "@ethereumjs/tx": "^3.1.3", "solc": "^0.7.4", "webworkify-webpack": "^2.1.5" }, diff --git a/libs/remix-solidity/src/compiler/types.ts b/libs/remix-solidity/src/compiler/types.ts index 4bf4a765d0..e10e99e52f 100644 --- a/libs/remix-solidity/src/compiler/types.ts +++ b/libs/remix-solidity/src/compiler/types.ts @@ -150,7 +150,7 @@ export interface CompilerInputOptions { language?: Language } -export type EVMVersion = 'homestead' | 'tangerineWhistle' | 'spuriousDragon' | 'byzantium' | 'constantinople' | 'petersburg' | 'istanbul' | 'muirGlacier' | null +export type EVMVersion = 'homestead' | 'tangerineWhistle' | 'spuriousDragon' | 'byzantium' | 'constantinople' | 'petersburg' | 'istanbul' | 'muirGlacier' | 'berlin' | null export type Language = 'Solidity' | 'Yul' diff --git a/libs/remix-tests/package.json b/libs/remix-tests/package.json index b97ebb8cb6..a2480bfa46 100644 --- a/libs/remix-tests/package.json +++ b/libs/remix-tests/package.json @@ -45,9 +45,9 @@ "color-support": "^1.1.3", "colors": "^1.1.2", "commander": "^2.13.0", - "ethereumjs-block": "^2.2.2", - "ethereumjs-tx": "^2.1.2", - "ethereumjs-vm": "4.1.3", + "@ethereumjs/vm": "^5.3.2", + "@ethereumjs/block": "^3.2.1", + "@ethereumjs/tx": "^3.1.3", "express-ws": "^4.0.0", "merge": "^1.2.0", "signale": "^1.4.0", diff --git a/package-lock.json b/package-lock.json index dadb116715..1c46ff1b5f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2515,6 +2515,721 @@ } } }, + "@ethereumjs/block": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@ethereumjs/block/-/block-3.2.1.tgz", + "integrity": "sha512-FCxo5KwwULne2A2Yuae4iaGGqSsRjwzXOlDhGalOFiBbLfP3hE04RHaHGw4c8vh1PfOrLauwi0dQNUBkOG3zIA==", + "requires": { + "@ethereumjs/common": "^2.2.0", + "@ethereumjs/tx": "^3.1.3", + "ethereumjs-util": "^7.0.10", + "merkle-patricia-tree": "^4.1.0" + }, + "dependencies": { + "@types/bn.js": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", + "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", + "requires": { + "@types/node": "*" + } + }, + "abstract-leveldown": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.3.0.tgz", + "integrity": "sha512-TU5nlYgta8YrBMNpc9FwQzRbiXsj49gsALsXadbGHt9CROPzX5fB0rWDR5mtdpOOKa5XqRFpbj1QroPAoPzVjQ==", + "requires": { + "buffer": "^5.5.0", + "immediate": "^3.2.3", + "level-concat-iterator": "~2.0.0", + "level-supports": "~1.0.0", + "xtend": "~4.0.0" + } + }, + "bn.js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", + "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" + }, + "deferred-leveldown": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz", + "integrity": "sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw==", + "requires": { + "abstract-leveldown": "~6.2.1", + "inherits": "^2.0.3" + }, + "dependencies": { + "abstract-leveldown": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", + "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", + "requires": { + "buffer": "^5.5.0", + "immediate": "^3.2.3", + "level-concat-iterator": "~2.0.0", + "level-supports": "~1.0.0", + "xtend": "~4.0.0" + } + } + } + }, + "encoding-down": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/encoding-down/-/encoding-down-6.3.0.tgz", + "integrity": "sha512-QKrV0iKR6MZVJV08QY0wp1e7vF6QbhnbQhb07bwpEyuz4uZiZgPlEGdkCROuFkUwdxlFaiPIhjyarH1ee/3vhw==", + "requires": { + "abstract-leveldown": "^6.2.1", + "inherits": "^2.0.3", + "level-codec": "^9.0.0", + "level-errors": "^2.0.0" + } + }, + "ethereumjs-util": { + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.0.10.tgz", + "integrity": "sha512-c/xThw6A+EAnej5Xk5kOzFzyoSnw0WX0tSlZ6pAsfGVvQj3TItaDg9b1+Fz1RJXA+y2YksKwQnuzgt1eY6LKzw==", + "requires": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "ethjs-util": "0.1.6", + "rlp": "^2.2.4" + } + }, + "level-codec": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/level-codec/-/level-codec-9.0.2.tgz", + "integrity": "sha512-UyIwNb1lJBChJnGfjmO0OR+ezh2iVu1Kas3nvBS/BzGnx79dv6g7unpKIDNPMhfdTEGoc7mC8uAu51XEtX+FHQ==", + "requires": { + "buffer": "^5.6.0" + } + }, + "level-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/level-errors/-/level-errors-2.0.1.tgz", + "integrity": "sha512-UVprBJXite4gPS+3VznfgDSU8PTRuVX0NXwoWW50KLxd2yw4Y1t2JUR5In1itQnudZqRMT9DlAM3Q//9NCjCFw==", + "requires": { + "errno": "~0.1.1" + } + }, + "level-iterator-stream": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/level-iterator-stream/-/level-iterator-stream-4.0.2.tgz", + "integrity": "sha512-ZSthfEqzGSOMWoUGhTXdX9jv26d32XJuHz/5YnuHZzH6wldfWMOVwI9TBtKcya4BKTyTt3XVA0A3cF3q5CY30Q==", + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.4.0", + "xtend": "^4.0.2" + } + }, + "level-mem": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/level-mem/-/level-mem-5.0.1.tgz", + "integrity": "sha512-qd+qUJHXsGSFoHTziptAKXoLX87QjR7v2KMbqncDXPxQuCdsQlzmyX+gwrEHhlzn08vkf8TyipYyMmiC6Gobzg==", + "requires": { + "level-packager": "^5.0.3", + "memdown": "^5.0.0" + } + }, + "level-packager": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/level-packager/-/level-packager-5.1.1.tgz", + "integrity": "sha512-HMwMaQPlTC1IlcwT3+swhqf/NUO+ZhXVz6TY1zZIIZlIR0YSn8GtAAWmIvKjNY16ZkEg/JcpAuQskxsXqC0yOQ==", + "requires": { + "encoding-down": "^6.3.0", + "levelup": "^4.3.2" + } + }, + "level-ws": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/level-ws/-/level-ws-2.0.0.tgz", + "integrity": "sha512-1iv7VXx0G9ec1isqQZ7y5LmoZo/ewAsyDHNA8EFDW5hqH2Kqovm33nSFkSdnLLAK+I5FlT+lo5Cw9itGe+CpQA==", + "requires": { + "inherits": "^2.0.3", + "readable-stream": "^3.1.0", + "xtend": "^4.0.1" + } + }, + "levelup": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/levelup/-/levelup-4.4.0.tgz", + "integrity": "sha512-94++VFO3qN95cM/d6eBXvd894oJE0w3cInq9USsyQzzoJxmiYzPAocNcuGCPGGjoXqDVJcr3C1jzt1TSjyaiLQ==", + "requires": { + "deferred-leveldown": "~5.3.0", + "level-errors": "~2.0.0", + "level-iterator-stream": "~4.0.0", + "level-supports": "~1.0.0", + "xtend": "~4.0.0" + } + }, + "memdown": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/memdown/-/memdown-5.1.0.tgz", + "integrity": "sha512-B3J+UizMRAlEArDjWHTMmadet+UKwHd3UjMgGBkZcKAxAYVPS9o0Yeiha4qvz7iGiL2Sb3igUft6p7nbFWctpw==", + "requires": { + "abstract-leveldown": "~6.2.1", + "functional-red-black-tree": "~1.0.1", + "immediate": "~3.2.3", + "inherits": "~2.0.1", + "ltgt": "~2.2.0", + "safe-buffer": "~5.2.0" + }, + "dependencies": { + "abstract-leveldown": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", + "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", + "requires": { + "buffer": "^5.5.0", + "immediate": "^3.2.3", + "level-concat-iterator": "~2.0.0", + "level-supports": "~1.0.0", + "xtend": "~4.0.0" + } + }, + "immediate": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.2.3.tgz", + "integrity": "sha1-0UD6j2FGWb1lQSMwl92qwlzdmRw=" + } + } + }, + "merkle-patricia-tree": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/merkle-patricia-tree/-/merkle-patricia-tree-4.1.0.tgz", + "integrity": "sha512-vmP1J7FwIpprFMVjjSMM1JAwFce85Q+tp0TYIedYv8qaMh2oLUZ3ETXn9wbgi9S6elySzKzGa+Ai6VNKGEwSlg==", + "requires": { + "@types/levelup": "^4.3.0", + "ethereumjs-util": "^7.0.8", + "level-mem": "^5.0.1", + "level-ws": "^2.0.0", + "readable-stream": "^3.6.0", + "rlp": "^2.2.3", + "semaphore-async-await": "^1.5.1" + } + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + } + } + }, + "@ethereumjs/blockchain": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@ethereumjs/blockchain/-/blockchain-5.2.1.tgz", + "integrity": "sha512-+hshP2qSOOFsiYvZCbaDQFG7jYTWafE8sfBi+pAsdhAHfP7BN7VLyob7qoQISgwS1s7NTR4c4+2t/woU9ahItw==", + "requires": { + "@ethereumjs/block": "^3.2.0", + "@ethereumjs/common": "^2.2.0", + "@ethereumjs/ethash": "^1.0.0", + "debug": "^2.2.0", + "ethereumjs-util": "^7.0.9", + "level-mem": "^5.0.1", + "lru-cache": "^5.1.1", + "rlp": "^2.2.4", + "semaphore-async-await": "^1.5.1" + }, + "dependencies": { + "@types/bn.js": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", + "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", + "requires": { + "@types/node": "*" + } + }, + "abstract-leveldown": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.3.0.tgz", + "integrity": "sha512-TU5nlYgta8YrBMNpc9FwQzRbiXsj49gsALsXadbGHt9CROPzX5fB0rWDR5mtdpOOKa5XqRFpbj1QroPAoPzVjQ==", + "requires": { + "buffer": "^5.5.0", + "immediate": "^3.2.3", + "level-concat-iterator": "~2.0.0", + "level-supports": "~1.0.0", + "xtend": "~4.0.0" + } + }, + "bn.js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", + "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "deferred-leveldown": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz", + "integrity": "sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw==", + "requires": { + "abstract-leveldown": "~6.2.1", + "inherits": "^2.0.3" + }, + "dependencies": { + "abstract-leveldown": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", + "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", + "requires": { + "buffer": "^5.5.0", + "immediate": "^3.2.3", + "level-concat-iterator": "~2.0.0", + "level-supports": "~1.0.0", + "xtend": "~4.0.0" + } + } + } + }, + "encoding-down": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/encoding-down/-/encoding-down-6.3.0.tgz", + "integrity": "sha512-QKrV0iKR6MZVJV08QY0wp1e7vF6QbhnbQhb07bwpEyuz4uZiZgPlEGdkCROuFkUwdxlFaiPIhjyarH1ee/3vhw==", + "requires": { + "abstract-leveldown": "^6.2.1", + "inherits": "^2.0.3", + "level-codec": "^9.0.0", + "level-errors": "^2.0.0" + } + }, + "ethereumjs-util": { + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.0.10.tgz", + "integrity": "sha512-c/xThw6A+EAnej5Xk5kOzFzyoSnw0WX0tSlZ6pAsfGVvQj3TItaDg9b1+Fz1RJXA+y2YksKwQnuzgt1eY6LKzw==", + "requires": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "ethjs-util": "0.1.6", + "rlp": "^2.2.4" + } + }, + "level-codec": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/level-codec/-/level-codec-9.0.2.tgz", + "integrity": "sha512-UyIwNb1lJBChJnGfjmO0OR+ezh2iVu1Kas3nvBS/BzGnx79dv6g7unpKIDNPMhfdTEGoc7mC8uAu51XEtX+FHQ==", + "requires": { + "buffer": "^5.6.0" + } + }, + "level-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/level-errors/-/level-errors-2.0.1.tgz", + "integrity": "sha512-UVprBJXite4gPS+3VznfgDSU8PTRuVX0NXwoWW50KLxd2yw4Y1t2JUR5In1itQnudZqRMT9DlAM3Q//9NCjCFw==", + "requires": { + "errno": "~0.1.1" + } + }, + "level-iterator-stream": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/level-iterator-stream/-/level-iterator-stream-4.0.2.tgz", + "integrity": "sha512-ZSthfEqzGSOMWoUGhTXdX9jv26d32XJuHz/5YnuHZzH6wldfWMOVwI9TBtKcya4BKTyTt3XVA0A3cF3q5CY30Q==", + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.4.0", + "xtend": "^4.0.2" + } + }, + "level-mem": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/level-mem/-/level-mem-5.0.1.tgz", + "integrity": "sha512-qd+qUJHXsGSFoHTziptAKXoLX87QjR7v2KMbqncDXPxQuCdsQlzmyX+gwrEHhlzn08vkf8TyipYyMmiC6Gobzg==", + "requires": { + "level-packager": "^5.0.3", + "memdown": "^5.0.0" + } + }, + "level-packager": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/level-packager/-/level-packager-5.1.1.tgz", + "integrity": "sha512-HMwMaQPlTC1IlcwT3+swhqf/NUO+ZhXVz6TY1zZIIZlIR0YSn8GtAAWmIvKjNY16ZkEg/JcpAuQskxsXqC0yOQ==", + "requires": { + "encoding-down": "^6.3.0", + "levelup": "^4.3.2" + } + }, + "levelup": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/levelup/-/levelup-4.4.0.tgz", + "integrity": "sha512-94++VFO3qN95cM/d6eBXvd894oJE0w3cInq9USsyQzzoJxmiYzPAocNcuGCPGGjoXqDVJcr3C1jzt1TSjyaiLQ==", + "requires": { + "deferred-leveldown": "~5.3.0", + "level-errors": "~2.0.0", + "level-iterator-stream": "~4.0.0", + "level-supports": "~1.0.0", + "xtend": "~4.0.0" + } + }, + "memdown": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/memdown/-/memdown-5.1.0.tgz", + "integrity": "sha512-B3J+UizMRAlEArDjWHTMmadet+UKwHd3UjMgGBkZcKAxAYVPS9o0Yeiha4qvz7iGiL2Sb3igUft6p7nbFWctpw==", + "requires": { + "abstract-leveldown": "~6.2.1", + "functional-red-black-tree": "~1.0.1", + "immediate": "~3.2.3", + "inherits": "~2.0.1", + "ltgt": "~2.2.0", + "safe-buffer": "~5.2.0" + }, + "dependencies": { + "abstract-leveldown": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", + "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", + "requires": { + "buffer": "^5.5.0", + "immediate": "^3.2.3", + "level-concat-iterator": "~2.0.0", + "level-supports": "~1.0.0", + "xtend": "~4.0.0" + } + }, + "immediate": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.2.3.tgz", + "integrity": "sha1-0UD6j2FGWb1lQSMwl92qwlzdmRw=" + } + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + } + } + }, + "@ethereumjs/common": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.2.0.tgz", + "integrity": "sha512-PyQiTG00MJtBRkJmv46ChZL8u2XWxNBeAthznAUIUiefxPAXjbkuiCZOuncgJS34/XkMbNc9zMt/PlgKRBElig==", + "requires": { + "crc-32": "^1.2.0", + "ethereumjs-util": "^7.0.9" + } + }, + "@ethereumjs/ethash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/ethash/-/ethash-1.0.0.tgz", + "integrity": "sha512-iIqnGG6NMKesyOxv2YctB2guOVX18qMAWlj3QlZyrc+GqfzLqoihti+cVNQnyNxr7eYuPdqwLQOFuPe6g/uKjw==", + "requires": { + "@types/levelup": "^4.3.0", + "buffer-xor": "^2.0.1", + "ethereumjs-util": "^7.0.7", + "miller-rabin": "^4.0.0" + }, + "dependencies": { + "@types/bn.js": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", + "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", + "requires": { + "@types/node": "*" + } + }, + "bn.js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", + "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" + }, + "buffer-xor": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-2.0.2.tgz", + "integrity": "sha512-eHslX0bin3GB+Lx2p7lEYRShRewuNZL3fUl4qlVJGGiwoPGftmt8JQgk2Y9Ji5/01TnVDo33E5b5O3vUB1HdqQ==", + "requires": { + "safe-buffer": "^5.1.1" + } + }, + "ethereumjs-util": { + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.0.10.tgz", + "integrity": "sha512-c/xThw6A+EAnej5Xk5kOzFzyoSnw0WX0tSlZ6pAsfGVvQj3TItaDg9b1+Fz1RJXA+y2YksKwQnuzgt1eY6LKzw==", + "requires": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "ethjs-util": "0.1.6", + "rlp": "^2.2.4" + } + } + } + }, + "@ethereumjs/tx": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.1.3.tgz", + "integrity": "sha512-DJBu6cbwYtiPTFeCUR8DF5p+PF0jxs+0rALJZiEcTz2tiRPIEkM72GEbrkGuqzENLCzBrJHT43O0DxSYTqeo+g==", + "requires": { + "@ethereumjs/common": "^2.2.0", + "ethereumjs-util": "^7.0.10" + }, + "dependencies": { + "@types/bn.js": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", + "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", + "requires": { + "@types/node": "*" + } + }, + "bn.js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", + "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" + }, + "ethereumjs-util": { + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.0.10.tgz", + "integrity": "sha512-c/xThw6A+EAnej5Xk5kOzFzyoSnw0WX0tSlZ6pAsfGVvQj3TItaDg9b1+Fz1RJXA+y2YksKwQnuzgt1eY6LKzw==", + "requires": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "ethjs-util": "0.1.6", + "rlp": "^2.2.4" + } + } + } + }, + "@ethereumjs/vm": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/@ethereumjs/vm/-/vm-5.3.2.tgz", + "integrity": "sha512-QmCUQrW6xbhgEbQh9njue4kAJdM056C+ytBFUTF/kDYa3kNDm4Qxp9HUyTlt1OCSXvDhws0qqlh8+q+pmXpN7g==", + "requires": { + "@ethereumjs/block": "^3.2.1", + "@ethereumjs/blockchain": "^5.2.1", + "@ethereumjs/common": "^2.2.0", + "@ethereumjs/tx": "^3.1.3", + "async-eventemitter": "^0.2.4", + "core-js-pure": "^3.0.1", + "debug": "^2.2.0", + "ethereumjs-util": "^7.0.10", + "functional-red-black-tree": "^1.0.1", + "mcl-wasm": "^0.7.1", + "merkle-patricia-tree": "^4.1.0", + "rustbn.js": "~0.2.0", + "util.promisify": "^1.0.1" + }, + "dependencies": { + "@types/bn.js": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", + "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", + "requires": { + "@types/node": "*" + } + }, + "abstract-leveldown": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.3.0.tgz", + "integrity": "sha512-TU5nlYgta8YrBMNpc9FwQzRbiXsj49gsALsXadbGHt9CROPzX5fB0rWDR5mtdpOOKa5XqRFpbj1QroPAoPzVjQ==", + "requires": { + "buffer": "^5.5.0", + "immediate": "^3.2.3", + "level-concat-iterator": "~2.0.0", + "level-supports": "~1.0.0", + "xtend": "~4.0.0" + } + }, + "bn.js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", + "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "deferred-leveldown": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz", + "integrity": "sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw==", + "requires": { + "abstract-leveldown": "~6.2.1", + "inherits": "^2.0.3" + }, + "dependencies": { + "abstract-leveldown": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", + "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", + "requires": { + "buffer": "^5.5.0", + "immediate": "^3.2.3", + "level-concat-iterator": "~2.0.0", + "level-supports": "~1.0.0", + "xtend": "~4.0.0" + } + } + } + }, + "encoding-down": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/encoding-down/-/encoding-down-6.3.0.tgz", + "integrity": "sha512-QKrV0iKR6MZVJV08QY0wp1e7vF6QbhnbQhb07bwpEyuz4uZiZgPlEGdkCROuFkUwdxlFaiPIhjyarH1ee/3vhw==", + "requires": { + "abstract-leveldown": "^6.2.1", + "inherits": "^2.0.3", + "level-codec": "^9.0.0", + "level-errors": "^2.0.0" + } + }, + "ethereumjs-util": { + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.0.10.tgz", + "integrity": "sha512-c/xThw6A+EAnej5Xk5kOzFzyoSnw0WX0tSlZ6pAsfGVvQj3TItaDg9b1+Fz1RJXA+y2YksKwQnuzgt1eY6LKzw==", + "requires": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "ethjs-util": "0.1.6", + "rlp": "^2.2.4" + } + }, + "level-codec": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/level-codec/-/level-codec-9.0.2.tgz", + "integrity": "sha512-UyIwNb1lJBChJnGfjmO0OR+ezh2iVu1Kas3nvBS/BzGnx79dv6g7unpKIDNPMhfdTEGoc7mC8uAu51XEtX+FHQ==", + "requires": { + "buffer": "^5.6.0" + } + }, + "level-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/level-errors/-/level-errors-2.0.1.tgz", + "integrity": "sha512-UVprBJXite4gPS+3VznfgDSU8PTRuVX0NXwoWW50KLxd2yw4Y1t2JUR5In1itQnudZqRMT9DlAM3Q//9NCjCFw==", + "requires": { + "errno": "~0.1.1" + } + }, + "level-iterator-stream": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/level-iterator-stream/-/level-iterator-stream-4.0.2.tgz", + "integrity": "sha512-ZSthfEqzGSOMWoUGhTXdX9jv26d32XJuHz/5YnuHZzH6wldfWMOVwI9TBtKcya4BKTyTt3XVA0A3cF3q5CY30Q==", + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.4.0", + "xtend": "^4.0.2" + } + }, + "level-mem": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/level-mem/-/level-mem-5.0.1.tgz", + "integrity": "sha512-qd+qUJHXsGSFoHTziptAKXoLX87QjR7v2KMbqncDXPxQuCdsQlzmyX+gwrEHhlzn08vkf8TyipYyMmiC6Gobzg==", + "requires": { + "level-packager": "^5.0.3", + "memdown": "^5.0.0" + } + }, + "level-packager": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/level-packager/-/level-packager-5.1.1.tgz", + "integrity": "sha512-HMwMaQPlTC1IlcwT3+swhqf/NUO+ZhXVz6TY1zZIIZlIR0YSn8GtAAWmIvKjNY16ZkEg/JcpAuQskxsXqC0yOQ==", + "requires": { + "encoding-down": "^6.3.0", + "levelup": "^4.3.2" + } + }, + "level-ws": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/level-ws/-/level-ws-2.0.0.tgz", + "integrity": "sha512-1iv7VXx0G9ec1isqQZ7y5LmoZo/ewAsyDHNA8EFDW5hqH2Kqovm33nSFkSdnLLAK+I5FlT+lo5Cw9itGe+CpQA==", + "requires": { + "inherits": "^2.0.3", + "readable-stream": "^3.1.0", + "xtend": "^4.0.1" + } + }, + "levelup": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/levelup/-/levelup-4.4.0.tgz", + "integrity": "sha512-94++VFO3qN95cM/d6eBXvd894oJE0w3cInq9USsyQzzoJxmiYzPAocNcuGCPGGjoXqDVJcr3C1jzt1TSjyaiLQ==", + "requires": { + "deferred-leveldown": "~5.3.0", + "level-errors": "~2.0.0", + "level-iterator-stream": "~4.0.0", + "level-supports": "~1.0.0", + "xtend": "~4.0.0" + } + }, + "memdown": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/memdown/-/memdown-5.1.0.tgz", + "integrity": "sha512-B3J+UizMRAlEArDjWHTMmadet+UKwHd3UjMgGBkZcKAxAYVPS9o0Yeiha4qvz7iGiL2Sb3igUft6p7nbFWctpw==", + "requires": { + "abstract-leveldown": "~6.2.1", + "functional-red-black-tree": "~1.0.1", + "immediate": "~3.2.3", + "inherits": "~2.0.1", + "ltgt": "~2.2.0", + "safe-buffer": "~5.2.0" + }, + "dependencies": { + "abstract-leveldown": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", + "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", + "requires": { + "buffer": "^5.5.0", + "immediate": "^3.2.3", + "level-concat-iterator": "~2.0.0", + "level-supports": "~1.0.0", + "xtend": "~4.0.0" + } + }, + "immediate": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.2.3.tgz", + "integrity": "sha1-0UD6j2FGWb1lQSMwl92qwlzdmRw=" + } + } + }, + "merkle-patricia-tree": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/merkle-patricia-tree/-/merkle-patricia-tree-4.1.0.tgz", + "integrity": "sha512-vmP1J7FwIpprFMVjjSMM1JAwFce85Q+tp0TYIedYv8qaMh2oLUZ3ETXn9wbgi9S6elySzKzGa+Ai6VNKGEwSlg==", + "requires": { + "@types/levelup": "^4.3.0", + "ethereumjs-util": "^7.0.8", + "level-mem": "^5.0.1", + "level-ws": "^2.0.0", + "readable-stream": "^3.6.0", + "rlp": "^2.2.3", + "semaphore-async-await": "^1.5.1" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + } + } + }, "@ethersproject/abi": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.1.2.tgz", @@ -7385,6 +8100,11 @@ "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", "dev": true }, + "@types/abstract-leveldown": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@types/abstract-leveldown/-/abstract-leveldown-5.0.1.tgz", + "integrity": "sha512-wYxU3kp5zItbxKmeRYCEplS2MW7DzyBnxPGj+GJVHZEUZiK/nn5Ei1sUFgURDh+X051+zsGe28iud3oHjrYWQQ==" + }, "@types/aria-query": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-4.2.0.tgz", @@ -7449,6 +8169,7 @@ "version": "4.11.6", "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.6.tgz", "integrity": "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==", + "dev": true, "requires": { "@types/node": "*" }, @@ -7456,7 +8177,8 @@ "@types/node": { "version": "14.0.23", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.23.tgz", - "integrity": "sha512-Z4U8yDAl5TFkmYsZdFPdjeMa57NOvnaf1tljHzhouaPEp7LCj2JKkejpI1ODviIAQuW4CcQmxkQ77rnLsOOoKw==" + "integrity": "sha512-Z4U8yDAl5TFkmYsZdFPdjeMa57NOvnaf1tljHzhouaPEp7LCj2JKkejpI1ODviIAQuW4CcQmxkQ77rnLsOOoKw==", + "dev": true } } }, @@ -7570,6 +8292,15 @@ "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", "dev": true }, + "@types/levelup": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/levelup/-/levelup-4.3.1.tgz", + "integrity": "sha512-n//PeTpbHLjMLTIgW5B/g06W/6iuTBHuvUka2nFL9APMSVMNe2r4enADfu3CIE9IyV9E+uquf9OEQQqrDeg24A==", + "requires": { + "@types/abstract-leveldown": "*", + "@types/node": "*" + } + }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", @@ -8252,21 +8983,6 @@ "event-target-shim": "^5.0.0" } }, - "abstract-leveldown": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-2.6.3.tgz", - "integrity": "sha512-2++wDf/DYqkPR3o5tbfdhF96EfMApo1GpPfzOsR/ZYXdkSmELlvOOEAl9iKkRsktMPHdGjO4rtkBpf2I7TiTeA==", - "requires": { - "xtend": "~4.0.0" - }, - "dependencies": { - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" - } - } - }, "accepts": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", @@ -10474,14 +11190,6 @@ "file-uri-to-path": "1.0.0" } }, - "bip66": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", - "integrity": "sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, "bl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/bl/-/bl-2.2.0.tgz", @@ -12096,14 +12804,6 @@ "integrity": "sha1-FCD/sQ/URNz8ebQ4kbv//TKoRgA=", "dev": true }, - "checkpoint-store": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/checkpoint-store/-/checkpoint-store-1.1.0.tgz", - "integrity": "sha1-BOTLUWuRQziTWB5tRgGnjpVS6gY=", - "requires": { - "functional-red-black-tree": "^1.0.1" - } - }, "chokidar": { "version": "2.1.8", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", @@ -13485,6 +14185,15 @@ } } }, + "crc-32": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.0.tgz", + "integrity": "sha512-1uBwHxF+Y/4yF5G48fwnKq6QsIXheor3ZLPT80yGBV1oEUwpPojlEhQbWKVw1VwcTQyMGHK1/XMmTjmlsmTTGA==", + "requires": { + "exit-on-epipe": "~1.0.1", + "printj": "~1.1.0" + } + }, "create-ecdh": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", @@ -14533,14 +15242,6 @@ "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==" }, - "deferred-leveldown": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-1.2.2.tgz", - "integrity": "sha512-uukrWD2bguRtXilKt6cAWKyoXrTSMo5m7crUdLfWQmu8kIm88w3QZoUL+6nhpfKVmhHANER6Re3sKoNoZ3IKMA==", - "requires": { - "abstract-leveldown": "~2.6.0" - } - }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -14978,16 +15679,6 @@ "minimatch": "^3.0.4" } }, - "drbg.js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", - "integrity": "sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs=", - "requires": { - "browserify-aes": "^1.0.6", - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4" - } - }, "duplexer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", @@ -15235,49 +15926,6 @@ } } }, - "encoding-down": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/encoding-down/-/encoding-down-5.0.4.tgz", - "integrity": "sha512-8CIZLDcSKxgzT+zX8ZVfgNbu8Md2wq/iqa1Y7zyVR18QBEAc0Nmzuvj/N5ykSKpfGzjM8qxbaFntLPwnVoUhZw==", - "requires": { - "abstract-leveldown": "^5.0.0", - "inherits": "^2.0.3", - "level-codec": "^9.0.0", - "level-errors": "^2.0.0", - "xtend": "^4.0.1" - }, - "dependencies": { - "abstract-leveldown": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-5.0.0.tgz", - "integrity": "sha512-5mU5P1gXtsMIXg65/rsYGsi93+MlogXZ9FA8JnwKurHQg64bfXwGYVdVdijNTVNOlAsuIiOwHdvFFD5JqCJQ7A==", - "requires": { - "xtend": "~4.0.0" - } - }, - "level-codec": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/level-codec/-/level-codec-9.0.2.tgz", - "integrity": "sha512-UyIwNb1lJBChJnGfjmO0OR+ezh2iVu1Kas3nvBS/BzGnx79dv6g7unpKIDNPMhfdTEGoc7mC8uAu51XEtX+FHQ==", - "requires": { - "buffer": "^5.6.0" - } - }, - "level-errors": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/level-errors/-/level-errors-2.0.1.tgz", - "integrity": "sha512-UVprBJXite4gPS+3VznfgDSU8PTRuVX0NXwoWW50KLxd2yw4Y1t2JUR5In1itQnudZqRMT9DlAM3Q//9NCjCFw==", - "requires": { - "errno": "~0.1.1" - } - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" - } - } - }, "end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -16285,42 +16933,20 @@ } } }, - "ethereumjs-account": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ethereumjs-account/-/ethereumjs-account-3.0.0.tgz", - "integrity": "sha512-WP6BdscjiiPkQfF9PVfMcwx/rDvfZTjFKY0Uwc09zSQr9JfIVH87dYIJu0gNhBhpmovV4yq295fdllS925fnBA==", - "requires": { - "ethereumjs-util": "^6.0.0", - "rlp": "^2.2.1", - "safe-buffer": "^5.1.1" - }, - "dependencies": { - "ethereumjs-util": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz", - "integrity": "sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw==", - "requires": { - "@types/bn.js": "^4.11.3", - "bn.js": "^4.11.0", - "create-hash": "^1.1.2", - "elliptic": "^6.5.2", - "ethereum-cryptography": "^0.1.3", - "ethjs-util": "0.1.6", - "rlp": "^2.2.3" - } - } - } + "ethereumjs-common": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/ethereumjs-common/-/ethereumjs-common-1.5.1.tgz", + "integrity": "sha512-aVUPRLgmXORGXXEVkFYgPhr9TGtpBY2tGhZ9Uh0A3lIUzUDr1x6kQx33SbjPUkLkX3eniPQnIL/2psjkjrOfcQ==", + "dev": true }, - "ethereumjs-block": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/ethereumjs-block/-/ethereumjs-block-2.2.2.tgz", - "integrity": "sha512-2p49ifhek3h2zeg/+da6XpdFR3GlqY3BIEiqxGF8j9aSRIgkb7M1Ky+yULBKJOu8PAZxfhsYA+HxUk2aCQp3vg==", + "ethereumjs-tx": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ethereumjs-tx/-/ethereumjs-tx-2.1.2.tgz", + "integrity": "sha512-zZEK1onCeiORb0wyCXUvg94Ve5It/K6GD1K+26KfFKodiBiS6d9lfCXlUKGBBdQ+bv7Day+JK0tj1K+BeNFRAw==", + "dev": true, "requires": { - "async": "^2.0.1", "ethereumjs-common": "^1.5.0", - "ethereumjs-tx": "^2.1.1", - "ethereumjs-util": "^5.0.0", - "merkle-patricia-tree": "^2.1.2" + "ethereumjs-util": "^6.0.0" }, "dependencies": { "async": { @@ -16332,49 +16958,36 @@ } }, "ethereumjs-util": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz", - "integrity": "sha512-CJAKdI0wgMbQFLlLRtZKGcy/L6pzVRgelIZqRqNbuVFM3K9VEnyfbcvz0ncWMRNCe4kaHWjwRYQcYMucmwsnWA==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz", + "integrity": "sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw==", + "dev": true, "requires": { + "@types/bn.js": "^4.11.3", "bn.js": "^4.11.0", "create-hash": "^1.1.2", - "ethjs-util": "^0.1.3", - "keccak": "^1.0.2", - "rlp": "^2.0.0", - "safe-buffer": "^5.1.1", - "secp256k1": "^3.0.1" - } - }, - "keccak": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", - "integrity": "sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw==", - "requires": { - "bindings": "^1.2.1", - "inherits": "^2.0.3", - "nan": "^2.2.1", - "safe-buffer": "^5.1.0" + "elliptic": "^6.5.2", + "ethereum-cryptography": "^0.1.3", + "ethjs-util": "0.1.6", + "rlp": "^2.2.3" } } } }, - "ethereumjs-blockchain": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/ethereumjs-blockchain/-/ethereumjs-blockchain-4.0.3.tgz", - "integrity": "sha512-0nJWbyA+Gu0ZKZr/cywMtB/77aS/4lOVsIKbgUN2sFQYscXO5rPbUfrEe7G2Zhjp86/a0VqLllemDSTHvx3vZA==", + "ethereumjs-util": { + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.0.10.tgz", + "integrity": "sha512-c/xThw6A+EAnej5Xk5kOzFzyoSnw0WX0tSlZ6pAsfGVvQj3TItaDg9b1+Fz1RJXA+y2YksKwQnuzgt1eY6LKzw==", "requires": { - "async": "^2.6.1", - "ethashjs": "~0.0.7", - "ethereumjs-block": "~2.2.2", - "ethereumjs-common": "^1.5.0", - "ethereumjs-util": "~6.1.0", - "flow-stoplight": "^1.0.0", - "level-mem": "^3.0.1", - "lru-cache": "^5.1.1", - "rlp": "^2.2.2", - "semaphore": "^1.1.0" + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "ethjs-util": "0.1.6", + "rlp": "^2.2.4" }, "dependencies": { +<<<<<<< HEAD "async": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", @@ -16387,29 +17000,24 @@ "version": "6.1.0", "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz", "integrity": "sha512-URESKMFbDeJxnAxPppnk2fN6Y3BIatn9fwn76Lm8bQlt+s52TpG8dN9M66MLPuRAiAOIqL3dfwqWJf0sd0fL0Q==", +======= + "@types/bn.js": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", + "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", +>>>>>>> use last ethereumjs-vm for berlin fork "requires": { - "bn.js": "^4.11.0", - "create-hash": "^1.1.2", - "ethjs-util": "0.1.6", - "keccak": "^1.0.2", - "rlp": "^2.0.0", - "safe-buffer": "^5.1.1", - "secp256k1": "^3.0.1" + "@types/node": "*" } }, - "keccak": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", - "integrity": "sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw==", - "requires": { - "bindings": "^1.2.1", - "inherits": "^2.0.3", - "nan": "^2.2.1", - "safe-buffer": "^5.1.0" - } + "bn.js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", + "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" } } }, +<<<<<<< HEAD "ethereumjs-common": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/ethereumjs-common/-/ethereumjs-common-1.5.1.tgz", @@ -16500,6 +17108,8 @@ } } }, +======= +>>>>>>> use last ethereumjs-vm for berlin fork "ethers": { "version": "5.1.4", "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.1.4.tgz", @@ -16667,6 +17277,11 @@ "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", "dev": true }, + "exit-on-epipe": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz", + "integrity": "sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw==" + }, "exorcist": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/exorcist/-/exorcist-0.4.0.tgz", @@ -17096,14 +17711,6 @@ "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" }, - "fake-merkle-patricia-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/fake-merkle-patricia-tree/-/fake-merkle-patricia-tree-1.0.1.tgz", - "integrity": "sha1-S4w6z7Ugr635hgsfFM2M40As3dM=", - "requires": { - "checkpoint-store": "^1.1.0" - } - }, "falafel": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/falafel/-/falafel-2.2.4.tgz", @@ -17486,11 +18093,6 @@ "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", "dev": true }, - "flow-stoplight": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/flow-stoplight/-/flow-stoplight-1.0.0.tgz", - "integrity": "sha1-SiksW8/4s5+mzAyxqFPYbyfu/3s=" - }, "flush-write-stream": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz", @@ -21700,7 +22302,8 @@ "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true }, "isbinaryfile": { "version": "3.0.3", @@ -24137,17 +24740,6 @@ "source-map-support": "^0.5.5" } }, - "keccak": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-2.1.0.tgz", - "integrity": "sha512-m1wbJRTo+gWbctZWay9i26v5fFnYkOn7D5PCxJ3fZUGUEb49dE1Pm4BREUYCt/aoO6di7jeoGmhvqN9Nzylm3Q==", - "requires": { - "bindings": "^1.5.0", - "inherits": "^2.0.4", - "nan": "^2.14.0", - "safe-buffer": "^5.2.0" - } - }, "keccakjs": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.3.tgz", @@ -24402,240 +24994,19 @@ } } }, - "level-codec": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/level-codec/-/level-codec-7.0.1.tgz", - "integrity": "sha512-Ua/R9B9r3RasXdRmOtd+t9TCOEIIlts+TN/7XTT2unhDaL6sJn83S3rUyljbr6lVtw49N3/yA0HHjpV6Kzb2aQ==" - }, - "level-errors": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/level-errors/-/level-errors-1.0.5.tgz", - "integrity": "sha512-/cLUpQduF6bNrWuAC4pwtUKA5t669pCsCi2XbmojG2tFeOr9j6ShtdDCtFFQO1DRt+EVZhx9gPzP9G2bUaG4ig==", - "requires": { - "errno": "~0.1.1" - } - }, - "level-iterator-stream": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/level-iterator-stream/-/level-iterator-stream-1.3.1.tgz", - "integrity": "sha1-5Dt4sagUPm+pek9IXrjqUwNS8u0=", - "requires": { - "inherits": "^2.0.1", - "level-errors": "^1.0.3", - "readable-stream": "^1.0.33", - "xtend": "^4.0.0" - }, - "dependencies": { - "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" - } - } - }, - "level-mem": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/level-mem/-/level-mem-3.0.1.tgz", - "integrity": "sha512-LbtfK9+3Ug1UmvvhR2DqLqXiPW1OJ5jEh0a3m9ZgAipiwpSxGj/qaVVy54RG5vAQN1nCuXqjvprCuKSCxcJHBg==", - "requires": { - "level-packager": "~4.0.0", - "memdown": "~3.0.0" - }, - "dependencies": { - "abstract-leveldown": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-5.0.0.tgz", - "integrity": "sha512-5mU5P1gXtsMIXg65/rsYGsi93+MlogXZ9FA8JnwKurHQg64bfXwGYVdVdijNTVNOlAsuIiOwHdvFFD5JqCJQ7A==", - "requires": { - "xtend": "~4.0.0" - } - }, - "immediate": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.2.3.tgz", - "integrity": "sha1-0UD6j2FGWb1lQSMwl92qwlzdmRw=" - }, - "memdown": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/memdown/-/memdown-3.0.0.tgz", - "integrity": "sha512-tbV02LfZMWLcHcq4tw++NuqMO+FZX8tNJEiD2aNRm48ZZusVg5N8NART+dmBkepJVye986oixErf7jfXboMGMA==", - "requires": { - "abstract-leveldown": "~5.0.0", - "functional-red-black-tree": "~1.0.1", - "immediate": "~3.2.3", - "inherits": "~2.0.1", - "ltgt": "~2.2.0", - "safe-buffer": "~5.1.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" - } - } - }, - "level-packager": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/level-packager/-/level-packager-4.0.1.tgz", - "integrity": "sha512-svCRKfYLn9/4CoFfi+d8krOtrp6RoX8+xm0Na5cgXMqSyRru0AnDYdLl+YI8u1FyS6gGZ94ILLZDE5dh2but3Q==", - "requires": { - "encoding-down": "~5.0.0", - "levelup": "^3.0.0" - }, - "dependencies": { - "abstract-leveldown": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-5.0.0.tgz", - "integrity": "sha512-5mU5P1gXtsMIXg65/rsYGsi93+MlogXZ9FA8JnwKurHQg64bfXwGYVdVdijNTVNOlAsuIiOwHdvFFD5JqCJQ7A==", - "requires": { - "xtend": "~4.0.0" - } - }, - "deferred-leveldown": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-4.0.2.tgz", - "integrity": "sha512-5fMC8ek8alH16QiV0lTCis610D1Zt1+LA4MS4d63JgS32lrCjTFDUFz2ao09/j2I4Bqb5jL4FZYwu7Jz0XO1ww==", - "requires": { - "abstract-leveldown": "~5.0.0", - "inherits": "^2.0.3" - } - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "level-errors": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/level-errors/-/level-errors-2.0.1.tgz", - "integrity": "sha512-UVprBJXite4gPS+3VznfgDSU8PTRuVX0NXwoWW50KLxd2yw4Y1t2JUR5In1itQnudZqRMT9DlAM3Q//9NCjCFw==", - "requires": { - "errno": "~0.1.1" - } - }, - "level-iterator-stream": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/level-iterator-stream/-/level-iterator-stream-3.0.1.tgz", - "integrity": "sha512-nEIQvxEED9yRThxvOrq8Aqziy4EGzrxSZK+QzEFAVuJvQ8glfyZ96GB6BoI4sBbLfjMXm2w4vu3Tkcm9obcY0g==", - "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.3.6", - "xtend": "^4.0.0" - } - }, - "levelup": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/levelup/-/levelup-3.1.1.tgz", - "integrity": "sha512-9N10xRkUU4dShSRRFTBdNaBxofz+PGaIZO962ckboJZiNmLuhVT6FZ6ZKAsICKfUBO76ySaYU6fJWX/jnj3Lcg==", - "requires": { - "deferred-leveldown": "~4.0.0", - "level-errors": "~2.0.0", - "level-iterator-stream": "~3.0.0", - "xtend": "~4.0.0" - } - }, - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" - } - } - }, - "level-ws": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/level-ws/-/level-ws-0.0.0.tgz", - "integrity": "sha1-Ny5RIXeSSgBCSwtDrvK7QkltIos=", - "requires": { - "readable-stream": "~1.0.15", - "xtend": "~2.1.1" - }, - "dependencies": { - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - } - } + "level-concat-iterator": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", + "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==" }, - "levelup": { - "version": "1.3.9", - "resolved": "https://registry.npmjs.org/levelup/-/levelup-1.3.9.tgz", - "integrity": "sha512-VVGHfKIlmw8w1XqpGOAGwq6sZm2WwWLmlDcULkKWQXEA5EopA8OBNJ2Ck2v6bdk8HeEZSbCSEgzXadyQFm76sQ==", + "level-supports": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", + "integrity": "sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg==", "requires": { - "deferred-leveldown": "~1.2.1", - "level-codec": "~7.0.0", - "level-errors": "~1.0.3", - "level-iterator-stream": "~1.3.0", - "prr": "~1.0.1", - "semver": "~5.4.1", - "xtend": "~4.0.0" + "xtend": "^4.0.2" }, "dependencies": { - "semver": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==" - }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", @@ -25661,6 +26032,11 @@ "integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==", "dev": true }, + "mcl-wasm": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/mcl-wasm/-/mcl-wasm-0.7.6.tgz", + "integrity": "sha512-cbRl3sUOkBeRY2hsM4t1EIln2TIdQBkSiTOqNTv/4Hu5KOECnMWCgjIf+a9Ebunyn22VKqkMF3zj6ejRzz7YBw==" + }, "md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -25693,39 +26069,6 @@ "p-is-promise": "^2.0.0" } }, - "memdown": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/memdown/-/memdown-1.4.1.tgz", - "integrity": "sha1-tOThkhdGZP+65BNhqlAPMRnv4hU=", - "requires": { - "abstract-leveldown": "~2.7.1", - "functional-red-black-tree": "^1.0.1", - "immediate": "^3.2.3", - "inherits": "~2.0.1", - "ltgt": "~2.2.0", - "safe-buffer": "~5.1.1" - }, - "dependencies": { - "abstract-leveldown": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-2.7.2.tgz", - "integrity": "sha512-+OVvxH2rHVEhWLdbudP6p0+dNMXu8JA1CbhP19T8paTYAcX7oJ4OVjT+ZUVpv7mITxXHqDMej+GdqXBmXkw09w==", - "requires": { - "xtend": "~4.0.0" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" - } - } - }, "memoize-one": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.1.1.tgz", @@ -26055,94 +26398,6 @@ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true }, - "merkle-patricia-tree": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/merkle-patricia-tree/-/merkle-patricia-tree-2.3.2.tgz", - "integrity": "sha512-81PW5m8oz/pz3GvsAwbauj7Y00rqm81Tzad77tHBwU7pIAtN+TJnMSOJhxBKflSVYhptMMb9RskhqHqrSm1V+g==", - "requires": { - "async": "^1.4.2", - "ethereumjs-util": "^5.0.0", - "level-ws": "0.0.0", - "levelup": "^1.2.1", - "memdown": "^1.0.0", - "readable-stream": "^2.0.0", - "rlp": "^2.0.0", - "semaphore": ">=1.0.1" - }, - "dependencies": { - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" - }, - "ethereumjs-util": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz", - "integrity": "sha512-CJAKdI0wgMbQFLlLRtZKGcy/L6pzVRgelIZqRqNbuVFM3K9VEnyfbcvz0ncWMRNCe4kaHWjwRYQcYMucmwsnWA==", - "requires": { - "bn.js": "^4.11.0", - "create-hash": "^1.1.2", - "ethjs-util": "^0.1.3", - "keccak": "^1.0.2", - "rlp": "^2.0.0", - "safe-buffer": "^5.1.1", - "secp256k1": "^3.0.1" - } - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "keccak": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", - "integrity": "sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw==", - "requires": { - "bindings": "^1.2.1", - "inherits": "^2.0.3", - "nan": "^2.2.1", - "safe-buffer": "^5.1.0" - } - }, - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - } - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - } - } - } - } - }, "methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -32518,11 +32773,6 @@ "define-properties": "^1.1.3" } }, - "object-keys": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz", - "integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=" - }, "object-visit": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", @@ -35209,6 +35459,11 @@ "plur": "^1.0.0" } }, + "printj": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/printj/-/printj-1.1.2.tgz", + "integrity": "sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ==" + }, "private": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", @@ -37131,21 +37386,6 @@ "resolved": "https://registry.npmjs.org/scryptsy/-/scryptsy-2.1.0.tgz", "integrity": "sha512-1CdSqHQowJBnMAFyPEBRfqag/YP9OF394FV+4YREIJX4ljD7OxvQRDayyoyyCk+senRjSkP6VnUNQmVQqB6g7w==" }, - "secp256k1": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.8.0.tgz", - "integrity": "sha512-k5ke5avRZbtl9Tqx/SA7CbY3NF6Ro+Sj9cZxezFzuBlLDmyqPiL8hJJ+EmzD8Ig4LUDByHJ3/iPOVoRixs/hmw==", - "requires": { - "bindings": "^1.5.0", - "bip66": "^1.1.5", - "bn.js": "^4.11.8", - "create-hash": "^1.2.0", - "drbg.js": "^1.0.1", - "elliptic": "^6.5.2", - "nan": "^2.14.0", - "safe-buffer": "^5.1.2" - } - }, "seek-bzip": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.6.tgz", @@ -37265,10 +37505,10 @@ "node-forge": "0.9.0" } }, - "semaphore": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/semaphore/-/semaphore-1.1.0.tgz", - "integrity": "sha512-O4OZEaNtkMd/K0i6js9SL+gqy0ZCBMgUvlSqHKi4IBdjhe7wB8pwztUk1BbZ1fmrvpwFrPbHzqd2w5pTcJH6LA==" + "semaphore-async-await": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/semaphore-async-await/-/semaphore-async-await-1.5.1.tgz", + "integrity": "sha1-hXvvXjZEYBykuVcLh+nfXKEpdPo=" }, "semver": { "version": "6.3.0", @@ -43204,14 +43444,6 @@ "integrity": "sha1-UqY+VsoLhKfzpfPWGHLxJq16WUM=", "dev": true }, - "xtend": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz", - "integrity": "sha1-bv7MKk2tjmlixJAbM3znuoe10os=", - "requires": { - "object-keys": "~0.4.0" - } - }, "y18n": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", diff --git a/package.json b/package.json index 2218460fcd..bd2a0e8aa6 100644 --- a/package.json +++ b/package.json @@ -130,6 +130,10 @@ }, "dependencies": { "@erebos/bzz-node": "^0.13.0", + "@ethereumjs/block": "^3.2.1", + "@ethereumjs/common": "^2.2.0", + "@ethereumjs/tx": "^3.1.3", + "@ethereumjs/vm": "^5.3.2", "@remixproject/engine": "^0.3.11", "@remixproject/engine-web": "^0.3.11", "@remixproject/plugin": "^0.3.11", @@ -147,10 +151,7 @@ "commander": "^2.20.3", "deep-equal": "^1.0.1", "document-register-element": "1.13.1", - "ethereumjs-block": "^2.2.2", - "ethereumjs-tx": "^2.1.2", - "ethereumjs-util": "^6.2.0", - "ethereumjs-vm": "4.1.3", + "ethereumjs-util": "^7.0.10", "ethers": "^5.1.4", "express-ws": "^4.0.0", "fs-extra": "^3.0.1", From f105cbccf06c86f0ba7b4d133900cfcddcf252bb Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 21 Apr 2021 10:07:37 +0200 Subject: [PATCH 02/29] comment 'await this._cache.flush()' --- libs/remix-lib/src/execution/execution-context.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/remix-lib/src/execution/execution-context.ts b/libs/remix-lib/src/execution/execution-context.ts index 98d16ae415..fe58451b9a 100644 --- a/libs/remix-lib/src/execution/execution-context.ts +++ b/libs/remix-lib/src/execution/execution-context.ts @@ -63,11 +63,13 @@ async getStateRoot (force: boolean = false): Promise { // throw new Error('Cannot get state root with uncommitted checkpoints') } + /* try { await this._cache.flush() } catch (e) { console.error(e) } + */ const stateRoot = this._trie.root return stateRoot From c01ac95ee70ff2ffab9e26773d7afc8b6e494cf0 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 21 Apr 2021 10:11:04 +0200 Subject: [PATCH 03/29] using fromBlockData --- libs/remix-debug/test/decoder/vmCall.ts | 14 +++++++------- libs/remix-debug/test/vmCall.ts | 14 +++++++------- libs/remix-lib/src/execution/txRunner.ts | 19 ++++++++++--------- libs/remix-simulator/src/genesis.ts | 19 ++++++++++--------- 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/libs/remix-debug/test/decoder/vmCall.ts b/libs/remix-debug/test/decoder/vmCall.ts index b797797699..91d6810dd3 100644 --- a/libs/remix-debug/test/decoder/vmCall.ts +++ b/libs/remix-debug/test/decoder/vmCall.ts @@ -1,7 +1,7 @@ 'use strict' var utileth = require('ethereumjs-util') var Tx = require('@ethereumjs/tx').Transaction -import { Block, BlockHeader } from '@ethereumjs/block' +import { Block } from '@ethereumjs/block' var BN = require('ethereumjs-util').BN var remixLib = require('@remix-project/remix-lib') import VM from '@ethereumjs/vm' @@ -18,12 +18,12 @@ export function sendTx (vm, from, to, value, data, cb) { }) tx.sign(from.privateKey) - var header = BlockHeader.fromHeaderData({ - timestamp: new Date().getTime() / 1000 | 0, - number: 0 - }) - - var block = new Block(header, [], []) + var block = Block.fromBlockData({ + header: { + timestamp: new Date().getTime() / 1000 | 0, + number: 0 + } + }) // still using default common try { vm.runTx({block: block, tx: tx, skipBalance: true, skipNonce: true}).then(function (result) { diff --git a/libs/remix-debug/test/vmCall.ts b/libs/remix-debug/test/vmCall.ts index 57d9a960ff..912ed68fd0 100644 --- a/libs/remix-debug/test/vmCall.ts +++ b/libs/remix-debug/test/vmCall.ts @@ -1,5 +1,5 @@ 'use strict' -import { Block, BlockHeader } from '@ethereumjs/block' +import { Block } from '@ethereumjs/block' import VM from '@ethereumjs/vm' var utileth = require('ethereumjs-util') var Tx = require('@ethereumjs/tx').Transaction @@ -17,12 +17,12 @@ function sendTx (vm, from, to, value, data, cb) { }) tx.sign(from.privateKey) - var header = BlockHeader.fromHeaderData({ - timestamp: new Date().getTime() / 1000 | 0, - number: 0 - }) - - var block = new Block(header, [], []) + var block = Block.fromBlockData({ + header: { + timestamp: new Date().getTime() / 1000 | 0, + number: 0 + } + }) // still using default common vm.runTx({block: block, tx: tx, skipBalance: true, skipNonce: true}).then(function (result) { setTimeout(() => { cb(null, utileth.bufferToHex(tx.hash())) diff --git a/libs/remix-lib/src/execution/txRunner.ts b/libs/remix-lib/src/execution/txRunner.ts index f8835cb6ee..e3b66e6ef6 100644 --- a/libs/remix-lib/src/execution/txRunner.ts +++ b/libs/remix-lib/src/execution/txRunner.ts @@ -1,6 +1,6 @@ 'use strict' import { Transaction } from '@ethereumjs/tx' -import { Block, BlockHeader } from '@ethereumjs/block' +import { Block } from '@ethereumjs/block' import { BN, bufferToHex, Address } from 'ethereumjs-util' import { ExecutionContext } from './execution-context' import { EventManager } from '../eventManager' @@ -127,15 +127,16 @@ export class TxRunner { const coinbases = ['0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', '0x8945a1288dc78a6d8952a92c77aee6730b414778', '0x94d76e24f818426ae84aa404140e8d5f60e10e7e'] const difficulties = [new BN('69762765929000', 10), new BN('70762765929000', 10), new BN('71762765929000', 10)] - const header: BlockHeader = BlockHeader.fromHeaderData({ - timestamp: timestamp || (new Date().getTime() / 1000 | 0), - number: self.blockNumber, - coinbase: coinbases[self.blockNumber % coinbases.length], - difficulty: difficulties[self.blockNumber % difficulties.length], - gasLimit: new BN(gasLimit.replace('0x', ''), 16).imuln(2) + var block = Block.fromBlockData({ + header: { + timestamp: timestamp || (new Date().getTime() / 1000 | 0), + number: self.blockNumber, + coinbase: coinbases[self.blockNumber % coinbases.length], + difficulty: difficulties[self.blockNumber % difficulties.length], + gasLimit: new BN(gasLimit.replace('0x', ''), 16).imuln(2) + } }, { common: this.commonContext }) - - const block = new Block(header, [tx], []) + if (!useCall) { ++self.blockNumber this.runBlockInVm(tx, block, callback) diff --git a/libs/remix-simulator/src/genesis.ts b/libs/remix-simulator/src/genesis.ts index b8e99af54e..a0a20cec78 100644 --- a/libs/remix-simulator/src/genesis.ts +++ b/libs/remix-simulator/src/genesis.ts @@ -1,15 +1,16 @@ -import { Block, BlockHeader } from '@ethereumjs/block' +import { Block } from '@ethereumjs/block' import { BN } from 'ethereumjs-util' export function generateBlock (executionContext) { - const header: BlockHeader = BlockHeader.fromHeaderData({ - timestamp: (new Date().getTime() / 1000 | 0), - number: 0, - coinbase: '0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', - difficulty: new BN('69762765929000', 10), - gasLimit: new BN('8000000').imuln(1) - }) - const block: Block = new Block(header, [], []) + const block: Block = Block.fromBlockData({ + header: { + timestamp: (new Date().getTime() / 1000 | 0), + number: 0, + coinbase: '0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', + difficulty: new BN('69762765929000', 10), + gasLimit: new BN('8000000').imuln(1) + } + }, { common: executionContext.vmObject().common }) executionContext.vm().runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false }).then(() => { executionContext.addBlock(block) From e0bcc34dac04cfa7731df5bfa0f700c50c909931 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 21 Apr 2021 11:38:53 +0200 Subject: [PATCH 04/29] fix add transaction --- libs/remix-lib/src/execution/txRunner.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/remix-lib/src/execution/txRunner.ts b/libs/remix-lib/src/execution/txRunner.ts index e3b66e6ef6..fd288b35eb 100644 --- a/libs/remix-lib/src/execution/txRunner.ts +++ b/libs/remix-lib/src/execution/txRunner.ts @@ -134,9 +134,10 @@ export class TxRunner { coinbase: coinbases[self.blockNumber % coinbases.length], difficulty: difficulties[self.blockNumber % difficulties.length], gasLimit: new BN(gasLimit.replace('0x', ''), 16).imuln(2) - } + }, + transactions: [tx] }, { common: this.commonContext }) - + if (!useCall) { ++self.blockNumber this.runBlockInVm(tx, block, callback) From 30f02ccbe33839aa0e0f2d38432ff3f1a2d3a098 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 21 Apr 2021 11:39:12 +0200 Subject: [PATCH 05/29] address use toString --- apps/remix-ide/src/blockchain/blockchain.js | 4 ++-- libs/remix-lib/src/web3Provider/web3VmProvider.ts | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/remix-ide/src/blockchain/blockchain.js b/apps/remix-ide/src/blockchain/blockchain.js index 1ee396ea3d..84062f7ac4 100644 --- a/apps/remix-ide/src/blockchain/blockchain.js +++ b/apps/remix-ide/src/blockchain/blockchain.js @@ -439,7 +439,7 @@ class Blockchain { function (error, result) { if (error) return next(error) - const rawAddress = self.executionContext.isVM() ? result.result.createdAddress.buf : result.result.contractAddress + const rawAddress = self.executionContext.isVM() ? (result.result.createdAddress && result.result.createdAddress.toBuffer()) : result.result.contractAddress const eventName = (tx.useCall ? 'callExecuted' : 'transactionExecuted') self.event.trigger(eventName, [error, tx.from, tx.to, tx.data, tx.useCall, result, timestamp, payLoad, rawAddress]) @@ -470,7 +470,7 @@ class Blockchain { let address = null let returnValue = null if (txResult && txResult.result) { - address = isVM ? txResult.result.createdAddress.buf : txResult.result.contractAddress + address = isVM ? (txResult.result.createdAddress && txResult.result.createdAddress.toBuffer()) : txResult.result.contractAddress // if it's not the VM, we don't have return value. We only have the transaction, and it does not contain the return value. returnValue = (txResult.result.execResult && isVM) ? txResult.result.execResult.returnValue : txResult.result } diff --git a/libs/remix-lib/src/web3Provider/web3VmProvider.ts b/libs/remix-lib/src/web3Provider/web3VmProvider.ts index 9a5fd82a20..8f7b432bd3 100644 --- a/libs/remix-lib/src/web3Provider/web3VmProvider.ts +++ b/libs/remix-lib/src/web3Provider/web3VmProvider.ts @@ -101,9 +101,9 @@ export class Web3VmProvider { } const tx = {} tx['hash'] = this.processingHash - tx['from'] = toChecksumAddress(hexConvert(data.getSenderAddress().buf)) - if (data.to && data.to.length) { - tx['to'] = toChecksumAddress(hexConvert(data.to.buf)) + tx['from'] = toChecksumAddress(data.getSenderAddress().toString()) + if (data.to) { + tx['to'] = toChecksumAddress(data.to.toString()) } this.processingAddress = tx['to'] // tx['data'] = hexConvert(data.data) @@ -155,8 +155,8 @@ export class Web3VmProvider { const status = data.execResult.exceptionError ? 0 : 1 this.txsReceipt[this.processingHash].status = `0x${status}` - if (data.createdAddress && data.createdAddress.buf) { - const address = hexConvert(data.createdAddress.buf) + if (data.createdAddress) { + const address = data.createdAddress.toString() this.vmTraces[this.processingHash].return = toChecksumAddress(address) this.txsReceipt[this.processingHash].contractAddress = toChecksumAddress(address) } else if (data.execResult.returnValue) { From 431f5d00c8fa97ddaf2c0d2afb33fce2c9b80e7e Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 21 Apr 2021 12:06:01 +0200 Subject: [PATCH 06/29] linting --- libs/remix-simulator/src/methods/accounts.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libs/remix-simulator/src/methods/accounts.ts b/libs/remix-simulator/src/methods/accounts.ts index 1bda2e9de3..6fd359594b 100644 --- a/libs/remix-simulator/src/methods/accounts.ts +++ b/libs/remix-simulator/src/methods/accounts.ts @@ -48,16 +48,15 @@ export class Accounts { this.accountsKeys[addressStr] = '0x' + privateKey.toString('hex') const stateManager = this.executionContext.vm().stateManager - stateManager.getAccount(Address.fromString(addressStr)).then((account) => { + stateManager.getAccount(Address.fromString(addressStr)).then((account) => { account.balance = new BN(balance.replace('0x', '') || 'f00000000000000001', 16) stateManager.putAccount(Address.fromString(addressStr), account).catch((error) => { reject(error) - }).then(() => { + }).then(() => { resolve({}) }) }).catch((error) => { reject(error) - return }) }) } @@ -84,10 +83,9 @@ export class Accounts { } eth_getBalance (payload, cb) { - let address = payload.params[0] - + const address = payload.params[0] - this.executionContext.vm().stateManager.getAccount(Address.fromString(address)).then((account) => { + this.executionContext.vm().stateManager.getAccount(Address.fromString(address)).then((account) => { cb(null, new BN(account.balance).toString(10)) }).catch((error) => { cb(error) From 12bd95eeb9c8f476e31ecea223e600e559098ae9 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 22 Apr 2021 10:20:37 +0200 Subject: [PATCH 07/29] fix address type --- libs/remix-lib/src/web3Provider/web3VmProvider.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libs/remix-lib/src/web3Provider/web3VmProvider.ts b/libs/remix-lib/src/web3Provider/web3VmProvider.ts index 8f7b432bd3..c17502e7f5 100644 --- a/libs/remix-lib/src/web3Provider/web3VmProvider.ts +++ b/libs/remix-lib/src/web3Provider/web3VmProvider.ts @@ -115,9 +115,8 @@ export class Web3VmProvider { this.txs[this.processingHash] = tx this.txsReceipt[this.processingHash] = tx this.storageCache[this.processingHash] = {} - if (tx['to']) { - const account = toBuffer(tx['to']) - this.vm.stateManager.dumpStorage(account).then((storage) => { + if (data.to) { + this.vm.stateManager.dumpStorage(data.to).then((storage) => { this.storageCache[this.processingHash][tx['to']] = storage this.lastProcessedStorageTxHash[tx['to']] = this.processingHash }) @@ -205,7 +204,7 @@ export class Web3VmProvider { this.processingAddress = normalizeHexAddress(step.stack[step.stack.length - 2]) this.processingAddress = toChecksumAddress(this.processingAddress) if (!this.storageCache[this.processingHash][this.processingAddress]) { - const account = toBuffer(this.processingAddress) + const account = Address.fromString(this.processingAddress) this.vm.stateManager.dumpStorage(account).then((storage) => { this.storageCache[this.processingHash][this.processingAddress] = storage this.lastProcessedStorageTxHash[this.processingAddress] = this.processingHash From 6f615d3720eeb163520ea01431e6292c5584b04b Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 22 Apr 2021 10:21:01 +0200 Subject: [PATCH 08/29] don't use checkpoint anymore --- libs/remix-lib/src/execution/execution-context.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/libs/remix-lib/src/execution/execution-context.ts b/libs/remix-lib/src/execution/execution-context.ts index fe58451b9a..67a336e315 100644 --- a/libs/remix-lib/src/execution/execution-context.ts +++ b/libs/remix-lib/src/execution/execution-context.ts @@ -63,13 +63,7 @@ async getStateRoot (force: boolean = false): Promise { // throw new Error('Cannot get state root with uncommitted checkpoints') } - /* - try { - await this._cache.flush() - } catch (e) { - console.error(e) - } - */ + await this._cache.flush() const stateRoot = this._trie.root return stateRoot @@ -152,7 +146,6 @@ export class ExecutionContext { createVm (hardfork) { const stateManager = new StateManagerCommonStorageDump() - stateManager.checkpoint() const common = new Common({ chain: 'mainnet', hardfork }) const vm = new VM({ common, @@ -253,9 +246,11 @@ export class ExecutionContext { if (!infoCb) infoCb = () => {} if (context === 'vm') { this.executionContext = context + /* this.vms[this.currentFork].stateManager.revert().then(() => { this.vms[this.currentFork].stateManager.checkpoint() }) + */ this.event.trigger('contextChanged', ['vm']) return cb() } From 2e45513291e6ca911219491c782976817d30fb4d Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 22 Apr 2021 12:19:35 +0200 Subject: [PATCH 09/29] fix remix simulator tests --- libs/remix-lib/src/execution/txRunner.ts | 8 ++++-- libs/remix-simulator/src/genesis.ts | 29 ++++++++++++---------- libs/remix-simulator/src/methods/blocks.ts | 4 ++- libs/remix-simulator/src/provider.ts | 7 +++--- libs/remix-simulator/test/accounts.ts | 3 ++- libs/remix-simulator/test/blocks.ts | 5 ++-- libs/remix-simulator/test/misc.ts | 3 ++- 7 files changed, 35 insertions(+), 24 deletions(-) diff --git a/libs/remix-lib/src/execution/txRunner.ts b/libs/remix-lib/src/execution/txRunner.ts index fd288b35eb..ddc2456fb5 100644 --- a/libs/remix-lib/src/execution/txRunner.ts +++ b/libs/remix-lib/src/execution/txRunner.ts @@ -111,6 +111,10 @@ export class TxRunner { return callback('Invalid account selected') } + if (Number.isInteger(gasLimit)) { + gasLimit = '0x' + gasLimit.toString(16) + } + this.executionContext.vm().stateManager.getAccount(Address.fromString(from)).then((res) => { // See https://github.com/ethereumjs/ethereumjs-tx/blob/master/docs/classes/transaction.md#constructor // for initialization fields and their types @@ -150,8 +154,8 @@ export class TxRunner { }) }) } - }).catch(() => { - callback('Account not found') + }).catch((e) => { + callback(e) }) } diff --git a/libs/remix-simulator/src/genesis.ts b/libs/remix-simulator/src/genesis.ts index a0a20cec78..e7176e8a77 100644 --- a/libs/remix-simulator/src/genesis.ts +++ b/libs/remix-simulator/src/genesis.ts @@ -2,17 +2,20 @@ import { Block } from '@ethereumjs/block' import { BN } from 'ethereumjs-util' export function generateBlock (executionContext) { - const block: Block = Block.fromBlockData({ - header: { - timestamp: (new Date().getTime() / 1000 | 0), - number: 0, - coinbase: '0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', - difficulty: new BN('69762765929000', 10), - gasLimit: new BN('8000000').imuln(1) - } - }, { common: executionContext.vmObject().common }) - - executionContext.vm().runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false }).then(() => { - executionContext.addBlock(block) - }) + return new Promise((resolve, reject) => { + const block: Block = Block.fromBlockData({ + header: { + timestamp: (new Date().getTime() / 1000 | 0), + number: 0, + coinbase: '0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', + difficulty: new BN('69762765929000', 10), + gasLimit: new BN('8000000').imuln(1) + } + }, { common: executionContext.vmObject().common }) + + executionContext.vm().runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false }).then(() => { + executionContext.addBlock(block) + resolve({}) + }).catch((e) => reject(e)) + }) } diff --git a/libs/remix-simulator/src/methods/blocks.ts b/libs/remix-simulator/src/methods/blocks.ts index fc66a22892..bfed840284 100644 --- a/libs/remix-simulator/src/methods/blocks.ts +++ b/libs/remix-simulator/src/methods/blocks.ts @@ -31,6 +31,9 @@ export class Blocks { blockIndex = this.executionContext.latestBlockNumber } + if (Number.isInteger(blockIndex)) { + blockIndex = '0x' + blockIndex.toString(16) + } const block = this.executionContext.blocks[blockIndex] if (!block) { @@ -57,7 +60,6 @@ export class Blocks { transactions: block.transactions.map((t) => '0x' + t.hash().toString('hex')), uncles: [] } - cb(null, b) } diff --git a/libs/remix-simulator/src/provider.ts b/libs/remix-simulator/src/provider.ts index afd6696a17..b5c62daa4f 100644 --- a/libs/remix-simulator/src/provider.ts +++ b/libs/remix-simulator/src/provider.ts @@ -38,13 +38,12 @@ export class Provider { this.methods = merge(this.methods, (new Filters(this.executionContext)).methods()) this.methods = merge(this.methods, netMethods()) this.methods = merge(this.methods, this.Transactions.methods()) - this.methods = merge(this.methods, (new Debug(this.executionContext)).methods()) - - generateBlock(this.executionContext) - this.init() + this.methods = merge(this.methods, (new Debug(this.executionContext)).methods()) + // this.init() } async init () { + await generateBlock(this.executionContext) await this.Accounts.resetAccounts() this.Transactions.init(this.Accounts.accounts) } diff --git a/libs/remix-simulator/test/accounts.ts b/libs/remix-simulator/test/accounts.ts index 471cacfd72..0c36c38191 100644 --- a/libs/remix-simulator/test/accounts.ts +++ b/libs/remix-simulator/test/accounts.ts @@ -5,8 +5,9 @@ const web3 = new Web3() import * as assert from 'assert' describe('Accounts', () => { - before(function () { + before(async function () { const provider = new Provider() + await provider.init() web3.setProvider(provider) }) diff --git a/libs/remix-simulator/test/blocks.ts b/libs/remix-simulator/test/blocks.ts index 5a404ee722..827c4dc726 100644 --- a/libs/remix-simulator/test/blocks.ts +++ b/libs/remix-simulator/test/blocks.ts @@ -5,10 +5,11 @@ const web3 = new Web3() import * as assert from 'assert' describe('blocks', () => { - before(() => { + before(async () => { const provider = new Provider('vm', { coinbase: '0x0000000000000000000000000000000000000001' }) + await provider.init() web3.setProvider(provider) }) @@ -29,7 +30,7 @@ describe('blocks', () => { parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000', sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', size: 163591, - stateRoot: '0x63e1738ea12d4e7d12b71f0f4604706417921eb6a62c407ca5f1d66b9e67f579', + stateRoot: '0x0000000000000000000000000000000000000000000000000000000000000000', timestamp: block.timestamp, totalDifficulty: '0', transactions: [], diff --git a/libs/remix-simulator/test/misc.ts b/libs/remix-simulator/test/misc.ts index 6d8f57ef49..cf38ce8740 100644 --- a/libs/remix-simulator/test/misc.ts +++ b/libs/remix-simulator/test/misc.ts @@ -5,8 +5,9 @@ const web3 = new Web3() import * as assert from 'assert' describe('Misc', () => { - before(() => { + before(async () => { const provider = new Provider() + await provider.init() web3.setProvider(provider) }) From 35cad3755c9c8ebeffb2906ffcf1a21ba11f6e3c Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 22 Apr 2021 13:33:21 +0200 Subject: [PATCH 10/29] linting --- libs/remix-simulator/src/genesis.ts | 4 ++-- libs/remix-simulator/src/provider.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/remix-simulator/src/genesis.ts b/libs/remix-simulator/src/genesis.ts index e7176e8a77..f3d7d0509e 100644 --- a/libs/remix-simulator/src/genesis.ts +++ b/libs/remix-simulator/src/genesis.ts @@ -12,10 +12,10 @@ export function generateBlock (executionContext) { gasLimit: new BN('8000000').imuln(1) } }, { common: executionContext.vmObject().common }) - + executionContext.vm().runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false }).then(() => { executionContext.addBlock(block) resolve({}) }).catch((e) => reject(e)) - }) + }) } diff --git a/libs/remix-simulator/src/provider.ts b/libs/remix-simulator/src/provider.ts index b5c62daa4f..1ce66a0b2e 100644 --- a/libs/remix-simulator/src/provider.ts +++ b/libs/remix-simulator/src/provider.ts @@ -38,7 +38,7 @@ export class Provider { this.methods = merge(this.methods, (new Filters(this.executionContext)).methods()) this.methods = merge(this.methods, netMethods()) this.methods = merge(this.methods, this.Transactions.methods()) - this.methods = merge(this.methods, (new Debug(this.executionContext)).methods()) + this.methods = merge(this.methods, (new Debug(this.executionContext)).methods()) // this.init() } From bfd649a433e9c438cf7387a4dad03156fc6589ee Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 26 Apr 2021 13:40:39 +0200 Subject: [PATCH 11/29] fix debugging --- libs/remix-debug/src/solidity-decoder/types/util.ts | 2 +- libs/remix-lib/src/util.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libs/remix-debug/src/solidity-decoder/types/util.ts b/libs/remix-debug/src/solidity-decoder/types/util.ts index 3229533ca8..30748c9aca 100644 --- a/libs/remix-debug/src/solidity-decoder/types/util.ts +++ b/libs/remix-debug/src/solidity-decoder/types/util.ts @@ -57,7 +57,7 @@ export function toBN (value) { if (value instanceof BN) { return value } else if (value.match && value.match(/^(0x)?([a-f0-9]*)$/)) { - value = unpadHexString(value.replace(/^(0x)/, '')) + value = unpadHexString(value) value = new BN(value === '' ? '0' : value, 16) } else if (!isNaN(value)) { value = new BN(value) diff --git a/libs/remix-lib/src/util.ts b/libs/remix-lib/src/util.ts index 1895930890..f55e5a31b6 100644 --- a/libs/remix-lib/src/util.ts +++ b/libs/remix-lib/src/util.ts @@ -1,5 +1,5 @@ 'use strict' -import { BN, bufferToHex, keccak, setLengthLeft } from 'ethereumjs-util' +import { BN, bufferToHex, keccak, setLengthLeft, intToBuffer } from 'ethereumjs-util' /* contains misc util: @TODO should be splitted @@ -165,10 +165,13 @@ export function buildCallPath (index, rootCall) { */ // eslint-disable-next-line camelcase export function sha3_256 (value) { - if (typeof value === 'string' && value.indexOf('0x') !== 0) { - value = '0x' + value + if (typeof value === 'string') { + value = Buffer.from(value.replace('0x', ''), 'hex') } - const retInBuffer: Buffer = keccak(setLengthLeft(Buffer.from(value.replace('0x', ''), 'hex'), 32)) + if (Number.isInteger(value)) { + value = intToBuffer(value) + } + const retInBuffer: Buffer = keccak(setLengthLeft(value, 32)) return bufferToHex(retInBuffer) } From 557425f191857013a7532966517386abec2c6854 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 28 Apr 2021 09:50:08 +0200 Subject: [PATCH 12/29] fix remix-simulator tests --- libs/remix-debug/test/debugger.ts | 82 ++++++++++--------- libs/remix-debug/test/decoder/localDecoder.ts | 4 +- .../test/decoder/stateTests/mapping.ts | 4 +- libs/remix-debug/test/decoder/vmCall.ts | 12 +-- libs/remix-debug/test/vmCall.ts | 8 +- libs/remix-lib/src/util.ts | 9 +- 6 files changed, 58 insertions(+), 61 deletions(-) diff --git a/libs/remix-debug/test/debugger.ts b/libs/remix-debug/test/debugger.ts index 684d9a01fd..ff859f7d4d 100644 --- a/libs/remix-debug/test/debugger.ts +++ b/libs/remix-debug/test/debugger.ts @@ -148,48 +148,50 @@ contract Ballot { winnerName_ = proposals[winningProposal()].name; } } -` +`; -var privateKey = Buffer.from('dae9801649ba2d95a21e688b56f77905e5667c44ce868ec83f82e838712a2c7a', 'hex') -var vm = vmCall.initVM(privateKey) -var output = compiler.compile(compilerInput(ballot)) -output = JSON.parse(output) -var web3VM = new remixLib.vm.Web3VMProvider() -web3VM.setVM(vm) -const param = '0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000148656c6c6f20576f726c64210000000000000000000000000000000000000000' -vmCall.sendTx(vm, {nonce: 0, privateKey: privateKey}, null, 0, output.contracts['test.sol']['Ballot'].evm.bytecode.object + param, (error, txHash) => { - console.log(error, txHash) - if (error) { - throw error - } else { - web3VM.eth.getTransaction(txHash, (error, tx) => { - if (error) { - throw error - } else { - var debugManager = new Debugger({ - compilationResult: function () { - return { data: output } - }, - web3: web3VM - }) - - debugManager.callTree.event.register('callTreeReady', () => { - testDebugging(debugManager) - }) - debugManager.callTree.event.register('callTreeNotReady', (error) => { - console.error(error) - throw error - }) - debugManager.callTree.event.register('callTreeBuildFailed', (error) => { - console.error(error) +(async () => { + var privateKey = Buffer.from('dae9801649ba2d95a21e688b56f77905e5667c44ce868ec83f82e838712a2c7a', 'hex') + var vm = await vmCall.initVM(privateKey) + var output = compiler.compile(compilerInput(ballot)) + output = JSON.parse(output) + var web3VM = new remixLib.vm.Web3VMProvider() + web3VM.setVM(vm) + const param = '0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000148656c6c6f20576f726c64210000000000000000000000000000000000000000' + vmCall.sendTx(vm, {nonce: 0, privateKey: privateKey}, null, 0, output.contracts['test.sol']['Ballot'].evm.bytecode.object + param, (error, txHash) => { + console.log(error, txHash) + if (error) { + throw error + } else { + web3VM.eth.getTransaction(txHash, (error, tx) => { + if (error) { throw error - }) - - debugManager.debug(tx) - } - }) - } -}) + } else { + var debugManager = new Debugger({ + compilationResult: function () { + return { data: output } + }, + web3: web3VM + }) + + debugManager.callTree.event.register('callTreeReady', () => { + testDebugging(debugManager) + }) + debugManager.callTree.event.register('callTreeNotReady', (error) => { + console.error(error) + throw error + }) + debugManager.callTree.event.register('callTreeBuildFailed', (error) => { + console.error(error) + throw error + }) + + debugManager.debug(tx) + } + }) + } + }) +})() function testDebugging (debugManager) { // stack diff --git a/libs/remix-debug/test/decoder/localDecoder.ts b/libs/remix-debug/test/decoder/localDecoder.ts index a9c82b1649..d76ff4c2c0 100644 --- a/libs/remix-debug/test/decoder/localDecoder.ts +++ b/libs/remix-debug/test/decoder/localDecoder.ts @@ -12,9 +12,9 @@ var structArrayLocalTest = require('./localsTests/structArray') var compilerInput = require('../helpers/compilerHelper').compilerInput tape('solidity', function (t) { - t.test('local decoder', function (st) { + t.test('local decoder', async function (st) { var privateKey = Buffer.from('dae9801649ba2d95a21e688b56f77905e5667c44ce868ec83f82e838712a2c7a', 'hex') - var vm = vmCall.initVM(st, privateKey) + var vm = await vmCall.initVM(st, privateKey) test(st, vm, privateKey) }) }) diff --git a/libs/remix-debug/test/decoder/stateTests/mapping.ts b/libs/remix-debug/test/decoder/stateTests/mapping.ts index 58875f9e25..eb2a0115b6 100644 --- a/libs/remix-debug/test/decoder/stateTests/mapping.ts +++ b/libs/remix-debug/test/decoder/stateTests/mapping.ts @@ -6,10 +6,10 @@ import { sendTx, initVM } from '../vmCall' import { StorageResolver } from '../../../src/storage/storageResolver' import { StorageViewer } from '../../../src/storage/storageViewer' -module.exports = function testMappingStorage (st, cb) { +module.exports = async function testMappingStorage (st, cb) { var mappingStorage = require('../contracts/mappingStorage') var privateKey = Buffer.from('dae9801649ba2d95a21e688b56f77905e5667c44ce868ec83f82e838712a2c7a', 'hex') - var vm = initVM(st, privateKey) + var vm = await initVM(st, privateKey) var output = compile(compilerInput(mappingStorage.contract)) output = JSON.parse(output) sendTx(vm, {nonce: 0, privateKey: privateKey}, null, 0, output.contracts['test.sol']['SimpleMappingState'].evm.bytecode.object, function (error, txHash) { diff --git a/libs/remix-debug/test/decoder/vmCall.ts b/libs/remix-debug/test/decoder/vmCall.ts index 91d6810dd3..eae3c94b9f 100644 --- a/libs/remix-debug/test/decoder/vmCall.ts +++ b/libs/remix-debug/test/decoder/vmCall.ts @@ -16,7 +16,7 @@ export function sendTx (vm, from, to, value, data, cb) { value: new BN(value, 10), data: Buffer.from(data, 'hex') }) - tx.sign(from.privateKey) + tx = tx.sign(from.privateKey) var block = Block.fromBlockData({ header: { @@ -39,9 +39,10 @@ export function sendTx (vm, from, to, value, data, cb) { } } -function createVm (hardfork) { +async function createVm (hardfork) { const common = new Common({ chain: 'mainnet', hardfork }) const vm = new VM({ common }) + await vm.init() // vm.blockchain.validate = false return { vm, stateManager: vm.stateManager } } @@ -49,12 +50,11 @@ function createVm (hardfork) { /* Init VM / Send Transaction */ -export function initVM (st, privateKey) { - var VM = createVm('berlin') +export async function initVM (st, privateKey) { + var VM = await createVm('berlin') const vm = VM.vm - var address = utileth.privateToAddress(privateKey) - + var address = utileth.Address.fromPrivateKey(privateKey) vm.stateManager.getAccount(address).then((account) => { account.balance = new BN('f00000000000000001', 16) vm.stateManager.putAccount(address, account).catch((error) => { diff --git a/libs/remix-debug/test/vmCall.ts b/libs/remix-debug/test/vmCall.ts index 912ed68fd0..ddba208a10 100644 --- a/libs/remix-debug/test/vmCall.ts +++ b/libs/remix-debug/test/vmCall.ts @@ -15,7 +15,7 @@ function sendTx (vm, from, to, value, data, cb) { value: new BN(value, 10), data: Buffer.from(data, 'hex') }) - tx.sign(from.privateKey) + tx = tx.sign(from.privateKey) var block = Block.fromBlockData({ header: { @@ -36,12 +36,12 @@ function sendTx (vm, from, to, value, data, cb) { /* Init VM / Send Transaction */ -function initVM (privateKey) { - var address = utileth.privateToAddress(privateKey) +async function initVM (privateKey) { + var address = utileth.Address.fromPrivateKey(privateKey) var vm = new VM({ activatePrecompiles: true }) - + await vm.init() vm.stateManager.getAccount(address).then((account) => { account.balance = new BN('f00000000000000001', 16) vm.stateManager.putAccount(address, account).catch((error) => { diff --git a/libs/remix-lib/src/util.ts b/libs/remix-lib/src/util.ts index f55e5a31b6..d17129d958 100644 --- a/libs/remix-lib/src/util.ts +++ b/libs/remix-lib/src/util.ts @@ -1,5 +1,5 @@ 'use strict' -import { BN, bufferToHex, keccak, setLengthLeft, intToBuffer } from 'ethereumjs-util' +import { BN, bufferToHex, keccak, setLengthLeft, toBuffer } from 'ethereumjs-util' /* contains misc util: @TODO should be splitted @@ -165,12 +165,7 @@ export function buildCallPath (index, rootCall) { */ // eslint-disable-next-line camelcase export function sha3_256 (value) { - if (typeof value === 'string') { - value = Buffer.from(value.replace('0x', ''), 'hex') - } - if (Number.isInteger(value)) { - value = intToBuffer(value) - } + value = toBuffer(value) const retInBuffer: Buffer = keccak(setLengthLeft(value, 32)) return bufferToHex(retInBuffer) } From 910821d1abe1c4aca011141b60df383a29f75a2b Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 28 Apr 2021 11:21:52 +0200 Subject: [PATCH 13/29] pass abi when recording a lib deployment --- libs/remix-lib/src/execution/txFormat.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-lib/src/execution/txFormat.ts b/libs/remix-lib/src/execution/txFormat.ts index 9578373026..7d3188a1d0 100644 --- a/libs/remix-lib/src/execution/txFormat.ts +++ b/libs/remix-lib/src/execution/txFormat.ts @@ -309,7 +309,7 @@ export function deployLibrary (libraryName, libraryShortName, library, contracts }, callbackStep, callbackDeployLibrary) } else { callbackStep(`creation of library ${libraryName} pending...`) - const data = { dataHex: bytecode, funAbi: { type: 'constructor' }, funArgs: [], contractBytecode: bytecode, contractName: libraryShortName } + const data = { dataHex: bytecode, funAbi: { type: 'constructor' }, funArgs: [], contractBytecode: bytecode, contractName: libraryShortName, contractABI: library.abi } callbackDeployLibrary({ data: data, useCall: false }, (err, txResult) => { if (err) { return callback(err) From c160313e3a79abe8f3ed0c7d27d02d54dd1aa554 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 28 Apr 2021 11:21:58 +0200 Subject: [PATCH 14/29] fix e2e --- apps/remix-ide-e2e/src/tests/debugger.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/debugger.spec.ts b/apps/remix-ide-e2e/src/tests/debugger.spec.ts index 414d9e987a..ac2f1489fc 100644 --- a/apps/remix-ide-e2e/src/tests/debugger.spec.ts +++ b/apps/remix-ide-e2e/src/tests/debugger.spec.ts @@ -187,7 +187,7 @@ module.exports = { browser .addFile('test_jsGetTrace.js', { content: jsGetTrace }) .executeScript('remix.exeCurrent()') - .waitForElementContainsText('*[data-id="terminalJournal"]', 'result { "gas": "0x5863", "return": "0x0000000000000000000000000000000000000000000000000000000000000000", "structLogs":', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'result { "gas": "0x575f", "return": "0x0000000000000000000000000000000000000000000000000000000000000000", "structLogs":', 60000) }, 'Should call the debugger api: debug': function (browser: NightwatchBrowser) { From 77c7295756b7eb43810d46ae4e4ffbeb0b73cd60 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 28 Apr 2021 14:45:10 +0200 Subject: [PATCH 15/29] change method used --- libs/remix-debug/src/solidity-decoder/types/Mapping.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-debug/src/solidity-decoder/types/Mapping.ts b/libs/remix-debug/src/solidity-decoder/types/Mapping.ts index 0d8b9e643a..75f0557538 100644 --- a/libs/remix-debug/src/solidity-decoder/types/Mapping.ts +++ b/libs/remix-debug/src/solidity-decoder/types/Mapping.ts @@ -66,7 +66,7 @@ function getMappingLocation (key, position) { // key should be a hex string, and position an int const mappingK = toBuffer('0x' + key) - let mappingP = intToBuffer(position) + let mappingP = toBuffer(position) mappingP = setLengthLeft(mappingP, 32) const mappingKeyBuf = concatTypedArrays(mappingK, mappingP) const mappingStorageLocation: Buffer = keccak(mappingKeyBuf) From 36c9ee3db220a8a08cb0fda118a67f7d530718b5 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 28 Apr 2021 14:45:23 +0200 Subject: [PATCH 16/29] linting --- .../src/execution/execution-context.ts | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/libs/remix-lib/src/execution/execution-context.ts b/libs/remix-lib/src/execution/execution-context.ts index 67a336e315..0e10e31ebc 100644 --- a/libs/remix-lib/src/execution/execution-context.ts +++ b/libs/remix-lib/src/execution/execution-context.ts @@ -31,32 +31,32 @@ class StateManagerCommonStorageDump extends StateManager { this.keyHashes = {} } -S -putContractStorage (address, key, value) { - this.keyHashes[keccak(key).toString('hex')] = bufferToHex(key) - return super.putContractStorage(address, key, value) -} -dumpStorage (address) { - return new Promise((resolve, reject) => { - this._getStorageTrie(address).then((trie) => { - const storage = {} - const stream = trie.createReadStream() - stream.on('data', (val) => { - const value = rlp.decode(val.value) - storage['0x' + val.key.toString('hex')] = { - key: this.keyHashes[val.key.toString('hex')], - value: '0x' + value.toString('hex') - } - }) - stream.on('end', function () { - resolve(storage) + putContractStorage (address, key, value) { + this.keyHashes[keccak(key).toString('hex')] = bufferToHex(key) + return super.putContractStorage(address, key, value) + } + + dumpStorage (address) { + return new Promise((resolve, reject) => { + this._getStorageTrie(address).then((trie) => { + const storage = {} + const stream = trie.createReadStream() + stream.on('data', (val) => { + const value = rlp.decode(val.value) + storage['0x' + val.key.toString('hex')] = { + key: this.keyHashes[val.key.toString('hex')], + value: '0x' + value.toString('hex') + } + }) + stream.on('end', function () { + resolve(storage) + }) + }).catch((error) => { + reject(error) }) - }).catch((error) => { - reject(error) }) - }) -} + } async getStateRoot (force: boolean = false): Promise { if (!force && this._checkpointCount !== 0) { From 78a73f34445dce66d750f2cc31f5926f1e8820ce Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 28 Apr 2021 14:46:22 +0200 Subject: [PATCH 17/29] fix caching contract storage --- .../src/web3Provider/web3VmProvider.ts | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/libs/remix-lib/src/web3Provider/web3VmProvider.ts b/libs/remix-lib/src/web3Provider/web3VmProvider.ts index c17502e7f5..3bf522c949 100644 --- a/libs/remix-lib/src/web3Provider/web3VmProvider.ts +++ b/libs/remix-lib/src/web3Provider/web3VmProvider.ts @@ -74,14 +74,17 @@ export class Web3VmProvider { setVM (vm) { if (this.vm === vm) return this.vm = vm - this.vm.on('step', (data) => { - this.pushTrace(data) + this.vm.on('step', async (data, next) => { + await this.pushTrace(data) + next() }) - this.vm.on('afterTx', (data) => { - this.txProcessed(data) + this.vm.on('afterTx', async (data, next) => { + await this.txProcessed(data) + next() }) - this.vm.on('beforeTx', (data) => { - this.txWillProcess(data) + this.vm.on('beforeTx', async (data, next) => { + await this.txWillProcess(data) + next() }) } @@ -91,7 +94,7 @@ export class Web3VmProvider { return ret } - txWillProcess (data) { + async txWillProcess (data) { this.incr++ this.processingHash = hexConvert(data.hash()) this.vmTraces[this.processingHash] = { @@ -116,15 +119,18 @@ export class Web3VmProvider { this.txsReceipt[this.processingHash] = tx this.storageCache[this.processingHash] = {} if (data.to) { - this.vm.stateManager.dumpStorage(data.to).then((storage) => { + try { + const storage = await this.vm.stateManager.dumpStorage(data.to) this.storageCache[this.processingHash][tx['to']] = storage this.lastProcessedStorageTxHash[tx['to']] = this.processingHash - }) + } catch (e) { + console.log(e) + } } this.processingIndex = 0 } - txProcessed (data) { + async txProcessed (data) { const lastOp = this.vmTraces[this.processingHash].structLogs[this.processingIndex - 1] if (lastOp) { lastOp.error = lastOp.op !== 'RETURN' && lastOp.op !== 'STOP' && lastOp.op !== 'thisDESTRUCT' @@ -168,7 +174,7 @@ export class Web3VmProvider { this.previousDepth = 0 } - pushTrace (data) { + async pushTrace (data) { const depth = data.depth + 1 // geth starts the depth from 1 if (!this.processingHash) { console.log('no tx processing') @@ -205,10 +211,13 @@ export class Web3VmProvider { this.processingAddress = toChecksumAddress(this.processingAddress) if (!this.storageCache[this.processingHash][this.processingAddress]) { const account = Address.fromString(this.processingAddress) - this.vm.stateManager.dumpStorage(account).then((storage) => { + try { + const storage = await this.vm.stateManager.dumpStorage(account) this.storageCache[this.processingHash][this.processingAddress] = storage this.lastProcessedStorageTxHash[this.processingAddress] = this.processingHash - }) + } catch (e) { + console.log(e) + } } } } From 348ace4cb1092da7d1651991d0b3cb2533676c7b Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 28 Apr 2021 14:55:06 +0200 Subject: [PATCH 18/29] linting --- .../src/solidity-decoder/types/Mapping.ts | 1 - .../src/execution/execution-context.ts | 47 +++++++++---------- .../src/web3Provider/web3VmProvider.ts | 2 +- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/libs/remix-debug/src/solidity-decoder/types/Mapping.ts b/libs/remix-debug/src/solidity-decoder/types/Mapping.ts index 75f0557538..e67a0e8a1b 100644 --- a/libs/remix-debug/src/solidity-decoder/types/Mapping.ts +++ b/libs/remix-debug/src/solidity-decoder/types/Mapping.ts @@ -2,7 +2,6 @@ import { RefType } from './RefType' import { normalizeHex } from './util' import { toBuffer, setLengthLeft, keccak, BN, bufferToHex } from 'ethereumjs-util' -import { intToBuffer } from 'ethjs-util' export class Mapping extends RefType { keyType diff --git a/libs/remix-lib/src/execution/execution-context.ts b/libs/remix-lib/src/execution/execution-context.ts index 0e10e31ebc..121227c2dc 100644 --- a/libs/remix-lib/src/execution/execution-context.ts +++ b/libs/remix-lib/src/execution/execution-context.ts @@ -31,7 +31,6 @@ class StateManagerCommonStorageDump extends StateManager { this.keyHashes = {} } - putContractStorage (address, key, value) { this.keyHashes[keccak(key).toString('hex')] = bufferToHex(key) return super.putContractStorage(address, key, value) @@ -58,40 +57,40 @@ class StateManagerCommonStorageDump extends StateManager { }) } -async getStateRoot (force: boolean = false): Promise { - if (!force && this._checkpointCount !== 0) { + async getStateRoot (force: boolean = false): Promise { + if (!force && this._checkpointCount !== 0) { // throw new Error('Cannot get state root with uncommitted checkpoints') - } + } - await this._cache.flush() + await this._cache.flush() - const stateRoot = this._trie.root - return stateRoot -} + const stateRoot = this._trie.root + return stateRoot + } -async setStateRoot (stateRoot: Buffer): Promise { - if (this._checkpointCount !== 0) { + async setStateRoot (stateRoot: Buffer): Promise { + if (this._checkpointCount !== 0) { // throw new Error('Cannot set state root with uncommitted checkpoints') - } + } - await this._cache.flush() + await this._cache.flush() + + if (stateRoot === this._trie.EMPTY_TRIE_ROOT) { + this._trie.root = stateRoot + this._cache.clear() + this._storageTries = {} + return + } + + const hasRoot = await this._trie.checkRoot(stateRoot) + if (!hasRoot) { + throw new Error('State trie does not contain state root') + } - if (stateRoot === this._trie.EMPTY_TRIE_ROOT) { this._trie.root = stateRoot this._cache.clear() this._storageTries = {} - return } - - const hasRoot = await this._trie.checkRoot(stateRoot) - if (!hasRoot) { - throw new Error('State trie does not contain state root') - } - - this._trie.root = stateRoot - this._cache.clear() - this._storageTries = {} -} } /* diff --git a/libs/remix-lib/src/web3Provider/web3VmProvider.ts b/libs/remix-lib/src/web3Provider/web3VmProvider.ts index 3bf522c949..fa17185a32 100644 --- a/libs/remix-lib/src/web3Provider/web3VmProvider.ts +++ b/libs/remix-lib/src/web3Provider/web3VmProvider.ts @@ -217,7 +217,7 @@ export class Web3VmProvider { this.lastProcessedStorageTxHash[this.processingAddress] = this.processingHash } catch (e) { console.log(e) - } + } } } } From 082b76d03f3721fea152c376af71c2821c169fd7 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 28 Apr 2021 15:19:43 +0200 Subject: [PATCH 19/29] fix e2e tests --- apps/remix-ide-e2e/src/tests/ballot.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/remix-ide-e2e/src/tests/ballot.test.ts b/apps/remix-ide-e2e/src/tests/ballot.test.ts index 61c5b685ba..35e615d933 100644 --- a/apps/remix-ide-e2e/src/tests/ballot.test.ts +++ b/apps/remix-ide-e2e/src/tests/ballot.test.ts @@ -42,6 +42,7 @@ module.exports = { .pause(2000) .waitForElementVisible('#stepdetail') .goToVMTraceStep(144) + .pause(2000) .checkVariableDebug('soliditystate', stateCheck) .checkVariableDebug('soliditylocals', localsCheck) }, From 6ee303e6e97691ca0048e5cf18a595ba916daff6 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 29 Apr 2021 10:03:25 +0200 Subject: [PATCH 20/29] remove commited --- libs/remix-debug/test/decoder/vmCall.ts | 1 - libs/remix-lib/src/execution/execution-context.ts | 5 ----- libs/remix-lib/src/web3Provider/web3VmProvider.ts | 1 - libs/remix-simulator/src/provider.ts | 1 - 4 files changed, 8 deletions(-) diff --git a/libs/remix-debug/test/decoder/vmCall.ts b/libs/remix-debug/test/decoder/vmCall.ts index eae3c94b9f..40438e4f63 100644 --- a/libs/remix-debug/test/decoder/vmCall.ts +++ b/libs/remix-debug/test/decoder/vmCall.ts @@ -43,7 +43,6 @@ async function createVm (hardfork) { const common = new Common({ chain: 'mainnet', hardfork }) const vm = new VM({ common }) await vm.init() - // vm.blockchain.validate = false return { vm, stateManager: vm.stateManager } } diff --git a/libs/remix-lib/src/execution/execution-context.ts b/libs/remix-lib/src/execution/execution-context.ts index 121227c2dc..5424ae0c58 100644 --- a/libs/remix-lib/src/execution/execution-context.ts +++ b/libs/remix-lib/src/execution/execution-context.ts @@ -245,11 +245,6 @@ export class ExecutionContext { if (!infoCb) infoCb = () => {} if (context === 'vm') { this.executionContext = context - /* - this.vms[this.currentFork].stateManager.revert().then(() => { - this.vms[this.currentFork].stateManager.checkpoint() - }) - */ this.event.trigger('contextChanged', ['vm']) return cb() } diff --git a/libs/remix-lib/src/web3Provider/web3VmProvider.ts b/libs/remix-lib/src/web3Provider/web3VmProvider.ts index fa17185a32..c883899000 100644 --- a/libs/remix-lib/src/web3Provider/web3VmProvider.ts +++ b/libs/remix-lib/src/web3Provider/web3VmProvider.ts @@ -109,7 +109,6 @@ export class Web3VmProvider { tx['to'] = toChecksumAddress(data.to.toString()) } this.processingAddress = tx['to'] - // tx['data'] = hexConvert(data.data) tx['input'] = hexConvert(data.data) tx['gas'] = data.gasLimit.toString(10) if (data.value) { diff --git a/libs/remix-simulator/src/provider.ts b/libs/remix-simulator/src/provider.ts index 1ce66a0b2e..8fdb5b5aba 100644 --- a/libs/remix-simulator/src/provider.ts +++ b/libs/remix-simulator/src/provider.ts @@ -39,7 +39,6 @@ export class Provider { this.methods = merge(this.methods, netMethods()) this.methods = merge(this.methods, this.Transactions.methods()) this.methods = merge(this.methods, (new Debug(this.executionContext)).methods()) - // this.init() } async init () { From 762daba8df7e9d090ed18a512d074ed6b5f148aa Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 29 Apr 2021 10:03:47 +0200 Subject: [PATCH 21/29] add berlin to solidity settings --- apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js b/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js index 28a864a7c0..f64cdead77 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js @@ -225,6 +225,7 @@ class CompilerContainer { this._view.evmVersionSelector = yo`