Skip to content

Commit e137411

Browse files
committed
fix e2e
1 parent 5ed0298 commit e137411

File tree

27 files changed

+80
-111
lines changed

27 files changed

+80
-111
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ 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')]"
2626
})
2727
.waitForElementPresent({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000 })
2828
.pause(1000)

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

Lines changed: 2 additions & 1 deletion
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,6 +325,7 @@ module.exports = {
325325
let currentBlockNumber: number
326326
browser
327327
.perform(async (done) => {
328+
console.log('getting the provider up..')
328329
const provider = new JsonRpcProvider('https://go.getblock.io/56f8bc5187aa4ac696348f67545acf38')
329330
currentBlockNumber = (await provider.getBlockNumber()) as number
330331
console.log('getBlockNumber', currentBlockNumber)

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

Lines changed: 2 additions & 1 deletion
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/src/app/providers/abstract-provider.tsx

Lines changed: 4 additions & 3 deletions
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,7 @@ 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 && (error.message.includes('SERVER_ERROR') || error.message.includes('Failed to fetch'))) {
125126
try {
126127
// replace escaped quotes with normal quotes
127128
const errorString = String(error.message).replace(/\\"/g, '"');
@@ -131,10 +132,10 @@ export abstract class AbstractProvider extends Plugin implements IProvider {
131132
if (messages && messages.length > 0) {
132133
this.switchAway(true, messages[0])
133134
} else {
134-
this.switchAway(true, error.message ? error.message : error.error ? error.error : error)
135+
this.switchAway(true, error.message ? `${error.message} ${data.method} ${data.params}` : error.error ? error.error : error)
135136
}
136137
} catch (error) {
137-
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)
138139
}
139140
}
140141
reject({ jsonrpc: '2.0', error: { message: error.message, code: -32603 }, id: data.id })

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

Lines changed: 2 additions & 1 deletion
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+
let 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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 9 additions & 9 deletions
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

Lines changed: 0 additions & 53 deletions
This file was deleted.

libs/remix-analyzer/package.json

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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",

0 commit comments

Comments
 (0)