Skip to content

Commit

Permalink
increase attempted reorgs at the right spot (#12106)
Browse files Browse the repository at this point in the history
  • Loading branch information
potuz committed Mar 9, 2023
1 parent 83a294c commit 6d3ff65
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion beacon-chain/blockchain/metrics.go
Expand Up @@ -111,7 +111,7 @@ var (
Name: "beacon_reorgs_total",
Help: "Count the number of times beacon chain has a reorg",
})
lateBlockAttemptedReorgCount = promauto.NewCounter(prometheus.CounterOpts{
LateBlockAttemptedReorgCount = promauto.NewCounter(prometheus.CounterOpts{
Name: "beacon_late_block_attempted_reorgs",
Help: "Count the number of times a proposer served by this beacon has attempted a late block reorg",
})
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/blockchain/process_block.go
Expand Up @@ -698,7 +698,6 @@ func (s *Service) fillMissingBlockPayloadId(ctx context.Context) error {
if !has || id != [8]byte{} {
return nil
}
lateBlockAttemptedReorgCount.Inc()
s.headLock.RLock()
headBlock, err := s.headBlock()
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions beacon-chain/rpc/prysm/v1alpha1/validator/proposer.go
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
emptypb "github.com/golang/protobuf/ptypes/empty"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/v3/beacon-chain/blockchain"
"github.com/prysmaticlabs/prysm/v3/beacon-chain/builder"
"github.com/prysmaticlabs/prysm/v3/beacon-chain/core/feed"
blockfeed "github.com/prysmaticlabs/prysm/v3/beacon-chain/core/feed/block"
Expand Down Expand Up @@ -50,7 +51,11 @@ func (vs *Server) GetBeaconBlock(ctx context.Context, req *ethpb.BlockRequest) (
// process attestations and update head in forkchoice
vs.ForkFetcher.ForkChoicer().Lock()
vs.HeadUpdater.UpdateHead(ctx, vs.ForkFetcher.CurrentSlot())
headRoot := vs.ForkFetcher.ForkChoicer().CachedHeadRoot()
parentRoot := vs.ForkFetcher.ForkChoicer().GetProposerHead()
if parentRoot != headRoot {
blockchain.LateBlockAttemptedReorgCount.Inc()
}
vs.ForkFetcher.ForkChoicer().Unlock()

// An optimistic validator MUST NOT produce a block (i.e., sign across the DOMAIN_BEACON_PROPOSER domain).
Expand Down

0 comments on commit 6d3ff65

Please sign in to comment.