Skip to content

Commit

Permalink
fix bugs in pact upgrade ChainwebVersion
Browse files Browse the repository at this point in the history
Change-Id: I2a72dc769b0cfb866cb94321d480845941385a2b
  • Loading branch information
chessai committed Jul 25, 2024
1 parent f61cd16 commit 31c1a67
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/Chainweb/Test/TestVersions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module Chainweb.Test.TestVersions
, timedConsensusVersion
, instantCpmTestVersion
, pact5CheckpointerTestVersion
, pact5SlowCpmTestVersion
) where

import Control.Lens hiding (elements)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 31c1a67

Please sign in to comment.