Skip to content

Eip 7702 #5969

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

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 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 @@ -325,7 +325,7 @@ module.exports = {
let currentBlockNumber: number
browser
.perform(async (done) => {
const provider = new ethers.providers.JsonRpcProvider('https://go.getblock.io/56f8bc5187aa4ac696348f67545acf38')
const provider = new JsonRpcProvider('https://go.getblock.io/56f8bc5187aa4ac696348f67545acf38')
currentBlockNumber = (await provider.getBlockNumber()) as number
console.log('getBlockNumber', currentBlockNumber)
done()
Expand Down
4 changes: 3 additions & 1 deletion apps/remix-ide/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { StoragePlugin } from './app/plugins/storage'
import { Layout } from './app/panels/layout'
import { NotificationPlugin } from './app/plugins/notification'
import { Blockchain } from './blockchain/blockchain'
import { MergeVMProvider, LondonVMProvider, BerlinVMProvider, ShanghaiVMProvider, CancunVMProvider } from './app/providers/vm-provider'
import { MergeVMProvider, LondonVMProvider, BerlinVMProvider, ShanghaiVMProvider, CancunVMProvider, PectraVMProvider } from './app/providers/vm-provider'
import { MainnetForkVMProvider } from './app/providers/mainnet-vm-fork-provider'
import { SepoliaForkVMProvider } from './app/providers/sepolia-vm-fork-provider'
import { GoerliForkVMProvider } from './app/providers/goerli-vm-fork-provider'
Expand Down Expand Up @@ -341,6 +341,7 @@ class AppComponent {
const vmProviderGoerliFork = new GoerliForkVMProvider(blockchain)
const vmProviderShanghai = new ShanghaiVMProvider(blockchain)
const vmProviderCancun = new CancunVMProvider(blockchain)
const vmProviderPectra = new PectraVMProvider(blockchain)
const vmProviderMerge = new MergeVMProvider(blockchain)
const vmProviderBerlin = new BerlinVMProvider(blockchain)
const vmProviderLondon = new LondonVMProvider(blockchain)
Expand Down Expand Up @@ -417,6 +418,7 @@ class AppComponent {
storagePlugin,
vmProviderShanghai,
vmProviderCancun,
vmProviderPectra,
vmProviderMerge,
vmProviderBerlin,
vmProviderLondon,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { hashMessage } from "ethers/lib/utils"
import { hashMessage } from "ethers"
import JSZip from "jszip"
import { fileSystem } from "../fileSystem"
const _paq = window._paq = window._paq || []
Expand Down
6 changes: 3 additions & 3 deletions apps/remix-ide/src/app/providers/abstract-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Plugin } from '@remixproject/engine'
import { AppModal, AlertModal, ModalTypes } from '@remix-ui/app'
import { Blockchain } from '../../blockchain/blockchain'
import { ethers } from 'ethers'
import { JsonRpcProvider } from 'ethers'

export type JsonDataRequest = {
id: number
Expand Down Expand Up @@ -33,7 +33,7 @@ export interface IProvider {
}

export abstract class AbstractProvider extends Plugin implements IProvider {
provider: ethers.providers.JsonRpcProvider
provider: JsonRpcProvider
blockchain: Blockchain
defaultUrl: string
connected: boolean
Expand Down Expand Up @@ -93,7 +93,7 @@ export abstract class AbstractProvider extends Plugin implements IProvider {
this.call('notification', 'modal', modalContent)
})
})()
this.provider = new ethers.providers.JsonRpcProvider(this.nodeUrl)
this.provider = new JsonRpcProvider(this.nodeUrl)
return {
nodeUrl: this.nodeUrl
}
Expand Down
18 changes: 18 additions & 0 deletions apps/remix-ide/src/app/providers/vm-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,24 @@ export class CancunVMProvider extends BasicVMProvider {
}
}

export class PectraVMProvider extends BasicVMProvider {
constructor(blockchain) {
super(
{
name: 'vm-pectra',
displayName: 'Remix VM (Pectra)',
kind: 'provider',
description: 'Remix VM (Pectra)',
methods: ['sendAsync', 'init'],
version: packageJson.version
},
blockchain
)
this.blockchain = blockchain
this.fork = 'prague'
}
}

export class ForkedVMStateProvider extends BasicVMProvider {
nodeUrl?: string
blockNumber?: string
Expand Down
9 changes: 5 additions & 4 deletions apps/remix-ide/src/app/udapp/run-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,15 @@ export class RunTab extends ViewPlugin {

// VM
const titleVM = 'Execution environment is local to Remix. Data is only saved to browser memory and will vanish upon reload.'
await addProvider(1, 'vm-cancun', 'Remix VM (Cancun)', { isInjected: false, isVM: true, isRpcForkedState: false, statePath: '.states/vm-cancun/state.json', fork: 'cancun' }, 'settingsVMCancunMode', titleVM)
await addProvider(1, 'vm-pectra', 'Remix VM (Pectra)', { isInjected: false, isVM: true, isRpcForkedState: false, statePath: '.states/vm-pectra/state.json', fork: 'prague' }, 'settingsVMPectraMode', titleVM)
await addProvider(2, 'vm-cancun', 'Remix VM (Cancun)', { isInjected: false, isVM: true, isRpcForkedState: false, statePath: '.states/vm-cancun/state.json', fork: 'cancun' }, 'settingsVMCancunMode', titleVM)
await addProvider(50, 'vm-shanghai', 'Remix VM (Shanghai)', { isInjected: false, isVM: true, isRpcForkedState: false, statePath: '.states/vm-shanghai/state.json', fork: 'shanghai' }, 'settingsVMShanghaiMode', titleVM)
await addProvider(51, 'vm-paris', 'Remix VM (Paris)', { isInjected: false, isVM: true, isRpcForkedState: false, statePath: '.states/vm-paris/state.json', fork: 'paris' }, 'settingsVMParisMode', titleVM)
await addProvider(52, 'vm-london', 'Remix VM (London)', { isInjected: false, isVM: true, isRpcForkedState: false, statePath: '.states/vm-london/state.json', fork: 'london' }, 'settingsVMLondonMode', titleVM)
await addProvider(53, 'vm-berlin', 'Remix VM (Berlin)', { isInjected: false, isVM: true, isRpcForkedState: false, statePath: '.states/vm-berlin/state.json', fork: 'berlin' }, 'settingsVMBerlinMode', titleVM)
await addProvider(2, 'vm-mainnet-fork', 'Remix VM - Mainnet fork', { isInjected: false, isVM: true, isVMStateForked: true, isRpcForkedState: true, fork: 'cancun' }, 'settingsVMMainnetMode', titleVM)
await addProvider(3, 'vm-sepolia-fork', 'Remix VM - Sepolia fork', { isInjected: false, isVM: true, isVMStateForked: true, isRpcForkedState: true, fork: 'cancun' }, 'settingsVMSepoliaMode', titleVM)
await addProvider(4, 'vm-custom-fork', 'Remix VM - Custom fork', { isInjected: false, isVM: true, isVMStateForked: true, isRpcForkedState: true, fork: '' }, 'settingsVMCustomMode', titleVM)
await addProvider(3, 'vm-mainnet-fork', 'Remix VM - Mainnet fork', { isInjected: false, isVM: true, isVMStateForked: true, isRpcForkedState: true, fork: 'cancun' }, 'settingsVMMainnetMode', titleVM)
await addProvider(4, 'vm-sepolia-fork', 'Remix VM - Sepolia fork', { isInjected: false, isVM: true, isVMStateForked: true, isRpcForkedState: true, fork: 'cancun' }, 'settingsVMSepoliaMode', titleVM)
await addProvider(5, 'vm-custom-fork', 'Remix VM - Custom fork', { isInjected: false, isVM: true, isVMStateForked: true, isRpcForkedState: true, fork: '' }, 'settingsVMCustomMode', titleVM)

// Forked VM States
const addFVSProvider = async(stateFilePath, pos) => {
Expand Down
4 changes: 3 additions & 1 deletion apps/remix-ide/src/blockchain/blockchain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,7 @@ export class Blockchain extends Plugin {
return new Promise(async (resolve, reject) => {
let fromAddress
let fromSmartAccount
let authorizationList
let value
let gasLimit
try {
Expand All @@ -936,7 +937,8 @@ export class Blockchain extends Plugin {
fromSmartAccount,
value: value,
gasLimit: gasLimit,
timestamp: args.data.timestamp
timestamp: args.data.timestamp,
authorizationList: args.authorizationList
}
const payLoad = {
funAbi: args.data.funAbi,
Expand Down
4 changes: 2 additions & 2 deletions libs/ghaction-helper/src/methods.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-ignore
import { ethers } from "ethers"
import { BrowserProvider } from "ethers"
import { Provider } from '@remix-project/remix-simulator'
import { getArtifactsByContractName } from './artifacts-helper'
import { SignerWithAddress } from './signer'
Expand All @@ -14,7 +14,7 @@ const providerConfig = {
const config = { defaultTransactionType: '0x0' }
global.remixProvider = new Provider(providerConfig)
global.remixProvider.init()
global.web3Provider = new ethers.providers.Web3Provider(global.remixProvider)
global.web3Provider = new BrowserProvider(global.remixProvider)
global.provider = global.web3Provider
global.ethereum = global.web3Provider
global.web3 = new Web3(global.web3Provider)
Expand Down
8 changes: 4 additions & 4 deletions libs/remix-analyzer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
}
],
"dependencies": {
"@ethereumjs/block": "5.3.0",
"@ethereumjs/tx": "5.4.0",
"@ethereumjs/util": "9.1.0",
"@ethereumjs/vm": "8.1.1",
"@ethereumjs/block": "^10.0.0-rc.1",
"@ethereumjs/tx": "^10.0.0-rc.1",
"@ethereumjs/util": "^10.0.0-rc.1",
"@ethereumjs/vm": "^10.0.0-rc.1",
"@remix-project/remix-astwalker": "^0.0.98",
"@remix-project/remix-lib": "^0.5.75",
"async": "^2.6.2",
Expand Down
8 changes: 4 additions & 4 deletions libs/remix-astwalker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
]
},
"dependencies": {
"@ethereumjs/block": "5.3.0",
"@ethereumjs/tx": "5.4.0",
"@ethereumjs/util": "9.1.0",
"@ethereumjs/vm": "8.1.1",
"@ethereumjs/block": "^10.0.0-rc.1",
"@ethereumjs/tx": "^10.0.0-rc.1",
"@ethereumjs/util": "^10.0.0-rc.1",
"@ethereumjs/vm": "^10.0.0-rc.1",
"@remix-project/remix-lib": "^0.5.75",
"@types/tape": "^4.2.33",
"async": "^2.6.2",
Expand Down
10 changes: 5 additions & 5 deletions libs/remix-debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
"test": "./../../node_modules/.bin/ts-node --project ../../tsconfig.base.json --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts"
},
"dependencies": {
"@ethereumjs/block": "5.3.0",
"@ethereumjs/common": "4.4.0",
"@ethereumjs/tx": "5.4.0",
"@ethereumjs/util": "9.1.0",
"@ethereumjs/vm": "8.1.1",
"@ethereumjs/block": "^10.0.0-rc.1",
"@ethereumjs/common": "^10.0.0-rc.1",
"@ethereumjs/tx": "^10.0.0-rc.1",
"@ethereumjs/util": "^10.0.0-rc.1",
"@ethereumjs/vm": "^10.0.0-rc.1",
"@remix-project/remix-astwalker": "^0.0.98",
"@remix-project/remix-lib": "^0.5.75",
"@remix-project/remix-simulator": "^0.2.68",
Expand Down
8 changes: 4 additions & 4 deletions libs/remix-debug/src/code/codeUtils.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict'
import { bytesToHex } from '@ethereumjs/util'
import { Common } from '@ethereumjs/common'
import { Common, Mainnet } from '@ethereumjs/common'
// TODO fix the import when getOpcodesForHF is exported
import { getOpcodesForHF } from '@ethereumjs/evm'
import { getOpcodesForHF, paramsEVM } from '@ethereumjs/evm'
import getOpcodes from './opcodes'

export function nameOpCodes (raw, hardfork) {
const common = new Common({ chain: 'mainnet', hardfork })
const common = new Common({ chain: Mainnet, hardfork, params: paramsEVM })
const opcodes = getOpcodesForHF(common).opcodes

let pushData = ''
Expand Down Expand Up @@ -50,7 +50,7 @@ type Opcode = {
* information about the opcode.
*/
export function parseCode (raw) {
const common = new Common({ chain: 'mainnet', hardfork: 'cancun' })
const common = new Common({ chain: Mainnet, hardfork: 'cancun' })
const opcodes = getOpcodesForHF(common).opcodes

const code = []
Expand Down
4 changes: 2 additions & 2 deletions libs/remix-debug/src/solidity-decoder/types/RefType.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
import { ethers } from 'ethers'
import { Interface } from 'ethers'
import { toBN } from './util'

export class RefType {
Expand Down Expand Up @@ -60,7 +60,7 @@ export class RefType {

_decodeFromCallData (variableDetails, calldata) {
calldata = calldata.length > 0 ? calldata[0] : '0x'
const ethersAbi = new ethers.utils.Interface(variableDetails.abi)
const ethersAbi = new Interface(variableDetails.abi)
const fnSign = calldata.substr(0, 10)
const decodedData = ethersAbi.decodeFunctionData(ethersAbi.getFunction(fnSign), calldata)
const decodedValue = decodedData[variableDetails.name]
Expand Down
2 changes: 1 addition & 1 deletion libs/remix-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"test": "./../../node_modules/.bin/ts-node --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts"
},
"dependencies": {
"@ethereumjs/util": "9.1.0",
"@ethereumjs/util": "^10.0.0-rc.1",
"async": "^2.1.2",
"create-hash": "^1.2.0",
"ethers": "^5.7.2",
Expand Down
11 changes: 6 additions & 5 deletions libs/remix-lib/src/execution/eventsDecoder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
import { ethers } from 'ethers'
import { EventFragment, Interface } from 'ethers'
import { visitContracts } from './txHelper'

/**
Expand Down Expand Up @@ -40,10 +40,11 @@ export class EventsDecoder {

_eventABI (contract): Record<string, { event, inputs, object, abi }> {
const eventABI: Record<string, { event, inputs, object, abi }> = {}
const abi = new ethers.utils.Interface(contract.abi)
for (const e in abi.events) {
const event = abi.getEvent(e)
eventABI[abi.getEventTopic(e).replace('0x', '')] = { event: event.name, inputs: event.inputs, object: event, abi: abi }
const abi = new Interface(contract.abi)
let eventFragments = abi.fragments.filter(f => f.type === "event") as Array<EventFragment>
for (const e of eventFragments) {
const event = abi.getEvent(e.name)
eventABI[e.topicHash.replace('0x', '')] = { event: event.name, inputs: event.inputs, object: event, abi: abi }
}
return eventABI
}
Expand Down
Loading