Skip to content
Open
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 CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi
- [docker] \#9073 enable cross platform build using docker buildx
- [docker] \#9462 ensure Docker image uses consistent version of Go
- [sequencer] \#45 Restore crash recovery when reth v2.5.2 loses its default in-memory block window. (@panos-xyz)
- [sequencer] \#49 Restore crash recovery when reth v2.10.1 loses its default in-memory block window. (@panos-xyz)
13 changes: 9 additions & 4 deletions sequencer/state_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ const (
// It has to cover how far the EL's canonical head can regress after a crash,
// which is upstream reth configuration rather than a fixed quantity: the
// ceiling is persistence_backpressure_threshold + memory_block_buffer_target,
// i.e. 16 on reth v2.4.0 (16 + 0) and 21 on reth v2.5.2 (16 + 5) with default
// settings. 32 covers the v2.5.2 default with margin.
// i.e. 16 on reth v2.4.0 (16 + 0), 21 on reth v2.5.2 (16 + 5) and 105 on
// reth v2.10.1 (100 + 5) with default settings. 128 covers the v2.10.1 default
// with margin.
//
// reth's state-masking suffix does not add to that ceiling: masked blocks stay
// in memory and count against the backpressure threshold, and a restart after
// a crash unwinds to the start of the suffix.
//
// When changing this or the EL's persistence configuration, keep:
//
Expand All @@ -65,13 +70,13 @@ const (
//
// A graceful EL shutdown persists up to the head, so the gap is 0 on SIGTERM
// and only non-zero after a crash.
backfillMaxDepth = 32
backfillMaxDepth = 128

// backfillCacheCapacity is how many recently applied blocks are retained so they
// can be re-pushed after the EL loses its unpersisted head. Kept above
// backfillMaxDepth so the oldest ancestor a backfill may need is still present;
// see the invariant on backfillMaxDepth.
backfillCacheCapacity = 64
backfillCacheCapacity = 256

// parentNotFoundError is the error text geth returns when a parent hash is
// absent from its chain (see go-ethereum/eth/catalyst/l2_api.go,
Expand Down
9 changes: 5 additions & 4 deletions sequencer/state_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,17 +640,18 @@ func cacheGap(t *testing.T, s *StateV2, head *BlockV2, depth int) common.Hash {
// backfillMaxDepth has to cover how far the EL's canonical head can regress
// after a crash. That ceiling is upstream reth configuration rather than a
// fixed quantity — persistence_backpressure_threshold + memory_block_buffer_target
// is 16 on reth v2.4.0 and 21 on reth v2.5.2 — so the boundary is pinned here
// instead of being left to the constant's comment. A depth short of it refuses
// the gap outright, which is indistinguishable from a node that simply stopped
// catching up.
// is 16 on reth v2.4.0, 21 on reth v2.5.2 and 105 on reth v2.10.1 — so the
// boundary is pinned here instead of being left to the constant's comment. A
// depth short of it refuses the gap outright, which is indistinguishable from a
// node that simply stopped catching up.
func TestStateV2_Backfill_DepthBoundary(t *testing.T) {
for _, tc := range []struct {
name string
depth int
wantErr string
}{
{"reth v2.5.2 default ceiling", 21, ""},
{"reth v2.10.1 default ceiling", 105, ""},
{"exactly backfillMaxDepth", backfillMaxDepth, ""},
{"one past backfillMaxDepth", backfillMaxDepth + 1, "gap exceeds backfillMaxDepth"},
} {
Expand Down
Loading