Merge pull request #3510 from ethereum/custom-fork

Resolve pending requests to remix-simulator after initialization is completed
pull/5370/head
yann300 2 years ago committed by GitHub
commit f0d7005408
  1. 8
      libs/ghaction-helper/package.json
  2. 24
      libs/ghaction-helper/src/methods.ts
  3. 8
      libs/remix-analyzer/package.json
  4. 6
      libs/remix-astwalker/package.json
  5. 12
      libs/remix-debug/package.json
  6. 4
      libs/remix-lib/package.json
  7. 6
      libs/remix-simulator/package.json
  8. 18
      libs/remix-simulator/src/provider.ts
  9. 6
      libs/remix-solidity/package.json
  10. 10
      libs/remix-tests/package.json
  11. 5
      libs/remix-tests/src/run.ts
  12. 3
      libs/remix-tests/src/runTestFiles.ts
  13. 1
      libs/remix-tests/tests/testRunner.cli.spec.ts
  14. 4
      libs/remix-url-resolver/package.json
  15. 4
      libs/remix-ws-templates/package.json

@ -1,6 +1,6 @@
{
"name": "@remix-project/ghaction-helper",
"version": "0.1.7-alpha.10",
"version": "0.1.7-alpha.17",
"description": "Solidity Tests GitHub Action Helper",
"main": "src/index.js",
"scripts": {
@ -19,17 +19,17 @@
},
"homepage": "https://github.com/ethereum/remix-project#readme",
"devDependencies": {
"@remix-project/remix-solidity": "^0.5.11-alpha.10",
"@remix-project/remix-solidity": "^0.5.11-alpha.17",
"@types/chai": "^4.3.4",
"typescript": "^4.9.3"
},
"dependencies": {
"@ethereum-waffle/chai": "^3.4.4",
"@remix-project/remix-simulator": "^0.2.25-alpha.10",
"@remix-project/remix-simulator": "^0.2.25-alpha.17",
"chai": "^4.3.7",
"ethers": "^5.7.2",
"web3": "^1.5.3"
},
"types": "./src/index.d.ts",
"gitHead": "4ea0d9afb03f04df480fdc57a60b8f85b771ed7c"
"gitHead": "4806543bb099b558872793ca7a215468e0bffc81"
}

@ -5,20 +5,18 @@ import { getArtifactsByContractName } from './artifacts-helper'
import { SignerWithAddress } from './signer'
import Web3 from "web3"
(async () => {
const providerConfig = {
fork: global.fork || null,
nodeUrl: global.nodeUrl || null,
blockNumber: global.blockNumber || null
}
const providerConfig = {
fork: global.fork || null,
nodeUrl: global.nodeUrl || null,
blockNumber: global.blockNumber || null
}
global.remixProvider = new Provider(providerConfig)
await global.remixProvider.init()
global.web3Provider = new ethers.providers.Web3Provider(global.remixProvider)
global.provider = global.web3Provider
global.ethereum = global.web3Provider
global.web3 = new Web3(global.web3Provider)
})()
global.remixProvider = new Provider(providerConfig)
global.remixProvider.init()
global.web3Provider = new ethers.providers.Web3Provider(global.remixProvider)
global.provider = global.web3Provider
global.ethereum = global.web3Provider
global.web3 = new Web3(global.web3Provider)
const isFactoryOptions = (signerOrOptions: any) => {
if (!signerOrOptions || signerOrOptions === undefined || signerOrOptions instanceof ethers.Signer) return false

@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-analyzer",
"version": "0.5.34-alpha.10",
"version": "0.5.34-alpha.17",
"description": "Tool to perform static analysis on Solidity smart contracts",
"scripts": {
"test": "./../../node_modules/.bin/ts-node --project ../../tsconfig.base.json --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts"
@ -25,8 +25,8 @@
"@ethereumjs/tx": "^4.0.2",
"@ethereumjs/util": "^8.0.3",
"@ethereumjs/vm": "^6.3.0",
"@remix-project/remix-astwalker": "^0.0.55-alpha.10",
"@remix-project/remix-lib": "^0.5.25-alpha.10",
"@remix-project/remix-astwalker": "^0.0.55-alpha.17",
"@remix-project/remix-lib": "^0.5.25-alpha.17",
"async": "^2.6.2",
"ethers": "^5.4.2",
"ethjs-util": "^0.1.6",
@ -50,6 +50,6 @@
"typescript": "^3.7.5"
},
"typings": "src/index.d.ts",
"gitHead": "4ea0d9afb03f04df480fdc57a60b8f85b771ed7c",
"gitHead": "4806543bb099b558872793ca7a215468e0bffc81",
"main": "./src/index.js"
}

