Skip to content

Commit

Permalink
optimize: extended expire time for sequencer block broadcasting (ethe…
Browse files Browse the repository at this point in the history
…reum-optimism#106)

* config: change block validator payload from 60s to 20 min

* config: increase seenMessagesTTL AND blockHeightLRU to avoid old block validation
  • Loading branch information
krish-nr authored Jan 2, 2024
1 parent 5f592b5 commit 387eb6c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions op-node/p2p/gossip.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const (
globalValidateThrottle = 512
gossipHeartbeat = 500 * time.Millisecond
// seenMessagesTTL limits the duration that message IDs are remembered for gossip deduplication purposes
// 130 * gossipHeartbeat
seenMessagesTTL = 130 * gossipHeartbeat
// 2500 * gossipHeartbeat
seenMessagesTTL = 2500 * gossipHeartbeat
DefaultMeshD = 8 // topic stable mesh target count
DefaultMeshDlo = 6 // topic stable mesh low watermark
DefaultMeshDhi = 12 // topic stable mesh high watermark
Expand Down Expand Up @@ -242,7 +242,7 @@ func BuildBlocksValidator(log log.Logger, cfg *rollup.Config, runCfg GossipRunti

// Seen block hashes per block height
// uint64 -> *seenBlocks
blockHeightLRU, err := lru.New(1000)
blockHeightLRU, err := lru.New(1500)
if err != nil {
panic(fmt.Errorf("failed to set up block height LRU cache: %w", err))
}
Expand Down Expand Up @@ -291,8 +291,8 @@ func BuildBlocksValidator(log log.Logger, cfg *rollup.Config, runCfg GossipRunti
// rounding down to seconds is fine here.
now := uint64(time.Now().Unix())

// [REJECT] if the `payload.timestamp` is older than 60 seconds in the past
if uint64(payload.Timestamp) < now-60 {
// [REJECT] if the `payload.timestamp` is older than 20 min in the past
if uint64(payload.Timestamp) < now-1200 {
log.Warn("payload is too old", "timestamp", uint64(payload.Timestamp))
return pubsub.ValidationReject
}
Expand Down

0 comments on commit 387eb6c

Please sign in to comment.