Skip to content

Commit

Permalink
Merge branch 'feature-flag-timestamp-verification' into withdrawals-b…
Browse files Browse the repository at this point in the history
…ackward-compatibility-with-bartio
  • Loading branch information
abi87 authored Nov 12, 2024
2 parents f4555ac + d7fad67 commit d53e6c6
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions mod/state-transition/pkg/core/state_processor_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package core

import (
"context"
"fmt"

"github.com/berachain/beacon-kit/mod/config/pkg/spec"
engineprimitives "github.com/berachain/beacon-kit/mod/engine-primitives/pkg/engine-primitives"
Expand All @@ -47,12 +48,19 @@ func (sp *StateProcessor[
g, gCtx = errgroup.WithContext(context.Background())
)

sp.logger.Info("processExecutionPayload",
fmt.Sprintf("consensus height %d", ctx.GetConsensusBlockHeight()),
fmt.Sprintf("payload height %d", payload.GetNumber()),
fmt.Sprintf("payload timestamp %d", payload.GetTimestamp()),
fmt.Sprintf("bound timestamp %d", payload.GetTimestamp()),
fmt.Sprintf("skip verification %t", ctx.GetSkipPayloadVerification()),
)

// Skip payload verification if the context is configured as such.
if !ctx.GetSkipPayloadVerification() {
g.Go(func() error {
return sp.validateExecutionPayload(
gCtx, st, blk,
ctx.GetConsensusBlockHeight(),
ctx.GetNextPayloadTimestamp(),
ctx.GetOptimisticEngine(),
)
Expand Down Expand Up @@ -89,13 +97,11 @@ func (sp *StateProcessor[
ctx context.Context,
st BeaconStateT,
blk BeaconBlockT,
consensusBlockHeight math.U64,
nextPayloadTimestamp math.U64,
optimisticEngine bool,
) error {
if err := sp.validateStatelessPayload(
blk,
consensusBlockHeight,
nextPayloadTimestamp,
); err != nil {
return err
Expand All @@ -109,19 +115,11 @@ func (sp *StateProcessor[
_, _, _, _, _, _, _, _, _, _, _, _, _,
]) validateStatelessPayload(
blk BeaconBlockT,
consensusBlockHeight math.U64,
nextPayloadTimestamp math.U64,
) error {
body := blk.GetBody()
payload := body.GetExecutionPayload()

sp.logger.Info("validateStatelessPayload",
"consensus height", consensusBlockHeight,
"payload height", payload.GetNumber(),
"payload timestamp", payload.GetTimestamp(),
"bound timestamp", nextPayloadTimestamp,
)

// We skip timestamp check on Bartio for backward compatibility reasons
// TODO: enforce the check when we drop other Bartio special cases.
if sp.cs.DepositEth1ChainID() != spec.BartioChainID {
Expand Down

0 comments on commit d53e6c6

Please sign in to comment.