@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-astwalker",
"version": "0.0.55-alpha.10",
"version": "0.0.55-alpha.17",
"description": "Tool to walk through Solidity AST",
"main": "src/index.js",
"scripts": {
@ -37,7 +37,7 @@
"@ethereumjs/tx": "^4.0.2",
"@ethereumjs/util": "^8.0.3",
"@ethereumjs/vm": "^6.3.0",
"@remix-project/remix-lib": "^0.5.25-alpha.10",
"@remix-project/remix-lib": "^0.5.25-alpha.17",
"@types/tape": "^4.2.33",
"async": "^2.6.2",
"ethers": "^5.4.2",
@ -53,6 +53,6 @@
"tap-spec": "^5.0.0"
},
"typings": "src/index.d.ts",
"gitHead": "4ea0d9afb03f04df480fdc57a60b8f85b771ed7c",
"gitHead": "4806543bb099b558872793ca7a215468e0bffc81",
"types": "./src/index.d.ts"
}

@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-debug",
"version": "0.5.25-alpha.10",
"version": "0.5.25-alpha.17",
"description": "Tool to debug Ethereum transactions",
"contributors": [
{
@ -26,10 +26,10 @@
"@ethereumjs/tx": "^4.0.2",
"@ethereumjs/util": "^8.0.3",
"@ethereumjs/vm": "^6.3.0",
"@remix-project/remix-astwalker": "^0.0.55-alpha.10",
"@remix-project/remix-lib": "^0.5.25-alpha.10",
"@remix-project/remix-simulator": "^0.2.25-alpha.10",
"@remix-project/remix-solidity": "^0.5.11-alpha.10",
"@remix-project/remix-astwalker": "^0.0.55-alpha.17",
"@remix-project/remix-lib": "^0.5.25-alpha.17",
"@remix-project/remix-simulator": "^0.2.25-alpha.17",
"@remix-project/remix-solidity": "^0.5.11-alpha.17",
"ansi-gray": "^0.1.1",
"async": "^2.6.2",
"color-support": "^1.1.3",
@ -69,6 +69,6 @@
},
"homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-debug#readme",
"typings": "src/index.d.ts",
"gitHead": "4ea0d9afb03f04df480fdc57a60b8f85b771ed7c",
"gitHead": "4806543bb099b558872793ca7a215468e0bffc81",
"types": "./src/index.d.ts"
}

@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-lib",
"version": "0.5.25-alpha.10",
"version": "0.5.25-alpha.17",
"description": "Library to various Remix tools",
"contributors": [
{
@ -51,6 +51,6 @@
},
"homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-lib#readme",
"typings": "src/index.d.ts",
"gitHead": "4ea0d9afb03f04df480fdc57a60b8f85b771ed7c",
"gitHead": "4806543bb099b558872793ca7a215468e0bffc81",
"types": "./src/index.d.ts"
}

@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-simulator",
"version": "0.2.25-alpha.10",
"version": "0.2.25-alpha.17",
"description": "Ethereum IDE and tools for the web",
"contributors": [
{
@ -22,7 +22,7 @@
"@ethereumjs/tx": "^4.0.2",
"@ethereumjs/util": "^8.0.3",
"@ethereumjs/vm": "^6.3.0",
"@remix-project/remix-lib": "^0.5.25-alpha.10",
"@remix-project/remix-lib": "^0.5.25-alpha.17",
"ansi-gray": "^0.1.1",
"async": "^3.1.0",
"body-parser": "^1.18.2",
@ -67,6 +67,6 @@
},
"homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-simulator#readme",
"typings": "src/index.d.ts",
"gitHead": "4ea0d9afb03f04df480fdc57a60b8f85b771ed7c",
"gitHead": "4806543bb099b558872793ca7a215468e0bffc81",
"types": "./src/index.d.ts"
}

