@@ -130,6 +130,7 @@ import Pact.Core.Serialise qualified as Pact
130
130
import Pact.Core.StableEncoding (encodeStable )
131
131
import Pact.Types.Persistence qualified as Pact4
132
132
import Prelude hiding (concat , log )
133
+ import System.LogLevel
133
134
134
135
data InternalDbException = InternalDbException CallStack Text
135
136
instance Show InternalDbException where show = displayException
@@ -566,7 +567,8 @@ doWriteRow wt d k v = case d of
566
567
doKeys
567
568
:: forall k v logger
568
569
-- ^ the highest block we should be reading writes from
569
- . Pact. Domain k v Pact. CoreBuiltin Pact. Info
570
+ . Logger logger
571
+ => Pact. Domain k v Pact. CoreBuiltin Pact. Info
570
572
-> BlockHandler logger [k ]
571
573
doKeys d = do
572
574
dbKeys <- getDbKeys
@@ -598,10 +600,16 @@ doKeys d = do
598
600
v <- view blockHandlerVersion
599
601
cid <- view blockHandlerChainId
600
602
bh <- view blockHandlerBlockHeight
601
- if chainweb230Pact v cid bh
603
+ let preResult = sort (memKeys ++ parsedKeys)
602
604
-- the read-cache contains duplicate keys that we need to remove.
603
- then return $ fmap head $ group $ sort (memKeys ++ parsedKeys)
604
- else return $ sort (memKeys ++ parsedKeys)
605
+ let postResult = fmap head $ group $ sort (memKeys ++ parsedKeys)
606
+ when (postResult /= preResult) $ do
607
+ lgr <- view blockHandlerLogger
608
+ liftIO $ logFunctionText lgr Error $ " duplicate keys in domain " <> sshow d
609
+ return $
610
+ if chainweb230Pact v cid bh
611
+ then postResult
612
+ else preResult
605
613
606
614
where
607
615
0 commit comments