From 2442280e37cb1d69e119a71e3ee9e4bfdf8bb65a Mon Sep 17 00:00:00 2001
From: Stefan <22667037+qu0b@users.noreply.github.com>
Date: Thu, 7 Mar 2024 20:46:03 +0100
Subject: [PATCH] Fix/race receive block (#13700)

* blob save: add better data checking for empty blob issues (#13647)

(cherry picked from commit daad29d0de5a053402a4da1fe9ca597f854dfa5c)

* avoid part path collisions with mem addr entropy (#13648)

* avoid part path collisions with mem addr entropy

* Regression test

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
(cherry picked from commit 4c66e4d0604f1ad3092cc51344e6bccadfd6b419)

* fix error race

---------

Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
Co-authored-by: kasey <489222+kasey@users.noreply.github.com>
---
 beacon-chain/blockchain/receive_block.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/beacon-chain/blockchain/receive_block.go b/beacon-chain/blockchain/receive_block.go
index 504e6c601..bac1c0f4a 100644
--- a/beacon-chain/blockchain/receive_block.go
+++ b/beacon-chain/blockchain/receive_block.go
@@ -97,6 +97,7 @@ func (s *Service) ReceiveBlock(ctx context.Context, block interfaces.ReadOnlySig
 	eg, _ := errgroup.WithContext(ctx)
 	var postState state.BeaconState
 	eg.Go(func() error {
+		var err error
 		postState, err = s.validateStateTransition(ctx, preState, blockCopy)
 		if err != nil {
 			return errors.Wrap(err, "failed to validate consensus state transition function")
@@ -105,6 +106,7 @@ func (s *Service) ReceiveBlock(ctx context.Context, block interfaces.ReadOnlySig
 	})
 	var isValidPayload bool
 	eg.Go(func() error {
+		var err error
 		isValidPayload, err = s.validateExecutionOnBlock(ctx, preStateVersion, preStateHeader, blockCopy, blockRoot)
 		if err != nil {
 			return errors.Wrap(err, "could not notify the engine of the new payload")