fix e2e failing

pull/5367/head
Joseph Izang 3 weeks ago committed by Aniket
parent 342d1f6d49
commit 7fd373e03d
  1. 45
      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. 64
      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: 421614, name: "Arbitrum Sepolia" },
{ id: 534352, name: "Scroll" },
{ id: 11155111, name: "Sepolia" }
// { id: 11155111, name: "Sepolia" }
],
minCompilerVersion: "0.8.24+commit.e11b9ed9",
evmVersion: 'cancun'
@ -73,7 +73,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
{ id: 59902, name: "Metis Sepolia Testnet" },
{ id: 421614, name: "Arbitrum Sepolia" },
{ id: 534352, name: "Scroll" },
{ id: 11155111, name: "Sepolia" },
// { id: 11155111, name: "Sepolia" },
{ id: 11155420, name: "Optimism Sepolia Testnet" },
{ 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: 421614, name: "Arbitrum Sepolia" },
{ id: 534352, name: "Scroll" },
{ id: 11155111, name: "Sepolia" },
// { id: 11155111, name: "Sepolia" },
{ id: 11155420, name: "Optimism Sepolia Testnet" },
{ 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: 59144, name: "Linea Mainnet" },
{ id: 59141, name: "Linea Testnet" },
{ id: 11155111, name: "Sepolia" },
// { id: 11155111, name: "Sepolia" },
],
minCompilerVersion: "0.8.7+commit.e28d00a7",
evmVersion: 'london'
@ -153,7 +153,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
{ id: 42220, name: "Celo Mainnet" },
{ id: 59144, name: "Linea Mainnet" },
{ id: 59141, name: "Linea Testnet" },
{ id: 11155111, name: "Sepolia" }
// { id: 11155111, name: "Sepolia" }
],
minCompilerVersion: "0.8.5+commit.a4f2e591",
evmVersion: 'berlin'
@ -174,7 +174,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
{ id: 42220, name: "Celo Mainnet" },
{ id: 59144, name: "Linea Mainnet" },
{ id: 59141, name: "Linea Testnet" },
{ id: 11155111, name: "Sepolia" }
// { id: 11155111, name: "Sepolia" }
],
minCompilerVersion: "0.5.14+commit.01f1aaa4",
evmVersion: 'istanbul'
@ -183,7 +183,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
chainId: [
{ id: 1, name: "Ethereum Mainnet" },
{ id: 5, name: "Goerli" },
{ id: 11155111, name: "Sepolia" }
// { id: 11155111, name: "Sepolia" }
],
minCompilerVersion: "0.5.5+commit.47a71e8f",
evmVersion: 'petersburg'
@ -192,7 +192,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
chainId: [
{ id: 1, name: "Ethereum Mainnet" },
{ id: 5, name: "Goerli" },
{ id: 11155111, name: "Sepolia" }
// { id: 11155111, name: "Sepolia" }
],
minCompilerVersion: "0.5.5+commit.47a71e8f",
evmVersion: 'constantinople'
@ -222,7 +222,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
chainId: [
{ id: 1, name: "Ethereum Mainnet" },
{ id: 5, name: "Goerli" },
{ id: 11155111, name: "Sepolia" }
// { id: 11155111, name: "Sepolia" }
],
minCompilerVersion: "0.1.2+commit.d0d36e3",
evmVersion: 'homestead'
@ -247,15 +247,26 @@ export function getCompatibleChain(
fork: HardFork,
chainId: number
): ChainCompatibleInfo | undefined {
const forkData = evmMap.get(fork)
if (!forkData) return undefined
// const forkData = evmMap.get(fork)
// if (!forkData) return undefined
// const compatibleChain = forkData.chainId.find(chain => chain.id === chainId)
// if (compatibleChain) {
// return {
// chain: compatibleChain,
// minCompilerVersion: forkData.minCompilerVersion,
// evmVersion: fork
// }
// }
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)
if (compatibleChain) {
return {
chain: compatibleChain,
minCompilerVersion: forkData.minCompilerVersion,
evmVersion: forkKey
}
}
}

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

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

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

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

@ -1,5 +1,5 @@
// 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 { FormattedMessage } from 'react-intl'
import { ModalDialog } from '@remix-ui/modal-dialog'
@ -86,6 +86,7 @@ export function RunTabUI(props: RunTabProps) {
const REACT_API = { runTab }
const currentfile = plugin.config.get('currentFile')
const [solcVersion, setSolcVersion] = useState<{version: string, canReceive: boolean}>({ version: '', canReceive: true })
const [evmCheckComplete, setEvmCheckComplete] = useState(false)
const getVersion = () => {
let version = '0.8.25'
@ -106,7 +107,9 @@ export function RunTabUI(props: RunTabProps) {
const getCompilerDetails = async () => await checkEvmChainCompatibility()
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) => {
@ -125,31 +128,41 @@ export function RunTabUI(props: RunTabProps) {
const checkEvmChainCompatibility = async () => {
const fetchDetails = await plugin.call('solidity', 'getCompilerQueryParameters')
const compilerState = await plugin.call('solidity', 'getCompilerState')
// if no contract file is open, don't do anything
if (compilerState.target !== null) {
const targetChainId = runTab.chainId ? parseInt(runTab.chainId) : runTab.chainId
const IsCompatible = isChainCompatible(fetchDetails.evmVersion ?? 'cancun', targetChainId)
if (!IsCompatible) {
const chain = await returnCompatibleChain(fetchDetails.evmVersion, targetChainId)
console.log('chain obtained', { chain, targetChainId, fetchDetails })
if (compilerState.target !== null && !runTab.networkName.toLowerCase().includes('vm')) {
const targetChainId = runTab.chainId
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) {
//show modal
plugin.call('notification', 'modal', {
id: 'evm-chainId-incompatible',
title: 'Incompatible EVM - ChainId Detected',
message: <div className="px-3">
<p>The selected chain is not compatible with the selected EVM version. Please select a one of the options below.</p>
<ul className="px-3">
<li>Have Remix switch to a compatible EVM version for this chain and recompile the contract.</li>
<li>Cancel to keep the current EVM version.</li>
</ul>
<p>To manually change the EVM version, go to the Advanced Configurations section of the Solidity compiler.</p>
</div>,
modalType: 'modal',
okLabel: 'Switch EVM and Recompile',
cancelLabel: 'Cancel',
okFn: () => checkEvmChainCompatibilityOkFunction(chain),
cancelFn: () => {}
})
plugin.call('notification', 'modal', {
id: 'evm-chainId-incompatible',
title: 'Incompatible EVM - ChainId Detected',
message: <div className="px-3">
<p>The selected chain is not compatible with the selected EVM version. Please select a one of the options below.</p>
<ul className="px-3">
<li>Have Remix switch to a compatible EVM version for this chain and recompile the contract.</li>
<li>Cancel to keep the current EVM version.</li>
</ul>
<p>To manually change the EVM version, go to the Advanced Configurations section of the Solidity compiler.</p>
</div>,
modalType: 'modal',
okLabel: 'Switch EVM and Recompile',
cancelLabel: 'Cancel',
okFn: () => checkEvmChainCompatibilityOkFunction(chain),
cancelFn: () => {}
})
}
}
}
}
@ -386,6 +399,7 @@ export function RunTabUI(props: RunTabProps) {
setCompilerVersion={setSolcVersion}
getCompilerVersion={getVersion}
getCompilerDetails={getCompilerDetails}
evmCheckComplete={evmCheckComplete}
/>
<RecorderUI
plugin={plugin}

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

Loading…
Cancel
Save