Skip to content

Commit

Permalink
add proposer pubkey check in getheader (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
aratz-lasa authored Mar 10, 2023
1 parent 058ff0f commit 4e1e368
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions pkg/relay/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,19 @@ func (rs *Relay) GetHeader(ctx context.Context, m *structs.MetricGroup, request

header := maxProfitBlock.Header

if header.Header == nil || (header.Header.ParentHash != parentHash) {
if header.Header.ParentHash != parentHash {
logger.WithField("expected", parentHash).WithField("got", parentHash).Debug("invalid parentHash")
}
if header.Header == nil {
rs.m.MissHeaderCount.WithLabelValues("badHeader").Add(1)
return nil, ErrNoBuilderBid
}

if header.Header.ParentHash != parentHash {
logger.WithField("expected", parentHash).WithField("got", parentHash).Debug("invalid parentHash")
rs.m.MissHeaderCount.WithLabelValues("badHeader").Add(1)
return nil, ErrNoBuilderBid
}

if header.Trace.ProposerPubkey != pk.PublicKey {
logger.WithField("expected", header.Trace.BuilderPubkey).WithField("got", pk.PublicKey).Debug("invalid pubkey")
rs.m.MissHeaderCount.WithLabelValues("badHeader").Add(1)
return nil, ErrNoBuilderBid
}
Expand Down

0 comments on commit 4e1e368

Please sign in to comment.