@ -18,7 +18,9 @@ export class Provider {
Accounts
Transactions
methods
connected: boolean;
connected: boolean
initialized: boolean
pendingRequests: Array<any>
constructor (options: Record<string, string | number> = {}) {
this.options = options
@ -39,15 +41,27 @@ export class Provider {
}
async init () {
this.initialized = false
this.pendingRequests = []
await this.vmContext.init()
await generateBlock(this.vmContext)
await this.Accounts.resetAccounts()
this.Transactions.init(this.Accounts.accounts)
this.initialized = true
if (this.pendingRequests.length > 0) {
this.pendingRequests.map((req) => {
this.sendAsync(req.payload, req.callback)
})
this.pendingRequests = []
}
}
sendAsync (payload, callback) {
// log.info('payload method is ', payload.method) // commented because, this floods the IDE console
if (!this.initialized) {
this.pendingRequests.push({ payload, callback })
return
}
const method = this.methods[payload.method]
if (this.options.logDetails) {
info(payload)

@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-solidity",
"version": "0.5.11-alpha.10",
"version": "0.5.11-alpha.17",
"description": "Tool to load and run Solidity compiler",
"main": "src/index.js",
"types": "src/index.d.ts",
@ -19,7 +19,7 @@
"@ethereumjs/tx": "^4.0.2",
"@ethereumjs/util": "^8.0.3",
"@ethereumjs/vm": "^6.3.0",
"@remix-project/remix-lib": "^0.5.25-alpha.10",
"@remix-project/remix-lib": "^0.5.25-alpha.17",
"async": "^2.6.2",
"eslint-scope": "^5.0.0",
"ethers": "^5.4.2",
@ -57,5 +57,5 @@
},
"homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-solidity#readme",
"typings": "src/index.d.ts",
"gitHead": "4ea0d9afb03f04df480fdc57a60b8f85b771ed7c"
"gitHead": "4806543bb099b558872793ca7a215468e0bffc81"
}

@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-tests",
"version": "0.2.25-alpha.10",
"version": "0.2.25-alpha.17",
"description": "Tool to test Solidity smart contracts",
"main": "src/index.js",
"types": "./src/index.d.ts",
@ -41,9 +41,9 @@
"@ethereumjs/tx": "^4.0.2",
"@ethereumjs/util": "^8.0.3",
"@ethereumjs/vm": "^6.3.0",
"@remix-project/remix-lib": "^0.5.25-alpha.10",
"@remix-project/remix-simulator": "^0.2.25-alpha.10",
"@remix-project/remix-solidity": "^0.5.11-alpha.10",
"@remix-project/remix-lib": "^0.5.25-alpha.17",
"@remix-project/remix-simulator": "^0.2.25-alpha.17",
"@remix-project/remix-solidity": "^0.5.11-alpha.17",
"@remix-project/remix-url-resolver": "^0.0.42",
"ansi-gray": "^0.1.1",
"async": "^2.6.0",
@ -78,5 +78,5 @@
"typescript": "^3.3.1"
},
"typings": "src/index.d.ts",
"gitHead": "4ea0d9afb03f04df480fdc57a60b8f85b771ed7c"
"gitHead": "4806543bb099b558872793ca7a215468e0bffc81"
}

@ -55,6 +55,7 @@ commander
.option('-f, --fork <string>', 'set hard fork (e.g: istanbul, berlin etc. See full list of hard forks here: https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/common/src/hardforks)')
.option('-n, --nodeUrl <string>', 'set node url (e.g: https://mainnet.infura.io/v3/your-api-key)')
.option('-b, --blockNumber <string>', 'set block number (e.g: 123456)')
.option('-k, --killProcess <bool>', 'kill process when tests fail')
.argument('file_path', 'path to test file or directory')
.action(async (file_path) => {
const options = commander.opts();
@ -131,8 +132,9 @@ commander
await provider.init()
web3.setProvider(provider)
extend(web3)
runTestFiles(path.resolve(file_path), isDirectory, web3, compilerConfig, (error) => {
runTestFiles(path.resolve(file_path), isDirectory, web3, compilerConfig, (error, totalPassing, totalFailing) => {
if (error) process.exit(1)
if (totalFailing > 0 && options.killProcess) process.exit(1)
})
})
@ -140,5 +142,4 @@ if (!process.argv.slice(2).length) {
log.error('Please specify a file or directory path')
process.exit(1)
}
commander.parse(process.argv)

@ -173,8 +173,7 @@ export function runTestFiles (filepath: string, isDirectory: boolean, web3: Web3
}
console.log(colors.white('Time Taken: ' + totalTime + 's'))
console.log('')
next()
next(null, totalPassing, totalFailing)
})
}
], finalCallback)

@ -49,6 +49,7 @@ Options:
-n, --nodeUrl <string> set node url (e.g:
https://mainnet.infura.io/v3/your-api-key)
-b, --blockNumber <string> set block number (e.g: 123456)
-k, --killProcess <bool> kill process when tests fail
-h, --help display help for command
Commands:

@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-url-resolver",
"version": "0.0.47-alpha.10",
"version": "0.0.47-alpha.17",
"description": "Solidity import url resolver engine",
"main": "src/index.js",
"types": "src/index.d.ts",
@ -40,5 +40,5 @@
"typescript": "^3.1.6"
},
"typings": "src/index.d.ts",
"gitHead": "4ea0d9afb03f04df480fdc57a60b8f85b771ed7c"
"gitHead": "4806543bb099b558872793ca7a215468e0bffc81"
}

@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-ws-templates",
"version": "1.0.12-alpha.10",
"version": "1.0.12-alpha.17",
"description": "Create a Remix IDE workspace using different templates",
"main": "src/index.js",
"types": "src/index.d.ts",
@ -24,5 +24,5 @@
"ethers": "^5.4.2",
"web3": "^1.5.1"
},
"gitHead": "4ea0d9afb03f04df480fdc57a60b8f85b771ed7c"
"gitHead": "4806543bb099b558872793ca7a215468e0bffc81"
}
Loading…
Cancel
Save