Skip to content

Commit 1195f9b

Browse files
authored
Stateless: Create snapshots before building witness during block import (#3542)
1 parent 39d7044 commit 1195f9b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

execution_chain/core/chain/persist_blocks.nim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ proc persistBlock*(p: var Persister, blk: Block): Result[void, string] =
165165
let parentTxFrame = vmState.ledger.txFrame
166166
vmState.ledger.txFrame = parentTxFrame.txFrameBegin()
167167

168+
# Creating a snapshot here significantly improves the performance of building
169+
# the witness from the prestate, especially when the import batch size is
170+
# set to a larger value.
171+
parentTxFrame.checkpoint(p.parent.number, skipSnapshot = false)
172+
168173
# Clear the caches before executing the block to ensure we collect the correct
169174
# witness keys and block hashes when processing the block as these will be used
170175
# when building the witness.

0 commit comments

Comments
 (0)