fix external provider failure

pull/5367/head
Joseph Izang 2 weeks ago committed by Aniket
parent 9c0433f9c5
commit 2b052f8e05
  1. 29
      libs/remix-ui/run-tab/src/lib/actions/evmmap.ts
  2. 144
      libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx
  3. 7
      libs/remix-ui/run-tab/src/lib/run-tab.tsx
  4. 9
      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,17 +247,6 @@ export function getCompatibleChain(
fork: HardFork, fork: HardFork,
chainId: number chainId: number
): ChainCompatibleInfo | undefined { ): ChainCompatibleInfo | 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
// }
// }
for (const [forkKey, forkData] of evmMap) { for (const [forkKey, forkData] of evmMap) {
const compatibleChain = forkData.chainId.find(chain => chain.id === chainId) const compatibleChain = forkData.chainId.find(chain => chain.id === chainId)

@ -174,56 +174,112 @@ export function ContractGUI(props: ContractGUIProps) {
const handleActionClick = async () => { const handleActionClick = async () => {
props.getVersion() props.getVersion()
await props.getCompilerDetails()
if (props.evmCheckComplete === false && !props.runTabState.selectExEnv.toLowerCase().includes('vm-')) return if (!props.runTabState.selectExEnv.toLowerCase().includes('vm-') || !props.runTabState.selectExEnv.toLowerCase().includes('basic-http-provider')) {
if (deployState.deploy) { const status = await props.getCompilerDetails()
const proxyInitializeString = getMultiValsString(initializeFields.current) if (status === 'Failed') {
props.clickCallBack(props.initializerOptions.inputs.inputs, proxyInitializeString, ['Deploy with Proxy']) props.plugin.call('terminal', 'log', { type: 'log', value: 'Consider opening an issue to update our internal store with your desired chainId.' })
} else if (deployState.upgrade) { return
if (proxyAddress === '') { }
setProxyAddressError(intl.formatMessage({ id: 'udapp.proxyAddressError1' })) if (deployState.deploy) {
} else { const proxyInitializeString = getMultiValsString(initializeFields.current)
const isValidProxyAddress = await props.isValidProxyAddress(proxyAddress) props.clickCallBack(props.initializerOptions.inputs.inputs, proxyInitializeString, ['Deploy with Proxy'])
if (isValidProxyAddress) { } else if (deployState.upgrade) {
setProxyAddressError('') if (proxyAddress === '') {
const upgradeReport: any = await props.isValidProxyUpgrade(proxyAddress) setProxyAddressError(intl.formatMessage({ id: 'udapp.proxyAddressError1' }))
if (upgradeReport.ok) { } else {
!proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy']) const isValidProxyAddress = await props.isValidProxyAddress(proxyAddress)
} else { if (isValidProxyAddress) {
if (upgradeReport.warning) { setProxyAddressError('')
props.modal( const upgradeReport: any = await props.isValidProxyUpgrade(proxyAddress)
'Proxy Upgrade Warning', if (upgradeReport.ok) {
unavailableProxyLayoutMsg(), !proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy'])
'Proceed',
() => {
!proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy'])
},
'Cancel',
() => {},
'btn-warning',
'btn-secondary'
)
} else { } else {
props.modal( if (upgradeReport.warning) {
'Proxy Upgrade Error', props.modal(
upgradeReportMsg(upgradeReport), 'Proxy Upgrade Warning',
'Continue anyway ', unavailableProxyLayoutMsg(),
() => { 'Proceed',
!proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy']) () => {
}, !proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy'])
'Cancel', },
() => {}, 'Cancel',
'btn-warning', () => {},
'btn-secondary' 'btn-warning',
) 'btn-secondary'
)
} else {
props.modal(
'Proxy Upgrade Error',
upgradeReportMsg(upgradeReport),
'Continue anyway ',
() => {
!proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy'])
},
'Cancel',
() => {},
'btn-warning',
'btn-secondary'
)
}
} }
} else {
setProxyAddressError(intl.formatMessage({ id: 'udapp.proxyAddressError2' }))
} }
} else {
setProxyAddressError(intl.formatMessage({ id: 'udapp.proxyAddressError2' }))
} }
} else {
props.clickCallBack(props.funcABI.inputs, basicInput)
} }
} else { } else {
props.clickCallBack(props.funcABI.inputs, basicInput) if (deployState.deploy) {
const proxyInitializeString = getMultiValsString(initializeFields.current)
props.clickCallBack(props.initializerOptions.inputs.inputs, proxyInitializeString, ['Deploy with Proxy'])
} else if (deployState.upgrade) {
if (proxyAddress === '') {
setProxyAddressError(intl.formatMessage({ id: 'udapp.proxyAddressError1' }))
} else {
const isValidProxyAddress = await props.isValidProxyAddress(proxyAddress)
if (isValidProxyAddress) {
setProxyAddressError('')
const upgradeReport: any = await props.isValidProxyUpgrade(proxyAddress)
if (upgradeReport.ok) {
!proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy'])
} else {
if (upgradeReport.warning) {
props.modal(
'Proxy Upgrade Warning',
unavailableProxyLayoutMsg(),
'Proceed',
() => {
!proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy'])
},
'Cancel',
() => {},
'btn-warning',
'btn-secondary'
)
} else {
props.modal(
'Proxy Upgrade Error',
upgradeReportMsg(upgradeReport),
'Continue anyway ',
() => {
!proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy'])
},
'Cancel',
() => {},
'btn-warning',
'btn-secondary'
)
}
}
} else {
setProxyAddressError(intl.formatMessage({ id: 'udapp.proxyAddressError2' }))
}
}
} else {
props.clickCallBack(props.funcABI.inputs, basicInput)
}
} }
} }

@ -58,6 +58,8 @@ import { ScenarioPrompt } from './components/scenario'
import { setIpfsCheckedState, setRemixDActivated } from './actions/payload' import { setIpfsCheckedState, setRemixDActivated } from './actions/payload'
import { ChainCompatibleInfo, getCompatibleChain, getCompatibleChains, HardFork, isChainCompatible, isChainCompatibleWithAnyFork } from './actions/evmmap' import { ChainCompatibleInfo, getCompatibleChain, getCompatibleChains, HardFork, isChainCompatible, isChainCompatibleWithAnyFork } from './actions/evmmap'
export type CheckStatus = 'Passed' | 'Failed'
export function RunTabUI(props: RunTabProps) { export function RunTabUI(props: RunTabProps) {
const { plugin } = props const { plugin } = props
const [focusModal, setFocusModal] = useState<Modal>({ const [focusModal, setFocusModal] = useState<Modal>({
@ -129,7 +131,7 @@ export function RunTabUI(props: RunTabProps) {
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 && !runTab.networkName.toLowerCase().includes('vm')) { if (compilerState.target !== null) {
const targetChainId = runTab.chainId const targetChainId = runTab.chainId
const ideDefault = fetchDetails && fetchDetails.evmVersion !== null ? fetchDetails.evmVersion : 'cancun' const ideDefault = fetchDetails && fetchDetails.evmVersion !== null ? fetchDetails.evmVersion : 'cancun'
const IsCompatible = isChainCompatible(ideDefault, targetChainId) const IsCompatible = isChainCompatible(ideDefault, targetChainId)
@ -137,7 +139,7 @@ export function RunTabUI(props: RunTabProps) {
if (chain === undefined) { if (chain === undefined) {
//show modal //show modal
plugin.call('terminal', 'log', { type: 'log', value: 'No compatible chain found for the selected EVM version.' }) plugin.call('terminal', 'log', { type: 'log', value: 'No compatible chain found for the selected EVM version.' })
return return 'Failed'
} else { } else {
setEvmCheckComplete(true) setEvmCheckComplete(true)
if (!IsCompatible) { if (!IsCompatible) {
@ -161,6 +163,7 @@ export function RunTabUI(props: RunTabProps) {
}) })
} }
} }
return 'Passed'
} }
} }

@ -4,6 +4,7 @@ import { ContractData, FuncABI, OverSizeLimit } from '@remix-project/core-plugin
import { RunTab } from './run-tab' import { RunTab } from './run-tab'
import { SolcInput, SolcOutput } from '@openzeppelin/upgrades-core' import { SolcInput, SolcOutput } from '@openzeppelin/upgrades-core'
import { LayoutCompatibilityReport } from '@openzeppelin/upgrades-core/dist/storage/report' import { LayoutCompatibilityReport } from '@openzeppelin/upgrades-core/dist/storage/report'
import { CheckStatus } from '../run-tab'
export interface RunTabProps { export interface RunTabProps {
plugin: RunTab, plugin: RunTab,
initialState?: RunTabState initialState?: RunTabState
@ -232,7 +233,7 @@ export type MainnetPrompt = (
) => JSX.Element ) => JSX.Element
export interface ContractDropdownProps { export interface ContractDropdownProps {
getCompilerDetails: () => Promise<any> getCompilerDetails: () => Promise<CheckStatus>
evmCheckComplete: boolean, evmCheckComplete: boolean,
plugin: RunTab, plugin: RunTab,
runTabState: RunTabState runTabState: RunTabState
@ -300,7 +301,7 @@ export interface RecorderProps {
} }
export interface InstanceContainerProps { export interface InstanceContainerProps {
getCompilerDetails: () => Promise<any> getCompilerDetails: () => Promise<CheckStatus>
runTabState: RunTabState runTabState: RunTabState
instances: { instances: {
instanceList: { instanceList: {
@ -383,7 +384,7 @@ export interface DeployOptions {
} }
export interface ContractGUIProps { export interface ContractGUIProps {
getCompilerDetails: () => Promise<any> getCompilerDetails: () => Promise<CheckStatus>
evmCheckComplete: boolean, evmCheckComplete: boolean,
plugin: RunTab, plugin: RunTab,
runTabState: RunTabState runTabState: RunTabState
@ -426,7 +427,7 @@ export interface MainnetProps {
} }
export interface UdappProps { export interface UdappProps {
getCompilerDetails: () => Promise<any> getCompilerDetails: () => Promise<CheckStatus>
runTabState: RunTabState runTabState: RunTabState
instance: { instance: {
contractData?: ContractData, contractData?: ContractData,

Loading…
Cancel
Save