Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: stop replaying empty blocks #1971

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/2024-06-19T182611-0400.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Speed up read-only replay by avoiding playing empty blocks
5 changes: 4 additions & 1 deletion src/Chainweb/Pact/PactService.hs
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,10 @@ execReadOnlyReplay lowerBound maybeUpperBound = pactLabel "execReadOnlyReplay" $
liftIO $ writeIORef heightRef (_blockHeight bh)
payload <- liftIO $ fromJuste <$>
lookupPayloadDataWithHeight pdb (Just $ _blockHeight bh) (_blockPayloadHash bh)
void $ execBlock bh (CheckablePayload payload)
let isPayloadEmpty = V.null (_payloadDataTransactions payload)
let isUpgradeBlock = isJust $ _chainwebVersion bhdb ^? versionUpgrades . onChain (_chainId bhdb) . ix (_blockHeight bh)
unless (isPayloadEmpty && not isUpgradeBlock) $
void $ execBlock bh (CheckablePayload payload)
)
validationFailed <- readIORef validationFailedRef
when validationFailed $
Expand Down
Loading