From 5307d93505efdfe6c8e9430659849a72b69b0b73 Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Fri, 1 Apr 2022 18:54:48 +0530 Subject: [PATCH 01/35] save slither report --- libs/remixd/src/services/slitherClient.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libs/remixd/src/services/slitherClient.ts b/libs/remixd/src/services/slitherClient.ts index 1187bd694e..7e22846d89 100644 --- a/libs/remixd/src/services/slitherClient.ts +++ b/libs/remixd/src/services/slitherClient.ts @@ -135,7 +135,7 @@ export class SlitherClient extends PluginClient { } const solcRemaps = remaps ? `--solc-remaps "${remaps}"` : '' - const outputFile: string = 'remix-slitherReport_' + Math.floor(Date.now() / 1000) + '.json' + const outputFile: string = 'remix-slither-report.json' const cmd = `slither ${filePath} ${solcArgs} ${solcRemaps} --json ${outputFile}` console.log('\x1b[32m%s\x1b[0m', '[Slither Analysis]: Running Slither...') // Added `stdio: 'ignore'` as for contract with NPM imports analysis which is exported in 'stderr' @@ -149,9 +149,6 @@ export class SlitherClient extends PluginClient { if (existsSync(outputFileAbsPath)) { let report = readFileSync(outputFileAbsPath, 'utf8') report = JSON.parse(report) - unlink(outputFileAbsPath, (err) => { - if (err) console.log(err) - }) if (report['success']) { response['status'] = true if (!report['results'] || !report['results'].detectors || !report['results'].detectors.length) { From b3a7bab95c8010999937e4b0b2273857e0b510e9 Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Mon, 4 Apr 2022 11:20:34 +0530 Subject: [PATCH 02/35] linting fix --- libs/remixd/src/services/slitherClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remixd/src/services/slitherClient.ts b/libs/remixd/src/services/slitherClient.ts index 7e22846d89..c689aba86a 100644 --- a/libs/remixd/src/services/slitherClient.ts +++ b/libs/remixd/src/services/slitherClient.ts @@ -135,7 +135,7 @@ export class SlitherClient extends PluginClient { } const solcRemaps = remaps ? `--solc-remaps "${remaps}"` : '' - const outputFile: string = 'remix-slither-report.json' + const outputFile = 'remix-slither-report.json' const cmd = `slither ${filePath} ${solcArgs} ${solcRemaps} --json ${outputFile}` console.log('\x1b[32m%s\x1b[0m', '[Slither Analysis]: Running Slither...') // Added `stdio: 'ignore'` as for contract with NPM imports analysis which is exported in 'stderr' From 758f1a81a70b417529b303b89b7f4f74c366cba0 Mon Sep 17 00:00:00 2001 From: David Disu Date: Thu, 17 Mar 2022 12:03:22 +0100 Subject: [PATCH 03/35] Move download from homepage to File Explorer --- .../home-tab/src/lib/remix-ui-home-tab.tsx | 45 ---------------- .../workspace/src/lib/actions/index.ts | 52 ++++++++++++++++++- .../workspace/src/lib/contexts/index.ts | 3 +- .../src/lib/providers/FileSystemProvider.tsx | 9 +++- .../workspace/src/lib/remix-ui-workspace.tsx | 21 +++++++- 5 files changed, 79 insertions(+), 51 deletions(-) diff --git a/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx b/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx index 986034c39d..76c365c3b4 100644 --- a/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx +++ b/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx @@ -1,7 +1,6 @@ import React, { useState, useRef, useEffect, useReducer } from 'react' // eslint-disable-line import './remix-ui-home-tab.css' -import JSZip from 'jszip' import { ModalDialog } from '@remix-ui/modal-dialog' // eslint-disable-line import { Toaster } from '@remix-ui/toaster' // eslint-disable-line import PluginButton from './components/pluginButton' // eslint-disable-line @@ -176,46 +175,6 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => { const startPluginManager = async () => { plugin.verticalIcons.select('pluginManager') } - const saveAs = (blob, name) => { - const node = document.createElement('a') - node.download = name - node.rel = 'noopener' - node.href = URL.createObjectURL(blob) - setTimeout(function () { URL.revokeObjectURL(node.href) }, 4E4) // 40s - setTimeout(function () { - try { - node.dispatchEvent(new MouseEvent('click')) - } catch (e) { - const evt = document.createEvent('MouseEvents') - evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, - 20, false, false, false, false, 0, null) - node.dispatchEvent(evt) - } - }, 0) // 40s - } - const downloadFiles = async () => { - try { - plugin.call('notification', 'toast', 'preparing files for download, please wait..') - const zip = new JSZip() - zip.file("readme.txt", "This is a Remix backup file.\nThis zip should be used by the restore backup tool in Remix.\nThe .workspaces directory contains your workspaces.") - const browserProvider = fileManager.getProvider('browser') - await browserProvider.copyFolderToJson('/', ({ path, content }) => { - zip.file(path, content) - }) - zip.generateAsync({ type: 'blob' }).then(function (blob) { - const today = new Date() - const date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate() - const time = today.getHours() + 'h' + today.getMinutes() + 'min' - saveAs(blob, `remix-backup-at-${time}-${date}.zip`) - _paq.push(['trackEvent', 'Backup', 'download', 'home']) - }).catch((e) => { - _paq.push(['trackEvent', 'Backup', 'error', e.message]) - plugin.call('notification', 'toast', e.message) - }) - } catch (e) { - plugin.call('notification', 'toast', e.message) - } - } const restoreBackupZip = async () => { await plugin.appManager.activatePlugin(['restorebackupzip']) @@ -336,10 +295,6 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => {

-

- - -

