From a76dffd2a8b04bfabe48119f286e06f1b20329f2 Mon Sep 17 00:00:00 2001
From: Aniket-Engg
Date: Fri, 1 Apr 2022 18:54:48 +0530
Subject: [PATCH 01/44] 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 33eb407832219b1d81978a0227e39b37afa5e579 Mon Sep 17 00:00:00 2001
From: Aniket-Engg
Date: Mon, 4 Apr 2022 11:20:34 +0530
Subject: [PATCH 02/44] 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 49a16cb2e010fa72a008f2b11d9103c86e199da4 Mon Sep 17 00:00:00 2001
From: David Disu
Date: Thu, 17 Mar 2022 12:03:22 +0100
Subject: [PATCH 03/44] 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'>
+ {
+ e.stopPropagation()
+ downloadWorkspaces()
+ }}
+ className='far fa-download remixui_menuicon'
+ title='Download Workspaces'>
+
-
-
-
-
diff --git a/libs/remix-ui/workspace/src/lib/actions/index.ts b/libs/remix-ui/workspace/src/lib/actions/index.ts
index ed1b47ce39..001c66b558 100644
--- a/libs/remix-ui/workspace/src/lib/actions/index.ts
+++ b/libs/remix-ui/workspace/src/lib/actions/index.ts
@@ -297,6 +297,12 @@ export const handleDownloadFiles = async () => {
}
}
+export const restoreBackupZip = async () => {
+ await plugin.appManager.activatePlugin(['restorebackupzip'])
+ plugin.verticalIcons.select('restorebackupzip')
+ _paq.push(['trackEvent', 'pluginManager', 'userActivate', 'restorebackupzip'])
+}
+
const packageGistFiles = async (directory) => {
const workspaceProvider = plugin.fileProviders.workspace
const isFile = await workspaceProvider.isFile(directory)
diff --git a/libs/remix-ui/workspace/src/lib/contexts/index.ts b/libs/remix-ui/workspace/src/lib/contexts/index.ts
index cb0d3a758b..b5daf01cc9 100644
--- a/libs/remix-ui/workspace/src/lib/contexts/index.ts
+++ b/libs/remix-ui/workspace/src/lib/contexts/index.ts
@@ -28,5 +28,6 @@ export const FileSystemContext = createContext<{
dispatchEmitContextMenuEvent: (cmd: customAction) => Promise,
dispatchHandleClickFile: (path: string, type: 'file' | 'folder' | 'gist') => Promise
dispatchHandleExpandPath: (paths: string[]) => Promise,
- dispatchHandleDownloadFiles: () => Promise
+ dispatchHandleDownloadFiles: () => Promise,
+ dispatchHandleRestoreBackup: () => 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 3803e34c14..cb4d4ce864 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, handleDownloadFiles } 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, restoreBackupZip } from '../actions'
import { Modal, WorkspaceProps } from '../types'
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Workspace } from '../remix-ui-workspace'
@@ -119,6 +119,10 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
await handleDownloadFiles()
}
+ const dispatchHandleRestoreBackup = async () => {
+ await restoreBackupZip()
+ }
+
useEffect(() => {
dispatchInitWorkspace()
}, [])
@@ -219,7 +223,8 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
dispatchEmitContextMenuEvent,
dispatchHandleClickFile,
dispatchHandleExpandPath,
- dispatchHandleDownloadFiles
+ dispatchHandleDownloadFiles,
+ dispatchHandleRestoreBackup
}
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 11eec79c16..ceb4c08b07 100644
--- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
+++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
@@ -58,6 +58,14 @@ export function Workspace () {
}
}
+ const restoreBackup = async () => {
+ try {
+ await global.dispatchHandleRestoreBackup()
+ } catch (e) {
+ console.error(e)
+ }
+ }
+
const onFinishRenameWorkspace = async () => {
if (workspaceRenameInput.current === undefined) return
// @ts-ignore: Object is possibly 'null'.
@@ -178,6 +186,16 @@ export function Workspace () {
className='far fa-download remixui_menuicon'
title='Download Workspaces'>
+ {
+ e.stopPropagation()
+ restoreBackup()
+ }}
+ className='far fa-upload remixui_menuicon'
+ title='Restore Workspaces Backup'>
+
From f4ecd649e465ab00ba4e5e882ec2d7f962b299af Mon Sep 17 00:00:00 2001
From: yann300
Date: Tue, 8 Mar 2022 20:21:11 +0100
Subject: [PATCH 12/44] 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 e62f88527db5ed364c52a33a66d22c66aa4abdbf Mon Sep 17 00:00:00 2001
From: yann300
Date: Tue, 8 Mar 2022 20:21:26 +0100
Subject: [PATCH 13/44] 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 fe2e1b0b184fea4b7a8cd955b1dd8bfc2f19dfe1 Mon Sep 17 00:00:00 2001
From: yann300
Date: Tue, 8 Mar 2022 20:43:36 +0100
Subject: [PATCH 14/44] 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 6694a15c3a83af55d373d64bcc75ba533b057019 Mon Sep 17 00:00:00 2001
From: yann300
Date: Thu, 17 Mar 2022 12:13:28 +0100
Subject: [PATCH 15/44] 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 2a6f435abd7e9df1be3ef9af79f57f7fd4254f28 Mon Sep 17 00:00:00 2001
From: yann300
Date: Fri, 18 Mar 2022 00:55:04 +0100
Subject: [PATCH 16/44] 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 a9de69bd45ddfe363ec9440fe5af8b1d24c75897 Mon Sep 17 00:00:00 2001
From: yann300
Date: Wed, 23 Mar 2022 12:06:18 +0100
Subject: [PATCH 17/44] 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 19eb811eeebd70a9a02cc0e6e8e26711347971de Mon Sep 17 00:00:00 2001
From: yann300
Date: Wed, 23 Mar 2022 12:27:58 +0100
Subject: [PATCH 18/44] 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 069ff364aa834489404c429f5711ac2be979e0d4 Mon Sep 17 00:00:00 2001
From: yann300
Date: Wed, 23 Mar 2022 12:36:50 +0100
Subject: [PATCH 19/44] 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 d6bad4e7af9b01c8596cd7654d7233616b1f3162 Mon Sep 17 00:00:00 2001
From: yann300
Date: Wed, 23 Mar 2022 14:33:54 +0100
Subject: [PATCH 20/44] 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 ee5735f6edcfd762b180aac9e51ff8c0a610e52e Mon Sep 17 00:00:00 2001
From: yann300
Date: Thu, 24 Mar 2022 10:59:39 +0100
Subject: [PATCH 21/44] 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 b75aece2df57cd925c773919a6f201182ee2bbde Mon Sep 17 00:00:00 2001
From: yann300
Date: Thu, 24 Mar 2022 15:38:31 +0100
Subject: [PATCH 22/44] 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 33ca1498605c7eda8f665dac5cc7eaca2ce5fbd6 Mon Sep 17 00:00:00 2001
From: yann300
Date: Thu, 24 Mar 2022 15:38:51 +0100
Subject: [PATCH 23/44] 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 28d97cd89378561ea4089f65c7372d77816dc246 Mon Sep 17 00:00:00 2001
From: yann300
Date: Thu, 24 Mar 2022 16:10:25 +0100
Subject: [PATCH 24/44] 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 7f0ccc36fc8f87a2fdb1e8002345169e24a74748 Mon Sep 17 00:00:00 2001
From: yann300
Date: Fri, 25 Mar 2022 12:22:59 +0100
Subject: [PATCH 25/44] 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 3b29a3c468836d2ada15ebe7c1c203369f5043e2 Mon Sep 17 00:00:00 2001
From: yann300
Date: Fri, 25 Mar 2022 13:09:09 +0100
Subject: [PATCH 26/44] 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 19815d96aa5cb59cdf4c5d08142758db4759e82f Mon Sep 17 00:00:00 2001
From: yann300
Date: Fri, 25 Mar 2022 13:54:02 +0100
Subject: [PATCH 27/44] 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 e2d26b641a5c2409d0b7907315b614333d10f3b8 Mon Sep 17 00:00:00 2001
From: yann300
Date: Fri, 25 Mar 2022 14:27:22 +0100
Subject: [PATCH 28/44] 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 a3559f3d1d9d0281bb610b5919b8e2d3e7f94e59 Mon Sep 17 00:00:00 2001
From: yann300
Date: Sat, 26 Mar 2022 02:20:10 +0100
Subject: [PATCH 29/44] 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 f6e5142fc921004d0c0ca95a0f86f0f6f6eb934f Mon Sep 17 00:00:00 2001
From: yann300
Date: Sat, 26 Mar 2022 10:08:06 +0100
Subject: [PATCH 30/44] 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 7d7d525dc5e1ee312702d486b44fe5ddab3d091e Mon Sep 17 00:00:00 2001
From: yann300
Date: Mon, 4 Apr 2022 16:18:04 +0200
Subject: [PATCH 31/44] 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 eab5ad471f7aab6f229c9836ba2c22d76de2b8c9 Mon Sep 17 00:00:00 2001
From: yann300
Date: Mon, 4 Apr 2022 16:47:44 +0200
Subject: [PATCH 32/44] 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 e26fca712f0cff0d634ddc17f0830ea6bdc1ef8c Mon Sep 17 00:00:00 2001
From: yann300
Date: Mon, 4 Apr 2022 17:51:00 +0200
Subject: [PATCH 33/44] 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 0d122bffbd0b356e31cfa03e2057e9067985c1d0 Mon Sep 17 00:00:00 2001
From: yann300
Date: Mon, 4 Apr 2022 17:52:57 +0200
Subject: [PATCH 34/44] 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 e962fb37b772d9eb77e554681f7609c3f684a860 Mon Sep 17 00:00:00 2001
From: yann300
Date: Mon, 4 Apr 2022 21:28:15 +0200
Subject: [PATCH 35/44] 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')
}
From 6dc9e164eacc6abbfd158365af06060c57535482 Mon Sep 17 00:00:00 2001
From: Aniket-Engg
Date: Fri, 25 Mar 2022 19:57:35 +0530
Subject: [PATCH 36/44] check if import is a library
---
.../src/lib/remix-ui-static-analyser.tsx | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
index 6b7503af02..203c0dad89 100644
--- a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
+++ b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
@@ -171,12 +171,13 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
}
})
})
- result.report.map((item) => {
+ result.report.map(async (item) => {
let location: any = {}
let locationString = 'not available'
let column = 0
let row = 0
let fileName = currentFile
+ let isLibrary = false
if (item.location) {
const split = item.location.split(':')
const file = split[2]
@@ -195,6 +196,10 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
locationString = row + 1 + ':' + column + ':'
fileName = Object.keys(lastCompilationResult.sources)[file]
}
+ if(fileName !== currentFile) {
+ const {file, provider} = await props.analysisModule.call('fileManager', 'getPathFromUrl', fileName)
+ if (file.startsWith('.deps') || (provider.type === 'localhost' && file.startsWith('localhost/node_modules'))) isLibrary = true
+ }
warningCount++
const msg = message(result.name, item.warning, item.more, fileName, locationString)
const options = {
@@ -202,6 +207,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
useSpan: true,
errFile: fileName,
fileName,
+ isLibrary,
errLine: row,
errCol: column,
item: item,
@@ -255,6 +261,10 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
fileName = Object.keys(lastCompilationResult.sources)[fileIndex]
}
}
+ if(fileName !== currentFile) {
+ console.log('inside ------------Slither')
+ props.analysisModule.call('fileManager', 'getPathFromUrl', fileName).then(console.log)
+ }
warningCount++
const msg = message(item.title, item.description, item.more, fileName, locationString)
const options = {
From fa533a58d4c0de264cdf1db45f18b83569342a03 Mon Sep 17 00:00:00 2001
From: Aniket-Engg
Date: Thu, 31 Mar 2022 14:06:46 +0530
Subject: [PATCH 37/44] remix analysis report fix
---
.../src/solidity-analyzer/index.ts | 8 +++---
.../src/lib/remix-ui-static-analyser.tsx | 27 +++++++++----------
2 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/libs/remix-analyzer/src/solidity-analyzer/index.ts b/libs/remix-analyzer/src/solidity-analyzer/index.ts
index da6b5bb35e..d2c45ff635 100644
--- a/libs/remix-analyzer/src/solidity-analyzer/index.ts
+++ b/libs/remix-analyzer/src/solidity-analyzer/index.ts
@@ -15,13 +15,13 @@ export default class staticAnalysisRunner {
* @param toRun module indexes (compiled from remix IDE)
* @param callback callback
*/
- run (compilationResult: CompilationResult, toRun: number[], callback: ((reports: AnalysisReport[]) => void)): void {
+ run (compilationResult: CompilationResult, toRun: number[]): AnalysisReport[] {
const modules: ModuleObj[] = toRun.map((i) => {
const Module = this.modules()[i]
const m = new Module()
return { name: m.name, mod: m }
})
- this.runWithModuleList(compilationResult, modules, callback)
+ return this.runWithModuleList(compilationResult, modules)
}
/**
@@ -30,7 +30,7 @@ export default class staticAnalysisRunner {
* @param modules analysis module
* @param callback callback
*/
- runWithModuleList (compilationResult: CompilationResult, modules: ModuleObj[], callback: ((reports: AnalysisReport[]) => void)): void {
+ runWithModuleList (compilationResult: CompilationResult, modules: ModuleObj[]): AnalysisReport[] {
let reports: AnalysisReport[] = []
// Also provide convenience analysis via the AST walker.
const walker = new AstWalker()
@@ -64,7 +64,7 @@ export default class staticAnalysisRunner {
}
return { name: item.name, report: report }
}))
- callback(reports)
+ return reports
}
/**
diff --git a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
index 203c0dad89..8270e8e0e0 100644
--- a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
+++ b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
@@ -76,9 +76,12 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
useEffect(() => {
setWarningState({})
+ const runAnalysis = async () => {
+ await run(state.data, state.source, state.file)
+ }
if (autoRun) {
if (state.data !== null) {
- run(state.data, state.source, state.file)
+ runAnalysis().catch(console.error);
}
} else {
props.event.trigger('staticAnaysisWarning', [])
@@ -152,7 +155,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
setWarningState(groupedCategory)
}
- const run = (lastCompilationResult, lastCompilationSource, currentFile) => {
+ const run = async (lastCompilationResult, lastCompilationSource, currentFile) => {
if (state.data !== null) {
if (lastCompilationResult && (categoryIndex.length > 0 || slitherEnabled)) {
let warningCount = 0
@@ -161,8 +164,8 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
// Remix Analysis
_paq.push(['trackEvent', 'solidityStaticAnalyzer', 'analyzeWithRemixAnalyzer'])
- runner.run(lastCompilationResult, categoryIndex, results => {
- results.map((result) => {
+ const results = runner.run(lastCompilationResult, categoryIndex)
+ for (const result of results) {
let moduleName
Object.keys(groupedModules).map(key => {
groupedModules[key].forEach(el => {
@@ -171,7 +174,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
}
})
})
- result.report.map(async (item) => {
+ for (const item of result.report) {
let location: any = {}
let locationString = 'not available'
let column = 0
@@ -199,7 +202,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
if(fileName !== currentFile) {
const {file, provider} = await props.analysisModule.call('fileManager', 'getPathFromUrl', fileName)
if (file.startsWith('.deps') || (provider.type === 'localhost' && file.startsWith('localhost/node_modules'))) isLibrary = true
- }
+ }
warningCount++
const msg = message(result.name, item.warning, item.more, fileName, locationString)
const options = {
@@ -218,8 +221,8 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
}
warningErrors.push(options)
warningMessage.push({ msg, options, hasWarning: true, warningModuleName: moduleName })
- })
- })
+ }
+ }
// Slither Analysis
if (slitherEnabled) {
props.analysisModule.call('solidity', 'getCompilerState').then((compilerState) => {
@@ -261,10 +264,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
fileName = Object.keys(lastCompilationResult.sources)[fileIndex]
}
}
- if(fileName !== currentFile) {
- console.log('inside ------------Slither')
- props.analysisModule.call('fileManager', 'getPathFromUrl', fileName).then(console.log)
- }
+
warningCount++
const msg = message(item.title, item.description, item.more, fileName, locationString)
const options = {
@@ -295,7 +295,6 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
showWarnings(warningMessage, 'warningModuleName')
props.event.trigger('staticAnaysisWarning', [warningCount])
}
- })
} else {
if (categoryIndex.length) {
warningContainer.current.innerText = 'No compiled AST available'
@@ -436,7 +435,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
label="Autorun"
onChange={() => {}}
/>
-
{ showSlither &&
From af6479291048b2eddb93a4c6efcd3bc512b1acb5 Mon Sep 17 00:00:00 2001
From: Aniket-Engg
Date: Thu, 31 Mar 2022 14:17:53 +0530
Subject: [PATCH 38/44] fix remix-analyser tests
---
.../staticAnalysisIntegration-test-0.4.24.ts | 13 ++++++-------
.../staticAnalysisIntegration-test-0.5.0.ts | 13 ++++++-------
.../analysis/staticAnalysisIssues-test-0.4.24.ts | 7 +++----
.../analysis/staticAnalysisIssues-test-0.5.0.ts | 7 +++----
4 files changed, 18 insertions(+), 22 deletions(-)
diff --git a/libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.ts b/libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.ts
index 67607d7a35..8052a1870a 100644
--- a/libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.ts
+++ b/libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.ts
@@ -814,12 +814,11 @@ test('Integration test forLoopIteratesOverDynamicArray module', function (t: tes
function runModuleOnFiles (Module: any, t: test.Test, cb: ((fname: string, report: AnalysisReportObj[]) => void)): void {
const statRunner: StatRunner = new StatRunner()
testFiles.forEach((fileName: string) => {
- statRunner.runWithModuleList(compilationResults[fileName], [{ name: new Module().name, mod: new Module() }], (reports: AnalysisReport[]) => {
- let report: AnalysisReportObj[] = reports[0].report
- if (report.some((x: AnalysisReportObj) => x.warning.includes('INTERNAL ERROR'))) {
- t.comment('Error while executing Module: ' + JSON.stringify(report))
- }
- cb(fileName, report)
- })
+ const reports = statRunner.runWithModuleList(compilationResults[fileName], [{ name: new Module().name, mod: new Module() }])
+ let report: AnalysisReportObj[] = reports[0].report
+ if (report.some((x: AnalysisReportObj) => x.warning.includes('INTERNAL ERROR'))) {
+ t.comment('Error while executing Module: ' + JSON.stringify(report))
+ }
+ cb(fileName, report)
})
}
diff --git a/libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts b/libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
index 780cfa2b63..aa14866a69 100644
--- a/libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
+++ b/libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
@@ -816,12 +816,11 @@ test('Integration test forLoopIteratesOverDynamicArray module', function (t: tes
function runModuleOnFiles (Module: any, t: test.Test, cb: ((fname: string, report: AnalysisReportObj[]) => void)): void {
const statRunner: StatRunner = new StatRunner()
testFiles.forEach((fileName: string) => {
- statRunner.runWithModuleList(compilationResults[fileName], [{ name: new Module().name, mod: new Module() }], (reports: AnalysisReport[]) => {
- let report: AnalysisReportObj[] = reports[0].report
- if (report.some((x: AnalysisReportObj) => x['warning'].includes('INTERNAL ERROR'))) {
- t.comment('Error while executing Module: ' + JSON.stringify(report))
- }
- cb(fileName, report)
- })
+ const reports = statRunner.runWithModuleList(compilationResults[fileName], [{ name: new Module().name, mod: new Module() }])
+ let report: AnalysisReportObj[] = reports[0].report
+ if (report.some((x: AnalysisReportObj) => x['warning'].includes('INTERNAL ERROR'))) {
+ t.comment('Error while executing Module: ' + JSON.stringify(report))
+ }
+ cb(fileName, report)
})
}
diff --git a/libs/remix-analyzer/test/analysis/staticAnalysisIssues-test-0.4.24.ts b/libs/remix-analyzer/test/analysis/staticAnalysisIssues-test-0.4.24.ts
index de6303ef89..2a6091dc32 100644
--- a/libs/remix-analyzer/test/analysis/staticAnalysisIssues-test-0.4.24.ts
+++ b/libs/remix-analyzer/test/analysis/staticAnalysisIssues-test-0.4.24.ts
@@ -31,10 +31,9 @@ test('staticAnalysisIssues.functionParameterPassingError', function (t) {
const statRunner: StatRunner = new StatRunner()
t.doesNotThrow(() => {
- statRunner.runWithModuleList(res, [{ name: new Module().name, mod: new Module() }], (reports: AnalysisReport[]) => {})
+ statRunner.runWithModuleList(res, [{ name: new Module().name, mod: new Module()}])
}, 'Analysis should not throw')
- statRunner.runWithModuleList(res, [{ name: new Module().name, mod: new Module() }], (reports: AnalysisReport[]) => {
- t.ok(!reports.some((mod: AnalysisReport) => mod.report.some((rep: AnalysisReportObj) => rep.warning.includes('INTERNAL ERROR')), 'Should not have internal errors'))
- })
+ const reports = statRunner.runWithModuleList(res, [{ name: new Module().name, mod: new Module()}])
+ t.ok(!reports.some((mod: AnalysisReport) => mod.report.some((rep: AnalysisReportObj) => rep.warning.includes('INTERNAL ERROR')), 'Should not have internal errors'))
})
diff --git a/libs/remix-analyzer/test/analysis/staticAnalysisIssues-test-0.5.0.ts b/libs/remix-analyzer/test/analysis/staticAnalysisIssues-test-0.5.0.ts
index beac78be6d..43234e4168 100644
--- a/libs/remix-analyzer/test/analysis/staticAnalysisIssues-test-0.5.0.ts
+++ b/libs/remix-analyzer/test/analysis/staticAnalysisIssues-test-0.5.0.ts
@@ -31,10 +31,9 @@ test('staticAnalysisIssues.functionParameterPassingError', function (t) {
const statRunner: StatRunner = new StatRunner()
t.doesNotThrow(() => {
- statRunner.runWithModuleList(res, [{ name: new Module().name, mod: new Module() }], (reports: AnalysisReport[]) => {})
+ statRunner.runWithModuleList(res, [{ name: new Module().name, mod: new Module() }])
}, 'Analysis should not throw')
- statRunner.runWithModuleList(res, [{ name: new Module().name, mod: new Module() }], (reports: AnalysisReport[]) => {
- t.ok(!reports.some((mod: AnalysisReport) => mod.report.some((rep: AnalysisReportObj) => rep.warning.includes('INTERNAL ERROR')), 'Should not have internal errors'))
- })
+ const reports = statRunner.runWithModuleList(res, [{ name: new Module().name, mod: new Module() }])
+ t.ok(!reports.some((mod: AnalysisReport) => mod.report.some((rep: AnalysisReportObj) => rep.warning.includes('INTERNAL ERROR')), 'Should not have internal errors'))
})
From ffa94f6f232f3212c7477d94675f0bfbfe333513 Mon Sep 17 00:00:00 2001
From: Aniket-Engg
Date: Thu, 31 Mar 2022 19:17:01 +0530
Subject: [PATCH 39/44] filter lib analysis using checkbox
---
.../src/lib/remix-ui-static-analyser.tsx | 32 +++++++++++++++++--
1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
index 8270e8e0e0..6ff31797fb 100644
--- a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
+++ b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
@@ -1,4 +1,4 @@
-import React, { useEffect, useState, useReducer } from 'react' // eslint-disable-line
+import React, { useEffect, useState, useReducer, useRef } from 'react' // eslint-disable-line
import Button from './Button/StaticAnalyserButton' // eslint-disable-line
import { util } from '@remix-project/remix-lib'
import _ from 'lodash'
@@ -64,10 +64,12 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
const [autoRun, setAutoRun] = useState(true)
const [slitherEnabled, setSlitherEnabled] = useState(false)
const [showSlither, setShowSlither] = useState(false)
+ const [showLibsWarning, setShowLibsWarning] = useState(false)
const [categoryIndex, setCategoryIndex] = useState(groupedModuleIndex(groupedModules))
-
- const warningContainer = React.useRef(null)
const [warningState, setWarningState] = useState({})
+
+ const warningContainer = useRef(null)
+ const allWarnings = useRef({})
const [state, dispatch] = useReducer(analysisReducer, initialState)
useEffect(() => {
@@ -152,6 +154,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
}
const groupedCategory = groupBy(resultArray, groupByKey)
+ allWarnings.current = groupedCategory
setWarningState(groupedCategory)
}
@@ -355,6 +358,21 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
}
}
+ const handleShowLibsWarning = () => {
+ if (showLibsWarning) setShowLibsWarning(false)
+ else setShowLibsWarning(true)
+ let newWarningState = {}
+ for (const category in allWarnings.current) {
+ const warnings = allWarnings.current[category]
+ newWarningState[category] = []
+ for (const warning of warnings) {
+ if (showLibsWarning && warning.options.isLibrary) newWarningState[category].push(warning)
+ else if (!showLibsWarning && !warning.options.isLibrary) newWarningState[category].push(warning)
+ }
+ }
+ setWarningState(newWarningState)
+ }
+
const categoryItem = (categoryId, item, i) => {
return (
@@ -478,6 +496,14 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
{state.file}
+ {}}
+ />
{Object.entries(warningState).length > 0 &&
From 7fe64f0a4fc1e8e708e0a607ecc40976a1de747f Mon Sep 17 00:00:00 2001
From: Aniket-Engg
Date: Thu, 31 Mar 2022 19:33:18 +0530
Subject: [PATCH 40/44] fixes label and count
---
.../src/lib/remix-ui-static-analyser.tsx | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
index 6ff31797fb..f719f210e9 100644
--- a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
+++ b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
@@ -64,7 +64,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
const [autoRun, setAutoRun] = useState(true)
const [slitherEnabled, setSlitherEnabled] = useState(false)
const [showSlither, setShowSlither] = useState(false)
- const [showLibsWarning, setShowLibsWarning] = useState(false)
+ const [showLibsWarning, setShowLibsWarning] = useState(true)
const [categoryIndex, setCategoryIndex] = useState(groupedModuleIndex(groupedModules))
const [warningState, setWarningState] = useState({})
@@ -362,14 +362,22 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
if (showLibsWarning) setShowLibsWarning(false)
else setShowLibsWarning(true)
let newWarningState = {}
+ let newWarningCount = 0
for (const category in allWarnings.current) {
const warnings = allWarnings.current[category]
newWarningState[category] = []
for (const warning of warnings) {
- if (showLibsWarning && warning.options.isLibrary) newWarningState[category].push(warning)
- else if (!showLibsWarning && !warning.options.isLibrary) newWarningState[category].push(warning)
+ if (showLibsWarning && warning.options.isLibrary) {
+ newWarningCount++
+ newWarningState[category].push(warning)
+ }
+ else if (!showLibsWarning && !warning.options.isLibrary) {
+ newWarningCount++
+ newWarningState[category].push(warning)
+ }
}
}
+ props.event.trigger('staticAnaysisWarning', [newWarningCount])
setWarningState(newWarningState)
}
@@ -511,7 +519,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
{
(Object.entries(warningState).map((element, index) => (
-
{element[0]}
+ {element[1]['length'] > 0 ?
{element[0]} : null}
{element[1]['map']((x, i) => ( // eslint-disable-line dot-notation
x.hasWarning ? ( // eslint-disable-next-line dot-notation
From 1ee813770ba46c0a9f176230a2bf53a4819f5edc Mon Sep 17 00:00:00 2001
From: Aniket-Engg
Date: Fri, 1 Apr 2022 11:44:05 +0530
Subject: [PATCH 41/44] filter warnings
---
.../src/lib/remix-ui-static-analyser.tsx | 74 +++++++++++--------
1 file changed, 42 insertions(+), 32 deletions(-)
diff --git a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
index f719f210e9..5cdeb61483 100644
--- a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
+++ b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
@@ -64,7 +64,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
const [autoRun, setAutoRun] = useState(true)
const [slitherEnabled, setSlitherEnabled] = useState(false)
const [showSlither, setShowSlither] = useState(false)
- const [showLibsWarning, setShowLibsWarning] = useState(true)
+ let [showLibsWarning, setShowLibsWarning] = useState(false)
const [categoryIndex, setCategoryIndex] = useState(groupedModuleIndex(groupedModules))
const [warningState, setWarningState] = useState({})
@@ -136,6 +136,30 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
)
}
+ const filterWarnings = () => {
+ let newWarningState = {}
+ let newWarningCount = 0
+ if (showLibsWarning) {
+ for (const category in allWarnings.current)
+ newWarningCount = newWarningCount + allWarnings.current[category].length
+ newWarningState = allWarnings.current
+ }
+ else {
+ for (const category in allWarnings.current) {
+ const warnings = allWarnings.current[category]
+ newWarningState[category] = []
+ for (const warning of warnings) {
+ if (!warning.options.isLibrary) {
+ newWarningCount++
+ newWarningState[category].push(warning)
+ }
+ }
+ }
+ }
+ props.event.trigger('staticAnaysisWarning', [newWarningCount])
+ setWarningState(newWarningState)
+ }
+
const showWarnings = (warningMessage, groupByKey) => {
const resultArray = []
warningMessage.map(x => {
@@ -155,7 +179,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
const groupedCategory = groupBy(resultArray, groupByKey)
allWarnings.current = groupedCategory
- setWarningState(groupedCategory)
+ filterWarnings()
}
const run = async (lastCompilationResult, lastCompilationSource, currentFile) => {
@@ -206,7 +230,6 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
const {file, provider} = await props.analysisModule.call('fileManager', 'getPathFromUrl', fileName)
if (file.startsWith('.deps') || (provider.type === 'localhost' && file.startsWith('localhost/node_modules'))) isLibrary = true
}
- warningCount++
const msg = message(result.name, item.warning, item.more, fileName, locationString)
const options = {
type: 'warning',
@@ -296,7 +319,6 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
})
} else {
showWarnings(warningMessage, 'warningModuleName')
- props.event.trigger('staticAnaysisWarning', [warningCount])
}
} else {
if (categoryIndex.length) {
@@ -359,26 +381,14 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
}
const handleShowLibsWarning = () => {
- if (showLibsWarning) setShowLibsWarning(false)
- else setShowLibsWarning(true)
- let newWarningState = {}
- let newWarningCount = 0
- for (const category in allWarnings.current) {
- const warnings = allWarnings.current[category]
- newWarningState[category] = []
- for (const warning of warnings) {
- if (showLibsWarning && warning.options.isLibrary) {
- newWarningCount++
- newWarningState[category].push(warning)
- }
- else if (!showLibsWarning && !warning.options.isLibrary) {
- newWarningCount++
- newWarningState[category].push(warning)
- }
- }
+ if (showLibsWarning) {
+ showLibsWarning = false
+ setShowLibsWarning(false)
+ } else {
+ showLibsWarning = true
+ setShowLibsWarning(true)
}
- props.event.trigger('staticAnaysisWarning', [newWarningCount])
- setWarningState(newWarningState)
+ filterWarnings()
}
const categoryItem = (categoryId, item, i) => {
@@ -504,17 +514,17 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
{state.file}
-
{}}
- />
-
{Object.entries(warningState).length > 0 &&
+
{}}
+ />
+
{
(Object.entries(warningState).map((element, index) => (
From d3b475d628739fe57153e55cbaf4fcf422aab780 Mon Sep 17 00:00:00 2001
From: Aniket-Engg
Date: Fri, 1 Apr 2022 12:18:13 +0530
Subject: [PATCH 42/44] filter slither warnings
---
.../src/lib/remix-ui-static-analyser.tsx | 241 +++++++++---------
1 file changed, 121 insertions(+), 120 deletions(-)
diff --git a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
index 5cdeb61483..c9be9bc3a1 100644
--- a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
+++ b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
@@ -64,7 +64,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
const [autoRun, setAutoRun] = useState(true)
const [slitherEnabled, setSlitherEnabled] = useState(false)
const [showSlither, setShowSlither] = useState(false)
- let [showLibsWarning, setShowLibsWarning] = useState(false)
+ let [showLibsWarning, setShowLibsWarning] = useState(false) // eslint-disable-line prefer-const
const [categoryIndex, setCategoryIndex] = useState(groupedModuleIndex(groupedModules))
const [warningState, setWarningState] = useState({})
@@ -185,141 +185,142 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
const run = async (lastCompilationResult, lastCompilationSource, currentFile) => {
if (state.data !== null) {
if (lastCompilationResult && (categoryIndex.length > 0 || slitherEnabled)) {
- let warningCount = 0
const warningMessage = []
const warningErrors = []
// Remix Analysis
_paq.push(['trackEvent', 'solidityStaticAnalyzer', 'analyzeWithRemixAnalyzer'])
const results = runner.run(lastCompilationResult, categoryIndex)
- for (const result of results) {
- let moduleName
- Object.keys(groupedModules).map(key => {
- groupedModules[key].forEach(el => {
- if (el.name === result.name) {
- moduleName = groupedModules[key][0].categoryDisplayName
- }
- })
- })
- for (const item of result.report) {
- let location: any = {}
- let locationString = 'not available'
- let column = 0
- let row = 0
- let fileName = currentFile
- let isLibrary = false
- if (item.location) {
- const split = item.location.split(':')
- const file = split[2]
- location = {
- start: parseInt(split[0]),
- length: parseInt(split[1])
- }
- location = props.analysisModule._deps.offsetToLineColumnConverter.offsetToLineColumn(
- location,
- parseInt(file),
- lastCompilationSource.sources,
- lastCompilationResult.sources
- )
- row = location.start.line
- column = location.start.column
- locationString = row + 1 + ':' + column + ':'
- fileName = Object.keys(lastCompilationResult.sources)[file]
+ for (const result of results) {
+ let moduleName
+ Object.keys(groupedModules).map(key => {
+ groupedModules[key].forEach(el => {
+ if (el.name === result.name) {
+ moduleName = groupedModules[key][0].categoryDisplayName
}
- if(fileName !== currentFile) {
- const {file, provider} = await props.analysisModule.call('fileManager', 'getPathFromUrl', fileName)
- if (file.startsWith('.deps') || (provider.type === 'localhost' && file.startsWith('localhost/node_modules'))) isLibrary = true
- }
- const msg = message(result.name, item.warning, item.more, fileName, locationString)
- const options = {
- type: 'warning',
- useSpan: true,
- errFile: fileName,
- fileName,
- isLibrary,
- errLine: row,
- errCol: column,
- item: item,
- name: result.name,
- locationString,
- more: item.more,
- location: location
+ })
+ })
+ for (const item of result.report) {
+ let location: any = {}
+ let locationString = 'not available'
+ let column = 0
+ let row = 0
+ let fileName = currentFile
+ let isLibrary = false
+
+ if (item.location) {
+ const split = item.location.split(':')
+ const file = split[2]
+ location = {
+ start: parseInt(split[0]),
+ length: parseInt(split[1])
}
- warningErrors.push(options)
- warningMessage.push({ msg, options, hasWarning: true, warningModuleName: moduleName })
+ location = props.analysisModule._deps.offsetToLineColumnConverter.offsetToLineColumn(
+ location,
+ parseInt(file),
+ lastCompilationSource.sources,
+ lastCompilationResult.sources
+ )
+ row = location.start.line
+ column = location.start.column
+ locationString = row + 1 + ':' + column + ':'
+ fileName = Object.keys(lastCompilationResult.sources)[file]
+ }
+ if(fileName !== currentFile) {
+ const {file, provider} = await props.analysisModule.call('fileManager', 'getPathFromUrl', fileName)
+ if (file.startsWith('.deps') || (provider.type === 'localhost' && file.startsWith('localhost/node_modules'))) isLibrary = true
+ }
+ const msg = message(result.name, item.warning, item.more, fileName, locationString)
+ const options = {
+ type: 'warning',
+ useSpan: true,
+ errFile: fileName,
+ fileName,
+ isLibrary,
+ errLine: row,
+ errCol: column,
+ item: item,
+ name: result.name,
+ locationString,
+ more: item.more,
+ location: location
}
+ warningErrors.push(options)
+ warningMessage.push({ msg, options, hasWarning: true, warningModuleName: moduleName })
}
- // Slither Analysis
- if (slitherEnabled) {
- props.analysisModule.call('solidity', 'getCompilerState').then((compilerState) => {
- const { currentVersion, optimize, evmVersion } = compilerState
- props.analysisModule.call('terminal', 'log', { type: 'info', value: '[Slither Analysis]: Running...' })
- _paq.push(['trackEvent', 'solidityStaticAnalyzer', 'analyzeWithSlither'])
- props.analysisModule.call('slither', 'analyse', state.file, { currentVersion, optimize, evmVersion }).then(async (result) => {
- if (result.status) {
- props.analysisModule.call('terminal', 'log', { type: 'info', value: `[Slither Analysis]: Analysis Completed!! ${result.count} warnings found.` })
- const report = result.data
- for (const item of report) {
- let location: any = {}
- let locationString = 'not available'
- let column = 0
- let row = 0
- let fileName = currentFile
-
- if (item.sourceMap && item.sourceMap.length) {
- let path = item.sourceMap[0].source_mapping.filename_relative
- let fileIndex = Object.keys(lastCompilationResult.sources).indexOf(path)
- if (fileIndex === -1) {
- path = await props.analysisModule.call('fileManager', 'getUrlFromPath', path)
- fileIndex = Object.keys(lastCompilationResult.sources).indexOf(path.file)
- }
- if (fileIndex >= 0) {
- location = {
- start: item.sourceMap[0].source_mapping.start,
- length: item.sourceMap[0].source_mapping.length
- }
- location = props.analysisModule._deps.offsetToLineColumnConverter.offsetToLineColumn(
- location,
- fileIndex,
- lastCompilationSource.sources,
- lastCompilationResult.sources
- )
- row = location.start.line
- column = location.start.column
- locationString = row + 1 + ':' + column + ':'
- fileName = Object.keys(lastCompilationResult.sources)[fileIndex]
- }
- }
+ }
+ // Slither Analysis
+ if (slitherEnabled) {
+ try {
+ const compilerState = await props.analysisModule.call('solidity', 'getCompilerState')
+ const { currentVersion, optimize, evmVersion } = compilerState
+ await props.analysisModule.call('terminal', 'log', { type: 'info', value: '[Slither Analysis]: Running...' })
+ _paq.push(['trackEvent', 'solidityStaticAnalyzer', 'analyzeWithSlither'])
+ const result = await props.analysisModule.call('slither', 'analyse', state.file, { currentVersion, optimize, evmVersion })
+ if (result.status) {
+ props.analysisModule.call('terminal', 'log', { type: 'info', value: `[Slither Analysis]: Analysis Completed!! ${result.count} warnings found.` })
+ const report = result.data
+ for (const item of report) {
+ let location: any = {}
+ let locationString = 'not available'
+ let column = 0
+ let row = 0
+ let fileName = currentFile
+ let isLibrary = false
- warningCount++
- const msg = message(item.title, item.description, item.more, fileName, locationString)
- const options = {
- type: 'warning',
- useSpan: true,
- errFile: fileName,
- fileName,
- errLine: row,
- errCol: column,
- item: { warning: item.description },
- name: item.title,
- locationString,
- more: item.more,
- location: location
+ if (item.sourceMap && item.sourceMap.length) {
+ let path = item.sourceMap[0].source_mapping.filename_relative
+ let fileIndex = Object.keys(lastCompilationResult.sources).indexOf(path)
+ if (fileIndex === -1) {
+ path = await props.analysisModule.call('fileManager', 'getUrlFromPath', path)
+ fileIndex = Object.keys(lastCompilationResult.sources).indexOf(path.file)
+ }
+ if (fileIndex >= 0) {
+ location = {
+ start: item.sourceMap[0].source_mapping.start,
+ length: item.sourceMap[0].source_mapping.length
}
- warningErrors.push(options)
- warningMessage.push({ msg, options, hasWarning: true, warningModuleName: 'Slither Analysis' })
+ location = props.analysisModule._deps.offsetToLineColumnConverter.offsetToLineColumn(
+ location,
+ fileIndex,
+ lastCompilationSource.sources,
+ lastCompilationResult.sources
+ )
+ row = location.start.line
+ column = location.start.column
+ locationString = row + 1 + ':' + column + ':'
+ fileName = Object.keys(lastCompilationResult.sources)[fileIndex]
}
- showWarnings(warningMessage, 'warningModuleName')
- props.event.trigger('staticAnaysisWarning', [warningCount])
}
- }).catch(() => {
- props.analysisModule.call('terminal', 'log', { type: 'error', value: '[Slither Analysis]: Error occured! See remixd console for details.' })
- showWarnings(warningMessage, 'warningModuleName')
- })
- })
- } else {
+ if(fileName !== currentFile) {
+ const {file, provider} = await props.analysisModule.call('fileManager', 'getPathFromUrl', fileName)
+ if (file.startsWith('.deps') || (provider.type === 'localhost' && file.startsWith('localhost/node_modules'))) isLibrary = true
+ }
+ const msg = message(item.title, item.description, item.more, fileName, locationString)
+ const options = {
+ type: 'warning',
+ useSpan: true,
+ errFile: fileName,
+ fileName,
+ isLibrary,
+ errLine: row,
+ errCol: column,
+ item: { warning: item.description },
+ name: item.title,
+ locationString,
+ more: item.more,
+ location: location
+ }
+ warningErrors.push(options)
+ warningMessage.push({ msg, options, hasWarning: true, warningModuleName: 'Slither Analysis' })
+ }
+ showWarnings(warningMessage, 'warningModuleName')
+ }
+ } catch(error) {
+ props.analysisModule.call('terminal', 'log', { type: 'error', value: '[Slither Analysis]: Error occured! See remixd console for details.' })
showWarnings(warningMessage, 'warningModuleName')
}
+ } else showWarnings(warningMessage, 'warningModuleName')
} else {
if (categoryIndex.length) {
warningContainer.current.innerText = 'No compiled AST available'
From 641294934aa43b0d8a4ee5a64bd1c22edfb8246a Mon Sep 17 00:00:00 2001
From: Aniket-Engg
Date: Fri, 1 Apr 2022 18:13:52 +0530
Subject: [PATCH 43/44] e2e tests for filtering analysis
---
.../src/tests/staticAnalysis.test.ts | 28 +++++++++++++++----
.../src/lib/remix-ui-static-analyser.tsx | 2 ++
2 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts b/apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts
index 504148b266..2a2b39b523 100644
--- a/apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts
+++ b/apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts
@@ -30,6 +30,27 @@ module.exports = {
},
'Static Analysis': function (browser: NightwatchBrowser) {
runTests(browser)
+ },
+ 'run analysis and filter results': function (browser: NightwatchBrowser) {
+ browser
+ .clickLaunchIcon('filePanel')
+ .click('*[data-id="treeViewLitreeViewItemcontracts"]')
+ .click('*[data-id="treeViewLitreeViewItemcontracts/2_Owner.sol"]')
+ .clickLaunchIcon('solidity')
+ .pause(10000)
+ .clickLaunchIcon('solidityStaticAnalysis')
+ .waitForElementPresent('#staticanalysisresult .warning', 5000)
+ .assert.containsText('#verticalIconsKindsolidityStaticAnalysis .remixui_status', '1') // Check warning count
+ .verify.elementPresent('input[name="showLibWarnings"]')
+ .verify.elementNotPresent('input[name="showLibWarnings"]:checked')
+ .verify.elementPresent('label[id="headingshowLibWarnings"]')
+ .click('label[id="headingshowLibWarnings"]')
+ .pause(1000)
+ .assert.containsText('#verticalIconsKindsolidityStaticAnalysis .remixui_status', '382')
+ .click('label[id="headingshowLibWarnings"]')
+ .pause(1000)
+ .assert.containsText('#verticalIconsKindsolidityStaticAnalysis .remixui_status', '1')
+ .end()
}
}
@@ -47,14 +68,12 @@ function runTests (browser: NightwatchBrowser) {
'TooMuchGas.() : Variables have very similar names "test" and "test1".',
'TooMuchGas.() : Variables have very similar names "test" and "test1".'],
'#staticanalysisresult .warning',
- browser, function () {
- browser.end()
- }
+ browser
)
})
}
-function listSelectorContains (textsToFind: string[], selector: string, browser: NightwatchBrowser, callback: VoidFunction) {
+function listSelectorContains (textsToFind: string[], selector: string, browser: NightwatchBrowser) {
browser.execute(function (selector) {
const items = document.querySelectorAll(selector)
const ret = []
@@ -68,6 +87,5 @@ function listSelectorContains (textsToFind: string[], selector: string, browser:
console.log('testing `' + result.value[k] + '` against `' + textsToFind[k] + '`')
browser.assert.equal(result.value[k].indexOf(textsToFind[k]) !== -1, true)
}
- callback()
})
}
diff --git a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
index c9be9bc3a1..f7665c41f6 100644
--- a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
+++ b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
@@ -519,6 +519,8 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
Date: Mon, 4 Apr 2022 18:21:10 +0530
Subject: [PATCH 44/44] title for checkboxes
---
libs/remix-ui/checkbox/src/lib/remix-ui-checkbox.tsx | 4 +++-
.../static-analyser/src/lib/remix-ui-static-analyser.tsx | 5 ++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/libs/remix-ui/checkbox/src/lib/remix-ui-checkbox.tsx b/libs/remix-ui/checkbox/src/lib/remix-ui-checkbox.tsx
index 95913e533b..4b0d4fa9be 100644
--- a/libs/remix-ui/checkbox/src/lib/remix-ui-checkbox.tsx
+++ b/libs/remix-ui/checkbox/src/lib/remix-ui-checkbox.tsx
@@ -12,6 +12,7 @@ export interface RemixUiCheckboxProps {
id?: string
itemName?: string
categoryId?: string
+ title?: string
visibility?: string
display?: string
}
@@ -26,11 +27,12 @@ export const RemixUiCheckbox = ({
onChange,
itemName,
categoryId,
+ title,
visibility,
display = 'flex'
}: RemixUiCheckboxProps) => {
return (
-