Skip to content

Commit

Permalink
insert into cache on reads too
Browse files Browse the repository at this point in the history
Change-Id: Id00000007f84d7de38391d240b94068587588764
  • Loading branch information
edmundnoble committed Jan 23, 2025
1 parent 959d3d3 commit c158a15
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Chainweb/Pact5/Backend/ChainwebPactDb.hs
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,14 @@ doReadRow mlim d k = do
Nothing -> return Nothing
Just (encodedValue, decodedValue) -> do
case d of
Pact.DModules ->
Pact.DModules -> do
BlockHandler $ lift $ lift
$ Pact.chargeGasM (Pact.GModuleOp (Pact.MOpLoadModule (BS.length encodedValue)))
bsPendingTx . _Just . _1 . pendingWrites %=
InMemDb.insert d k (InMemDb.ReadEntry encodedValue decodedValue)
Pact.DUserTables {} -> do
bsPendingTx . _Just . _1 . pendingWrites %=
InMemDb.insert d k (InMemDb.ReadEntry encodedValue decodedValue)
_ -> return ()
return (Just decodedValue)
where
Expand Down
6 changes: 6 additions & 0 deletions test/unit/Chainweb/Test/Pact5/TransactionExecTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,12 @@ applyCmdSpec rdb = readFromAfterGenesis v rdb $ do
P.match InMemDb._WriteEntry P.succeed
]
]

, P.fun InMemDb.modules
? P.alignExact ? Map.fromList
[ ModuleName "coin" Nothing :=>
P.match InMemDb._ReadEntry P.succeed
]
]

quirkSpec :: RocksDb -> IO ()
Expand Down

0 comments on commit c158a15

Please sign in to comment.