Skip to content

Include chain IDs in more EVM errors #2155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: pp/evm
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/Chainweb/PayloadProvider/EVM.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading