fix e2e failing

pull/5367/head
Joseph Izang 3 weeks ago committed by Aniket
parent 342d1f6d49
commit 7fd373e03d
  1. 35
      libs/remix-ui/run-tab/src/lib/actions/evmmap.ts
  2. 1
      libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx
  3. 1
      libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx
  4. 1
      libs/remix-ui/run-tab/src/lib/components/environment.tsx
  5. 1
      libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx
  6. 28
      libs/remix-ui/run-tab/src/lib/run-tab.tsx
  7. 2
      libs/remix-ui/run-tab/src/lib/types/index.ts

@ -41,7 +41,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
{ id: 59141, name: "Linea Testnet" }, { id: 59141, name: "Linea Testnet" },
{ id: 421614, name: "Arbitrum Sepolia" }, { id: 421614, name: "Arbitrum Sepolia" },
{ id: 534352, name: "Scroll" }, { id: 534352, name: "Scroll" },
{ id: 11155111, name: "Sepolia" } // { id: 11155111, name: "Sepolia" }
], ],
minCompilerVersion: "0.8.24+commit.e11b9ed9", minCompilerVersion: "0.8.24+commit.e11b9ed9",
evmVersion: 'cancun' evmVersion: 'cancun'
@ -73,7 +73,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
{ id: 59902, name: "Metis Sepolia Testnet" }, { id: 59902, name: "Metis Sepolia Testnet" },
{ id: 421614, name: "Arbitrum Sepolia" }, { id: 421614, name: "Arbitrum Sepolia" },
{ id: 534352, name: "Scroll" }, { id: 534352, name: "Scroll" },
{ id: 11155111, name: "Sepolia" }, // { id: 11155111, name: "Sepolia" },
{ id: 11155420, name: "Optimism Sepolia Testnet" }, { id: 11155420, name: "Optimism Sepolia Testnet" },
{ id: 1666600000, name: "Harmony Mainnet Shard 0" } { id: 1666600000, name: "Harmony Mainnet Shard 0" }
], ],
@ -109,7 +109,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
{ id: 59902, name: "Metis Sepolia Testnet" }, { id: 59902, name: "Metis Sepolia Testnet" },
{ id: 421614, name: "Arbitrum Sepolia" }, { id: 421614, name: "Arbitrum Sepolia" },
{ id: 534352, name: "Scroll" }, { id: 534352, name: "Scroll" },
{ id: 11155111, name: "Sepolia" }, // { id: 11155111, name: "Sepolia" },
{ id: 11155420, name: "Optimism Sepolia Testnet" }, { id: 11155420, name: "Optimism Sepolia Testnet" },
{ id: 1666600000, name: "Harmony Mainnet Shard 0" } { id: 1666600000, name: "Harmony Mainnet Shard 0" }
], ],
@ -132,7 +132,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
{ id: 42220, name: "Celo Mainnet" }, { id: 42220, name: "Celo Mainnet" },
{ id: 59144, name: "Linea Mainnet" }, { id: 59144, name: "Linea Mainnet" },
{ id: 59141, name: "Linea Testnet" }, { id: 59141, name: "Linea Testnet" },
{ id: 11155111, name: "Sepolia" }, // { id: 11155111, name: "Sepolia" },
], ],
minCompilerVersion: "0.8.7+commit.e28d00a7", minCompilerVersion: "0.8.7+commit.e28d00a7",
evmVersion: 'london' evmVersion: 'london'
@ -153,7 +153,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
{ id: 42220, name: "Celo Mainnet" }, { id: 42220, name: "Celo Mainnet" },
{ id: 59144, name: "Linea Mainnet" }, { id: 59144, name: "Linea Mainnet" },
{ id: 59141, name: "Linea Testnet" }, { id: 59141, name: "Linea Testnet" },
{ id: 11155111, name: "Sepolia" } // { id: 11155111, name: "Sepolia" }
], ],
minCompilerVersion: "0.8.5+commit.a4f2e591", minCompilerVersion: "0.8.5+commit.a4f2e591",
evmVersion: 'berlin' evmVersion: 'berlin'
@ -174,7 +174,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
{ id: 42220, name: "Celo Mainnet" }, { id: 42220, name: "Celo Mainnet" },
{ id: 59144, name: "Linea Mainnet" }, { id: 59144, name: "Linea Mainnet" },
{ id: 59141, name: "Linea Testnet" }, { id: 59141, name: "Linea Testnet" },
{ id: 11155111, name: "Sepolia" } // { id: 11155111, name: "Sepolia" }
], ],
minCompilerVersion: "0.5.14+commit.01f1aaa4", minCompilerVersion: "0.5.14+commit.01f1aaa4",
evmVersion: 'istanbul' evmVersion: 'istanbul'
@ -183,7 +183,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
chainId: [ chainId: [
{ id: 1, name: "Ethereum Mainnet" }, { id: 1, name: "Ethereum Mainnet" },
{ id: 5, name: "Goerli" }, { id: 5, name: "Goerli" },
{ id: 11155111, name: "Sepolia" } // { id: 11155111, name: "Sepolia" }
], ],
minCompilerVersion: "0.5.5+commit.47a71e8f", minCompilerVersion: "0.5.5+commit.47a71e8f",
evmVersion: 'petersburg' evmVersion: 'petersburg'
@ -192,7 +192,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
chainId: [ chainId: [
{ id: 1, name: "Ethereum Mainnet" }, { id: 1, name: "Ethereum Mainnet" },
{ id: 5, name: "Goerli" }, { id: 5, name: "Goerli" },
{ id: 11155111, name: "Sepolia" } // { id: 11155111, name: "Sepolia" }
], ],
minCompilerVersion: "0.5.5+commit.47a71e8f", minCompilerVersion: "0.5.5+commit.47a71e8f",
evmVersion: 'constantinople' evmVersion: 'constantinople'
@ -222,7 +222,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
chainId: [ chainId: [
{ id: 1, name: "Ethereum Mainnet" }, { id: 1, name: "Ethereum Mainnet" },
{ id: 5, name: "Goerli" }, { id: 5, name: "Goerli" },
{ id: 11155111, name: "Sepolia" } // { id: 11155111, name: "Sepolia" }
], ],
minCompilerVersion: "0.1.2+commit.d0d36e3", minCompilerVersion: "0.1.2+commit.d0d36e3",
evmVersion: 'homestead' evmVersion: 'homestead'
@ -247,15 +247,26 @@ export function getCompatibleChain(
fork: HardFork, fork: HardFork,
chainId: number chainId: number
): ChainCompatibleInfo | undefined { ): ChainCompatibleInfo | undefined {
const forkData = evmMap.get(fork) // const forkData = evmMap.get(fork)
if (!forkData) return undefined // if (!forkData) return undefined
// const compatibleChain = forkData.chainId.find(chain => chain.id === chainId)
// if (compatibleChain) {
// return {
// chain: compatibleChain,
// minCompilerVersion: forkData.minCompilerVersion,
// evmVersion: fork
// }
// }
for (const [forkKey, forkData] of evmMap) {
const compatibleChain = forkData.chainId.find(chain => chain.id === chainId) const compatibleChain = forkData.chainId.find(chain => chain.id === chainId)
if (compatibleChain) { if (compatibleChain) {
return { return {
chain: compatibleChain, chain: compatibleChain,
minCompilerVersion: forkData.minCompilerVersion, minCompilerVersion: forkData.minCompilerVersion,
evmVersion: fork evmVersion: forkKey
}
} }
} }

@ -482,6 +482,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
solcVersion={props.solCompilerVersion} solcVersion={props.solCompilerVersion}
setSolcVersion={props.setCompilerVersion} setSolcVersion={props.setCompilerVersion}
getVersion={props.getCompilerVersion} getVersion={props.getCompilerVersion}
evmCheckComplete={props.evmCheckComplete}
/> />
<div className="d-flex py-1 align-items-center custom-control custom-checkbox"> <div className="d-flex py-1 align-items-center custom-control custom-checkbox">
<input <input

@ -175,6 +175,7 @@ export function ContractGUI(props: ContractGUIProps) {
const handleActionClick = async () => { const handleActionClick = async () => {
props.getVersion() props.getVersion()
await props.getCompilerDetails() await props.getCompilerDetails()
if (props.evmCheckComplete === false) return
if (deployState.deploy) { if (deployState.deploy) {
const proxyInitializeString = getMultiValsString(initializeFields.current) const proxyInitializeString = getMultiValsString(initializeFields.current)
props.clickCallBack(props.initializerOptions.inputs.inputs, proxyInitializeString, ['Deploy with Proxy']) props.clickCallBack(props.initializerOptions.inputs.inputs, proxyInitializeString, ['Deploy with Proxy'])

@ -67,7 +67,6 @@ export function EnvironmentUI(props: EnvironmentProps) {
<Dropdown.Item <Dropdown.Item
key={name} key={name}
onClick={async () => { onClick={async () => {
await props.checkSelectionCorrectness()
handleChangeExEnv(name) handleChangeExEnv(name)
}} }}
data-id={`dropdown-item-${name}`} data-id={`dropdown-item-${name}`}

@ -327,6 +327,7 @@ export function UniversalDappUI(props: UdappProps) {
<ContractGUI <ContractGUI
getVersion={props.getVersion} getVersion={props.getVersion}
getCompilerDetails={props.getCompilerDetails} getCompilerDetails={props.getCompilerDetails}
evmCheckComplete={false}
funcABI={funcABI} funcABI={funcABI}
clickCallBack={(valArray: {name: string; type: string}[], inputsValues: string) => { clickCallBack={(valArray: {name: string; type: string}[], inputsValues: string) => {
runTransaction(lookupOnly, funcABI, valArray, inputsValues, index) runTransaction(lookupOnly, funcABI, valArray, inputsValues, index)

@ -1,5 +1,5 @@
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define
import React, { Fragment, useEffect, useReducer, useState } from 'react' import React, { Fragment, useCallback, useEffect, useReducer, useState } from 'react'
import semver from 'semver' import semver from 'semver'
import { FormattedMessage } from 'react-intl' import { FormattedMessage } from 'react-intl'
import { ModalDialog } from '@remix-ui/modal-dialog' import { ModalDialog } from '@remix-ui/modal-dialog'
@ -86,6 +86,7 @@ export function RunTabUI(props: RunTabProps) {
const REACT_API = { runTab } const REACT_API = { runTab }
const currentfile = plugin.config.get('currentFile') const currentfile = plugin.config.get('currentFile')
const [solcVersion, setSolcVersion] = useState<{version: string, canReceive: boolean}>({ version: '', canReceive: true }) const [solcVersion, setSolcVersion] = useState<{version: string, canReceive: boolean}>({ version: '', canReceive: true })
const [evmCheckComplete, setEvmCheckComplete] = useState(false)
const getVersion = () => { const getVersion = () => {
let version = '0.8.25' let version = '0.8.25'
@ -106,7 +107,9 @@ export function RunTabUI(props: RunTabProps) {
const getCompilerDetails = async () => await checkEvmChainCompatibility() const getCompilerDetails = async () => await checkEvmChainCompatibility()
const returnCompatibleChain = async (evmVersion: HardFork, targetChainId: number) => { const returnCompatibleChain = async (evmVersion: HardFork, targetChainId: number) => {
return getCompatibleChain(evmVersion ?? 'paris', targetChainId) // using paris evm as a default fallback version const result = getCompatibleChain(evmVersion ?? 'paris', targetChainId) // using paris evm as a default fallback version
console.log('result', result)
return result
} }
const checkEvmChainCompatibilityOkFunction = async (fetchDetails: ChainCompatibleInfo) => { const checkEvmChainCompatibilityOkFunction = async (fetchDetails: ChainCompatibleInfo) => {
@ -125,13 +128,22 @@ export function RunTabUI(props: RunTabProps) {
const checkEvmChainCompatibility = async () => { const checkEvmChainCompatibility = async () => {
const fetchDetails = await plugin.call('solidity', 'getCompilerQueryParameters') const fetchDetails = await plugin.call('solidity', 'getCompilerQueryParameters')
const compilerState = await plugin.call('solidity', 'getCompilerState') const compilerState = await plugin.call('solidity', 'getCompilerState')
// if no contract file is open, don't do anything // if no contract file is open, don't do anything
if (compilerState.target !== null) { if (compilerState.target !== null && !runTab.networkName.toLowerCase().includes('vm')) {
const targetChainId = runTab.chainId ? parseInt(runTab.chainId) : runTab.chainId const targetChainId = runTab.chainId
const IsCompatible = isChainCompatible(fetchDetails.evmVersion ?? 'cancun', targetChainId) const ideDefault = fetchDetails && fetchDetails.evmVersion !== null ? fetchDetails.evmVersion : 'cancun'
console.log(ideDefault)
const IsCompatible = isChainCompatible(ideDefault, targetChainId)
const chain = await returnCompatibleChain(ideDefault, targetChainId)
if (chain === undefined) {
//show modal
await plugin.call('notification', 'alert', { id: 'evm-chainId-error', message: 'No compatible chain found for the selected EVM version.', title: 'Error' })
return
} else {
setEvmCheckComplete(true)
console.log('check the things', { chain, fetchDetails, compilerState, targetChainId, runTab })
if (!IsCompatible) { if (!IsCompatible) {
const chain = await returnCompatibleChain(fetchDetails.evmVersion, targetChainId)
console.log('chain obtained', { chain, targetChainId, fetchDetails })
//show modal //show modal
plugin.call('notification', 'modal', { plugin.call('notification', 'modal', {
id: 'evm-chainId-incompatible', id: 'evm-chainId-incompatible',
@ -153,6 +165,7 @@ export function RunTabUI(props: RunTabProps) {
} }
} }
} }
}
useEffect(() => { useEffect(() => {
if (!props.initialState) { if (!props.initialState) {
@ -386,6 +399,7 @@ export function RunTabUI(props: RunTabProps) {
setCompilerVersion={setSolcVersion} setCompilerVersion={setSolcVersion}
getCompilerVersion={getVersion} getCompilerVersion={getVersion}
getCompilerDetails={getCompilerDetails} getCompilerDetails={getCompilerDetails}
evmCheckComplete={evmCheckComplete}
/> />
<RecorderUI <RecorderUI
plugin={plugin} plugin={plugin}

@ -233,6 +233,7 @@ export type MainnetPrompt = (
export interface ContractDropdownProps { export interface ContractDropdownProps {
getCompilerDetails: () => Promise<any> getCompilerDetails: () => Promise<any>
evmCheckComplete: boolean,
selectedAccount: string, selectedAccount: string,
exEnvironment: string, exEnvironment: string,
contracts: { contracts: {
@ -380,6 +381,7 @@ export interface DeployOptions {
export interface ContractGUIProps { export interface ContractGUIProps {
getCompilerDetails: () => Promise<any> getCompilerDetails: () => Promise<any>
evmCheckComplete: boolean,
title?: string, title?: string,
funcABI: FuncABI, funcABI: FuncABI,
inputs: string, inputs: string,

Loading…
Cancel
Save