diff --git a/libs/remix-ui/workspace/src/lib/actions/index.ts b/libs/remix-ui/workspace/src/lib/actions/index.ts index 7e1a47e43a..ed1b47ce39 100644 --- a/libs/remix-ui/workspace/src/lib/actions/index.ts +++ b/libs/remix-ui/workspace/src/lib/actions/index.ts @@ -5,13 +5,14 @@ import { customAction } from '@remixproject/plugin-api/lib/file-system/file-pane import { displayNotification, displayPopUp, fetchDirectoryError, fetchDirectoryRequest, fetchDirectorySuccess, focusElement, fsInitializationCompleted, hidePopUp, removeInputFieldSuccess, setCurrentWorkspace, setExpandPath, setMode, setWorkspaces } from './payload' import { listenOnPluginEvents, listenOnProviderEvents } from './events' import { createWorkspaceTemplate, getWorkspaces, loadWorkspacePreset, setPlugin } from './workspace' +import { QueryParams } from '@remix-project/remix-lib' +import JSZip from 'jszip' export * from './events' export * from './workspace' -import { QueryParams } from '@remix-project/remix-lib' - const queryParams = new QueryParams() +const _paq = window._paq = window._paq || [] let plugin, dispatch: React.Dispatch @@ -269,6 +270,33 @@ export const handleExpandPath = (paths: string[]) => { dispatch(setExpandPath(paths)) } +export const handleDownloadFiles = async () => { + try { + plugin.call('notification', 'toast', 'preparing files for download, please wait..') + const zip = new JSZip() + + zip.file("readme.txt", "This is a Remix backup file.\nThis zip should be used by the restore backup tool in Remix.\nThe .workspaces directory contains your workspaces.") + const browserProvider = plugin.fileManager.getProvider('browser') + + await browserProvider.copyFolderToJson('/', ({ path, content }) => { + zip.file(path, content) + }) + zip.generateAsync({ type: 'blob' }).then(function (blob) { + const today = new Date() + const date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate() + const time = today.getHours() + 'h' + today.getMinutes() + 'min' + + saveAs(blob, `remix-backup-at-${time}-${date}.zip`) + _paq.push(['trackEvent', 'Backup', 'download', 'home']) + }).catch((e) => { + _paq.push(['trackEvent', 'Backup', 'error', e.message]) + plugin.call('notification', 'toast', e.message) + }) + } catch (e) { + plugin.call('notification', 'toast', e.message) + } +} + const packageGistFiles = async (directory) => { const workspaceProvider = plugin.fileProviders.workspace const isFile = await workspaceProvider.isFile(directory) @@ -344,3 +372,23 @@ const getOriginalFiles = async (id) => { const data = await res.json() return data.files || [] } + +const saveAs = (blob, name) => { + const node = document.createElement('a') + + node.download = name + node.rel = 'noopener' + node.href = URL.createObjectURL(blob) + setTimeout(function () { URL.revokeObjectURL(node.href) }, 4E4) // 40s + setTimeout(function () { + try { + node.dispatchEvent(new MouseEvent('click')) + } catch (e) { + const evt = document.createEvent('MouseEvents') + + evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, + 20, false, false, false, false, 0, null) + node.dispatchEvent(evt) + } + }, 0) // 40s +} diff --git a/libs/remix-ui/workspace/src/lib/contexts/index.ts b/libs/remix-ui/workspace/src/lib/contexts/index.ts index 1aedce98b5..cb0d3a758b 100644 --- a/libs/remix-ui/workspace/src/lib/contexts/index.ts +++ b/libs/remix-ui/workspace/src/lib/contexts/index.ts @@ -27,5 +27,6 @@ export const FileSystemContext = createContext<{ dispatchRunScript: (path: string) => Promise, dispatchEmitContextMenuEvent: (cmd: customAction) => Promise, dispatchHandleClickFile: (path: string, type: 'file' | 'folder' | 'gist') => Promise - dispatchHandleExpandPath: (paths: string[]) => Promise + dispatchHandleExpandPath: (paths: string[]) => Promise, + dispatchHandleDownloadFiles: () => Promise }>(null) diff --git a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx index 904ed7cade..3803e34c14 100644 --- a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx +++ b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx @@ -5,7 +5,7 @@ import { Toaster } from '@remix-ui/toaster' // eslint-disable-line // eslint-disable-next-line @typescript-eslint/no-unused-vars import { FileSystemContext } from '../contexts' import { browserReducer, browserInitialState } from '../reducers/workspace' -import { initWorkspace, fetchDirectory, removeInputField, deleteWorkspace, clearPopUp, publishToGist, createNewFile, setFocusElement, createNewFolder, deletePath, renamePath, copyFile, copyFolder, runScript, emitContextMenuEvent, handleClickFile, handleExpandPath, addInputField, createWorkspace, fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile } from '../actions' +import { initWorkspace, fetchDirectory, removeInputField, deleteWorkspace, clearPopUp, publishToGist, createNewFile, setFocusElement, createNewFolder, deletePath, renamePath, copyFile, copyFolder, runScript, emitContextMenuEvent, handleClickFile, handleExpandPath, addInputField, createWorkspace, fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile, handleDownloadFiles } from '../actions' import { Modal, WorkspaceProps } from '../types' // eslint-disable-next-line @typescript-eslint/no-unused-vars import { Workspace } from '../remix-ui-workspace' @@ -115,6 +115,10 @@ export const FileSystemProvider = (props: WorkspaceProps) => { await handleExpandPath(paths) } + const dispatchHandleDownloadFiles = async () => { + await handleDownloadFiles() + } + useEffect(() => { dispatchInitWorkspace() }, []) @@ -214,7 +218,8 @@ export const FileSystemProvider = (props: WorkspaceProps) => { dispatchRunScript, dispatchEmitContextMenuEvent, dispatchHandleClickFile, - dispatchHandleExpandPath + dispatchHandleExpandPath, + dispatchHandleDownloadFiles } return ( diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index a51224f86c..11eec79c16 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -50,6 +50,14 @@ export function Workspace () { global.modal('Delete Current Workspace', 'Are you sure to delete the current workspace?', 'OK', onFinishDeleteWorkspace, '') } + const downloadWorkspaces = async () => { + try { + await global.dispatchHandleDownloadFiles() + } catch (e) { + console.error(e) + } + } + const onFinishRenameWorkspace = async () => { if (workspaceRenameInput.current === undefined) return // @ts-ignore: Object is possibly 'null'. @@ -156,9 +164,20 @@ export function Workspace () { e.stopPropagation() deleteCurrentWorkspace() }} - className='fas fa-trash' + className='fas fa-trash remixui_menuicon' title='Delete'> + switchWorkspace(e.target.value)} className="form-control custom-select"> { From 57da48040b76db279431cb30876a80c2f4b68082 Mon Sep 17 00:00:00 2001 From: David Disu Date: Tue, 29 Mar 2022 11:01:10 +0100 Subject: [PATCH 06/35] Update show content call --- libs/remix-ui/workspace/src/lib/actions/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/remix-ui/workspace/src/lib/actions/index.ts b/libs/remix-ui/workspace/src/lib/actions/index.ts index 001c66b558..a000853f9f 100644 --- a/libs/remix-ui/workspace/src/lib/actions/index.ts +++ b/libs/remix-ui/workspace/src/lib/actions/index.ts @@ -299,6 +299,7 @@ export const handleDownloadFiles = async () => { export const restoreBackupZip = async () => { await plugin.appManager.activatePlugin(['restorebackupzip']) + await plugin.call('mainPanel', 'showContent', 'restorebackupzip') plugin.verticalIcons.select('restorebackupzip') _paq.push(['trackEvent', 'pluginManager', 'userActivate', 'restorebackupzip']) } From 027ab36e549a4ab5354f70d55990697a7e1f483e Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 8 Mar 2022 12:43:56 +0100 Subject: [PATCH 07/35] add script Executor plugin --- apps/remix-ide/src/app.js | 5 ++- .../app/tabs/intelligent-script-executor.js | 40 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 apps/remix-ide/src/app/tabs/intelligent-script-executor.js diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index 35c31e862a..6927f20c4b 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -5,6 +5,7 @@ import { RemixAppManager } from './remixAppManager' import { ThemeModule } from './app/tabs/theme-module' import { NetworkModule } from './app/tabs/network-module' import { Web3ProviderModule } from './app/tabs/web3-provider' +import { IntelligentScriptExecutor } from './app/tabs/intelligent-script-executor' import { SidePanel } from './app/components/side-panel' import { HiddenPanel } from './app/components/hidden-panel' import { VerticalIcons } from './app/components/vertical-icons' @@ -179,7 +180,8 @@ class AppComponent { api: offsetToLineColumnConverter, name: 'offsettolinecolumnconverter' }) - + // ----------------- run script after each compilation results ----------- + const intelligentScriptExecutor = new IntelligentScriptExecutor() // -------------------Terminal---------------------------------------- makeUdapp(blockchain, compilersArtefacts, domEl => terminal.logHtml(domEl)) const terminal = new Terminal( @@ -222,6 +224,7 @@ class AppComponent { contextualListener, terminal, web3Provider, + intelligentScriptExecutor, fetchAndCompile, dGitProvider, storagePlugin, diff --git a/apps/remix-ide/src/app/tabs/intelligent-script-executor.js b/apps/remix-ide/src/app/tabs/intelligent-script-executor.js new file mode 100644 index 0000000000..074f12d947 --- /dev/null +++ b/apps/remix-ide/src/app/tabs/intelligent-script-executor.js @@ -0,0 +1,40 @@ +import { Plugin } from '@remixproject/engine' +import * as packageJson from '../../../../../package.json' + +export const profile = { + name: 'IntelligentScriptExecutor', + displayName: 'Intelligent Script Executor', + description: 'after each compilation, run the script defined in Natspec.', + methods: [], + version: packageJson.version, + kind: 'none' +} + +export class IntelligentScriptExecutor extends Plugin { + constructor () { + super(profile) + } + + onActivation () { + this.on('solidity', 'compilationFinished', async (file, source, languageVersion, data, input, version) => { + const currentFile = await this.call('fileManager', 'file') + if (data && data.sources[currentFile] && + data.sources[currentFile].ast && data.sources[currentFile].ast.nodes && data.sources[currentFile].ast.nodes.length) { + const nodes = data.sources[currentFile].ast.nodes + for (let node of nodes) { + if (node.documentation && node.documentation.text && node.documentation.text.startsWith('@custom:dev-run-script')) { + const text = node.documentation.text.replace('@custom:dev-run-script', '').trim() + await this.call('terminal', 'log', `running ${text} ...`) + const content = await this.call('fileManager', 'readFile', text) + await this.call('udapp', 'clearAllInstances') + await this.call('scriptRunner', 'execute', content) + } + } + } + }) + } + + onDeactivation () { + this.off('solidity', 'compilationFinished') + } +} From 979225d1e1f52032c9040ac5ff74095014c74473 Mon Sep 17 00:00:00 2001 From: yann300 Date: Sat, 5 Mar 2022 15:42:21 +0100 Subject: [PATCH 08/35] listen on new deployed contract and add to udapp --- apps/remix-ide/src/app/tabs/web3-provider.js | 9 ++++- apps/remix-ide/src/app/udapp/run-tab.js | 10 +++++- apps/remix-ide/src/blockchain/blockchain.js | 10 +++++- .../src/lib/compiler-artefacts.ts | 35 +++++++++++++++++-- .../src/lib/compiler-metadata.ts | 3 +- .../remix-ui/run-tab/src/lib/actions/index.ts | 10 +++++- 6 files changed, 69 insertions(+), 8 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/web3-provider.js b/apps/remix-ide/src/app/tabs/web3-provider.js index 4224106a39..42de424839 100644 --- a/apps/remix-ide/src/app/tabs/web3-provider.js +++ b/apps/remix-ide/src/app/tabs/web3-provider.js @@ -24,8 +24,15 @@ export class Web3ProviderModule extends Plugin { return new Promise((resolve, reject) => { const provider = this.blockchain.web3().currentProvider // see https://github.com/ethereum/web3.js/pull/1018/files#diff-d25786686c1053b786cc2626dc6e048675050593c0ebaafbf0814e1996f22022R129 - provider[provider.sendAsync ? 'sendAsync' : 'send'](payload, (error, message) => { + provider[provider.sendAsync ? 'sendAsync' : 'send'](payload, async (error, message) => { if (error) return reject(error) + if (payload.method === 'eth_sendTransaction') { + if (payload.params.length && !payload.params[0].to && message.result) { + const receipt = await this.call('blockchain', 'getTransactionReceipt', message.result) + const contractData = await this.call('compilerArtefacts', 'getContractDataFromAddress', receipt.contractAddress) + if (contractData) this.call('udapp', 'addInstance', receipt.contractAddress, contractData.contract.abi, contractData.name) + } + } resolve(message) }) }) diff --git a/apps/remix-ide/src/app/udapp/run-tab.js b/apps/remix-ide/src/app/udapp/run-tab.js index 05a015c4fc..313161b121 100644 --- a/apps/remix-ide/src/app/udapp/run-tab.js +++ b/apps/remix-ide/src/app/udapp/run-tab.js @@ -18,7 +18,7 @@ const profile = { version: packageJson.version, permission: true, events: ['newTransaction'], - methods: ['createVMAccount', 'sendTransaction', 'getAccounts', 'pendingTransactionsCount', 'getSettings', 'setEnvironmentMode'] + methods: ['createVMAccount', 'sendTransaction', 'getAccounts', 'pendingTransactionsCount', 'getSettings', 'setEnvironmentMode', 'clearAllInstances', 'addInstance'] } export class RunTab extends ViewPlugin { @@ -64,6 +64,14 @@ export class RunTab extends ViewPlugin { } } + clearAllInstances () { + this.emit('clearAllInstancesReducer') + } + + addInstance (address, abi, name) { + this.emit('addInstanceReducer', address, abi, name) + } + createVMAccount (newAccount) { return this.blockchain.createVMAccount(newAccount) } diff --git a/apps/remix-ide/src/blockchain/blockchain.js b/apps/remix-ide/src/blockchain/blockchain.js index 3382d3a649..705c3089bd 100644 --- a/apps/remix-ide/src/blockchain/blockchain.js +++ b/apps/remix-ide/src/blockchain/blockchain.js @@ -22,7 +22,7 @@ const profile = { name: 'blockchain', displayName: 'Blockchain', description: 'Blockchain - Logic', - methods: [], + methods: ['getCode', 'getTransactionReceipt'], version: packageJson.version } @@ -392,6 +392,14 @@ export class Blockchain extends Plugin { return Object.keys(this.txRunner.pendingTxs).length } + async getCode(address) { + return await this.web3().eth.getCode(address) + } + + async getTransactionReceipt (hash) { + return await this.web3().eth.getTransactionReceipt(hash) + } + /** * This function send a tx only to javascript VM or testnet, will return an error for the mainnet * SHOULD BE TAKEN CAREFULLY! diff --git a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts index df7a895bfc..24b0a6bee6 100644 --- a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts +++ b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts @@ -1,10 +1,11 @@ 'use strict' import { Plugin } from '@remixproject/engine' +import { util } from '@remix-project/remix-lib' import { CompilerAbstract } from '@remix-project/remix-solidity' const profile = { name: 'compilerArtefacts', - methods: ['get', 'addResolvedContract', 'getCompilerAbstract', 'getAllContractDatas', 'getLastCompilationResult', 'getArtefactsByContractName'], + methods: ['get', 'addResolvedContract', 'getCompilerAbstract', 'getAllContractDatas', 'getLastCompilationResult', 'getArtefactsByContractName', 'getContractDataFromAddress'], events: [], version: '0.0.1' } @@ -72,15 +73,27 @@ export class CompilerArtefacts extends Plugin { * @returns compilatin output */ getAllContractDatas () { + return this.filterAllContractDatas(() => true) + } + + /** + * filter compilation output for contracts compiled during a session of Remix IDE + * @returns compilatin output + */ + filterAllContractDatas (filter) { const contractsData = {} Object.keys(this.compilersArtefactsPerFile).map((targetFile) => { const contracts = this.compilersArtefactsPerFile[targetFile].getContracts() - Object.keys(contracts).map((file) => { contractsData[file] = contracts[file] }) + Object.keys(contracts).map((file) => { + if (filter(file, contracts[file])) contractsData[file] = contracts[file] + }) }) // making sure we save last compilation result in there if (this.compilersArtefacts.__last) { const contracts = this.compilersArtefacts.__last.getContracts() - Object.keys(contracts).map((file) => { contractsData[file] = contracts[file] }) + Object.keys(contracts).map((file) => { + if (filter(file, contracts[file])) contractsData[file] = contracts[file] + }) } return contractsData } @@ -182,4 +195,20 @@ export class CompilerArtefacts extends Plugin { get (key) { return this.compilersArtefacts[key] } + + async getContractDataFromAddress (address) { + const code = await this.call('blockchain', 'getCode', address) + let found + this.filterAllContractDatas((file, contractsData) => { + for (let name of Object.keys(contractsData)) { + const contract = contractsData[name] + if (util.compareByteCode(code, '0x' + contract.evm.deployedBytecode.object)) { + found = { name, contract } + return true + } + } + return true + }) + return found + } } diff --git a/libs/remix-core-plugin/src/lib/compiler-metadata.ts b/libs/remix-core-plugin/src/lib/compiler-metadata.ts index e7c5f3eec6..07f1996f90 100644 --- a/libs/remix-core-plugin/src/lib/compiler-metadata.ts +++ b/libs/remix-core-plugin/src/lib/compiler-metadata.ts @@ -42,6 +42,7 @@ export class CompilerMetadata extends Plugin { await this._setArtefacts(content, contract, path) })() }) + this.emit('artefactsUpdated') }) } @@ -103,7 +104,7 @@ export class CompilerMetadata extends Plugin { }, abi: contract.object.abi } - await this.call('fileManager', 'writeFile', fileName, JSON.stringify(data, null, '\t')) + await this.call('fileManager', 'writeFile', fileName, JSON.stringify(data, null, '\t')) } _syncContext (contract, metadata) { diff --git a/libs/remix-ui/run-tab/src/lib/actions/index.ts b/libs/remix-ui/run-tab/src/lib/actions/index.ts index 17ae11e4bb..6e0ebeae9c 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/index.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/index.ts @@ -83,6 +83,14 @@ const setupEvents = () => { setExecutionContext(env) }) + plugin.on('udapp', 'clearAllInstancesReducer', () => { + dispatch(clearAllInstances()) + }) + + plugin.on('udapp', 'addInstanceReducer', (address, abi, name) => { + addInstance({ abi, address, name }) + }) + plugin.on('filePanel', 'setWorkspace', () => { dispatch(resetUdapp()) resetAndInit() @@ -549,7 +557,7 @@ export const updateTxFeeContent = (content: string) => { dispatch(setTxFeeContent(content)) } -const addInstance = (instance: { contractData?: ContractData, address: string, name: string, abi?: any, decodedResponse?: Record }) => { +export const addInstance = (instance: { contractData?: ContractData, address: string, name: string, abi?: any, decodedResponse?: Record }) => { instance.decodedResponse = {} dispatch(addNewInstance(instance)) } From bfdd30b94732806a83aeaac930e48979cca4fe7e Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 8 Mar 2022 12:54:20 +0100 Subject: [PATCH 09/35] add to native plugin --- apps/remix-ide/src/app/tabs/intelligent-script-executor.js | 2 +- apps/remix-ide/src/remixAppManager.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/intelligent-script-executor.js b/apps/remix-ide/src/app/tabs/intelligent-script-executor.js index 074f12d947..08bca2bbc1 100644 --- a/apps/remix-ide/src/app/tabs/intelligent-script-executor.js +++ b/apps/remix-ide/src/app/tabs/intelligent-script-executor.js @@ -2,7 +2,7 @@ import { Plugin } from '@remixproject/engine' import * as packageJson from '../../../../../package.json' export const profile = { - name: 'IntelligentScriptExecutor', + name: 'intelligentScriptExecutor', displayName: 'Intelligent Script Executor', description: 'after each compilation, run the script defined in Natspec.', methods: [], diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index 6c1b909dfa..dd00e99177 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -13,7 +13,7 @@ const requiredModules = [ // services + layout views + system views const dependentModules = ['git', 'hardhat', 'slither'] // module which shouldn't be manually activated (e.g git is activated by remixd) export function isNative (name) { - const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons', 'solidity', 'hardhat-provider', 'solidityStaticAnalysis', 'solidityUnitTesting', 'layout', 'notification'] + const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons', 'solidity', 'hardhat-provider', 'solidityStaticAnalysis', 'solidityUnitTesting', 'layout', 'notification', 'intelligentScriptExecutor'] return nativePlugins.includes(name) || requiredModules.includes(name) } From 6297bd393c72f59805962bdc5534f862c8260165 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 8 Mar 2022 19:48:17 +0100 Subject: [PATCH 10/35] fix returning txs from aa block --- libs/remix-simulator/src/methods/blocks.ts | 51 +++++++++++++++++++++- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/libs/remix-simulator/src/methods/blocks.ts b/libs/remix-simulator/src/methods/blocks.ts index a58319b916..1ecc7b30e4 100644 --- a/libs/remix-simulator/src/methods/blocks.ts +++ b/libs/remix-simulator/src/methods/blocks.ts @@ -1,6 +1,9 @@ +import Web3 from 'web3' + export class Blocks { vmContext coinbase: string + TX_INDEX = '0x0' // currently there's always only 1 tx per block, so the transaction index will always be 0x0 constructor (vmContext, _options) { this.vmContext = vmContext const options = _options || {} @@ -37,6 +40,28 @@ export class Blocks { return cb(new Error('block not found')) } + console.log(block.transactions) + const transactions = block.transactions.map((t) => { + const hash = '0x' + t.hash().toString('hex') + const tx = this.vmContext.txByHash[hash] + const receipt = this.vmContext.currentVm.web3vm.txsReceipt[hash] + if (receipt) { + return { + blockHash: '0x' + block.hash().toString('hex'), + blockNumber: '0x' + block.header.number.toString('hex'), + from: receipt.from, + gas: Web3.utils.toHex(receipt.gas), + chainId: '0xd05', + gasPrice: '0x4a817c800', // 20000000000 + hash: receipt.transactionHash, + input: receipt.input, + nonce: '0x' + tx.nonce.toString('hex'), + transactionIndex: this.TX_INDEX, + value: receipt.value === '0x' ? '0x0' : receipt.value, + to: receipt.to ? receipt.to : null + } + } + }) const b = { baseFeePerGas: '0x01', number: this.toHex(block.header.number), @@ -55,7 +80,7 @@ export class Blocks { gasLimit: this.toHex(block.header.gasLimit), gasUsed: this.toHex(block.header.gasUsed), timestamp: this.toHex(block.header.timestamp), - transactions: block.transactions.map((t) => '0x' + t.hash().toString('hex')), + transactions, uncles: [] } cb(null, b) @@ -70,6 +95,28 @@ export class Blocks { eth_getBlockByHash (payload, cb) { const block = this.vmContext.blocks[payload.params[0]] + console.log(block.transactions) + const transactions = block.transactions.map((t) => { + const hash = '0x' + t.hash().toString('hex') + const tx = this.vmContext.txByHash[hash] + const receipt = this.vmContext.currentVm.web3vm.txsReceipt[hash] + if (receipt) { + return { + blockHash: '0x' + block.hash().toString('hex'), + blockNumber: '0x' + block.header.number.toString('hex'), + from: receipt.from, + gas: Web3.utils.toHex(receipt.gas), + chainId: '0xd05', + gasPrice: '0x4a817c800', // 20000000000 + hash: receipt.transactionHash, + input: receipt.input, + nonce: '0x' + tx.nonce.toString('hex'), + transactionIndex: this.TX_INDEX, + value: receipt.value === '0x' ? '0x0' : receipt.value, + to: receipt.to ? receipt.to : null + } + } + }) const b = { baseFeePerGas: '0x01', number: this.toHex(block.header.number), @@ -88,7 +135,7 @@ export class Blocks { gasLimit: this.toHex(block.header.gasLimit), gasUsed: this.toHex(block.header.gasUsed), timestamp: this.toHex(block.header.timestamp), - transactions: block.transactions.map((t) => '0x' + t.hash().toString('hex')), + transactions, uncles: [] } From 9f819395d3b7836ee26669ce99b0aa6c3076f89b Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 8 Mar 2022 19:48:25 +0100 Subject: [PATCH 11/35] update label --- libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx index 2da3df49d3..f8eae05bb5 100644 --- a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx +++ b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx @@ -462,7 +462,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { title="If checked Remix will listen on all transactions mined in the current environment and not only transactions created by you" htmlFor="listenNetworkCheck" > - listen on network + listen on all transactions

From b2f18795b5d05188960793b1a7da591a5a523e54 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 8 Mar 2022 20:21:11 +0100 Subject: [PATCH 12/35] listen on artefactsUpdated instead --- .../app/tabs/intelligent-script-executor.js | 26 +++++++++---------- .../src/lib/compiler-metadata.ts | 2 +- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/intelligent-script-executor.js b/apps/remix-ide/src/app/tabs/intelligent-script-executor.js index 08bca2bbc1..a6736c8b1c 100644 --- a/apps/remix-ide/src/app/tabs/intelligent-script-executor.js +++ b/apps/remix-ide/src/app/tabs/intelligent-script-executor.js @@ -16,20 +16,18 @@ export class IntelligentScriptExecutor extends Plugin { } onActivation () { - this.on('solidity', 'compilationFinished', async (file, source, languageVersion, data, input, version) => { - const currentFile = await this.call('fileManager', 'file') - if (data && data.sources[currentFile] && - data.sources[currentFile].ast && data.sources[currentFile].ast.nodes && data.sources[currentFile].ast.nodes.length) { - const nodes = data.sources[currentFile].ast.nodes - for (let node of nodes) { - if (node.documentation && node.documentation.text && node.documentation.text.startsWith('@custom:dev-run-script')) { - const text = node.documentation.text.replace('@custom:dev-run-script', '').trim() - await this.call('terminal', 'log', `running ${text} ...`) - const content = await this.call('fileManager', 'readFile', text) - await this.call('udapp', 'clearAllInstances') - await this.call('scriptRunner', 'execute', content) - } - } + let listen = false + setTimeout(() => { + listen = true + }, 500) + this.on('compilerMetadata', 'artefactsUpdated', async (fileName, contract) => { + if (!listen) return + if (contract.object && contract.object.devdoc['custom:dev-run-script']) { + const text = contract.object.devdoc['custom:dev-run-script'] + await this.call('terminal', 'log', `running ${text} ...`) + const content = await this.call('fileManager', 'readFile', text) + await this.call('udapp', 'clearAllInstances') + await this.call('scriptRunner', 'execute', content) } }) } diff --git a/libs/remix-core-plugin/src/lib/compiler-metadata.ts b/libs/remix-core-plugin/src/lib/compiler-metadata.ts index 07f1996f90..2f065e769f 100644 --- a/libs/remix-core-plugin/src/lib/compiler-metadata.ts +++ b/libs/remix-core-plugin/src/lib/compiler-metadata.ts @@ -42,7 +42,6 @@ export class CompilerMetadata extends Plugin { await this._setArtefacts(content, contract, path) })() }) - this.emit('artefactsUpdated') }) } @@ -105,6 +104,7 @@ export class CompilerMetadata extends Plugin { abi: contract.object.abi } await this.call('fileManager', 'writeFile', fileName, JSON.stringify(data, null, '\t')) + this.emit('artefactsUpdated', fileName, contract) } _syncContext (contract, metadata) { From 61be7603b42a94fd6849c78ec039406b6c2b2e66 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 8 Mar 2022 20:21:26 +0100 Subject: [PATCH 13/35] fix listening on new block --- libs/remix-lib/src/execution/txListener.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/remix-lib/src/execution/txListener.ts b/libs/remix-lib/src/execution/txListener.ts index 533a501d3b..0e8874173c 100644 --- a/libs/remix-lib/src/execution/txListener.ts +++ b/libs/remix-lib/src/execution/txListener.ts @@ -133,7 +133,7 @@ export class TxListener { */ init () { this.blocks = [] - this.lastBlock = null + this.lastBlock = -1 } /** @@ -170,8 +170,7 @@ export class TxListener { this.executionContext.web3().eth.getBlockNumber((error, blockNumber) => { if (this._loopId === null) return if (error) return console.log(error) - if (currentLoopId === this._loopId && (!this.lastBlock || blockNumber > this.lastBlock)) { - if (!this.lastBlock) this.lastBlock = blockNumber - 1 + if (currentLoopId === this._loopId && blockNumber > this.lastBlock) { let current = this.lastBlock + 1 this.lastBlock = blockNumber while (blockNumber >= current) { From 2cefa0deaf3ef38598f078ce8af441aedb88534c Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 8 Mar 2022 20:43:36 +0100 Subject: [PATCH 14/35] fix listen on web3: VM is now considered as a web3 network --- libs/remix-lib/src/execution/txListener.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-lib/src/execution/txListener.ts b/libs/remix-lib/src/execution/txListener.ts index 0e8874173c..0d5b26eb84 100644 --- a/libs/remix-lib/src/execution/txListener.ts +++ b/libs/remix-lib/src/execution/txListener.ts @@ -60,7 +60,7 @@ export class TxListener { // in VM mode // in web3 mode && listen remix txs only if (!this._isListening) return // we don't listen - if (this._loopId && this.executionContext.getProvider() !== 'vm') return // we seems to already listen on a "web3" network + if (this._loopId) return // we seems to already listen on a "web3" network let returnValue let execResult @@ -95,7 +95,7 @@ export class TxListener { // in VM mode // in web3 mode && listen remix txs only if (!this._isListening) return // we don't listen - if (this._loopId && this.executionContext.getProvider() !== 'vm') return // we seems to already listen on a "web3" network + if (this._loopId) return // we seems to already listen on a "web3" network this.executionContext.web3().eth.getTransaction(txResult.transactionHash, async (error, tx) => { if (error) return console.log(error) From d6544e6386a5005f222b44c398093a10ddaf4281 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 17 Mar 2022 12:13:28 +0100 Subject: [PATCH 15/35] improve script executor --- .../app/tabs/intelligent-script-executor.js | 38 ------------ .../app/tabs/intelligent-script-executor.ts | 60 +++++++++++++++++++ 2 files changed, 60 insertions(+), 38 deletions(-) delete mode 100644 apps/remix-ide/src/app/tabs/intelligent-script-executor.js create mode 100644 apps/remix-ide/src/app/tabs/intelligent-script-executor.ts diff --git a/apps/remix-ide/src/app/tabs/intelligent-script-executor.js b/apps/remix-ide/src/app/tabs/intelligent-script-executor.js deleted file mode 100644 index a6736c8b1c..0000000000 --- a/apps/remix-ide/src/app/tabs/intelligent-script-executor.js +++ /dev/null @@ -1,38 +0,0 @@ -import { Plugin } from '@remixproject/engine' -import * as packageJson from '../../../../../package.json' - -export const profile = { - name: 'intelligentScriptExecutor', - displayName: 'Intelligent Script Executor', - description: 'after each compilation, run the script defined in Natspec.', - methods: [], - version: packageJson.version, - kind: 'none' -} - -export class IntelligentScriptExecutor extends Plugin { - constructor () { - super(profile) - } - - onActivation () { - let listen = false - setTimeout(() => { - listen = true - }, 500) - this.on('compilerMetadata', 'artefactsUpdated', async (fileName, contract) => { - if (!listen) return - if (contract.object && contract.object.devdoc['custom:dev-run-script']) { - const text = contract.object.devdoc['custom:dev-run-script'] - await this.call('terminal', 'log', `running ${text} ...`) - const content = await this.call('fileManager', 'readFile', text) - await this.call('udapp', 'clearAllInstances') - await this.call('scriptRunner', 'execute', content) - } - }) - } - - onDeactivation () { - this.off('solidity', 'compilationFinished') - } -} diff --git a/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts b/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts new file mode 100644 index 0000000000..c524b36137 --- /dev/null +++ b/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts @@ -0,0 +1,60 @@ +import { Plugin } from '@remixproject/engine' +import * as packageJson from '../../../../../package.json' + +export const profile = { + name: 'intelligentScriptExecutor', + displayName: 'Intelligent Script Executor', + description: 'after each compilation, run the script defined in Natspec.', + methods: [], + version: packageJson.version, + kind: 'none' +} + +type listener = (event: KeyboardEvent) => void + +export class IntelligentScriptExecutor extends Plugin { + executionListener: listener + targetFileName: string + + constructor () { + super(profile) + this.executionListener = async (e) => { + // ctrl+e or command+e + const file = await this.call('fileManager', 'file') + if ((e.metaKey || e.ctrlKey) && e.keyCode === 69 && file !== '') { + if (file.endsWith('.sol')) { + e.preventDefault() + this.targetFileName = file + await this.call('solidity', 'compile', file) + } else if (file.endsWith('.js')) { + e.preventDefault() + this.runScript(file) + } + } + } + } + + async runScript (fileName) { + await this.call('terminal', 'log', `running ${fileName} ...`) + const content = await this.call('fileManager', 'readFile', fileName) + await this.call('udapp', 'clearAllInstances') + await this.call('scriptRunner', 'execute', content) + } + + onActivation () { + window.document.addEventListener('keydown', this.executionListener) + + this.on('compilerMetadata', 'artefactsUpdated', async (fileName, contract) => { + if (this.targetFileName === contract.file && contract.object && contract.object.devdoc['custom:dev-run-script']) { + const file = contract.object.devdoc['custom:dev-run-script'] + if (file) this.runScript(file) + } + this.targetFileName = null + }) + } + + onDeactivation () { + window.document.removeEventListener('keydown', this.executionListener) + this.off('compilerMetadata', 'artefactsUpdated') + } +} From 2a1ea1c8375dc588b57a2119d61ae8bd62576165 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 18 Mar 2022 00:55:04 +0100 Subject: [PATCH 16/35] fix gasEstimate --- .../src/methods/transactions.ts | 26 +- package-lock.json | 279 +++++++++++------- package.json | 8 +- 3 files changed, 196 insertions(+), 117 deletions(-) diff --git a/libs/remix-simulator/src/methods/transactions.ts b/libs/remix-simulator/src/methods/transactions.ts index 93b6850812..32ef9d8a64 100644 --- a/libs/remix-simulator/src/methods/transactions.ts +++ b/libs/remix-simulator/src/methods/transactions.ts @@ -2,6 +2,7 @@ import Web3 from 'web3' import { toChecksumAddress, BN, Address } from 'ethereumjs-util' import { processTx } from './txProcess' import { execution } from '@remix-project/remix-lib' +import { ethers } from 'ethers' const TxRunnerVM = execution.TxRunnerVM const TxRunner = execution.TxRunner @@ -122,7 +123,30 @@ export class Transactions { } eth_estimateGas (payload, cb) { - cb(null, 10000000 * 8) + // from might be lowercased address (web3) + if (payload.params && payload.params.length > 0 && payload.params[0].from) { + payload.params[0].from = toChecksumAddress(payload.params[0].from) + } + if (payload.params && payload.params.length > 0 && payload.params[0].to) { + payload.params[0].to = toChecksumAddress(payload.params[0].to) + } + + payload.params[0].gas = 10000000 * 10 + + processTx(this.txRunnerInstance, payload, true, (error, result) => { + if (error) return cb(error) + if (result.result.status === '0x0') { + try { + const msg = result.result.execResult.returnValue + const abiCoder = new ethers.utils.AbiCoder() + const reason = abiCoder.decode(['string'], msg.slice(4))[0] + return cb('revert ' + reason) + } catch (e) { + return cb(e.message) + } + } + cb(null, result.result.execResult.gasUsed.toNumber()) + }) } eth_getCode (payload, cb) { diff --git a/package-lock.json b/package-lock.json index 0d31f1b3ea..20f8f215d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2813,20 +2813,34 @@ } }, "@ethereumjs/block": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/block/-/block-3.6.0.tgz", - "integrity": "sha512-dqLo1LtsLG+Oelu5S5tWUDG0pah3QUwV5TJZy2cm19BXDr4ka/S9XBSgao0i09gTcuPlovlHgcs6d7EZ37urjQ==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@ethereumjs/block/-/block-3.6.1.tgz", + "integrity": "sha512-o5d/zpGl4SdVfdTfrsq9ZgYMXddc0ucKMiFW5OphBCX+ep4xzYnSjboFcZXT2V/tcSBr84VrKWWp21CGVb3DGw==", "requires": { - "@ethereumjs/common": "^2.6.0", - "@ethereumjs/tx": "^3.4.0", - "ethereumjs-util": "^7.1.3", - "merkle-patricia-tree": "^4.2.2" + "@ethereumjs/common": "^2.6.1", + "@ethereumjs/tx": "^3.5.0", + "ethereumjs-util": "^7.1.4", + "merkle-patricia-tree": "^4.2.3" + }, + "dependencies": { + "ethereumjs-util": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.4.tgz", + "integrity": "sha512-p6KmuPCX4mZIqsQzXfmSx9Y0l2hqf+VkAiwSisW3UKUFdk8ZkAt+AYaor83z2nSi6CU2zSsXMlD80hAbNEGM0A==", + "requires": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "rlp": "^2.2.4" + } + } } }, "@ethereumjs/blockchain": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/blockchain/-/blockchain-5.5.0.tgz", - "integrity": "sha512-879YVmWbM8OUKLVj+OuEZ+sZFkQOnXYGeak5oi7O1hOjaRv//je+fK2axGP04cbttu7sPCp41zy7O6xw4cut8A==", + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethereumjs/blockchain/-/blockchain-5.5.1.tgz", + "integrity": "sha512-JS2jeKxl3tlaa5oXrZ8mGoVBCz6YqsGG350XVNtHAtNZXKk7pU3rH4xzF2ru42fksMMqzFLzKh9l4EQzmNWDqA==", "requires": { "@ethereumjs/block": "^3.6.0", "@ethereumjs/common": "^2.6.0", @@ -2854,12 +2868,26 @@ } }, "@ethereumjs/common": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.6.0.tgz", - "integrity": "sha512-Cq2qS0FTu6O2VU1sgg+WyU9Ps0M6j/BEMHN+hRaECXCV/r0aI78u4N6p52QW/BDVhwWZpCdrvG8X7NJdzlpNUA==", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.6.2.tgz", + "integrity": "sha512-vDwye5v0SVeuDky4MtKsu+ogkH2oFUV8pBKzH/eNBzT8oI91pKa8WyzDuYuxOQsgNgv5R34LfFDh2aaw3H4HbQ==", "requires": { "crc-32": "^1.2.0", - "ethereumjs-util": "^7.1.3" + "ethereumjs-util": "^7.1.4" + }, + "dependencies": { + "ethereumjs-util": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.4.tgz", + "integrity": "sha512-p6KmuPCX4mZIqsQzXfmSx9Y0l2hqf+VkAiwSisW3UKUFdk8ZkAt+AYaor83z2nSi6CU2zSsXMlD80hAbNEGM0A==", + "requires": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "rlp": "^2.2.4" + } + } } }, "@ethereumjs/ethash": { @@ -2885,45 +2913,66 @@ } }, "@ethereumjs/tx": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.4.0.tgz", - "integrity": "sha512-WWUwg1PdjHKZZxPPo274ZuPsJCWV3SqATrEKQP1n2DrVYVP1aZIYpo/mFaA0BDoE0tIQmBeimRCEA0Lgil+yYw==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.5.0.tgz", + "integrity": "sha512-/+ZNbnJhQhXC83Xuvy6I9k4jT5sXiV0tMR9C+AzSSpcCV64+NB8dTE1m3x98RYMqb8+TLYWA+HML4F5lfXTlJw==", "requires": { - "@ethereumjs/common": "^2.6.0", - "ethereumjs-util": "^7.1.3" + "@ethereumjs/common": "^2.6.1", + "ethereumjs-util": "^7.1.4" + }, + "dependencies": { + "ethereumjs-util": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.4.tgz", + "integrity": "sha512-p6KmuPCX4mZIqsQzXfmSx9Y0l2hqf+VkAiwSisW3UKUFdk8ZkAt+AYaor83z2nSi6CU2zSsXMlD80hAbNEGM0A==", + "requires": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "rlp": "^2.2.4" + } + } } }, "@ethereumjs/vm": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/vm/-/vm-5.6.0.tgz", - "integrity": "sha512-J2m/OgjjiGdWF2P9bj/4LnZQ1zRoZhY8mRNVw/N3tXliGI8ai1sI1mlDPkLpeUUM4vq54gH6n0ZlSpz8U/qlYQ==", + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethereumjs/vm/-/vm-5.7.1.tgz", + "integrity": "sha512-NiFm5FMaeDGZ9ojBL+Y9Y/xhW6S4Fgez+zPBM402T5kLsfeAR9mrRVckYhvkGVJ6FMwsY820CLjYP5OVwMjLTg==", "requires": { - "@ethereumjs/block": "^3.6.0", - "@ethereumjs/blockchain": "^5.5.0", - "@ethereumjs/common": "^2.6.0", - "@ethereumjs/tx": "^3.4.0", + "@ethereumjs/block": "^3.6.1", + "@ethereumjs/blockchain": "^5.5.1", + "@ethereumjs/common": "^2.6.2", + "@ethereumjs/tx": "^3.5.0", "async-eventemitter": "^0.2.4", "core-js-pure": "^3.0.1", - "debug": "^2.2.0", - "ethereumjs-util": "^7.1.3", + "debug": "^4.3.3", + "ethereumjs-util": "^7.1.4", "functional-red-black-tree": "^1.0.1", "mcl-wasm": "^0.7.1", - "merkle-patricia-tree": "^4.2.2", + "merkle-patricia-tree": "^4.2.3", "rustbn.js": "~0.2.0" }, "dependencies": { "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "requires": { - "ms": "2.0.0" + "ms": "2.1.2" } }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "ethereumjs-util": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.4.tgz", + "integrity": "sha512-p6KmuPCX4mZIqsQzXfmSx9Y0l2hqf+VkAiwSisW3UKUFdk8ZkAt+AYaor83z2nSi6CU2zSsXMlD80hAbNEGM0A==", + "requires": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "rlp": "^2.2.4" + } } } }, @@ -10507,9 +10556,9 @@ "dev": true }, "@types/abstract-leveldown": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@types/abstract-leveldown/-/abstract-leveldown-5.0.2.tgz", - "integrity": "sha512-+jA1XXF3jsz+Z7FcuiNqgK53hTa/luglT2TyTpKPqoYbxVY+mCPF22Rm+q3KPBrMHJwNXFrTViHszBOfU4vftQ==" + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", + "integrity": "sha512-q5veSX6zjUy/DlDhR4Y4cU0k2Ar+DT2LUraP00T19WLmTO6Se1djepCCaqU6nQrwcJ5Hyo/CWqxTzrrFg8eqbQ==" }, "@types/aria-query": { "version": "4.2.2", @@ -10837,13 +10886,6 @@ "@types/abstract-leveldown": "*", "@types/level-errors": "*", "@types/node": "*" - }, - "dependencies": { - "@types/node": { - "version": "16.10.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.3.tgz", - "integrity": "sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ==" - } } }, "@types/lodash": { @@ -16223,9 +16265,9 @@ } }, "core-js-pure": { - "version": "3.18.2", - "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.18.2.tgz", - "integrity": "sha512-4hMMLUlZhKJKOWbbGD1/VDUxGPEhEoN/T01k7bx271WiBKCvCfkgPzy0IeRS4PB50p6/N1q/SZL4B/TRsTE5bA==" + "version": "3.21.1", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.21.1.tgz", + "integrity": "sha512-12VZfFIu+wyVbBebyHmRTuEE/tZrB4tJToWcwAMcsp3h4+sHR+fMJWbKpYiCRWlhFBq+KNyO8rIV9rTkeVmznQ==" }, "core-util-is": { "version": "1.0.3", @@ -30503,17 +30545,30 @@ "dev": true }, "merkle-patricia-tree": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/merkle-patricia-tree/-/merkle-patricia-tree-4.2.2.tgz", - "integrity": "sha512-eqZYNTshcYx9aESkSPr71EqwsR/QmpnObDEV4iLxkt/x/IoLYZYjJvKY72voP/27Vy61iMOrfOG6jrn7ttXD+Q==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/merkle-patricia-tree/-/merkle-patricia-tree-4.2.3.tgz", + "integrity": "sha512-S4xevdXl5KvdBGgUxhQcxoep0onqXiIhzfwZp4M78kIuJH3Pu9o9IUgqhzSFOR2ykLO6t265026Xb6PY0q2UFQ==", "requires": { "@types/levelup": "^4.3.0", - "ethereumjs-util": "^7.1.2", + "ethereumjs-util": "^7.1.4", "level-mem": "^5.0.1", "level-ws": "^2.0.0", "readable-stream": "^3.6.0", - "rlp": "^2.2.4", "semaphore-async-await": "^1.5.1" + }, + "dependencies": { + "ethereumjs-util": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.4.tgz", + "integrity": "sha512-p6KmuPCX4mZIqsQzXfmSx9Y0l2hqf+VkAiwSisW3UKUFdk8ZkAt+AYaor83z2nSi6CU2zSsXMlD80hAbNEGM0A==", + "requires": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "rlp": "^2.2.4" + } + } } }, "methods": { @@ -35695,7 +35750,7 @@ }, "cross-spawn": { "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "resolved": false, "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true, "requires": { @@ -35712,7 +35767,7 @@ }, "execa": { "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "resolved": false, "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true, "requires": { @@ -35742,19 +35797,19 @@ }, "get-stream": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "resolved": false, "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, "invert-kv": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "resolved": false, "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "dev": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "resolved": false, "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { @@ -35763,7 +35818,7 @@ }, "is-stream": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "resolved": false, "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, @@ -35775,7 +35830,7 @@ }, "lcid": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "resolved": false, "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true, "requires": { @@ -35794,7 +35849,7 @@ }, "lru-cache": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "resolved": false, "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", "dev": true, "requires": { @@ -35804,7 +35859,7 @@ }, "mem": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "resolved": false, "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", "dev": true, "requires": { @@ -35813,13 +35868,13 @@ }, "mimic-fn": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", + "resolved": false, "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", "dev": true }, "minimist": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": false, "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, @@ -35849,7 +35904,7 @@ }, "os-locale": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "resolved": false, "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "dev": true, "requires": { @@ -35938,7 +35993,7 @@ }, "string-width": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "resolved": false, "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { @@ -35989,19 +36044,19 @@ }, "y18n": { "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "resolved": false, "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", "dev": true }, "yallist": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "resolved": false, "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true }, "yargs": { "version": "10.0.3", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.0.3.tgz", + "resolved": false, "integrity": "sha512-DqBpQ8NAUX4GyPP/ijDGHsJya4tYqLQrjPr95HNsr1YwL3+daCfvBwg7+gIC6IdJhR2kATh3hb61vjzMWEtjdw==", "dev": true, "requires": { @@ -36021,13 +36076,13 @@ "dependencies": { "ansi-regex": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "resolved": false, "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, "cliui": { "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "resolved": false, "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "dev": true, "requires": { @@ -36038,7 +36093,7 @@ "dependencies": { "string-width": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "resolved": false, "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { @@ -36051,7 +36106,7 @@ }, "string-width": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "resolved": false, "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { @@ -36061,13 +36116,13 @@ "dependencies": { "is-fullwidth-code-point": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "resolved": false, "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "strip-ansi": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "resolved": false, "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { @@ -36080,7 +36135,7 @@ }, "yargs-parser": { "version": "8.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.0.0.tgz", + "resolved": false, "integrity": "sha1-IdR2Mw5agieaS4gTRb8GYQLiGcY=", "dev": true, "requires": { @@ -36089,7 +36144,7 @@ "dependencies": { "camelcase": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "resolved": false, "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true } @@ -36360,7 +36415,7 @@ "dependencies": { "ansi-regex": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "resolved": false, "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, @@ -36472,7 +36527,7 @@ }, "cross-spawn": { "version": "4.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", + "resolved": false, "integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=", "dev": true, "requires": { @@ -36482,7 +36537,7 @@ }, "debug": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "resolved": false, "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "dev": true, "requires": { @@ -36571,7 +36626,7 @@ }, "find-up": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "resolved": false, "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "dev": true, "requires": { @@ -36668,7 +36723,7 @@ }, "inherits": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "resolved": false, "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, @@ -36692,7 +36747,7 @@ }, "is-stream": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "resolved": false, "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, @@ -36704,7 +36759,7 @@ }, "istanbul-lib-coverage": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", + "resolved": false, "integrity": "sha512-dKWuzRGCs4G+67VfW9pBFFz2Jpi4vSp/k7zBcJ888ofV5Mi1g5CUML5GvMvV6u9Cjybftu+E8Cgp+k0dI1E5lw==", "dev": true }, @@ -36748,7 +36803,7 @@ }, "istanbul-lib-report": { "version": "2.0.4", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-2.0.4.tgz", + "resolved": false, "integrity": "sha512-sOiLZLAWpA0+3b5w5/dq0cjm2rrNdAfHWaGhmn7XEFW6X++IV9Ohn+pnELAl9K3rfpaeBfbmH9JU5sejacdLeA==", "dev": true, "requires": { @@ -36759,7 +36814,7 @@ "dependencies": { "supports-color": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "resolved": false, "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", "dev": true, "requires": { @@ -36770,7 +36825,7 @@ }, "istanbul-lib-source-maps": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.2.tgz", + "resolved": false, "integrity": "sha512-JX4v0CiKTGp9fZPmoxpu9YEkPbEqCqBbO3403VabKjH+NRXo72HafD5UgnjTEqHL2SAjaZK1XDuDOkn6I5QVfQ==", "dev": true, "requires": { @@ -36783,7 +36838,7 @@ "dependencies": { "source-map": { "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "resolved": false, "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true } @@ -36791,7 +36846,7 @@ }, "istanbul-reports": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.1.1.tgz", + "resolved": false, "integrity": "sha512-FzNahnidyEPBCI0HcufJoSEoKykesRlFcSzQqjH9x0+LC8tnnE/p/90PBLu8iZTxr8yYZNyTtiAujUqyN+CIxw==", "dev": true, "requires": { @@ -36827,7 +36882,7 @@ }, "locate-path": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "resolved": false, "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "dev": true, "requires": { @@ -36843,7 +36898,7 @@ }, "lru-cache": { "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "resolved": false, "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", "dev": true, "requires": { @@ -36853,7 +36908,7 @@ }, "make-dir": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "resolved": false, "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", "dev": true, "requires": { @@ -36882,7 +36937,7 @@ }, "merge-source-map": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.1.0.tgz", + "resolved": false, "integrity": "sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==", "dev": true, "requires": { @@ -36891,7 +36946,7 @@ "dependencies": { "source-map": { "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "resolved": false, "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true } @@ -36899,7 +36954,7 @@ }, "mimic-fn": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "resolved": false, "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", "dev": true }, @@ -36914,7 +36969,7 @@ }, "minimist": { "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "resolved": false, "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=" }, "mkdirp": { @@ -37028,7 +37083,7 @@ }, "p-limit": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.1.0.tgz", + "resolved": false, "integrity": "sha512-NhURkNcrVB+8hNfLuysU8enY5xn2KXphsHBaC2YmRNTZRc7RWusw6apSpdEj3jo4CMb6W9nrF6tTnsJsJeyu6g==", "dev": true, "requires": { @@ -37037,7 +37092,7 @@ }, "p-locate": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "resolved": false, "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", "dev": true, "requires": { @@ -37046,7 +37101,7 @@ }, "p-try": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", + "resolved": false, "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", "dev": true }, @@ -37132,7 +37187,7 @@ }, "read-pkg": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "resolved": false, "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", "dev": true, "requires": { @@ -37143,7 +37198,7 @@ }, "read-pkg-up": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz", + "resolved": false, "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==", "dev": true, "requires": { @@ -37174,7 +37229,7 @@ }, "resolve": { "version": "1.10.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz", + "resolved": false, "integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==", "dev": true, "requires": { @@ -37183,7 +37238,7 @@ }, "resolve-from": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "resolved": false, "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, @@ -37198,13 +37253,13 @@ }, "safe-buffer": { "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "resolved": false, "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, "semver": { "version": "5.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "resolved": false, "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", "dev": true }, @@ -37293,7 +37348,7 @@ }, "strip-ansi": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "resolved": false, "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { @@ -37314,7 +37369,7 @@ }, "test-exclude": { "version": "5.1.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.1.0.tgz", + "resolved": false, "integrity": "sha512-gwf0S2fFsANC55fSeSqpb8BYk6w3FDvwZxfNjeF6FRgvFa43r+7wRiA/Q0IxoRU37wB/LE8IQ4221BsNucTaCA==", "dev": true, "requires": { @@ -37326,7 +37381,7 @@ }, "uglify-js": { "version": "3.4.9", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz", + "resolved": false, "integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==", "requires": { "commander": "~2.17.1", @@ -37431,7 +37486,7 @@ }, "write-file-atomic": { "version": "2.4.2", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.2.tgz", + "resolved": false, "integrity": "sha512-s0b6vB3xIVRLWywa6X9TOMA7k9zio0TMOsl9ZnDkliA/cfJlpHXAscj0gbHVJiTdIuAYpIyqS5GW91fqm6gG5g==", "dev": true, "requires": { @@ -37448,7 +37503,7 @@ }, "yallist": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "resolved": false, "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true }, diff --git a/package.json b/package.json index 16d9ea14b8..ed9d0c5dcb 100644 --- a/package.json +++ b/package.json @@ -145,10 +145,10 @@ "dependencies": { "@babel/plugin-proposal-class-properties": "^7.16.0", "@erebos/bzz-node": "^0.13.0", - "@ethereumjs/block": "^3.5.1", - "@ethereumjs/common": "^2.5.0", - "@ethereumjs/tx": "^3.3.2", - "@ethereumjs/vm": "^5.5.3", + "@ethereumjs/block": "^3.6.1", + "@ethereumjs/common": "^2.6.2", + "@ethereumjs/tx": "^3.5.0", + "@ethereumjs/vm": "^5.7.1", "@ethersphere/bee-js": "^3.2.0", "@isomorphic-git/lightning-fs": "^4.4.1", "@monaco-editor/react": "^4.3.1", From c3a67e49f9d2b6410ca8685998e7b06fe83edf60 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 23 Mar 2022 12:06:18 +0100 Subject: [PATCH 17/35] add e2e --- apps/remix-ide-e2e/src/tests/terminal.test.ts | 121 +++++++++++++++++- apps/remix-ide/src/app.js | 2 +- 2 files changed, 121 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 0f90f84199..386aa6ade6 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -190,7 +190,16 @@ module.exports = { .waitForElementVisible('*[data-id="terminalCli"]') .click('*[data-id="terminalCli"]') .sendKeys('*[data-id="terminalCliInput"]', 'remix.') - .assert.visible('*[data-id="autoCompletePopUpAutoCompleteItem"]').end() + .assert.visible('*[data-id="autoCompletePopUpAutoCompleteItem"]') + }, + + 'Should run a script right after compilation #group5': function (browser: NightwatchBrowser) { + browser + .addFile('storage.sol', { content: scriptAutoExec.contract } ) + .addFile('autoExec.js', { content: scriptAutoExec.script } ) + .openFile('storage.sol') + .sendKeys('body', [browser.Keys.CONTROL, 'e']) + .journalChildIncludes('147', { shouldHaveOnlyOneOccurence: true }) } } @@ -484,3 +493,113 @@ contract OwnerTest { return owner; } }` + +const scriptAutoExec = { + contract: ` + +// SPDX-License-Identifier: GPL-3.0 + +pragma solidity >=0.7.0 <0.9.0; + +library lib { + function test () public view returns (uint) { + return 147; + } +} +/** + * @title Storage + * @dev Store & retrieve value inr a variable + */ +contract Storage { + + uint256 number; + + /** + * @dev Store valrue in variable + * @param num value to store + */ + function store(uint256 num) public { + number = num; + } + + /** + * @dev Return value + * @return value of 'number' + */ + function retrieve() public view returns (uint256){ + return number; + } + + function getFromLib() public view returns (uint) { + return lib.test(); + } +}`, + script: ` + // Right click on the script name and hit "Run" to execute +const { expect } = require("chai"); +const { ethers } = require("hardhat"); + +(async () => { + try { + // function getContractFactoryFromArtifact(artifact: Artifact, signer?: ethers.Signer): Promise; + + // function getContractFactoryFromArtifact(artifact: Artifact, factoryOptions: FactoryOptions): Promise; + + const metadataLib = JSON.parse(await remix.call('fileManager', 'readFile', 'contracts/artifacts/lib.json')) + console.log('deploying lib:') + + const artifactLib = { + contractName: 'Lib', + sourceName: 'contracts/1_Storage.sol', + abi: metadataLib.abi, + bytecode: '0x' + metadataLib.data.bytecode.object, + deployedBytecode: '0x' + metadataLib.data.deployedBytecode.object, + linkReferences: metadataLib.data.bytecode.linkReferences, + deployedLinkReferences: metadataLib.data.deployedBytecode.linkReferences, + } + const optionsLib = {} + + const factoryLib = await ethers.getContractFactoryFromArtifact(artifactLib, optionsLib) + + const lib = await factoryLib.deploy(); + + await lib.deployed() + + console.log('lib deployed', lib.address) + + const metadata = JSON.parse(await remix.call('fileManager', 'readFile', 'contracts/artifacts/Storage.json')) + const artifact = { + contractName: 'Storage', + sourceName: 'contracts/1_Storage.sol', + abi: metadata.abi, + bytecode: '0x' + metadata.data.bytecode.object, + deployedBytecode: '0x' + metadata.data.deployedBytecode.object, + linkReferences: metadata.data.bytecode.linkReferences, + deployedLinkReferences: metadata.data.deployedBytecode.linkReferences, + } + const options = { + libraries: { + 'lib': lib.address + } + } + + const factory = await ethers.getContractFactoryFromArtifact(artifact, options) + + const storage = await factory.deploy(); + + await storage.deployed() + + const storeValue = await storage.store(333); + + // wait until the transaction is mined + await storeValue.wait(); + + console.log((await storage.getFromLib()).toString()) + // expect((await storage.getFromLib()).toString()).to.equal('34'); + + } catch (e) { + console.error(e.message) + } + })() + ` +} \ No newline at end of file diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index 6927f20c4b..a2ccbfd16b 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -346,7 +346,7 @@ class AppComponent { await this.appManager.activatePlugin(['settings', 'config']) await this.appManager.activatePlugin(['hiddenPanel', 'pluginManager', 'contextualListener', 'terminal', 'blockchain', 'fetchAndCompile', 'contentImport', 'gistHandler']) await this.appManager.activatePlugin(['settings']) - await this.appManager.activatePlugin(['walkthrough','storage']) + await this.appManager.activatePlugin(['walkthrough','storage', 'intelligentScriptExecutor']) this.appManager.on( 'filePanel', From 0b6edbf074ed47c161a5fef47b0228613b36c49f Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 23 Mar 2022 12:27:58 +0100 Subject: [PATCH 18/35] fix linting --- libs/remix-core-plugin/src/lib/compiler-artefacts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts index 24b0a6bee6..dc44695680 100644 --- a/libs/remix-core-plugin/src/lib/compiler-artefacts.ts +++ b/libs/remix-core-plugin/src/lib/compiler-artefacts.ts @@ -200,7 +200,7 @@ export class CompilerArtefacts extends Plugin { const code = await this.call('blockchain', 'getCode', address) let found this.filterAllContractDatas((file, contractsData) => { - for (let name of Object.keys(contractsData)) { + for (const name of Object.keys(contractsData)) { const contract = contractsData[name] if (util.compareByteCode(code, '0x' + contract.evm.deployedBytecode.object)) { found = { name, contract } From a78d53c35fcd55abdd10266c36958203cf2d5fb9 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 23 Mar 2022 12:36:50 +0100 Subject: [PATCH 19/35] fix e2e --- apps/remix-ide-e2e/src/tests/plugin_api.ts | 2 +- apps/remix-ide-e2e/src/tests/terminal.test.ts | 210 +++++++++--------- 2 files changed, 107 insertions(+), 105 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/plugin_api.ts b/apps/remix-ide-e2e/src/tests/plugin_api.ts index 1a8c9ab896..07fb7e033d 100644 --- a/apps/remix-ide-e2e/src/tests/plugin_api.ts +++ b/apps/remix-ide-e2e/src/tests/plugin_api.ts @@ -358,7 +358,7 @@ module.exports = { .scrollAndClick('[data-id="pluginManagerComponentActivateButtonhardhat-provider"]') .clickLaunchIcon('udapp') .click('*[data-id="Hardhat Provider"]') - .modalFooterOKClick('hardhatprovider') + .modalFooterOKClick('hardhat-provider') .waitForElementContainsText('*[data-id="settingsNetworkEnv"]', 'Custom') // e.g Custom (1337) network .clickLaunchIcon('localPlugin') .useXpath() diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 386aa6ade6..66ad8af3ea 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -196,7 +196,7 @@ module.exports = { 'Should run a script right after compilation #group5': function (browser: NightwatchBrowser) { browser .addFile('storage.sol', { content: scriptAutoExec.contract } ) - .addFile('autoExec.js', { content: scriptAutoExec.script } ) + .addFile('scripts/deploy_storage.js', { content: scriptAutoExec.script } ) .openFile('storage.sol') .sendKeys('body', [browser.Keys.CONTROL, 'e']) .journalChildIncludes('147', { shouldHaveOnlyOneOccurence: true }) @@ -495,111 +495,113 @@ contract OwnerTest { }` const scriptAutoExec = { - contract: ` - -// SPDX-License-Identifier: GPL-3.0 - -pragma solidity >=0.7.0 <0.9.0; - -library lib { - function test () public view returns (uint) { - return 147; - } -} -/** - * @title Storage - * @dev Store & retrieve value inr a variable - */ -contract Storage { - - uint256 number; + contract: `// SPDX-License-Identifier: GPL-3.0 - /** - * @dev Store valrue in variable - * @param num value to store - */ - function store(uint256 num) public { - number = num; - } - - /** - * @dev Return value - * @return value of 'number' - */ - function retrieve() public view returns (uint256){ - return number; - } - - function getFromLib() public view returns (uint) { - return lib.test(); - } -}`, + pragma solidity >=0.7.0 <0.9.0; + + library lib { + function test () public view returns (uint) { + + return 147; + } + } + + /** + * @title Storage + * @dev Store & retrieve value inr a variable + * @custom:dev-run-script ./scripts/deploy_storage.js + */ + contract Storage { + + uint256 number; + + /** + * @dev Store valrue in variable + * @param num value to store + */ + function store(uint256 num) public { + number = num; + } + + /** + * @dev Return value + * @return value of 'number' + */ + function retrieve() public view returns (uint256){ + return number; + } + + function getFromLib() public view returns (uint) { + return lib.test(); + } + } + `, script: ` // Right click on the script name and hit "Run" to execute -const { expect } = require("chai"); -const { ethers } = require("hardhat"); - -(async () => { - try { - // function getContractFactoryFromArtifact(artifact: Artifact, signer?: ethers.Signer): Promise; - - // function getContractFactoryFromArtifact(artifact: Artifact, factoryOptions: FactoryOptions): Promise; - - const metadataLib = JSON.parse(await remix.call('fileManager', 'readFile', 'contracts/artifacts/lib.json')) - console.log('deploying lib:') - - const artifactLib = { - contractName: 'Lib', - sourceName: 'contracts/1_Storage.sol', - abi: metadataLib.abi, - bytecode: '0x' + metadataLib.data.bytecode.object, - deployedBytecode: '0x' + metadataLib.data.deployedBytecode.object, - linkReferences: metadataLib.data.bytecode.linkReferences, - deployedLinkReferences: metadataLib.data.deployedBytecode.linkReferences, - } - const optionsLib = {} - - const factoryLib = await ethers.getContractFactoryFromArtifact(artifactLib, optionsLib) - - const lib = await factoryLib.deploy(); - - await lib.deployed() - - console.log('lib deployed', lib.address) - - const metadata = JSON.parse(await remix.call('fileManager', 'readFile', 'contracts/artifacts/Storage.json')) - const artifact = { - contractName: 'Storage', - sourceName: 'contracts/1_Storage.sol', - abi: metadata.abi, - bytecode: '0x' + metadata.data.bytecode.object, - deployedBytecode: '0x' + metadata.data.deployedBytecode.object, - linkReferences: metadata.data.bytecode.linkReferences, - deployedLinkReferences: metadata.data.deployedBytecode.linkReferences, - } - const options = { - libraries: { - 'lib': lib.address - } - } - - const factory = await ethers.getContractFactoryFromArtifact(artifact, options) - - const storage = await factory.deploy(); - - await storage.deployed() - - const storeValue = await storage.store(333); - - // wait until the transaction is mined - await storeValue.wait(); - - console.log((await storage.getFromLib()).toString()) - // expect((await storage.getFromLib()).toString()).to.equal('34'); - - } catch (e) { - console.error(e.message) - } - })() + const { expect } = require("chai"); + const { ethers } = require("hardhat"); + + (async () => { + try { + // function getContractFactoryFromArtifact(artifact: Artifact, signer?: ethers.Signer): Promise; + + // function getContractFactoryFromArtifact(artifact: Artifact, factoryOptions: FactoryOptions): Promise; + + const metadataLib = JSON.parse(await remix.call('fileManager', 'readFile', 'contracts/artifacts/lib.json')) + console.log('deploying lib:') + + const artifactLib = { + contractName: 'Lib', + sourceName: 'contracts/1_Storage.sol', + abi: metadataLib.abi, + bytecode: '0x' + metadataLib.data.bytecode.object, + deployedBytecode: '0x' + metadataLib.data.deployedBytecode.object, + linkReferences: metadataLib.data.bytecode.linkReferences, + deployedLinkReferences: metadataLib.data.deployedBytecode.linkReferences, + } + const optionsLib = {} + + const factoryLib = await ethers.getContractFactoryFromArtifact(artifactLib, optionsLib) + + const lib = await factoryLib.deploy(); + + await lib.deployed() + + console.log('lib deployed', lib.address) + + const metadata = JSON.parse(await remix.call('fileManager', 'readFile', 'contracts/artifacts/Storage.json')) + const artifact = { + contractName: 'Storage', + sourceName: 'contracts/1_Storage.sol', + abi: metadata.abi, + bytecode: '0x' + metadata.data.bytecode.object, + deployedBytecode: '0x' + metadata.data.deployedBytecode.object, + linkReferences: metadata.data.bytecode.linkReferences, + deployedLinkReferences: metadata.data.deployedBytecode.linkReferences, + } + const options = { + libraries: { + 'lib': lib.address + } + } + + const factory = await ethers.getContractFactoryFromArtifact(artifact, options) + + const storage = await factory.deploy(); + + await storage.deployed() + + const storeValue = await storage.store(333); + + // wait until the transaction is mined + await storeValue.wait(); + + console.log((await storage.getFromLib()).toString()) + // expect((await storage.getFromLib()).toString()).to.equal('34'); + + } catch (e) { + console.error(e.message) + } + })() ` } \ No newline at end of file From 358c75955ba79e7c57a5bbdcdd52e241fdaaa313 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 23 Mar 2022 14:33:54 +0100 Subject: [PATCH 20/35] fix e2e --- apps/remix-ide-e2e/src/tests/plugin_api.ts | 2 +- apps/remix-ide-e2e/src/tests/terminal.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/plugin_api.ts b/apps/remix-ide-e2e/src/tests/plugin_api.ts index 07fb7e033d..1a8c9ab896 100644 --- a/apps/remix-ide-e2e/src/tests/plugin_api.ts +++ b/apps/remix-ide-e2e/src/tests/plugin_api.ts @@ -358,7 +358,7 @@ module.exports = { .scrollAndClick('[data-id="pluginManagerComponentActivateButtonhardhat-provider"]') .clickLaunchIcon('udapp') .click('*[data-id="Hardhat Provider"]') - .modalFooterOKClick('hardhat-provider') + .modalFooterOKClick('hardhatprovider') .waitForElementContainsText('*[data-id="settingsNetworkEnv"]', 'Custom') // e.g Custom (1337) network .clickLaunchIcon('localPlugin') .useXpath() diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 66ad8af3ea..71c77f8043 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -193,13 +193,13 @@ module.exports = { .assert.visible('*[data-id="autoCompletePopUpAutoCompleteItem"]') }, - 'Should run a script right after compilation #group5': function (browser: NightwatchBrowser) { + 'Should run a script right after compilation #group6': function (browser: NightwatchBrowser) { browser .addFile('storage.sol', { content: scriptAutoExec.contract } ) .addFile('scripts/deploy_storage.js', { content: scriptAutoExec.script } ) .openFile('storage.sol') .sendKeys('body', [browser.Keys.CONTROL, 'e']) - .journalChildIncludes('147', { shouldHaveOnlyOneOccurence: true }) + .journalLastChildIncludes('147') } } From ced9077119583007e256f9a35c46a86e8b6d0e3f Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 24 Mar 2022 10:59:39 +0100 Subject: [PATCH 21/35] just send the tx if "VM" --- libs/remix-lib/src/execution/txRunnerWeb3.ts | 52 ++++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/libs/remix-lib/src/execution/txRunnerWeb3.ts b/libs/remix-lib/src/execution/txRunnerWeb3.ts index 1da52c8049..4483a41fe0 100644 --- a/libs/remix-lib/src/execution/txRunnerWeb3.ts +++ b/libs/remix-lib/src/execution/txRunnerWeb3.ts @@ -101,16 +101,16 @@ export class TxRunnerWeb3 { // // @todo(#378) this should be removed when https://github.com/WalletConnect/walletconnect-monorepo/issues/334 is fixed callback(new Error('Gas estimation failed because of an unknown internal error. This may indicated that the transaction will fail.')) } - gasEstimationForceSend(err, () => { - // callback is called whenever no error - tx['gas'] = !gasEstimation ? gasLimit : gasEstimation - - this._api.detectNetwork((err, network) => { - if (err) { - console.log(err) - return - } - + this._api.detectNetwork((errNetWork, network) => { + if (errNetWork) { + console.log(errNetWork) + return + } + err = network.name === 'VM' ? null : err // just send the tx if "VM" + gasEstimationForceSend(err, () => { + // callback is called whenever no error + tx['gas'] = !gasEstimation ? gasLimit : gasEstimation + if (this._api.config.getUnpersistedProperty('doNotShowTransactionConfirmationAgain')) { return this._executeTx(tx, network, null, this._api, promptCb, callback) } @@ -120,23 +120,23 @@ export class TxRunnerWeb3 { }, (error) => { callback(error) }) + }, () => { + const blockGasLimit = this.currentblockGasLimit() + // NOTE: estimateGas very likely will return a large limit if execution of the code failed + // we want to be able to run the code in order to debug and find the cause for the failure + if (err) return callback(err) + + let warnEstimation = ' An important gas estimation might also be the sign of a problem in the contract code. Please check loops and be sure you did not sent value to a non payable function (that\'s also the reason of strong gas estimation). ' + warnEstimation += ' ' + err + + if (gasEstimation > gasLimit) { + return callback('Gas required exceeds limit: ' + gasLimit + '. ' + warnEstimation) + } + if (gasEstimation > blockGasLimit) { + return callback('Gas required exceeds block gas limit: ' + gasLimit + '. ' + warnEstimation) + } }) - }, () => { - const blockGasLimit = this.currentblockGasLimit() - // NOTE: estimateGas very likely will return a large limit if execution of the code failed - // we want to be able to run the code in order to debug and find the cause for the failure - if (err) return callback(err) - - let warnEstimation = ' An important gas estimation might also be the sign of a problem in the contract code. Please check loops and be sure you did not sent value to a non payable function (that\'s also the reason of strong gas estimation). ' - warnEstimation += ' ' + err - - if (gasEstimation > gasLimit) { - return callback('Gas required exceeds limit: ' + gasLimit + '. ' + warnEstimation) - } - if (gasEstimation > blockGasLimit) { - return callback('Gas required exceeds block gas limit: ' + gasLimit + '. ' + warnEstimation) - } - }) + }) }) } } From 267f2abc30c2ef603ed7b6e8c20ea718ee776330 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 24 Mar 2022 15:38:31 +0100 Subject: [PATCH 22/35] gasEstimate allows from to be null, in case of a call, we set a default from --- libs/remix-lib/src/execution/txRunnerVM.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/remix-lib/src/execution/txRunnerVM.ts b/libs/remix-lib/src/execution/txRunnerVM.ts index e2b2322a89..2f50204503 100644 --- a/libs/remix-lib/src/execution/txRunnerVM.ts +++ b/libs/remix-lib/src/execution/txRunnerVM.ts @@ -56,7 +56,11 @@ export class TxRunnerVM { runInVm (from, to, data, value, gasLimit, useCall, timestamp, callback) { const self = this - const account = self.vmaccounts[from] + let account = self.vmaccounts[from] + if (!account && useCall && Object.keys(self.vmaccounts).length) { + from = Object.keys(self.vmaccounts)[0] + account = self.vmaccounts[from] + } if (!account) { return callback('Invalid account selected') } From 63874ab4b798459b2c9656514aa39bb98ef64460 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 24 Mar 2022 15:38:51 +0100 Subject: [PATCH 23/35] fix loading compiler from unit test --- libs/remix-tests/src/compiler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-tests/src/compiler.ts b/libs/remix-tests/src/compiler.ts index 697483d593..f16c925edc 100644 --- a/libs/remix-tests/src/compiler.ts +++ b/libs/remix-tests/src/compiler.ts @@ -183,7 +183,7 @@ export function compileContractSources (sources: SrcIfc, newCompConfig: any, imp async.waterfall([ (next) => { - if (!deepequal(UTRunner.compilerConfig, newCompConfig)) { + if (!compiler || !deepequal(UTRunner.compilerConfig, newCompConfig)) { UTRunner.compilerConfig = newCompConfig const { currentCompilerUrl, evmVersion, optimize, runs, usingWorker } = newCompConfig compiler = new RemixCompiler(importFileCb) From dbad77ffbb6dcb0915c3f8b2778fa37f858c8b39 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 24 Mar 2022 16:10:25 +0100 Subject: [PATCH 24/35] fix e2e --- apps/remix-ide-e2e/src/tests/terminal.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 71c77f8043..23f8065a31 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -195,10 +195,11 @@ module.exports = { 'Should run a script right after compilation #group6': function (browser: NightwatchBrowser) { browser - .addFile('storage.sol', { content: scriptAutoExec.contract } ) + .addFile('contracts/storage.sol', { content: scriptAutoExec.contract } ) .addFile('scripts/deploy_storage.js', { content: scriptAutoExec.script } ) - .openFile('storage.sol') + .openFile('contracts/storage.sol') .sendKeys('body', [browser.Keys.CONTROL, 'e']) + .pause(5000) .journalLastChildIncludes('147') } } From 6309af2619abe8ffa4b95411d7fa8c7c3645c02b Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 25 Mar 2022 12:22:59 +0100 Subject: [PATCH 25/35] revert package.json --- package-lock.json | 279 +++++++++++++++++++--------------------------- package.json | 8 +- 2 files changed, 116 insertions(+), 171 deletions(-) diff --git a/package-lock.json b/package-lock.json index 20f8f215d6..0d31f1b3ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2813,34 +2813,20 @@ } }, "@ethereumjs/block": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/@ethereumjs/block/-/block-3.6.1.tgz", - "integrity": "sha512-o5d/zpGl4SdVfdTfrsq9ZgYMXddc0ucKMiFW5OphBCX+ep4xzYnSjboFcZXT2V/tcSBr84VrKWWp21CGVb3DGw==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/block/-/block-3.6.0.tgz", + "integrity": "sha512-dqLo1LtsLG+Oelu5S5tWUDG0pah3QUwV5TJZy2cm19BXDr4ka/S9XBSgao0i09gTcuPlovlHgcs6d7EZ37urjQ==", "requires": { - "@ethereumjs/common": "^2.6.1", - "@ethereumjs/tx": "^3.5.0", - "ethereumjs-util": "^7.1.4", - "merkle-patricia-tree": "^4.2.3" - }, - "dependencies": { - "ethereumjs-util": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.4.tgz", - "integrity": "sha512-p6KmuPCX4mZIqsQzXfmSx9Y0l2hqf+VkAiwSisW3UKUFdk8ZkAt+AYaor83z2nSi6CU2zSsXMlD80hAbNEGM0A==", - "requires": { - "@types/bn.js": "^5.1.0", - "bn.js": "^5.1.2", - "create-hash": "^1.1.2", - "ethereum-cryptography": "^0.1.3", - "rlp": "^2.2.4" - } - } + "@ethereumjs/common": "^2.6.0", + "@ethereumjs/tx": "^3.4.0", + "ethereumjs-util": "^7.1.3", + "merkle-patricia-tree": "^4.2.2" } }, "@ethereumjs/blockchain": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@ethereumjs/blockchain/-/blockchain-5.5.1.tgz", - "integrity": "sha512-JS2jeKxl3tlaa5oXrZ8mGoVBCz6YqsGG350XVNtHAtNZXKk7pU3rH4xzF2ru42fksMMqzFLzKh9l4EQzmNWDqA==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/blockchain/-/blockchain-5.5.0.tgz", + "integrity": "sha512-879YVmWbM8OUKLVj+OuEZ+sZFkQOnXYGeak5oi7O1hOjaRv//je+fK2axGP04cbttu7sPCp41zy7O6xw4cut8A==", "requires": { "@ethereumjs/block": "^3.6.0", "@ethereumjs/common": "^2.6.0", @@ -2868,26 +2854,12 @@ } }, "@ethereumjs/common": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.6.2.tgz", - "integrity": "sha512-vDwye5v0SVeuDky4MtKsu+ogkH2oFUV8pBKzH/eNBzT8oI91pKa8WyzDuYuxOQsgNgv5R34LfFDh2aaw3H4HbQ==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.6.0.tgz", + "integrity": "sha512-Cq2qS0FTu6O2VU1sgg+WyU9Ps0M6j/BEMHN+hRaECXCV/r0aI78u4N6p52QW/BDVhwWZpCdrvG8X7NJdzlpNUA==", "requires": { "crc-32": "^1.2.0", - "ethereumjs-util": "^7.1.4" - }, - "dependencies": { - "ethereumjs-util": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.4.tgz", - "integrity": "sha512-p6KmuPCX4mZIqsQzXfmSx9Y0l2hqf+VkAiwSisW3UKUFdk8ZkAt+AYaor83z2nSi6CU2zSsXMlD80hAbNEGM0A==", - "requires": { - "@types/bn.js": "^5.1.0", - "bn.js": "^5.1.2", - "create-hash": "^1.1.2", - "ethereum-cryptography": "^0.1.3", - "rlp": "^2.2.4" - } - } + "ethereumjs-util": "^7.1.3" } }, "@ethereumjs/ethash": { @@ -2913,66 +2885,45 @@ } }, "@ethereumjs/tx": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.5.0.tgz", - "integrity": "sha512-/+ZNbnJhQhXC83Xuvy6I9k4jT5sXiV0tMR9C+AzSSpcCV64+NB8dTE1m3x98RYMqb8+TLYWA+HML4F5lfXTlJw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.4.0.tgz", + "integrity": "sha512-WWUwg1PdjHKZZxPPo274ZuPsJCWV3SqATrEKQP1n2DrVYVP1aZIYpo/mFaA0BDoE0tIQmBeimRCEA0Lgil+yYw==", "requires": { - "@ethereumjs/common": "^2.6.1", - "ethereumjs-util": "^7.1.4" - }, - "dependencies": { - "ethereumjs-util": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.4.tgz", - "integrity": "sha512-p6KmuPCX4mZIqsQzXfmSx9Y0l2hqf+VkAiwSisW3UKUFdk8ZkAt+AYaor83z2nSi6CU2zSsXMlD80hAbNEGM0A==", - "requires": { - "@types/bn.js": "^5.1.0", - "bn.js": "^5.1.2", - "create-hash": "^1.1.2", - "ethereum-cryptography": "^0.1.3", - "rlp": "^2.2.4" - } - } + "@ethereumjs/common": "^2.6.0", + "ethereumjs-util": "^7.1.3" } }, "@ethereumjs/vm": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/@ethereumjs/vm/-/vm-5.7.1.tgz", - "integrity": "sha512-NiFm5FMaeDGZ9ojBL+Y9Y/xhW6S4Fgez+zPBM402T5kLsfeAR9mrRVckYhvkGVJ6FMwsY820CLjYP5OVwMjLTg==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/vm/-/vm-5.6.0.tgz", + "integrity": "sha512-J2m/OgjjiGdWF2P9bj/4LnZQ1zRoZhY8mRNVw/N3tXliGI8ai1sI1mlDPkLpeUUM4vq54gH6n0ZlSpz8U/qlYQ==", "requires": { - "@ethereumjs/block": "^3.6.1", - "@ethereumjs/blockchain": "^5.5.1", - "@ethereumjs/common": "^2.6.2", - "@ethereumjs/tx": "^3.5.0", + "@ethereumjs/block": "^3.6.0", + "@ethereumjs/blockchain": "^5.5.0", + "@ethereumjs/common": "^2.6.0", + "@ethereumjs/tx": "^3.4.0", "async-eventemitter": "^0.2.4", "core-js-pure": "^3.0.1", - "debug": "^4.3.3", - "ethereumjs-util": "^7.1.4", + "debug": "^2.2.0", + "ethereumjs-util": "^7.1.3", "functional-red-black-tree": "^1.0.1", "mcl-wasm": "^0.7.1", - "merkle-patricia-tree": "^4.2.3", + "merkle-patricia-tree": "^4.2.2", "rustbn.js": "~0.2.0" }, "dependencies": { "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { - "ms": "2.1.2" + "ms": "2.0.0" } }, - "ethereumjs-util": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.4.tgz", - "integrity": "sha512-p6KmuPCX4mZIqsQzXfmSx9Y0l2hqf+VkAiwSisW3UKUFdk8ZkAt+AYaor83z2nSi6CU2zSsXMlD80hAbNEGM0A==", - "requires": { - "@types/bn.js": "^5.1.0", - "bn.js": "^5.1.2", - "create-hash": "^1.1.2", - "ethereum-cryptography": "^0.1.3", - "rlp": "^2.2.4" - } + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" } } }, @@ -10556,9 +10507,9 @@ "dev": true }, "@types/abstract-leveldown": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@types/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", - "integrity": "sha512-q5veSX6zjUy/DlDhR4Y4cU0k2Ar+DT2LUraP00T19WLmTO6Se1djepCCaqU6nQrwcJ5Hyo/CWqxTzrrFg8eqbQ==" + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@types/abstract-leveldown/-/abstract-leveldown-5.0.2.tgz", + "integrity": "sha512-+jA1XXF3jsz+Z7FcuiNqgK53hTa/luglT2TyTpKPqoYbxVY+mCPF22Rm+q3KPBrMHJwNXFrTViHszBOfU4vftQ==" }, "@types/aria-query": { "version": "4.2.2", @@ -10886,6 +10837,13 @@ "@types/abstract-leveldown": "*", "@types/level-errors": "*", "@types/node": "*" + }, + "dependencies": { + "@types/node": { + "version": "16.10.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.3.tgz", + "integrity": "sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ==" + } } }, "@types/lodash": { @@ -16265,9 +16223,9 @@ } }, "core-js-pure": { - "version": "3.21.1", - "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.21.1.tgz", - "integrity": "sha512-12VZfFIu+wyVbBebyHmRTuEE/tZrB4tJToWcwAMcsp3h4+sHR+fMJWbKpYiCRWlhFBq+KNyO8rIV9rTkeVmznQ==" + "version": "3.18.2", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.18.2.tgz", + "integrity": "sha512-4hMMLUlZhKJKOWbbGD1/VDUxGPEhEoN/T01k7bx271WiBKCvCfkgPzy0IeRS4PB50p6/N1q/SZL4B/TRsTE5bA==" }, "core-util-is": { "version": "1.0.3", @@ -30545,30 +30503,17 @@ "dev": true }, "merkle-patricia-tree": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/merkle-patricia-tree/-/merkle-patricia-tree-4.2.3.tgz", - "integrity": "sha512-S4xevdXl5KvdBGgUxhQcxoep0onqXiIhzfwZp4M78kIuJH3Pu9o9IUgqhzSFOR2ykLO6t265026Xb6PY0q2UFQ==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/merkle-patricia-tree/-/merkle-patricia-tree-4.2.2.tgz", + "integrity": "sha512-eqZYNTshcYx9aESkSPr71EqwsR/QmpnObDEV4iLxkt/x/IoLYZYjJvKY72voP/27Vy61iMOrfOG6jrn7ttXD+Q==", "requires": { "@types/levelup": "^4.3.0", - "ethereumjs-util": "^7.1.4", + "ethereumjs-util": "^7.1.2", "level-mem": "^5.0.1", "level-ws": "^2.0.0", "readable-stream": "^3.6.0", + "rlp": "^2.2.4", "semaphore-async-await": "^1.5.1" - }, - "dependencies": { - "ethereumjs-util": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.4.tgz", - "integrity": "sha512-p6KmuPCX4mZIqsQzXfmSx9Y0l2hqf+VkAiwSisW3UKUFdk8ZkAt+AYaor83z2nSi6CU2zSsXMlD80hAbNEGM0A==", - "requires": { - "@types/bn.js": "^5.1.0", - "bn.js": "^5.1.2", - "create-hash": "^1.1.2", - "ethereum-cryptography": "^0.1.3", - "rlp": "^2.2.4" - } - } } }, "methods": { @@ -35750,7 +35695,7 @@ }, "cross-spawn": { "version": "5.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true, "requires": { @@ -35767,7 +35712,7 @@ }, "execa": { "version": "0.7.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true, "requires": { @@ -35797,19 +35742,19 @@ }, "get-stream": { "version": "3.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, "invert-kv": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "dev": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { @@ -35818,7 +35763,7 @@ }, "is-stream": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, @@ -35830,7 +35775,7 @@ }, "lcid": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true, "requires": { @@ -35849,7 +35794,7 @@ }, "lru-cache": { "version": "4.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", "dev": true, "requires": { @@ -35859,7 +35804,7 @@ }, "mem": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", "dev": true, "requires": { @@ -35868,13 +35813,13 @@ }, "mimic-fn": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", "dev": true }, "minimist": { "version": "0.0.8", - "resolved": false, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, @@ -35904,7 +35849,7 @@ }, "os-locale": { "version": "2.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "dev": true, "requires": { @@ -35993,7 +35938,7 @@ }, "string-width": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { @@ -36044,19 +35989,19 @@ }, "y18n": { "version": "3.2.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", "dev": true }, "yallist": { "version": "2.1.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true }, "yargs": { "version": "10.0.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.0.3.tgz", "integrity": "sha512-DqBpQ8NAUX4GyPP/ijDGHsJya4tYqLQrjPr95HNsr1YwL3+daCfvBwg7+gIC6IdJhR2kATh3hb61vjzMWEtjdw==", "dev": true, "requires": { @@ -36076,13 +36021,13 @@ "dependencies": { "ansi-regex": { "version": "3.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, "cliui": { "version": "3.2.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "dev": true, "requires": { @@ -36093,7 +36038,7 @@ "dependencies": { "string-width": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { @@ -36106,7 +36051,7 @@ }, "string-width": { "version": "2.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { @@ -36116,13 +36061,13 @@ "dependencies": { "is-fullwidth-code-point": { "version": "2.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "strip-ansi": { "version": "4.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { @@ -36135,7 +36080,7 @@ }, "yargs-parser": { "version": "8.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.0.0.tgz", "integrity": "sha1-IdR2Mw5agieaS4gTRb8GYQLiGcY=", "dev": true, "requires": { @@ -36144,7 +36089,7 @@ "dependencies": { "camelcase": { "version": "4.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true } @@ -36415,7 +36360,7 @@ "dependencies": { "ansi-regex": { "version": "3.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, @@ -36527,7 +36472,7 @@ }, "cross-spawn": { "version": "4.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", "integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=", "dev": true, "requires": { @@ -36537,7 +36482,7 @@ }, "debug": { "version": "4.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "dev": true, "requires": { @@ -36626,7 +36571,7 @@ }, "find-up": { "version": "3.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "dev": true, "requires": { @@ -36723,7 +36668,7 @@ }, "inherits": { "version": "2.0.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, @@ -36747,7 +36692,7 @@ }, "is-stream": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, @@ -36759,7 +36704,7 @@ }, "istanbul-lib-coverage": { "version": "2.0.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", "integrity": "sha512-dKWuzRGCs4G+67VfW9pBFFz2Jpi4vSp/k7zBcJ888ofV5Mi1g5CUML5GvMvV6u9Cjybftu+E8Cgp+k0dI1E5lw==", "dev": true }, @@ -36803,7 +36748,7 @@ }, "istanbul-lib-report": { "version": "2.0.4", - "resolved": false, + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-2.0.4.tgz", "integrity": "sha512-sOiLZLAWpA0+3b5w5/dq0cjm2rrNdAfHWaGhmn7XEFW6X++IV9Ohn+pnELAl9K3rfpaeBfbmH9JU5sejacdLeA==", "dev": true, "requires": { @@ -36814,7 +36759,7 @@ "dependencies": { "supports-color": { "version": "6.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", "dev": true, "requires": { @@ -36825,7 +36770,7 @@ }, "istanbul-lib-source-maps": { "version": "3.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.2.tgz", "integrity": "sha512-JX4v0CiKTGp9fZPmoxpu9YEkPbEqCqBbO3403VabKjH+NRXo72HafD5UgnjTEqHL2SAjaZK1XDuDOkn6I5QVfQ==", "dev": true, "requires": { @@ -36838,7 +36783,7 @@ "dependencies": { "source-map": { "version": "0.6.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true } @@ -36846,7 +36791,7 @@ }, "istanbul-reports": { "version": "2.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.1.1.tgz", "integrity": "sha512-FzNahnidyEPBCI0HcufJoSEoKykesRlFcSzQqjH9x0+LC8tnnE/p/90PBLu8iZTxr8yYZNyTtiAujUqyN+CIxw==", "dev": true, "requires": { @@ -36882,7 +36827,7 @@ }, "locate-path": { "version": "3.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "dev": true, "requires": { @@ -36898,7 +36843,7 @@ }, "lru-cache": { "version": "4.1.5", - "resolved": false, + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", "dev": true, "requires": { @@ -36908,7 +36853,7 @@ }, "make-dir": { "version": "1.3.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", "dev": true, "requires": { @@ -36937,7 +36882,7 @@ }, "merge-source-map": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.1.0.tgz", "integrity": "sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==", "dev": true, "requires": { @@ -36946,7 +36891,7 @@ "dependencies": { "source-map": { "version": "0.6.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true } @@ -36954,7 +36899,7 @@ }, "mimic-fn": { "version": "1.2.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", "dev": true }, @@ -36969,7 +36914,7 @@ }, "minimist": { "version": "0.0.10", - "resolved": false, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=" }, "mkdirp": { @@ -37083,7 +37028,7 @@ }, "p-limit": { "version": "2.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.1.0.tgz", "integrity": "sha512-NhURkNcrVB+8hNfLuysU8enY5xn2KXphsHBaC2YmRNTZRc7RWusw6apSpdEj3jo4CMb6W9nrF6tTnsJsJeyu6g==", "dev": true, "requires": { @@ -37092,7 +37037,7 @@ }, "p-locate": { "version": "3.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", "dev": true, "requires": { @@ -37101,7 +37046,7 @@ }, "p-try": { "version": "2.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", "dev": true }, @@ -37187,7 +37132,7 @@ }, "read-pkg": { "version": "3.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", "dev": true, "requires": { @@ -37198,7 +37143,7 @@ }, "read-pkg-up": { "version": "4.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz", "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==", "dev": true, "requires": { @@ -37229,7 +37174,7 @@ }, "resolve": { "version": "1.10.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz", "integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==", "dev": true, "requires": { @@ -37238,7 +37183,7 @@ }, "resolve-from": { "version": "4.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, @@ -37253,13 +37198,13 @@ }, "safe-buffer": { "version": "5.1.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, "semver": { "version": "5.6.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", "dev": true }, @@ -37348,7 +37293,7 @@ }, "strip-ansi": { "version": "4.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { @@ -37369,7 +37314,7 @@ }, "test-exclude": { "version": "5.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.1.0.tgz", "integrity": "sha512-gwf0S2fFsANC55fSeSqpb8BYk6w3FDvwZxfNjeF6FRgvFa43r+7wRiA/Q0IxoRU37wB/LE8IQ4221BsNucTaCA==", "dev": true, "requires": { @@ -37381,7 +37326,7 @@ }, "uglify-js": { "version": "3.4.9", - "resolved": false, + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz", "integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==", "requires": { "commander": "~2.17.1", @@ -37486,7 +37431,7 @@ }, "write-file-atomic": { "version": "2.4.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.2.tgz", "integrity": "sha512-s0b6vB3xIVRLWywa6X9TOMA7k9zio0TMOsl9ZnDkliA/cfJlpHXAscj0gbHVJiTdIuAYpIyqS5GW91fqm6gG5g==", "dev": true, "requires": { @@ -37503,7 +37448,7 @@ }, "yallist": { "version": "2.1.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true }, diff --git a/package.json b/package.json index ed9d0c5dcb..16d9ea14b8 100644 --- a/package.json +++ b/package.json @@ -145,10 +145,10 @@ "dependencies": { "@babel/plugin-proposal-class-properties": "^7.16.0", "@erebos/bzz-node": "^0.13.0", - "@ethereumjs/block": "^3.6.1", - "@ethereumjs/common": "^2.6.2", - "@ethereumjs/tx": "^3.5.0", - "@ethereumjs/vm": "^5.7.1", + "@ethereumjs/block": "^3.5.1", + "@ethereumjs/common": "^2.5.0", + "@ethereumjs/tx": "^3.3.2", + "@ethereumjs/vm": "^5.5.3", "@ethersphere/bee-js": "^3.2.0", "@isomorphic-git/lightning-fs": "^4.4.1", "@monaco-editor/react": "^4.3.1", From c3719c077705b5f1af8199da4ecdcaabbcbcf9db Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 25 Mar 2022 13:09:09 +0100 Subject: [PATCH 26/35] better selection of current account --- libs/remix-lib/src/execution/txRunnerVM.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/remix-lib/src/execution/txRunnerVM.ts b/libs/remix-lib/src/execution/txRunnerVM.ts index 2f50204503..fb4e291916 100644 --- a/libs/remix-lib/src/execution/txRunnerVM.ts +++ b/libs/remix-lib/src/execution/txRunnerVM.ts @@ -56,11 +56,12 @@ export class TxRunnerVM { runInVm (from, to, data, value, gasLimit, useCall, timestamp, callback) { const self = this - let account = self.vmaccounts[from] - if (!account && useCall && Object.keys(self.vmaccounts).length) { + let account + if (!from && useCall && Object.keys(self.vmaccounts).length) { from = Object.keys(self.vmaccounts)[0] account = self.vmaccounts[from] - } + } else account = self.vmaccounts[from] + if (!account) { return callback('Invalid account selected') } From bb7002454262c68de7debbae5553a89e6d4eb5be Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 25 Mar 2022 13:54:02 +0100 Subject: [PATCH 27/35] fix catching gasEstimation failure --- libs/remix-tests/src/deployer.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/remix-tests/src/deployer.ts b/libs/remix-tests/src/deployer.ts index 505281fe00..d3164eb285 100644 --- a/libs/remix-tests/src/deployer.ts +++ b/libs/remix-tests/src/deployer.ts @@ -79,6 +79,9 @@ export function deployAll (compileResult: compilationInterface, web3: Web3, test console.error(err) callback(err) }) + }).catch((err) => { + console.error(err) + callback(err) }) } From 8761a1f0eaef50f96960ac63cdb314feae940e1b Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 25 Mar 2022 14:27:22 +0100 Subject: [PATCH 28/35] update test --- apps/remix-ide-e2e/src/tests/debugger.test.ts | 4 ++-- apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/debugger.test.ts b/apps/remix-ide-e2e/src/tests/debugger.test.ts index 56a1174521..40c56957ff 100644 --- a/apps/remix-ide-e2e/src/tests/debugger.test.ts +++ b/apps/remix-ide-e2e/src/tests/debugger.test.ts @@ -477,7 +477,7 @@ const localVariable_step717_ABIEncoder = { // eslint-disable-line const jsGetTrace = `(async () => { try { - const result = await remix.call('debugger', 'getTrace', '0x16be5c31014a7e1552d136f7ed7bc7788f3bb9e45e31b059df253173f2df31e7') + const result = await remix.call('debugger', 'getTrace', '0x5eac18dc23e948b6895a163e1f467c86448be8f8b042f66f9f3ef339d299c4b4') console.log('result ', result) } catch (e) { console.log(e.message) @@ -486,7 +486,7 @@ const jsGetTrace = `(async () => { const jsDebug = `(async () => { try { - const result = await remix.call('debugger', 'debug', '0x16be5c31014a7e1552d136f7ed7bc7788f3bb9e45e31b059df253173f2df31e7') + const result = await remix.call('debugger', 'debug', '0x5eac18dc23e948b6895a163e1f467c86448be8f8b042f66f9f3ef339d299c4b4') console.log('result ', result) } catch (e) { console.log(e.message) diff --git a/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts b/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts index ed5cf3570c..30a2913891 100644 --- a/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts +++ b/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts @@ -132,7 +132,7 @@ module.exports = { .click('*[data-id="testTabCheckAllTests"]') .clickElementAtPosition('.singleTestLabel', 1) .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') - .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'contract deployment failed after trying twice', 120000) + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'revert Deploy Failed', 120000) }, 'Should fail when parameters are passed to method in test contract #group3': function (browser: NightwatchBrowser) { From 01a1e484c2bbdb69f597def9004524caff32b5d4 Mon Sep 17 00:00:00 2001 From: yann300 Date: Sat, 26 Mar 2022 02:20:10 +0100 Subject: [PATCH 29/35] update gasUsed --- libs/remix-simulator/src/methods/transactions.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/remix-simulator/src/methods/transactions.ts b/libs/remix-simulator/src/methods/transactions.ts index 32ef9d8a64..4774e948b8 100644 --- a/libs/remix-simulator/src/methods/transactions.ts +++ b/libs/remix-simulator/src/methods/transactions.ts @@ -145,7 +145,8 @@ export class Transactions { return cb(e.message) } } - cb(null, result.result.execResult.gasUsed.toNumber()) + const gasUsed = result.result.execResult.gasUsed.toNumber() + cb(null, Math.ceil(gasUsed + (15 * gasUsed) / 100)) }) } From 6be8afb111786997a48add851cf3c8dc316c6334 Mon Sep 17 00:00:00 2001 From: yann300 Date: Sat, 26 Mar 2022 10:08:06 +0100 Subject: [PATCH 30/35] fix log --- apps/remix-ide-e2e/src/tests/debugger.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/debugger.test.ts b/apps/remix-ide-e2e/src/tests/debugger.test.ts index 40c56957ff..9010b79b58 100644 --- a/apps/remix-ide-e2e/src/tests/debugger.test.ts +++ b/apps/remix-ide-e2e/src/tests/debugger.test.ts @@ -477,7 +477,7 @@ const localVariable_step717_ABIEncoder = { // eslint-disable-line const jsGetTrace = `(async () => { try { - const result = await remix.call('debugger', 'getTrace', '0x5eac18dc23e948b6895a163e1f467c86448be8f8b042f66f9f3ef339d299c4b4') + const result = await remix.call('debugger', 'getTrace', '0x65f0813753462414f9a91f0aabea946188327995f54b893b63a8d7ff186cfca3') console.log('result ', result) } catch (e) { console.log(e.message) @@ -486,7 +486,7 @@ const jsGetTrace = `(async () => { const jsDebug = `(async () => { try { - const result = await remix.call('debugger', 'debug', '0x5eac18dc23e948b6895a163e1f467c86448be8f8b042f66f9f3ef339d299c4b4') + const result = await remix.call('debugger', 'debug', '0x65f0813753462414f9a91f0aabea946188327995f54b893b63a8d7ff186cfca3') console.log('result ', result) } catch (e) { console.log(e.message) From 601ec3e3f56e283594c21c5da5d6f215032fdaab Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 4 Apr 2022 16:18:04 +0200 Subject: [PATCH 31/35] move to required module --- apps/remix-ide/src/remixAppManager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index dd00e99177..764f7db574 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -8,12 +8,12 @@ const requiredModules = [ // services + layout views + system views 'manager', 'config', 'compilerArtefacts', 'compilerMetadata', 'contextualListener', 'editor', 'offsetToLineColumnConverter', 'network', 'theme', 'fileManager', 'contentImport', 'blockchain', 'web3Provider', 'scriptRunner', 'fetchAndCompile', 'mainPanel', 'hiddenPanel', 'sidePanel', 'menuicons', 'filePanel', 'terminal', 'settings', 'pluginManager', 'tabs', 'udapp', 'dGitProvider', 'solidity-logic', 'gistHandler', 'layout', - 'notification', 'permissionhandler', 'walkthrough', 'storage', 'restorebackupzip', 'link-libraries', 'deploy-libraries'] + 'notification', 'permissionhandler', 'walkthrough', 'storage', 'restorebackupzip', 'link-libraries', 'deploy-libraries', 'intelligentScriptExecutor'] const dependentModules = ['git', 'hardhat', 'slither'] // module which shouldn't be manually activated (e.g git is activated by remixd) export function isNative (name) { - const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons', 'solidity', 'hardhat-provider', 'solidityStaticAnalysis', 'solidityUnitTesting', 'layout', 'notification', 'intelligentScriptExecutor'] + const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons', 'solidity', 'hardhat-provider', 'solidityStaticAnalysis', 'solidityUnitTesting', 'layout', 'notification'] return nativePlugins.includes(name) || requiredModules.includes(name) } From d19a55d4f14e61ddfdba52ba2f64668a285ef8be Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 4 Apr 2022 16:47:44 +0200 Subject: [PATCH 32/35] update keybinding --- apps/remix-ide/src/app/tabs/intelligent-script-executor.ts | 2 +- apps/solidity-compiler/src/app/compiler-api.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts b/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts index c524b36137..1448c2cc52 100644 --- a/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts +++ b/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts @@ -21,7 +21,7 @@ export class IntelligentScriptExecutor extends Plugin { this.executionListener = async (e) => { // ctrl+e or command+e const file = await this.call('fileManager', 'file') - if ((e.metaKey || e.ctrlKey) && e.keyCode === 69 && file !== '') { + if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.keyCode === 83 && file !== '') { if (file.endsWith('.sol')) { e.preventDefault() this.targetFileName = file diff --git a/apps/solidity-compiler/src/app/compiler-api.ts b/apps/solidity-compiler/src/app/compiler-api.ts index 7d5188be6b..64747b3c51 100644 --- a/apps/solidity-compiler/src/app/compiler-api.ts +++ b/apps/solidity-compiler/src/app/compiler-api.ts @@ -321,7 +321,7 @@ export const CompilerApiMixin = (Base) => class extends Base { // Run the compiler instead of trying to save the website this.data.eventHandlers.onKeyDown = async (e) => { // ctrl+s or command+s - if ((e.metaKey || e.ctrlKey) && e.keyCode === 83 && this.currentFile !== '') { + if ((e.metaKey || e.ctrlKey) && !e.shiftKey && e.keyCode === 83 && this.currentFile !== '') { e.preventDefault() this.compileTabLogic.runCompiler(await this.getAppParameter('hardhat-compilation')) } From 0cdbd0a56e7265fb679ed0de03c504840eb17110 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 4 Apr 2022 17:51:00 +0200 Subject: [PATCH 33/35] fix clearing targetfilename --- apps/remix-ide/src/app/tabs/intelligent-script-executor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts b/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts index 1448c2cc52..78bf8f030b 100644 --- a/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts +++ b/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts @@ -46,10 +46,10 @@ export class IntelligentScriptExecutor extends Plugin { this.on('compilerMetadata', 'artefactsUpdated', async (fileName, contract) => { if (this.targetFileName === contract.file && contract.object && contract.object.devdoc['custom:dev-run-script']) { + this.targetFileName = null const file = contract.object.devdoc['custom:dev-run-script'] if (file) this.runScript(file) } - this.targetFileName = null }) } From 4b4c611380228114754d5caf3ec3874c6152b466 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 4 Apr 2022 17:52:57 +0200 Subject: [PATCH 34/35] don't clear ui if just running a script --- .../src/app/tabs/intelligent-script-executor.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts b/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts index 78bf8f030b..66368b5f56 100644 --- a/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts +++ b/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts @@ -26,18 +26,20 @@ export class IntelligentScriptExecutor extends Plugin { e.preventDefault() this.targetFileName = file await this.call('solidity', 'compile', file) - } else if (file.endsWith('.js')) { + } else if (file.endsWith('.js') || file.endsWith('.ts')) { e.preventDefault() - this.runScript(file) + this.runScript(file, false) } } } } - async runScript (fileName) { + async runScript (fileName, clearAllInstances) { await this.call('terminal', 'log', `running ${fileName} ...`) const content = await this.call('fileManager', 'readFile', fileName) - await this.call('udapp', 'clearAllInstances') + if (clearAllInstances) { + await this.call('udapp', 'clearAllInstances') + } await this.call('scriptRunner', 'execute', content) } @@ -48,7 +50,7 @@ export class IntelligentScriptExecutor extends Plugin { if (this.targetFileName === contract.file && contract.object && contract.object.devdoc['custom:dev-run-script']) { this.targetFileName = null const file = contract.object.devdoc['custom:dev-run-script'] - if (file) this.runScript(file) + if (file) this.runScript(file, true) } }) } From ff778f25c2a7fe67e55af121c3b1e7af1cf62b51 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 4 Apr 2022 21:28:15 +0200 Subject: [PATCH 35/35] fix e2e --- apps/remix-ide-e2e/src/tests/terminal.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 23f8065a31..4e41970b81 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -198,7 +198,7 @@ module.exports = { .addFile('contracts/storage.sol', { content: scriptAutoExec.contract } ) .addFile('scripts/deploy_storage.js', { content: scriptAutoExec.script } ) .openFile('contracts/storage.sol') - .sendKeys('body', [browser.Keys.CONTROL, 'e']) + .sendKeys('body', [browser.Keys.CONTROL, browser.Keys.SHIFT, 's']) .pause(5000) .journalLastChildIncludes('147') }