Skip to content

Commit

Permalink
add extra validation so that ethereum chains aren't served from firec…
Browse files Browse the repository at this point in the history
…ore without setting the 'base/extended/hybrid' feature
  • Loading branch information
sduchesneau committed Aug 23, 2024
1 parent 7a5541b commit f708314
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions firehose/info/info_filler.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ var DefaultInfoResponseFiller = func(firstStreamableBlock *pbbstream.Block, resp
break
}
}

// Extra validation for ethereum blocks
if firstStreamableBlock.Payload.TypeUrl == "type.googleapis.com/sf.ethereum.type.v2.Block" {
var seenDetailLevel bool
for _, feature := range resp.BlockFeatures {
if feature == "base" || feature == "extended" || feature == "hybrid" {
seenDetailLevel = true
break
}
}
if !seenDetailLevel {
return fmt.Errorf("ethereum blocks are used without setting detail level in 'advertise-block-features': expected one of 'base', 'extended' or 'hybrid' (or use 'firehose-ethereum' binary instead to serve this chain and get automatic detection/validation)")
}
}

return nil
}

Expand Down

0 comments on commit f708314

Please sign in to comment.