Skip to content

Commit e7cabc3

Browse files
committed
fix e2e
1 parent 19bb2c5 commit e7cabc3

File tree

32 files changed

+1602
-126
lines changed

32 files changed

+1602
-126
lines changed

apps/remix-ide-e2e/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"npm": "^6.14.15"
77
},
88
"dependencies": {
9+
"ethers": "npm:ethers@beta-eip-7702",
910
"@openzeppelin/contracts": "^5.0.2",
1011
"@openzeppelin/contracts-upgradeable": "^5.0.2",
1112
"@openzeppelin/upgrades-core": "^1.30.0",

apps/remix-ide-e2e/src/tests/providers.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ module.exports = {
2222
.modalFooterOKClick('ganache-provider')
2323
.waitForElementVisible({
2424
locateStrategy: 'xpath',
25-
selector: "//span[@class='text-danger' and contains(., 'missing response')]"
25+
selector: "//span[@class='text-danger' and contains(., 'Failed to fetch')]",
26+
timeout: 10000
2627
})
2728
.waitForElementPresent({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000 })
2829
.pause(1000)

apps/remix-ide-e2e/src/tests/transactionExecution.test.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ module.exports = {
311311
})
312312
},
313313

314-
'Should stay connected in the mainnet VM fork and: check the block number is advancing and is not low #group5': function (browser: NightwatchBrowser) {
314+
'Should stay connected to mainnet VM fork and: check the block number is advancing and is not low #group5': function (browser: NightwatchBrowser) {
315315
/*
316316
Should stay connected in the mainnet VM fork and:
317317
- check the block number has been set to the current mainnet block number.
@@ -325,10 +325,15 @@ module.exports = {
325325
let currentBlockNumber: number
326326
browser
327327
.perform(async (done) => {
328-
const provider = new JsonRpcProvider('https://go.getblock.io/56f8bc5187aa4ac696348f67545acf38')
329-
currentBlockNumber = (await provider.getBlockNumber()) as number
330-
console.log('getBlockNumber', currentBlockNumber)
331-
done()
328+
try {
329+
console.log('getting the provider up..')
330+
const provider = new JsonRpcProvider('https://go.getblock.io/56f8bc5187aa4ac696348f67545acf38')
331+
currentBlockNumber = (await provider.getBlockNumber()) as number
332+
console.log('getBlockNumber', currentBlockNumber)
333+
done()
334+
} catch (e) {
335+
console.error(e)
336+
}
332337
})
333338
.click('*[data-id="deployAndRunClearInstances"]') // clear udapp instances
334339
.clickLaunchIcon('filePanel')

apps/remix-ide-e2e/src/tests/vm_state.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ const tests = {
1919
.waitForElementVisible('*[data-id="fork-state-icon"]')
2020
.waitForElementVisible('*[data-id="delete-state-icon"]')
2121
},
22-
'Should show toaster while trying fork and delete VM state without state #group1': function (browser: NightwatchBrowser) {
22+
'Should show toaster while trying fork and delete VM state without state #group1': '' + function (browser: NightwatchBrowser) {
23+
// removing this test as now the state contains the created addresses and is not empty...
2324
browser
2425
.waitForElementVisible('*[data-id="fork-state-icon"]')
2526
.click('*[data-id="fork-state-icon"]')

apps/remix-ide-e2e/yarn.lock

+1,506-6
Large diffs are not rendered by default.

apps/remix-ide/src/app/providers/abstract-provider.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export abstract class AbstractProvider extends Plugin implements IProvider {
109109

110110
private async switchAway(showError: boolean, msg: string) {
111111
if (!this.provider) return
112+
this.provider.destroy()
112113
if (showError) {
113114
this.call('terminal', 'log', { type: 'error', value: 'Error while querying the provider: ' + msg })
114115
}
@@ -121,7 +122,10 @@ export abstract class AbstractProvider extends Plugin implements IProvider {
121122
const result = await this.provider.send(data.method, data.params)
122123
resolve({ jsonrpc: '2.0', result, id: data.id })
123124
} catch (error) {
124-
if (error && error.message && error.message.includes('SERVER_ERROR')) {
125+
if (error && error.message &&
126+
(error.message.includes('SERVER_ERROR') ||
127+
error.message.includes('Failed to fetch') ||
128+
error.message.includes('NetworkError'))) {
125129
try {
126130
// replace escaped quotes with normal quotes
127131
const errorString = String(error.message).replace(/\\"/g, '"');
@@ -131,10 +135,10 @@ export abstract class AbstractProvider extends Plugin implements IProvider {
131135
if (messages && messages.length > 0) {
132136
this.switchAway(true, messages[0])
133137
} else {
134-
this.switchAway(true, error.message ? error.message : error.error ? error.error : error)
138+
this.switchAway(true, error.message ? `${error.message} ${data.method} ${data.params}` : error.error ? error.error : error)
135139
}
136140
} catch (error) {
137-
this.switchAway(true, error.message ? error.message : error.error ? error.error : error)
141+
this.switchAway(true, error.message ? `${error.message} ${data.method} ${data.params}` : error.error ? error.error : error)
138142
}
139143
}
140144
reject({ jsonrpc: '2.0', error: { message: error.message, code: -32603 }, id: data.id })

apps/remix-ide/src/blockchain/blockchain.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1026,8 +1026,8 @@ export class Blockchain extends Plugin {
10261026
if (isBasicVMState || isForkedVMState || isForkedRpcState) {
10271027
if (!tx.useCall && this.config.get('settings/save-evm-state')) {
10281028
try {
1029-
let state = await this.executionContext.getStateDetails()
10301029
if (provider.config.statePath) {
1030+
let state = await this.executionContext.getStateDetails()
10311031
const stateFileExists = await this.call('fileManager', 'exists', provider.config.statePath)
10321032
if (stateFileExists) {
10331033
let stateDetails = await this.call('fileManager', 'readFile', provider.config.statePath)
@@ -1037,6 +1037,7 @@ export class Blockchain extends Plugin {
10371037
}
10381038
this.call('fileManager', 'writeFile', provider.config.statePath, state)
10391039
} else if (isBasicVMState && !isForkedRpcState && !isForkedRpcState) {
1040+
const state = await this.executionContext.getStateDetails()
10401041
// in that case, we store the state only if it is a basic VM.
10411042
const provider = this.executionContext.getProvider()
10421043
this.call('fileManager', 'writeFile', `.states/${provider}/state.json`, state)

libs/ghaction-helper/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@ethereum-waffle/chai": "^3.4.4",
2828
"@remix-project/remix-simulator": "^0.2.68",
2929
"chai": "^4.3.7",
30-
"ethers": "^5.7.2",
30+
"ethers": "npm:ethers@beta-eip-7702",
3131
"web3": "^4.1.1"
3232
},
3333
"types": "./src/index.d.ts",

libs/ghaction-helper/src/methods.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// @ts-ignore
2-
import { BrowserProvider } from "ethers"
2+
import { BrowserProvider, Contract, Signer } from "ethers"
3+
import { InterfaceAbi } from "ethers"
34
import { Provider } from '@remix-project/remix-simulator'
45
import { getArtifactsByContractName } from './artifacts-helper'
5-
import { SignerWithAddress } from './signer'
66
import { Web3 } from "web3"
77

88
const providerConfig = {
@@ -21,7 +21,7 @@ global.web3 = new Web3(global.web3Provider)
2121
global.web3.eth.setConfig(config)
2222

2323
const isFactoryOptions = (signerOrOptions: any) => {
24-
if (!signerOrOptions || signerOrOptions === undefined || signerOrOptions instanceof ethers.Signer) return false
24+
if (!signerOrOptions || signerOrOptions === undefined || typeof(signerOrOptions.connect) === 'function') return false
2525
return true
2626
}
2727

@@ -172,7 +172,7 @@ const resultToArtifact = (result: any) => {
172172
}
173173
}
174174

175-
const getContractFactory = async (contractNameOrABI: ethers.ContractInterface, bytecode?: string, signerOrOptions = null) => {
175+
const getContractFactory = async (contractNameOrABI: InterfaceAbi, bytecode?: string, signerOrOptions = null) => {
176176
if (bytecode && contractNameOrABI) {
177177
//@ts-ignore
178178
return new ethers.ContractFactory(contractNameOrABI, bytecode, signerOrOptions || web3Provider.getSigner())
@@ -181,7 +181,7 @@ const getContractFactory = async (contractNameOrABI: ethers.ContractInterface, b
181181

182182
if (contract) {
183183
//@ts-ignore
184-
return new ethers.ContractFactory(contract.abi, contract.evm.bytecode.object, signerOrOptions || web3Provider.getSigner())
184+
return new ContractFactory(contract.abi, contract.evm.bytecode.object, signerOrOptions || web3Provider.getSigner())
185185
} else {
186186
throw new Error('Contract artifacts not found')
187187
}
@@ -190,20 +190,20 @@ const getContractFactory = async (contractNameOrABI: ethers.ContractInterface, b
190190
}
191191
}
192192

193-
const getContractAt = async (contractNameOrABI: ethers.ContractInterface, address: string, signer = null) => {
193+
const getContractAt = async (contractNameOrABI: InterfaceAbi, address: string, signer = null) => {
194194
//@ts-ignore
195195
const provider = web3Provider
196196

197197
if (typeof contractNameOrABI === 'string') {
198198
const result = await getArtifactsByContractName(contractNameOrABI)
199199

200200
if (result) {
201-
return new ethers.Contract(address, result.abi, signer || provider.getSigner())
201+
return new Contract(address, result.abi, signer || provider.getSigner())
202202
} else {
203203
throw new Error('Contract artifacts not found')
204204
}
205205
} else {
206-
return new ethers.Contract(address, contractNameOrABI, signer || provider.getSigner())
206+
return new Contract(address, contractNameOrABI, signer || provider.getSigner())
207207
}
208208
}
209209

@@ -212,7 +212,7 @@ const getSigner = async (address: string) => {
212212
const provider = web3Provider
213213
const signer = provider.getSigner(address)
214214

215-
return SignerWithAddress.create(signer)
215+
return signer
216216
}
217217

218218
const getSigners = async () => {

libs/ghaction-helper/src/signer.ts

-53
This file was deleted.

libs/remix-analyzer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@remix-project/remix-astwalker": "^0.0.98",
2929
"@remix-project/remix-lib": "^0.5.75",
3030
"async": "^2.6.2",
31-
"ethers": "^5.4.2",
31+
"ethers": "npm:ethers@beta-eip-7702",
3232
"ethjs-util": "^0.1.6",
3333
"string-similarity": "^4.0.4",
3434
"web3": "^4.1.1"

libs/remix-astwalker/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@remix-project/remix-lib": "^0.5.75",
4141
"@types/tape": "^4.2.33",
4242
"async": "^2.6.2",
43-
"ethers": "^5.4.2",
43+
"ethers": "npm:ethers@beta-eip-7702",
4444
"ethjs-util": "^0.1.6",
4545
"nyc": "^13.3.0",
4646
"string-similarity": "^4.0.4",

libs/remix-debug/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"color-support": "^1.1.3",
3636
"commander": "^9.4.1",
3737
"deep-equal": "^1.0.1",
38-
"ethers": "^5.4.2",
38+
"ethers": "npm:ethers@beta-eip-7702",
3939
"ethjs-util": "^0.1.6",
4040
"express-ws": "^4.0.0",
4141
"merge": "^2.1.1",

libs/remix-debug/src/code/codeUtils.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict'
2-
import { bytesToHex } from '@ethereumjs/util'
2+
import { util } from '@remix-project/remix-lib'
33
import { Common, Mainnet } from '@ethereumjs/common'
44
import { getOpcodesForHF, paramsEVM } from '@ethereumjs/evm'
55
import getOpcodes from './opcodes'
@@ -26,8 +26,8 @@ export function nameOpCodes (raw, hardfork) {
2626
const jumpNum = raw[pc] - 0x5f
2727
pushData = raw.slice(pc + 1, pc + jumpNum + 1)
2828
i += jumpNum
29-
}
30-
const hexCode = pushData ? bytesToHex((pushData as any)) : ''
29+
}
30+
const hexCode = pushData ? util.bytesToHex((pushData as any)) : ''
3131
// @ts-ignore
3232
const data = hexCode !== '' ? ' ' + hexCode : ''
3333

@@ -48,7 +48,7 @@ type Opcode = {
4848
* information about the opcode.
4949
*/
5050
export function parseCode (raw) {
51-
const common = new Common({ chain: Mainnet, hardfork: 'cancun' })
51+
const common = new Common({ chain: Mainnet, hardfork: 'cancun', params: paramsEVM })
5252
const opcodes = getOpcodesForHF(common).opcodes
5353

5454
const code = []

libs/remix-debug/src/code/disassembler.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import { parseCode } from './codeUtils'
44
import { util } from '@remix-project/remix-lib'
5-
import { bytesToHex } from '@ethereumjs/util'
65

76
function createExpressions (instructions) {
87
const expressions = []
@@ -37,7 +36,7 @@ function createExpressions (instructions) {
3736

3837
function toString (expr) {
3938
if (expr.name.slice(0, 4) === 'PUSH') {
40-
return bytesToHex(expr.pushData)
39+
return util.bytesToHex(expr.pushData)
4140
} else if (expr.name === 'JUMPDEST') {
4241
return expr.label + ':'
4342
} else if (expr.args) {

libs/remix-debug/src/trace/traceAnalyser.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22
import { util } from '@remix-project/remix-lib'
3-
import { bytesToHex } from '@ethereumjs/util'
3+
// import { bytesToHex } from '@ethereumjs/util'
44
const { toHexPaddedString } = util
55
import * as traceHelper from './traceHelper'
66

@@ -86,7 +86,7 @@ export class TraceAnalyser {
8686
offset = 2 * parseInt(toHexPaddedString(stack[stack.length - 4]), 16)
8787
size = 2 * parseInt(toHexPaddedString(stack[stack.length - 5]), 16)
8888
}
89-
calldata = bytesToHex(memory).replace('0x', '').substring(offset, offset + size)
89+
calldata = util.bytesToHex(memory).replace('0x', '').substring(offset, offset + size)
9090
this.traceCache.pushCallDataChanges(index + 1, calldata)
9191
}
9292
}

libs/remix-debug/test/decoder/stateTests/revert-state-sub-call.ts

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { InternalCallTree } from '../../../src/solidity-decoder/internalCallTree
1010
import * as vmCall from '../../vmCall'
1111
import { StorageResolver } from '../../../src/storage/storageResolver'
1212
import { StorageViewer } from '../../../src/storage/storageViewer'
13-
import { Address, bytesToHex } from '@ethereumjs/util'
1413

1514
module.exports = async function testMappingStorage (st, cb) {
1615
const revertStateContract = require('../contracts/revert-state-sub-call.ts')

libs/remix-debug/test/vmCall.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22
import { extendWeb3 } from '../src/init'
3-
import { Address } from '@ethereumjs/util'
3+
import { createAddressFromPrivateKey } from '@ethereumjs/util'
44
import { Web3 } from 'web3';
55
const { Provider } = require('@remix-project/remix-simulator')
66

@@ -17,7 +17,7 @@ async function sendTx (web3, from, to, value, data, cb) {
1717
try {
1818
cb = cb || (() => {})
1919
const receipt = await web3.eth.sendTransaction({
20-
from: Address.fromPrivateKey(from.privateKey).toString(),
20+
from: createAddressFromPrivateKey(from.privateKey).toString(),
2121
to,
2222
value,
2323
data,

libs/remix-lib/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@ethereumjs/util": "^10.0.0-rc.1",
2121
"async": "^2.1.2",
2222
"create-hash": "^1.2.0",
23-
"ethers": "^5.7.2",
23+
"ethers": "npm:ethers@beta-eip-7702",
2424
"ethjs-util": "^0.1.6",
2525
"events": "^3.0.0",
2626
"from-exponential": "1.1.1",

libs/remix-lib/src/execution/eventsDecoder.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class EventsDecoder {
4141
_eventABI (contract): Record<string, { event, inputs, object, abi }> {
4242
const eventABI: Record<string, { event, inputs, object, abi }> = {}
4343
const abi = new Interface(contract.abi)
44-
let eventFragments = abi.fragments.filter(f => f.type === "event") as Array<EventFragment>
44+
const eventFragments = abi.fragments.filter(f => f.type === "event") as Array<EventFragment>
4545
for (const e of eventFragments) {
4646
const event = abi.getEvent(e.name)
4747
eventABI[e.topicHash.replace('0x', '')] = { event: event.name, inputs: event.inputs, object: event, abi: abi }

libs/remix-lib/src/execution/txExecution.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ export function checkError (execResult, compiledContracts) {
115115
decodedCustomErrorInputsClean = {}
116116
let devdoc = {}
117117
// "contract" represents the compilation result containing the NATSPEC documentation
118-
let fnFragments = fn.fragments.filter(f => f.type === "function") as Array<FunctionFragment>
118+
const fnFragments = fn.fragments.filter(f => f.type === "function") as Array<FunctionFragment>
119119
if (contract && fnFragments && fnFragments.length) {
120-
const functionSignature = fnFragments[0].selector
120+
const functionSignature = fnFragments[0].format()
121121
// we check in the 'devdoc' if there's a developer documentation for this error
122122
try {
123123
devdoc = (contract.devdoc.errors && contract.devdoc.errors[functionSignature][0]) || {}

libs/remix-lib/src/execution/txRunnerVM.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export class TxRunnerVM {
158158
const difficulties = [69762765929000, 70762765929000, 71762765929000]
159159
const difficulty = this.commonContext.consensusType() === ConsensusType.ProofOfStake ? 0 : difficulties[this.blocks.length % difficulties.length]
160160
const blockNumber = this.baseBlockNumber ? parseInt(this.baseBlockNumber) + this.blocks.length : this.blocks.length
161-
const block = createBlock({
161+
const block = createBlock({
162162
header: {
163163
timestamp: new Date().getTime() / 1000 | 0,
164164
number: blockNumber,

0 commit comments

Comments
 (0)