Skip to content

update Ethereumjs 10 / ethers 6 #5980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CompilerAbstract, SourcesCode } from '@remix-project/remix-solidity'
import { AbstractVerifier } from './AbstractVerifier'
import type { LookupResponse, SourceFile, SubmittedContract, VerificationResponse, VerificationStatus } from '../types'
import { ethers } from 'ethers'
import { getAddress } from 'ethers'

interface SourcifyVerificationRequest {
address: string
Expand Down Expand Up @@ -144,7 +144,7 @@ export class SourcifyVerifier extends AbstractVerifier {

for (const file of files) {
let filePath: string
for (const a of [contractAddress, ethers.utils.getAddress(contractAddress)]) {
for (const a of [contractAddress, getAddress(contractAddress)]) {
const matching = file.path.match(`/${a}/(.*)$`)
if (matching) {
filePath = matching[1]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useContext, useEffect, useRef, useState } from 'react'
import { BigNumber, ethers } from 'ethers'
import { AbiCoder } from 'ethers'

import { AppContext } from '../AppContext'
import { ContractDropdownSelection } from './ContractDropdown'
Expand Down Expand Up @@ -27,12 +27,12 @@ export const ConstructorArguments: React.FC<ConstructorArgumentsProps> = ({ abiE

const decodeConstructorArgs = (value: string) => {
try {
const decodedObj = ethers.utils.defaultAbiCoder.decode(
const decodedObj = AbiCoder.defaultAbiCoder().decode(
constructorArgs.map((inp) => inp.type),
value
)
const decoded = decodedObj.map((val) => {
if (val instanceof BigNumber) {
if (typeof val === 'bigint') {
return val.toString()
}
return JSON.stringify(val)
Expand Down Expand Up @@ -85,7 +85,7 @@ export const ConstructorArguments: React.FC<ConstructorArgumentsProps> = ({ abiE
}

try {
const newAbiEncoding = ethers.utils.defaultAbiCoder.encode(types, parsedArgsValues)
const newAbiEncoding = AbiCoder.defaultAbiCoder().encode(types, parsedArgsValues)
setAbiEncodedConstructorArgs(newAbiEncoding)
setAbiEncodingError('')
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState, useContext } from 'react'
import { ethers } from 'ethers'
import { isAddress } from 'ethers'

interface ContractAddressInputProps {
label: string | any
Expand All @@ -13,7 +13,7 @@ interface ContractAddressInputProps {
// Chooses one contract from the compilation output.
export const ContractAddressInput: React.FC<ContractAddressInputProps> = ({ label, id, contractAddress, setContractAddress, contractAddressError, setContractAddressError }) => {
const handleAddressChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const isValidAddress = ethers.utils.isAddress(event.target.value)
const isValidAddress = isAddress(event.target.value)
setContractAddress(event.target.value)
if (!isValidAddress) {
setContractAddressError('Invalid contract address')
Expand Down
4 changes: 2 additions & 2 deletions apps/remix-dapp/src/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from 'axios';
import Web3 from 'web3';
import { ethers } from 'ethers';
import { AbiCoder } from 'ethers';
import BN from 'bn.js';
import { execution } from '@remix-project/remix-lib';
import { toBytes, addHexPrefix } from '@ethereumjs/util';
Expand All @@ -25,7 +25,7 @@ const decodeInputParams = (data: any, abi: any) => {
: type
);
}
const abiCoder = new ethers.utils.AbiCoder();
const abiCoder = new AbiCoder();
const decoded = abiCoder.decode(inputTypes, data);
const ret: any = {};
for (const k in abi.inputs) {
Expand Down
1 change: 1 addition & 0 deletions apps/remix-ide-e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"npm": "^6.14.15"
},
"dependencies": {
"ethers": "npm:ethers@beta-eip-7702",
"@openzeppelin/contracts": "^5.0.2",
"@openzeppelin/contracts-upgradeable": "^5.0.2",
"@openzeppelin/upgrades-core": "^1.30.0",
Expand Down
3 changes: 2 additions & 1 deletion apps/remix-ide-e2e/src/tests/providers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ module.exports = {
.modalFooterOKClick('ganache-provider')
.waitForElementVisible({
locateStrategy: 'xpath',
selector: "//span[@class='text-danger' and contains(., 'missing response')]"
selector: "//span[@class='text-danger' and contains(., 'Error while querying the provider')]",
timeout: 10000
})
.waitForElementPresent({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000 })
.pause(1000)
Expand Down
2 changes: 1 addition & 1 deletion apps/remix-ide-e2e/src/tests/remixd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ async function installFoundry(): Promise<void> {
server.stdout.on('data', function (data) {
console.log(data.toString())
if (
data.toString().includes("foundryup: use - chisel 1.0.0-stable")
data.toString().includes("foundryup: use - ")
) {
console.log('resolving')
resolve()
Expand Down
17 changes: 11 additions & 6 deletions apps/remix-ide-e2e/src/tests/transactionExecution.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
import { ethers } from 'ethers'
import { JsonRpcProvider } from 'ethers'

module.exports = {
'@disabled': true,
Expand Down Expand Up @@ -311,7 +311,7 @@ module.exports = {
})
},

'Should stay connected in the mainnet VM fork and: check the block number is advancing and is not low #group5': function (browser: NightwatchBrowser) {
'Should stay connected to mainnet VM fork and: check the block number is advancing and is not low #group5': function (browser: NightwatchBrowser) {
/*
Should stay connected in the mainnet VM fork and:
- check the block number has been set to the current mainnet block number.
Expand All @@ -325,10 +325,15 @@ module.exports = {
let currentBlockNumber: number
browser
.perform(async (done) => {
const provider = new ethers.providers.JsonRpcProvider('https://go.getblock.io/56f8bc5187aa4ac696348f67545acf38')
currentBlockNumber = (await provider.getBlockNumber()) as number
console.log('getBlockNumber', currentBlockNumber)
done()
try {
console.log('getting the provider up..')
const provider = new JsonRpcProvider('https://go.getblock.io/56f8bc5187aa4ac696348f67545acf38')
currentBlockNumber = (await provider.getBlockNumber()) as number
console.log('getBlockNumber', currentBlockNumber)
done()
} catch (e) {
console.error(e)
}
})
.click('*[data-id="deployAndRunClearInstances"]') // clear udapp instances
.clickLaunchIcon('filePanel')
Expand Down
3 changes: 2 additions & 1 deletion apps/remix-ide-e2e/src/tests/vm_state.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const tests = {
.waitForElementVisible('*[data-id="fork-state-icon"]')
.waitForElementVisible('*[data-id="delete-state-icon"]')
},
'Should show toaster while trying fork and delete VM state without state #group1': function (browser: NightwatchBrowser) {
'Should show toaster while trying fork and delete VM state without state #group1': '' + function (browser: NightwatchBrowser) {
// removing this test as now the state contains the created addresses and is not empty...
browser
.waitForElementVisible('*[data-id="fork-state-icon"]')
.click('*[data-id="fork-state-icon"]')
Expand Down
Loading