Skip to content

Ethereum tests are not working due to JSON parsing error #907

@msooseth

Description

@msooseth

With this diff:

diff --git a/test/EVM/Test/BlockchainTests.hs b/test/EVM/Test/BlockchainTests.hs
index 52f86d07..97b20bbf 100644
--- a/test/EVM/Test/BlockchainTests.hs
+++ b/test/EVM/Test/BlockchainTests.hs
@@ -102,9 +102,14 @@ testsFromFile fname problematicTests = do
   let parsed = parseBCSuite fContents
   liftIO $ putStrLn $ "Parsed " <> fname
   case parsed of
-    Left "No cases to check." -> pure []
-    Left _err -> pure []
-    Right allTests -> mapM runTest $ Map.toList allTests
+    Left "No cases to check." -> do
+      liftIO $ putStrLn $ "No cases to check in " <> fname
+      pure []
+    Left _err -> do
+      liftIO $ putStrLn $ "Error parsing " <> fname <> ": " <> _err
+      pure []
+    Right allTests -> do
+      mapM runTest $ Map.toList allTests
   where
     runTest :: (String, Case) -> m TestTree
     runTest (name, x) = do

It becomes evident that we have a Contract parsing error in the JSON, in particular:

   , codehash    :: Expr EWord
   , opIxMap     :: VS.Vector Int -- ^ map from byte index to op index
   , codeOps     :: V.Vector (Int, Op)
  , external    :: Bool -- ^ is this an externally owned account? ERROR
   }
   deriving (Show, Eq, Ord)

The external here is an hevm-internal thing, but it's attempted to be parsed in, and it fails:

Reading /nix/store/v4fmfsh22rh54ykcqzd4dvjafh70l1fc-source/BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/01_tloadBeginningTxn.json
Parsed /nix/store/v4fmfsh22rh54ykcqzd4dvjafh70l1fc-source/BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/01_tloadBeginningTxn.json
Error parsing /nix/store/v4fmfsh22rh54ykcqzd4dvjafh70l1fc-source/BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/01_tloadBeginningTxn.json: Error in $['01_tloadBeginningTxn_d0g0v0_Cancun']['0xa00000000000000000000000000000000000000a']: key "external" not found
Reading /nix/store/v4fmfsh22rh54ykcqzd4dvjafh70l1fc-source/BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/02_tloadAfterTstore.json
Parsed /nix/store/v4fmfsh22rh54ykcqzd4dvjafh70l1fc-source/BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/02_tloadAfterTstore.json
Error parsing /nix/store/v4fmfsh22rh54ykcqzd4dvjafh70l1fc-source/BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/02_tloadAfterTstore.json: Error in $['02_tloadAfterTstore_d0g0v0_Cancun']['0xa00000000000000000000000000000000000000a']: key "external" not found
Reading /nix/store/v4fmfsh22rh54ykcqzd4dvjafh70l1fc-source/BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/03_tloadAfterStoreIs0.json
Parsed /nix/store/v4fmfsh22rh54ykcqzd4dvjafh70l1fc-source/BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/03_tloadAfterStoreIs0.json
Error parsing /nix/store/v4fmfsh22rh54ykcqzd4dvjafh70l1fc-source/BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/03_tloadAfterStoreIs0.json: Error in $['03_tloadAfterStoreIs0_d0g0v0_Cancun']['0xa00000000000000000000000000000000000000a']: key "external" not found
Reading /nix/store/v4fmfsh22rh54ykcqzd4dvjafh70l1fc-source/BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/04_tloadAfterCall.json
Parsed /nix/store/v4fmfsh22rh54ykcqzd4dvjafh70l1fc-source/BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/04_tloadAfterCall.json
Error parsing /nix/store/v4fmfsh22rh54ykcqzd4dvjafh70l1fc-source/BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/04_tloadAfterCall.json: Error in $['04_tloadAfterCall_d0g0v0_Cancun']['0xa00000000000000000000000000000000000000a']: key "external" not found
Reading /nix/store/v4fmfsh22rh54ykcqzd4dvjafh70l1fc-source/BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/05_tloadReentrancy.json
Parsed /nix/store/v4fmfsh22rh54ykcqzd4dvjafh70l1fc-source/BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/05_tloadReentrancy.json
Error parsing /nix/store/v4fmfsh22rh54ykcqzd4dvjafh70l1fc-source/BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/05_tloadReentrancy.json: Error in $['05_tloadReentrancy_d0g0v0_Cancun']['0xa00000000000000000000000000000000000000a']: key "external" not found
[...]

Hence, currently all ethereum-tests fail. This should be easy to fix via a custom parser for the JSON.

Thanks to @blishko for finding this serious bug :S

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions