From 8ac2e612a0ecad0ab129427890b423b86db62ca4 Mon Sep 17 00:00:00 2001 From: Potuz Date: Thu, 7 Nov 2024 15:40:21 -0300 Subject: [PATCH] payload attribute and withdrawal fixes --- beacon-chain/blockchain/execution_engine_epbs.go | 2 +- beacon-chain/blockchain/log.go | 4 ++-- beacon-chain/blockchain/process_block.go | 7 +++++++ beacon-chain/core/blocks/withdrawals.go | 2 +- beacon-chain/core/epbs/execution_payload_header.go | 1 - consensus-types/payload-attribute/types.go | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/beacon-chain/blockchain/execution_engine_epbs.go b/beacon-chain/blockchain/execution_engine_epbs.go index 9f2158e14f6d..034583549a11 100644 --- a/beacon-chain/blockchain/execution_engine_epbs.go +++ b/beacon-chain/blockchain/execution_engine_epbs.go @@ -30,7 +30,7 @@ func (s *Service) notifyForkchoiceUpdateEPBS(ctx context.Context, blockhash [32] FinalizedBlockHash: finalizedHash[:], } if attributes == nil { - attributes = payloadattribute.EmptyWithVersion(version.Electra) + attributes = payloadattribute.EmptyWithVersion(version.Deneb) } payloadID, lastValidHash, err := s.cfg.ExecutionEngineCaller.ForkchoiceUpdated(ctx, fcs, attributes) if err != nil { diff --git a/beacon-chain/blockchain/log.go b/beacon-chain/blockchain/log.go index 83869607e33d..ac3d0bf0cdda 100644 --- a/beacon-chain/blockchain/log.go +++ b/beacon-chain/blockchain/log.go @@ -54,10 +54,10 @@ func logStateTransitionData(b interfaces.ReadOnlyBeaconBlock) error { if err != nil { return err } - log = log.WithFields(logrus.Fields{"payloadHash": header.BlockHash(), + log = log.WithFields(logrus.Fields{"payloadHash": fmt.Sprintf("%#x", header.BlockHash()), "builderIndex": header.BuilderIndex(), "value": header.Value(), - "blobKzgCommitmentsRoot": header.BlobKzgCommitmentsRoot(), + "blobKzgCommitmentsRoot": fmt.Sprintf("%#x", header.BlobKzgCommitmentsRoot()), }) } else { if b.Version() >= version.Bellatrix { diff --git a/beacon-chain/blockchain/process_block.go b/beacon-chain/blockchain/process_block.go index 099d312837e2..1935e8a2930a 100644 --- a/beacon-chain/blockchain/process_block.go +++ b/beacon-chain/blockchain/process_block.go @@ -102,6 +102,13 @@ func (s *Service) postBlockProcess(cfg *postBlockProcessConfig) error { return nil } if cfg.roblock.Version() >= version.EPBS { + if err := s.saveHead(ctx, cfg.headRoot, cfg.roblock, cfg.postState); err != nil { + log.WithError(err).Error("could not save head") + } + if err := s.pruneAttsFromPool(cfg.roblock); err != nil { + log.WithError(err).Error("could not prune attestations from pool") + } + // update the NSC and handle epoch boundaries here since we do // not send FCU at all return s.updateCachesPostBlockProcessing(cfg) diff --git a/beacon-chain/core/blocks/withdrawals.go b/beacon-chain/core/blocks/withdrawals.go index 329d651a34ea..76730d365f58 100644 --- a/beacon-chain/core/blocks/withdrawals.go +++ b/beacon-chain/core/blocks/withdrawals.go @@ -239,7 +239,7 @@ func ProcessWithdrawals(st state.BeaconState, executionData interfaces.Execution } if !IsParentBlockFull { - return nil, nil + return st, nil } } diff --git a/beacon-chain/core/epbs/execution_payload_header.go b/beacon-chain/core/epbs/execution_payload_header.go index 440f10c7e99e..c328f958da5d 100644 --- a/beacon-chain/core/epbs/execution_payload_header.go +++ b/beacon-chain/core/epbs/execution_payload_header.go @@ -16,7 +16,6 @@ func ValidatePayloadHeaderSignature(st state.ReadOnlyBeaconState, sh interfaces. if err != nil { return err } - pubkey := st.PubkeyAtIndex(h.BuilderIndex()) pub, err := bls.PublicKeyFromBytes(pubkey[:]) if err != nil { diff --git a/consensus-types/payload-attribute/types.go b/consensus-types/payload-attribute/types.go index 88f9f1e4f061..6b1356f7d34c 100644 --- a/consensus-types/payload-attribute/types.go +++ b/consensus-types/payload-attribute/types.go @@ -45,7 +45,7 @@ func New(i interface{}) (Attributer, error) { func EmptyWithVersion(ver int) Attributer { if ver == version.EPBS { return &data{ - version: version.Electra, + version: version.Deneb, } } return &data{