From eef7b8fd41150bbdc4a493d52c3ee57a14b38ca3 Mon Sep 17 00:00:00 2001 From: KillariDev Date: Tue, 30 Jan 2024 15:38:39 +0200 Subject: [PATCH 1/4] no gas limit for eth_simulateV1 eth_call's and `isEthSimulateV1Node` refactor --- app/ts/background/settings.ts | 2 ++ app/ts/background/simulationModeHanders.ts | 13 +++----- app/ts/components/pages/PersonalSign.tsx | 7 ++-- .../SimulationSummary.tsx | 3 +- .../GovernanceVoteVisualizer.tsx | 7 ++-- .../services/EthereumClientService.ts | 3 +- .../SimulationModeEthereumClientService.ts | 32 +++++++++++++++---- app/ts/types/wire-types.ts | 3 +- app/ts/utils/constants.ts | 1 + 9 files changed, 45 insertions(+), 26 deletions(-) diff --git a/app/ts/background/settings.ts b/app/ts/background/settings.ts index b8da6a25..42032a54 100644 --- a/app/ts/background/settings.ts +++ b/app/ts/background/settings.ts @@ -115,6 +115,8 @@ export const defaultRpcs = [ }, ] as const +export const isEthSimulateV1Node = (httpsRpc: string) => httpsRpc === 'https://rpc.dark.florist/winedancemuffinborrow' || httpsRpc === 'https://rpc.dark.florist/birdchalkrenewtip' || httpsRpc === 'https://rpc-goerli.dark.florist/flipcardtrustone' + export async function getSettings() : Promise { const results = await browserStorageLocalGet([ 'activeSimulationAddress', diff --git a/app/ts/background/simulationModeHanders.ts b/app/ts/background/simulationModeHanders.ts index 8466e41a..214c45b2 100644 --- a/app/ts/background/simulationModeHanders.ts +++ b/app/ts/background/simulationModeHanders.ts @@ -1,7 +1,7 @@ import { EthereumClientService } from '../simulation/services/EthereumClientService.js' import { createEthereumSubscription, removeEthereumSubscription } from '../simulation/services/EthereumSubscriptionService.js' -import { simulationGasLeft, getSimulatedBalance, getSimulatedBlock, getSimulatedBlockNumber, getSimulatedCode, getSimulatedLogs, getSimulatedStack, getSimulatedTransactionByHash, getSimulatedTransactionCount, getSimulatedTransactionReceipt, simulatedCall, simulateEstimateGas, getInputFieldFromDataOrInput, getSimulatedBlockByHash, getSimulatedFeeHistory } from '../simulation/services/SimulationModeEthereumClientService.js' -import { ERROR_INTERCEPTOR_GAS_ESTIMATION_FAILED, ERROR_INTERCEPTOR_GET_CODE_FAILED, KNOWN_CONTRACT_CALLER_ADDRESSES } from '../utils/constants.js' +import { getSimulatedBalance, getSimulatedBlock, getSimulatedBlockNumber, getSimulatedCode, getSimulatedLogs, getSimulatedStack, getSimulatedTransactionByHash, getSimulatedTransactionCount, getSimulatedTransactionReceipt, simulatedCall, simulateEstimateGas, getInputFieldFromDataOrInput, getSimulatedBlockByHash, getSimulatedFeeHistory } from '../simulation/services/SimulationModeEthereumClientService.js' +import { DEFAULT_CALL_ADDRESS, ERROR_INTERCEPTOR_GAS_ESTIMATION_FAILED, ERROR_INTERCEPTOR_GET_CODE_FAILED, KNOWN_CONTRACT_CALLER_ADDRESSES } from '../utils/constants.js' import { RPCReply } from '../types/interceptor-messages.js' import { WebsiteTabConnections } from '../types/user-interface-types.js' import { SimulationState } from '../types/visualizer-types.js' @@ -15,8 +15,6 @@ import { Simulator } from '../simulation/simulator.js' import { Website } from '../types/websiteAccessTypes.js' import { SignMessageParams } from '../types/jsonRpc-signing-types.js' -const defaultCallAddress = 0x1n - export async function getBlockByHash(ethereumClientService: EthereumClientService, simulationState: SimulationState | undefined, request: EthBlockByHashParams) { return { method: request.method, result: await getSimulatedBlockByHash(ethereumClientService, simulationState, request.params[0], request.params[1]) } } @@ -74,7 +72,6 @@ async function singleCallWithFromOverride(ethereumClientService: EthereumClientS value, input: getInputFieldFromDataOrInput(callParams), accessList: [], - gasLimit: callParams.gas === undefined ? simulationGasLeft(simulationState, await ethereumClientService.getBlock()) : callParams.gas } return await simulatedCall(ethereumClientService, simulationState, callTransaction, blockTag) @@ -82,15 +79,15 @@ async function singleCallWithFromOverride(ethereumClientService: EthereumClientS export async function call(ethereumClientService: EthereumClientService, simulationState: SimulationState | undefined, request: EthCallParams) { const callParams = request.params[0] - const from = callParams.from !== undefined && !KNOWN_CONTRACT_CALLER_ADDRESSES.includes(callParams.from) ? callParams.from : defaultCallAddress + const from = callParams.from !== undefined && !KNOWN_CONTRACT_CALLER_ADDRESSES.includes(callParams.from) ? callParams.from : DEFAULT_CALL_ADDRESS const callResult = await singleCallWithFromOverride(ethereumClientService, simulationState, request, from) if (callResult.error !== undefined && callResult.error.code === ERROR_INTERCEPTOR_GAS_ESTIMATION_FAILED ) return { method: request.method, ...callResult } // if we fail our call because we are calling from a contract, retry and change address to our default calling address // TODO: Remove this logic and KNOWN_CONTRACT_CALLER_ADDRESSES when multicall supports calling from contracts - if (callResult.error !== undefined && 'data' in callResult.error && callResult.error?.data === 'sender has deployed code' && from !== defaultCallAddress) { - const callerChangeResult = await singleCallWithFromOverride(ethereumClientService, simulationState, request, defaultCallAddress) + if (callResult.error !== undefined && 'data' in callResult.error && callResult.error?.data === 'sender has deployed code' && from !== DEFAULT_CALL_ADDRESS) { + const callerChangeResult = await singleCallWithFromOverride(ethereumClientService, simulationState, request, DEFAULT_CALL_ADDRESS) if (callerChangeResult.error !== undefined) return { method: request.method, ...callerChangeResult } return { method: request.method, ...callerChangeResult } } diff --git a/app/ts/components/pages/PersonalSign.tsx b/app/ts/components/pages/PersonalSign.tsx index bec9a7a4..0e846b6c 100644 --- a/app/ts/components/pages/PersonalSign.tsx +++ b/app/ts/components/pages/PersonalSign.tsx @@ -24,6 +24,7 @@ import { TransactionCreated } from '../simulationExplaining/SimulationSummary.js import { EnrichedSolidityTypeComponent } from '../subcomponents/solidityType.js' import { QuarantineReasons } from '../simulationExplaining/Transactions.js' import { ModifyAddressWindowState } from '../../types/visualizer-types.js' +import { isEthSimulateV1Node } from '../../background/settings.js' type SignatureCardParams = { VisualizedPersonalSignRequest: VisualizedPersonalSignRequest @@ -473,8 +474,7 @@ export function PersonalSign() { function isConfirmDisabled(VisualizedPersonalSignRequest: VisualizedPersonalSignRequest, activeAddress: bigint) { return !isPossibleToSend(VisualizedPersonalSignRequest, activeAddress) && !forceSend - && !(VisualizedPersonalSignRequest.rpcNetwork.httpsRpc === 'https://rpc.dark.florist/birdchalkrenewtip' // todo remove this check - || VisualizedPersonalSignRequest.rpcNetwork.httpsRpc === 'https://rpc.dark.florist/winedancemuffinborrow') + && !(VisualizedPersonalSignRequest.rpcNetwork.httpsRpc !== undefined && isEthSimulateV1Node(VisualizedPersonalSignRequest.rpcNetwork.httpsRpc)) } function Buttons() { @@ -562,8 +562,7 @@ export function PersonalSign() { : <> } - { !(VisualizedPersonalSignRequest.rpcNetwork.httpsRpc === 'https://rpc.dark.florist/birdchalkrenewtip' // todo remove this check - || VisualizedPersonalSignRequest.rpcNetwork.httpsRpc === 'https://rpc.dark.florist/winedancemuffinborrow') + { !(VisualizedPersonalSignRequest.rpcNetwork.httpsRpc !== undefined && isEthSimulateV1Node(VisualizedPersonalSignRequest.rpcNetwork.httpsRpc)) && VisualizedPersonalSignRequest.simulationMode && (VisualizedPersonalSignRequest.activeAddress.address === undefined || VisualizedPersonalSignRequest.activeAddress.address !== MOCK_PRIVATE_KEYS_ADDRESS || VisualizedPersonalSignRequest.method !== 'personal_sign') ?
diff --git a/app/ts/components/simulationExplaining/SimulationSummary.tsx b/app/ts/components/simulationExplaining/SimulationSummary.tsx index caa9d385..a9eb18e1 100644 --- a/app/ts/components/simulationExplaining/SimulationSummary.tsx +++ b/app/ts/components/simulationExplaining/SimulationSummary.tsx @@ -17,6 +17,7 @@ import { getEthDonator } from '../../background/storageVariables.js' import { RpcNetwork } from '../../types/rpc.js' import { AddressBookEntry, Erc1155Entry, Erc20TokenEntry, Erc721Entry } from '../../types/addressBookTypes.js' import { Website } from '../../types/websiteAccessTypes.js' +import { isEthSimulateV1Node } from '../../background/settings.js' type EtherChangeParams = { textColor: string, @@ -463,7 +464,7 @@ export function TokenLogAnalysisCard({ simTx, renameAddressCallBack }: TokenLogA const [showLogs, setShowLogs] = useState(false) const identifiedSwap = identifySwap(simTx) if (simTx === undefined) return <> - const hasEthLogs = simTx.transaction.rpcNetwork.httpsRpc === 'https://rpc.dark.florist/birdchalkrenewtip' || simTx.transaction.rpcNetwork.httpsRpc === 'https://rpc.dark.florist/winedancemuffinborrow' //todo, remove this check, all txs should have ETH logs + const hasEthLogs = simTx.transaction.rpcNetwork.httpsRpc !== undefined && isEthSimulateV1Node(simTx.transaction.rpcNetwork.httpsRpc) const tokenEventsPlural = hasEthLogs ? 'token events or ETH transactions' : 'token events' const tokenEventsSingular = hasEthLogs ? 'One token event or an ETH transaction' : 'One token event' return <> diff --git a/app/ts/components/simulationExplaining/customExplainers/GovernanceVoteVisualizer.tsx b/app/ts/components/simulationExplaining/customExplainers/GovernanceVoteVisualizer.tsx index 2e199100..d2202fe1 100644 --- a/app/ts/components/simulationExplaining/customExplainers/GovernanceVoteVisualizer.tsx +++ b/app/ts/components/simulationExplaining/customExplainers/GovernanceVoteVisualizer.tsx @@ -1,4 +1,5 @@ import { sendPopupMessageToBackgroundPage } from '../../../background/backgroundUtils.js' +import { isEthSimulateV1Node } from '../../../background/settings.js' import { AddressBookEntry } from '../../../types/addressBookTypes.js' import { MessageToPopup, GovernanceVoteInputParameters, SimulateGovernanceContractExecutionReply } from '../../../types/interceptor-messages.js' import { RenameAddressCallBack, RpcConnectionStatus } from '../../../types/user-interface-types.js' @@ -104,15 +105,13 @@ const ShowSuccessOrFailure = ({ currentBlockNumber, rpcConnectionStatus, simulat const missingAbiText = 'The governance contract is missing an ABI. Add an ABI to simulate execution of this proposal.' if (simulateGovernanceContractExecutionReply === undefined) { return
- { !(simulationAndVisualisationResults.rpcNetwork.httpsRpc === 'https://rpc.dark.florist/birdchalkrenewtip' // todo remove this check - || simulationAndVisualisationResults.rpcNetwork.httpsRpc=== 'https://rpc.dark.florist/winedancemuffinborrow') ?

experimental rpc client required

: <> } + { !(simulationAndVisualisationResults.rpcNetwork.httpsRpc !== undefined && isEthSimulateV1Node(simulationAndVisualisationResults.rpcNetwork.httpsRpc)) ?

experimental rpc client required

: <> } { simTx.transaction.to !== undefined && 'abi' in simTx.transaction.to && simTx.transaction.to.abi !== undefined ? diff --git a/app/ts/simulation/services/EthereumClientService.ts b/app/ts/simulation/services/EthereumClientService.ts index bf5fe0db..3eaa0cdc 100644 --- a/app/ts/simulation/services/EthereumClientService.ts +++ b/app/ts/simulation/services/EthereumClientService.ts @@ -10,6 +10,7 @@ import { assertNever } from '../../utils/typescript.js' import { MessageHashAndSignature, SignatureWithFakeSignerAddress, simulatePersonalSign } from './SimulationModeEthereumClientService.js' import { getEcRecoverOverride } from '../../utils/ethereumByteCodes.js' import * as funtypes from 'funtypes' +import { isEthSimulateV1Node } from '../../background/settings.js' export type IEthereumClientService = Pick export class EthereumClientService { @@ -196,7 +197,7 @@ export class EthereumClientService { public readonly multicall = async (transactions: readonly EthereumUnsignedTransaction[], spoofedSignatures: readonly SignatureWithFakeSignerAddress[], blockNumber: bigint, extraAccountOverrides: StateOverrides = {}) => { const httpsRpc = this.requestHandler.getRpcEntry().httpsRpc - if (httpsRpc === 'https://rpc.dark.florist/winedancemuffinborrow' || httpsRpc === 'https://rpc.dark.florist/birdchalkrenewtip') { + if (isEthSimulateV1Node(httpsRpc)) { //TODO: Remove this when we get rid of our old multicall const transactionsWithRemoveZeroPricedOnes = transactions.map((transaction) => { diff --git a/app/ts/simulation/services/SimulationModeEthereumClientService.ts b/app/ts/simulation/services/SimulationModeEthereumClientService.ts index 70dc0192..b92197c9 100644 --- a/app/ts/simulation/services/SimulationModeEthereumClientService.ts +++ b/app/ts/simulation/services/SimulationModeEthereumClientService.ts @@ -1,7 +1,7 @@ import { EthereumClientService } from './EthereumClientService.js' -import { EthereumUnsignedTransaction, EthereumSignedTransactionWithBlockData, EthereumBlockTag, EthereumAddress, EthereumBlockHeader, EthereumBlockHeaderWithTransactionHashes, EthereumSignedTransaction, EthereumData, EthereumQuantity, EthereumBytes32 } from '../../types/wire-types.js' +import { EthereumUnsignedTransaction, EthereumSignedTransactionWithBlockData, EthereumBlockTag, EthereumAddress, EthereumBlockHeader, EthereumBlockHeaderWithTransactionHashes, EthereumSignedTransaction, EthereumData, EthereumQuantity, EthereumBytes32, OptionalEthereumUnsignedTransaction } from '../../types/wire-types.js' import { addressString, bytes32String, calculateWeightedPercentile, dataStringWith0xStart, max, min, stringToUint8Array } from '../../utils/bigint.js' -import { CANNOT_SIMULATE_OFF_LEGACY_BLOCK, ERROR_INTERCEPTOR_GAS_ESTIMATION_FAILED, ETHEREUM_LOGS_LOGGER_ADDRESS, ETHEREUM_EIP1559_BASEFEECHANGEDENOMINATOR, ETHEREUM_EIP1559_ELASTICITY_MULTIPLIER, MOCK_ADDRESS, MULTICALL3, Multicall3ABI } from '../../utils/constants.js' +import { CANNOT_SIMULATE_OFF_LEGACY_BLOCK, ERROR_INTERCEPTOR_GAS_ESTIMATION_FAILED, ETHEREUM_LOGS_LOGGER_ADDRESS, ETHEREUM_EIP1559_BASEFEECHANGEDENOMINATOR, ETHEREUM_EIP1559_ELASTICITY_MULTIPLIER, MOCK_ADDRESS, MULTICALL3, Multicall3ABI, DEFAULT_CALL_ADDRESS } from '../../utils/constants.js' import { Interface, TypedDataEncoder, ethers, hashMessage, keccak256, } from 'ethers' import { WebsiteCreatedEthereumUnsignedTransaction, SimulatedTransaction, SimulationState, TokenBalancesAfter, EstimateGasError, SignedMessageTransaction, WebsiteCreatedEthereumUnsignedTransactionOrFailed } from '../../types/visualizer-types.js' import { EthereumUnsignedTransactionToUnsignedTransaction, IUnsignedTransaction1559, serializeSignedTransactionToBytes } from '../../utils/ethereum.js' @@ -12,6 +12,7 @@ import { SignMessageParams } from '../../types/jsonRpc-signing-types.js' import { UniqueRequestIdentifier, doesUniqueRequestIdentifiersMatch } from '../../utils/requests.js' import { StateOverrides } from '../../types/multicall-types.js' import { getCodeByteCode } from '../../utils/ethereumByteCodes.js' +import { isEthSimulateV1Node } from '../../background/settings.js' const MOCK_PUBLIC_PRIVATE_KEY = 0x1n // key used to sign mock transactions const MOCK_SIMULATION_PRIVATE_KEY = 0x2n // key used to sign simulated transatons @@ -661,19 +662,23 @@ export const getSimulatedTransactionByHash = async (ethereumClientService: Ether return await ethereumClientService.getTransactionByHash(hash) } -export const simulatedCall = async (ethereumClientService: EthereumClientService, simulationState: SimulationState | undefined, params: Pick, blockTag: EthereumBlockTag = 'latest') => { +export const simulatedCall = async (ethereumClientService: EthereumClientService, simulationState: SimulationState | undefined, params: Pick & Partial>, blockTag: EthereumBlockTag = 'latest') => { const currentBlock = await ethereumClientService.getBlockNumber() const blockNumToUse = blockTag === 'latest' || blockTag === 'pending' ? currentBlock : min(blockTag, currentBlock) const simulationStateToUse = blockNumToUse >= currentBlock ? simulationState : undefined - + const from = params.from ?? DEFAULT_CALL_ADDRESS const transaction = { ...params, type: '1559', gas: params.gasLimit, - nonce: await getSimulatedTransactionCount(ethereumClientService, simulationStateToUse, params.from, blockTag), + from, + nonce: await getSimulatedTransactionCount(ethereumClientService, simulationStateToUse, from, blockTag), chainId: ethereumClientService.getChainId(), } as const - const multicallResult = await simulatedMulticall(ethereumClientService, simulationStateToUse, [transaction], blockNumToUse) + + const multicallResult = isEthSimulateV1Node(ethereumClientService.getRpcEntry().httpsRpc) ? + await simulated484Multicall(ethereumClientService, simulationStateToUse, [transaction], blockNumToUse) + : await simulatedMulticall(ethereumClientService, simulationStateToUse, [{ ...transaction, gas: params.gasLimit === undefined ? simulationGasLeft(simulationState, await ethereumClientService.getBlock()) : params.gasLimit }], blockNumToUse) const callResult = multicallResult[multicallResult.length - 1] if (callResult === undefined) throw new Error('call result was undefined') if (callResult.statusCode === 'failure') { @@ -697,6 +702,21 @@ export const simulatedMulticall = async (ethereumClientService: EthereumClientSe return await ethereumClientService.multicall(mergedTxs.concat(transactions), getSignedMessagesWithFakeSigner(simulationState), blockNumber, extraAccountOverrides) } +export const simulated484Multicall = async (ethereumClientService: EthereumClientService, simulationState: SimulationState | undefined, transactions: OptionalEthereumUnsignedTransaction[], blockNumber: bigint, extraAccountOverrides: StateOverrides = {}) => { + const mergedTxs: OptionalEthereumUnsignedTransaction[] = getTransactionQueue(simulationState) + const transactionsWithRemoveZeroPricedOnes = mergedTxs.concat(transactions).map((transaction) => { + if (transaction.type !== '1559') return transaction + const { maxFeePerGas, ...transactionWithoutMaxFee } = transaction + return { + ...transactionWithoutMaxFee, + ...maxFeePerGas === 0n ? {} : { maxFeePerGas } + } + }) + console.log('simulated484Multicall') + console.log(transactionsWithRemoveZeroPricedOnes) + return await ethereumClientService.executionSpec383MultiCallOnlyTransactionsAndSignatures(transactionsWithRemoveZeroPricedOnes, getSignedMessagesWithFakeSigner(simulationState), blockNumber, extraAccountOverrides) +} + // use time as block hash as that makes it so that updated simulations with different states are different, but requires no additional calculation export const getHashOfSimulatedBlock = (simulationState: SimulationState) => BigInt(simulationState.simulationConductedTimestamp.getTime()) diff --git a/app/ts/types/wire-types.ts b/app/ts/types/wire-types.ts index 443608e5..6aa11470 100644 --- a/app/ts/types/wire-types.ts +++ b/app/ts/types/wire-types.ts @@ -241,13 +241,13 @@ export const OptionalEthereumUnsignedTransaction1559 = funtypes.Intersect( type: funtypes.Literal('0x2').withParser(LiteralConverterParserFactory('0x2', '1559' as const)), from: EthereumAddress, nonce: EthereumQuantity, - gas: EthereumQuantity, to: funtypes.Union(EthereumAddress, funtypes.Null), value: EthereumQuantity, input: EthereumInput, chainId: EthereumQuantity, }).asReadonly(), funtypes.Partial({ + gas: EthereumQuantity, maxFeePerGas: EthereumQuantity, maxPriorityFeePerGas: EthereumQuantity, accessList: EthereumAccessList, @@ -257,7 +257,6 @@ export const OptionalEthereumUnsignedTransaction1559 = funtypes.Intersect( export type OptionalEthereumUnsignedTransaction = funtypes.Static export const OptionalEthereumUnsignedTransaction = funtypes.Union(EthereumUnsignedTransactionLegacy, EthereumUnsignedTransaction2930, OptionalEthereumUnsignedTransaction1559) - export const EthereumTransaction2930And1559Signature = funtypes.Intersect( funtypes.ReadonlyObject({ r: EthereumQuantity, diff --git a/app/ts/utils/constants.ts b/app/ts/utils/constants.ts index 5c21f61f..21e4d923 100644 --- a/app/ts/utils/constants.ts +++ b/app/ts/utils/constants.ts @@ -108,6 +108,7 @@ export const MAKE_YOU_RICH_TRANSACTION = { }, transactionSendingFormat: 'eth_sendTransaction' as const, } +export const DEFAULT_CALL_ADDRESS = 0x1n export const TIME_BETWEEN_BLOCKS = 12 export const METAMASK_LOGO = '../img/signers/metamask.svg' From c3e524dfae19c636cd599a77dc015d278073b88b Mon Sep 17 00:00:00 2001 From: KillariDev Date: Tue, 30 Jan 2024 15:49:42 +0200 Subject: [PATCH 2/4] remove debug printing --- .../simulation/services/SimulationModeEthereumClientService.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/ts/simulation/services/SimulationModeEthereumClientService.ts b/app/ts/simulation/services/SimulationModeEthereumClientService.ts index b92197c9..3481bd8d 100644 --- a/app/ts/simulation/services/SimulationModeEthereumClientService.ts +++ b/app/ts/simulation/services/SimulationModeEthereumClientService.ts @@ -712,8 +712,6 @@ export const simulated484Multicall = async (ethereumClientService: EthereumClien ...maxFeePerGas === 0n ? {} : { maxFeePerGas } } }) - console.log('simulated484Multicall') - console.log(transactionsWithRemoveZeroPricedOnes) return await ethereumClientService.executionSpec383MultiCallOnlyTransactionsAndSignatures(transactionsWithRemoveZeroPricedOnes, getSignedMessagesWithFakeSigner(simulationState), blockNumber, extraAccountOverrides) } From 884fadde460d7ee267d9cc3a8fc6db3488801e89 Mon Sep 17 00:00:00 2001 From: KillariDev Date: Tue, 30 Jan 2024 17:13:58 +0200 Subject: [PATCH 3/4] fix tests --- test/tests/nethermindComparison.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/tests/nethermindComparison.ts b/test/tests/nethermindComparison.ts index e2ee0a4e..9824d52b 100644 --- a/test/tests/nethermindComparison.ts +++ b/test/tests/nethermindComparison.ts @@ -46,7 +46,7 @@ export async function main() { const rpcNetwork = { name: 'Goerli', chainId: 5n, - httpsRpc: 'https://rpc-goerli.dark.florist/flipcardtrustone', + httpsRpc: 'https://some-goerli-rpc', currencyName: 'Goerli Testnet ETH', currencyTicker: 'GÖETH', primary: true, From cf9e971e715753cbd3f33595ff9fbeedb702b59a Mon Sep 17 00:00:00 2001 From: KillariDev Date: Wed, 31 Jan 2024 10:14:26 +0200 Subject: [PATCH 4/4] clean up call function according comments --- app/ts/background/simulationModeHanders.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/ts/background/simulationModeHanders.ts b/app/ts/background/simulationModeHanders.ts index 214c45b2..46aae698 100644 --- a/app/ts/background/simulationModeHanders.ts +++ b/app/ts/background/simulationModeHanders.ts @@ -86,9 +86,8 @@ export async function call(ethereumClientService: EthereumClientService, simulat // if we fail our call because we are calling from a contract, retry and change address to our default calling address // TODO: Remove this logic and KNOWN_CONTRACT_CALLER_ADDRESSES when multicall supports calling from contracts - if (callResult.error !== undefined && 'data' in callResult.error && callResult.error?.data === 'sender has deployed code' && from !== DEFAULT_CALL_ADDRESS) { + if (callResult.error !== undefined && 'data' in callResult.error && callResult.error.data === 'sender has deployed code' && from !== DEFAULT_CALL_ADDRESS) { const callerChangeResult = await singleCallWithFromOverride(ethereumClientService, simulationState, request, DEFAULT_CALL_ADDRESS) - if (callerChangeResult.error !== undefined) return { method: request.method, ...callerChangeResult } return { method: request.method, ...callerChangeResult } } return { method: request.method, ...callResult }