Skip to content

Commit

Permalink
fix(comet): Revert syncing to head change, seems unreliable. (beracha…
Browse files Browse the repository at this point in the history
  • Loading branch information
Devon Bear authored Jun 9, 2024
1 parent b167dc0 commit f16f354
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
5 changes: 1 addition & 4 deletions mod/beacon/blockchain/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
package blockchain

import (
"strconv"
"time"

"github.com/berachain/beacon-kit/mod/primitives/pkg/math"
Expand All @@ -45,13 +44,11 @@ func newChainMetrics(
// measureStateTransitionDuration measures the time to process
// the state transition for a block.
func (cm *chainMetrics) measureStateTransitionDuration(
start time.Time, skipPayloadVerification bool,
start time.Time,
) {
cm.sink.MeasureSince(
"beacon_kit.beacon.blockchain.state_transition_duration",
start,
"skip_payload_verification",
strconv.FormatBool(skipPayloadVerification),
)
}

Expand Down
8 changes: 3 additions & 5 deletions mod/beacon/blockchain/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func (s *Service[
ctx context.Context,
blk BeaconBlockT,
sidecars BlobSidecarsT,
syncedToHead bool,
) ([]*transition.ValidatorUpdate, error) {
var (
g, gCtx = errgroup.WithContext(ctx)
Expand All @@ -94,7 +93,7 @@ func (s *Service[
// ends up not being valid later, the node will simply AppHash,
// which is completely fine. This means we were syncing from a
// bad peer, and we would likely AppHash anyways.
valUpdates, err = s.processBeaconBlock(gCtx, st, blk, syncedToHead)
valUpdates, err = s.processBeaconBlock(gCtx, st, blk)
return err
})

Expand Down Expand Up @@ -147,10 +146,9 @@ func (s *Service[
ctx context.Context,
st BeaconStateT,
blk BeaconBlockT,
syncedToHead bool,
) ([]*transition.ValidatorUpdate, error) {
startTime := time.Now()
defer s.metrics.measureStateTransitionDuration(startTime, syncedToHead)
defer s.metrics.measureStateTransitionDuration(startTime)
valUpdates, err := s.sp.Transition(
&transition.Context{
Context: ctx,
Expand All @@ -168,7 +166,7 @@ func (s *Service[
// of validators in their process proposal call and thus
// the "verification aspect" of this NewPayload call is
// actually irrelevant at this point.
SkipPayloadVerification: syncedToHead,
SkipPayloadVerification: false,
},
st,
blk,
Expand Down
5 changes: 4 additions & 1 deletion mod/runtime/pkg/runtime/middleware/finalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ func (h *FinalizeBlockMiddleware[
// Process the state transition and produce the required delta from
// the sync committee.
h.valUpdates, err = h.chainService.ProcessBlockAndBlobs(
ctx, blk, blobs, req.SyncingToHeight == req.Height,
ctx, blk, blobs,
// TODO: Speak with @melekes about this, doesn't seem to
// work reliably.
/*req.SyncingToHeight == req.Height*/
)
return err
}
Expand Down
1 change: 0 additions & 1 deletion mod/runtime/pkg/runtime/middleware/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ type BlockchainService[
context.Context,
BeaconBlockT,
BlobSidecarsT,
bool,
) ([]*transition.ValidatorUpdate, error)

// ReceiveBlockAndBlobs receives a beacon block and
Expand Down

0 comments on commit f16f354

Please sign in to comment.