From 31c1a671142594e78a2676945d560a8e26a0b1ce Mon Sep 17 00:00:00 2001 From: chessai Date: Thu, 25 Jul 2024 17:30:11 -0500 Subject: [PATCH] fix bugs in pact upgrade ChainwebVersion Change-Id: I2a72dc769b0cfb866cb94321d480845941385a2b --- test/Chainweb/Test/TestVersions.hs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/Chainweb/Test/TestVersions.hs b/test/Chainweb/Test/TestVersions.hs index fc2ba7e907..5b3f6778ff 100644 --- a/test/Chainweb/Test/TestVersions.hs +++ b/test/Chainweb/Test/TestVersions.hs @@ -16,6 +16,7 @@ module Chainweb.Test.TestVersions , timedConsensusVersion , instantCpmTestVersion , pact5CheckpointerTestVersion + , pact5SlowCpmTestVersion ) where import Control.Lens hiding (elements) @@ -123,6 +124,9 @@ testVersions = _versionName <$> concat , [ pact5CheckpointerTestVersion (knownChainGraph g) | g :: KnownGraph <- [minBound..maxBound] ] + , [ pact5SlowCpmTestVersion (knownChainGraph g) + | g :: KnownGraph <- [minBound..maxBound] + ] ] -- | Details common to all test versions thus far. @@ -389,13 +393,20 @@ pact5SlowCpmTestVersion :: ChainGraph -> ChainwebVersion pact5SlowCpmTestVersion g = buildTestVersion $ \v -> v & cpmTestVersion g & versionName .~ ChainwebVersionName ("pact5-slow-CPM-" <> toText g) + & versionGenesis .~ VersionGenesis + { _genesisBlockPayload = onChains $ + (unsafeChainId 0, IN0.payloadBlock) : + [(n, INN.payloadBlock) | n <- HS.toList (unsafeChainId 0 `HS.delete` graphChainIds g)] + , _genesisBlockTarget = AllChains maxTarget + , _genesisTime = AllChains $ BlockCreationTime epoch + } & versionForks .~ tabulateHashMap (\case -- genesis blocks are not ever run with Pact 5 Pact5Fork -> onChains [ (cid, ForkAtBlockHeight (succ $ genesisHeightSlow v cid)) | cid <- HS.toList $ graphChainIds g ] _ -> AllChains ForkAtGenesis ) & versionUpgrades .~ indexByForkHeights v - [ (Chainweb225Pact, AllChains (ForPact5 $ Pact5Upgrade (List.map pactTxFrom4To5 CoinV5.transactions))) + [ (Pact5Fork, AllChains (ForPact5 $ Pact5Upgrade (List.map pactTxFrom4To5 CoinV5.transactions))) ] pact5EarlyTestVersion :: ChainGraph -> ChainwebVersion