diff --git a/mod/beacon/blockchain/execution_engine.go b/mod/beacon/blockchain/execution_engine.go index dd33f3dbaf..8afd41de19 100644 --- a/mod/beacon/blockchain/execution_engine.go +++ b/mod/beacon/blockchain/execution_engine.go @@ -164,3 +164,54 @@ func (s *Service[ ) } } + +func (s *Service[ + AvailabilityStoreT, + BeaconStateT, + BlobSidecarsT, + DepositStoreT, +]) SendHackFCU(ctx context.Context) error { + st := s.sb.StateFromContext(ctx) + + lph, err := st.GetLatestExecutionPayloadHeader() + if err != nil { + return err + } + + lbr, err := st.GetLatestBlockHeader() + if err != nil { + return err + } + + lbr.StateRoot, err = st.HashTreeRoot() + if err != nil { + return err + } + + br, err := lbr.HashTreeRoot() + if err != nil { + return err + } + + ss, err := st.GetSlot() + if err != nil { + return err + } + + // Ask the builder to send a forkchoice update with attributes. + // This will trigger a new payload to be built. + if _, err = s.lb.RequestPayload( + ctx, + st, + ss, + //#nosec:G701 // won't realistically overflow. + // TODO: clock time properly. + uint64(time.Now().Unix()+1), + br, + lph.GetBlockHash(), + ); err != nil { + return err + } + + return nil +} diff --git a/mod/runtime/pkg/abci/types.go b/mod/runtime/pkg/abci/types.go index 2e1645bb8f..ccf9217aad 100644 --- a/mod/runtime/pkg/abci/types.go +++ b/mod/runtime/pkg/abci/types.go @@ -75,4 +75,6 @@ type BlockchainService[BlobsSidecarsT ssz.Marshallable] interface { VerifyPayloadOnBlk( context.Context, types.BeaconBlock, ) error + + SendHackFCU(ctx context.Context) error }