From 04166e75f727931dce5dfbe357d6bafe8d1d4f38 Mon Sep 17 00:00:00 2001 From: Fridrik Asmundsson Date: Sun, 19 Jan 2025 10:39:57 -0500 Subject: [PATCH] remove use of context.Background() --- da/blob/processor.go | 3 +++ da/blob/verifier.go | 3 ++- state-transition/core/core_test.go | 1 + state-transition/core/state_processor_payload.go | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/da/blob/processor.go b/da/blob/processor.go index c635f172f..4205bbb7e 100644 --- a/da/blob/processor.go +++ b/da/blob/processor.go @@ -21,6 +21,7 @@ package blob import ( + "context" "time" "github.com/berachain/beacon-kit/chain" @@ -66,6 +67,7 @@ func NewProcessor( // VerifySidecars verifies the blobs and ensures they match the local state. func (sp *Processor) VerifySidecars( + ctx context.Context, sidecars datypes.BlobSidecars, blkHeader *ctypes.BeaconBlockHeader, kzgCommitments eip4844.KZGCommitments[common.ExecutionHash], @@ -81,6 +83,7 @@ func (sp *Processor) VerifySidecars( // Verify the blobs and ensure they match the local state. return sp.verifier.verifySidecars( + ctx, sidecars, blkHeader, kzgCommitments, diff --git a/da/blob/verifier.go b/da/blob/verifier.go index dfa109053..fbd948ca0 100644 --- a/da/blob/verifier.go +++ b/da/blob/verifier.go @@ -62,6 +62,7 @@ func newVerifier( // verifySidecars verifies the blobs for both inclusion as well // as the KZG proofs. func (bv *verifier) verifySidecars( + ctx context.Context, sidecars datypes.BlobSidecars, blkHeader *ctypes.BeaconBlockHeader, kzgCommitments eip4844.KZGCommitments[common.ExecutionHash], @@ -71,7 +72,7 @@ func (bv *verifier) verifySidecars( bv.proofVerifier.GetImplementation(), ) - g, _ := errgroup.WithContext(context.Background()) + g, _ := errgroup.WithContext(ctx) // Create lookup table for each blob sidecar commitment. blobSidecarCommitments := make(map[eip4844.KZGCommitment]struct{}) diff --git a/state-transition/core/core_test.go b/state-transition/core/core_test.go index 5f49e6a29..f1a0a2503 100644 --- a/state-transition/core/core_test.go +++ b/state-transition/core/core_test.go @@ -149,6 +149,7 @@ func setupState(t *testing.T, cs chain.Spec) ( ) ctx := &transition.Context{ + Context: context.Background(), SkipPayloadVerification: true, SkipValidateResult: true, ProposerAddress: dummyProposerAddr, diff --git a/state-transition/core/state_processor_payload.go b/state-transition/core/state_processor_payload.go index e4f48068a..3d0385105 100644 --- a/state-transition/core/state_processor_payload.go +++ b/state-transition/core/state_processor_payload.go @@ -38,7 +38,7 @@ func (sp *StateProcessor[ContextT]) processExecutionPayload( body = blk.GetBody() payload = body.GetExecutionPayload() header *ctypes.ExecutionPayloadHeader - g, gCtx = errgroup.WithContext(context.Background()) + g, gCtx = errgroup.WithContext(ctx) ) payloadTimestamp := payload.GetTimestamp().Unwrap()