reth icon indicating copy to clipboard operation
reth copied to clipboard

Save Merkle stage checkpoint into the same database table as other stages

Open shekhirin opened this issue 2 years ago • 0 comments

Describe the feature

Merkle stage still uses the SyncStageProgress table to save its checkpoint: https://github.com/paradigmxyz/reth/blob/b90d0b41069015d5746b08b3e408e738bc65a6a7/crates/primitives/src/stage/checkpoints.rs#L15-L26

Instead, we should use the SyncStage table along with the StageCheckpointUnit as hashing stages do: https://github.com/paradigmxyz/reth/blob/b90d0b41069015d5746b08b3e408e738bc65a6a7/crates/primitives/src/stage/checkpoints.rs#L273-L276

We didn't do it initially because Merkle checkpoint is pretty heavy (it contains some unbounded trie-related fields) compared to hashing stages', so it can't be Copy. It's a problem because Exec|Unwind)(Input|Output) are Copy.

After moving the Merkle stage checkpoint into one unified table, we can safely delete the SyncStageProgress table and everything related to it, simplifying the stage checkpointing logic.

Additional context

No response

shekhirin avatar Jun 16 '23 15:06 shekhirin