From 8b0dc3e31943bb542f24f9deceb2e0e2163bc7f7 Mon Sep 17 00:00:00 2001 From: chessai Date: Thu, 21 Nov 2024 14:52:32 -0600 Subject: [PATCH] better error message on devnet mismatch Change-Id: Ife724b6b4a3d18e840f98dc5adc141b206d48209 --- src/Chainweb/Version/Registry.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Chainweb/Version/Registry.hs b/src/Chainweb/Version/Registry.hs index 8e362a2520..bfa9cc8fb7 100644 --- a/src/Chainweb/Version/Registry.hs +++ b/src/Chainweb/Version/Registry.hs @@ -129,17 +129,21 @@ lookupVersionByCode code -- the case that we don't actually need the version, just the code. lookupVersion & versionCode .~ code where + lookupVersion :: HasCallStack => ChainwebVersion lookupVersion = unsafeDupablePerformIO $ do m <- readIORef versionMap return $ fromMaybe (error notRegistered) $ HM.lookup code m + notRegistered - | code == _versionCode recapDevnet = "recapDevnet version used but not registered, remember to do so after it's configured" - | code == _versionCode devnet = "devnet version used but not registered, remember to do so after it's configured" - | code == _versionCode pact5Devnet = "Pact 5 devnet version used but not registered, remember to do so after it's configured" + | code == _versionCode recapDevnet = "recapDevnet version used but not registered, remember to do so after it's configured. " <> perhaps + | code == _versionCode devnet = "devnet version used but not registered, remember to do so after it's configured. " <> perhaps + | code == _versionCode pact5Devnet = "Pact 5 devnet version used but not registered, remember to do so after it's configured. " <> perhaps | otherwise = "version not registered with code " <> show code <> ", have you seen Chainweb.Test.TestVersions.testVersions?" + perhaps = "Perhaps you are attempting to run a different devnet version than a previous run, and you need to delete your db directory before restarting devnet with the new version?" + -- TODO: ideally all uses of this are deprecated. currently in use in -- ObjectEncoded block header decoder and CutHashes decoder. lookupVersionByName :: HasCallStack => ChainwebVersionName -> ChainwebVersion