From 0565b572de5e4c4f3243a19b9e533a4319187cd2 Mon Sep 17 00:00:00 2001 From: Edmund Noble Date: Thu, 24 Apr 2025 09:47:54 -0400 Subject: [PATCH] Include chain ID in more EVM errors Change-Id: Id0000000bbdfc7a4ed71ecfd7cd964ab797aa8c3 --- src/Chainweb/PayloadProvider/EVM.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Chainweb/PayloadProvider/EVM.hs b/src/Chainweb/PayloadProvider/EVM.hs index 170ae89713..36a0f3bed0 100644 --- a/src/Chainweb/PayloadProvider/EVM.hs +++ b/src/Chainweb/PayloadProvider/EVM.hs @@ -417,8 +417,8 @@ logg p l t = logFunctionText (_evmLogger p) l t -- Exceptions data EvmExecutionEngineException - = EvmChainIdMissmatch (Expected EVM.ChainId) (Actual EVM.ChainId) - | EvmInvalidGensisHeader (Expected BlockPayloadHash) (Actual BlockPayloadHash) + = EvmChainIdMismatch ChainId (Expected EVM.ChainId) (Actual EVM.ChainId) + | EvmInvalidGenesisHeader ChainId (Expected BlockPayloadHash) (Actual BlockPayloadHash) deriving (Show, Eq, Generic) instance Exception EvmExecutionEngineException @@ -557,12 +557,13 @@ checkExecutionClient checkExecutionClient v c ctx expectedEcid = do ecid <- callMethodHttp @Eth_ChainId ctx Nothing unless (expectedEcid == ecid) $ - throwM $ EvmChainIdMissmatch (Expected expectedEcid) (Actual ecid) + throwM $ EvmChainIdMismatch (_chainId c) (Expected expectedEcid) (Actual ecid) callMethodHttp @Eth_GetBlockByNumber ctx (DefaultBlockNumber 0, False) >>= \case Nothing -> throwM EvmGenesisHeaderNotFound Just h -> do unless (EVM._hdrPayloadHash h == expectedGenesisHeader) $ - throwM $ EvmInvalidGensisHeader + throwM $ EvmInvalidGenesisHeader + (_chainId c) (Expected expectedGenesisHeader) (Actual $ EVM._hdrPayloadHash h) return h