From b0f773ae6eb13dd6b44f64b7e22103be07b0dda0 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Fri, 1 Nov 2024 14:42:52 -0700 Subject: [PATCH 1/4] Return early blob constructor if not deneb --- CHANGELOG.md | 1 + beacon-chain/sync/subscriber_beacon_blocks.go | 5 +++++ beacon-chain/sync/subscriber_beacon_blocks_test.go | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e0d00851e0..7c0ac025be0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve - Simplified `ExitedValidatorIndices`. - Simplified `EjectedValidatorIndices`. - `engine_newPayloadV4`,`engine_getPayloadV4` are changes due to new execution request serialization decisions, [PR](https://github.com/prysmaticlabs/prysm/pull/14580) +- Return early for blob constructor during capella fork ### Deprecated diff --git a/beacon-chain/sync/subscriber_beacon_blocks.go b/beacon-chain/sync/subscriber_beacon_blocks.go index 45e8608449c..488549e65f3 100644 --- a/beacon-chain/sync/subscriber_beacon_blocks.go +++ b/beacon-chain/sync/subscriber_beacon_blocks.go @@ -12,6 +12,7 @@ import ( "github.com/prysmaticlabs/prysm/v5/consensus-types/blocks" "github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces" "github.com/prysmaticlabs/prysm/v5/io/file" + "github.com/prysmaticlabs/prysm/v5/runtime/version" "github.com/prysmaticlabs/prysm/v5/time/slots" "google.golang.org/protobuf/proto" ) @@ -62,6 +63,10 @@ func (s *Service) beaconBlockSubscriber(ctx context.Context, msg proto.Message) // This function reconstructs the blob sidecars from the EL using the block's KZG commitments, // broadcasts the reconstructed blobs over P2P, and saves them into the blob storage. func (s *Service) reconstructAndBroadcastBlobs(ctx context.Context, block interfaces.ReadOnlySignedBeaconBlock) { + if block.Version() < version.Deneb { + return + } + startTime, err := slots.ToTime(uint64(s.cfg.chain.GenesisTime().Unix()), block.Block().Slot()) if err != nil { log.WithError(err).Error("Failed to convert slot to time") diff --git a/beacon-chain/sync/subscriber_beacon_blocks_test.go b/beacon-chain/sync/subscriber_beacon_blocks_test.go index 26a2cec418c..d43c51a9a58 100644 --- a/beacon-chain/sync/subscriber_beacon_blocks_test.go +++ b/beacon-chain/sync/subscriber_beacon_blocks_test.go @@ -194,3 +194,12 @@ func TestReconstructAndBroadcastBlobs(t *testing.T) { }) } } + +func TestReconstructAndBroadcastBlobs_Capella(t *testing.T) { + b := util.NewBeaconBlockCapella() + sb, err := blocks.NewSignedBeaconBlock(b) + require.NoError(t, err) + + s := Service{} + s.reconstructAndBroadcastBlobs(context.Background(), sb) +} From 763081bb7a6a6eb1d5089897c8be564de0cc1a1d Mon Sep 17 00:00:00 2001 From: terence Date: Tue, 5 Nov 2024 16:51:40 -0800 Subject: [PATCH 2/4] Update CHANGELOG.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Radosław Kapka --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c0ac025be0..f8c3bfcadef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,7 +38,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve - Simplified `ExitedValidatorIndices`. - Simplified `EjectedValidatorIndices`. - `engine_newPayloadV4`,`engine_getPayloadV4` are changes due to new execution request serialization decisions, [PR](https://github.com/prysmaticlabs/prysm/pull/14580) -- Return early for blob constructor during capella fork +- Return early for blob reconstructor during capella fork ### Deprecated From 7cc6e22c3cd52f0f9452ae1f5445b46044510ce3 Mon Sep 17 00:00:00 2001 From: terence Date: Tue, 5 Nov 2024 16:52:05 -0800 Subject: [PATCH 3/4] Remove test --- beacon-chain/sync/subscriber_beacon_blocks_test.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/beacon-chain/sync/subscriber_beacon_blocks_test.go b/beacon-chain/sync/subscriber_beacon_blocks_test.go index d43c51a9a58..48876330876 100644 --- a/beacon-chain/sync/subscriber_beacon_blocks_test.go +++ b/beacon-chain/sync/subscriber_beacon_blocks_test.go @@ -195,11 +195,3 @@ func TestReconstructAndBroadcastBlobs(t *testing.T) { } } -func TestReconstructAndBroadcastBlobs_Capella(t *testing.T) { - b := util.NewBeaconBlockCapella() - sb, err := blocks.NewSignedBeaconBlock(b) - require.NoError(t, err) - - s := Service{} - s.reconstructAndBroadcastBlobs(context.Background(), sb) -} From 935fef052ac0e93004561d192ff3f2fd62f75133 Mon Sep 17 00:00:00 2001 From: terence Date: Tue, 5 Nov 2024 16:52:21 -0800 Subject: [PATCH 4/4] Remove space --- beacon-chain/sync/subscriber_beacon_blocks_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/beacon-chain/sync/subscriber_beacon_blocks_test.go b/beacon-chain/sync/subscriber_beacon_blocks_test.go index 48876330876..26a2cec418c 100644 --- a/beacon-chain/sync/subscriber_beacon_blocks_test.go +++ b/beacon-chain/sync/subscriber_beacon_blocks_test.go @@ -194,4 +194,3 @@ func TestReconstructAndBroadcastBlobs(t *testing.T) { }) } } -