From 24b029bbef3332ffaff03e77256edb9a585dc73e Mon Sep 17 00:00:00 2001 From: terence Date: Tue, 20 Feb 2024 13:32:13 -0800 Subject: [PATCH] Some clean ups on the sync package (#13636) --- beacon-chain/sync/backfill/verify_test.go | 2 +- beacon-chain/sync/block_batcher.go | 10 +++++----- beacon-chain/sync/initial-sync/verification.go | 2 +- beacon-chain/sync/verify/blob_test.go | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/beacon-chain/sync/backfill/verify_test.go b/beacon-chain/sync/backfill/verify_test.go index 9250007a8..19253ba7f 100644 --- a/beacon-chain/sync/backfill/verify_test.go +++ b/beacon-chain/sync/backfill/verify_test.go @@ -56,7 +56,7 @@ func testBlocksWithKeys(t *testing.T, nBlocks uint64, nBlobs int, vr []byte) ([] func TestVerify(t *testing.T) { vr := make([]byte, 32) - copy(vr, []byte("yooooo")) + copy(vr, "yooooo") blks, _, _, pks := testBlocksWithKeys(t, 2, 0, vr) pubkeys := make([][fieldparams.BLSPubkeyLength]byte, len(pks)) for i := range pks { diff --git a/beacon-chain/sync/block_batcher.go b/beacon-chain/sync/block_batcher.go index ef6b6103d..014b7cdbe 100644 --- a/beacon-chain/sync/block_batcher.go +++ b/beacon-chain/sync/block_batcher.go @@ -151,14 +151,14 @@ func newBlockBatch(start, reqEnd primitives.Slot, size uint64) (blockBatch, bool return nb, true } -func (bat blockBatch) next(reqEnd primitives.Slot, size uint64) (blockBatch, bool) { - if bat.error() != nil { - return bat, false +func (bb blockBatch) next(reqEnd primitives.Slot, size uint64) (blockBatch, bool) { + if bb.error() != nil { + return bb, false } - if bat.nonLinear() { + if bb.nonLinear() { return blockBatch{}, false } - return newBlockBatch(bat.end.Add(1), reqEnd, size) + return newBlockBatch(bb.end.Add(1), reqEnd, size) } // blocks returns the list of linear, canonical blocks read from the db. diff --git a/beacon-chain/sync/initial-sync/verification.go b/beacon-chain/sync/initial-sync/verification.go index 1ffbb9783..1a2b936ed 100644 --- a/beacon-chain/sync/initial-sync/verification.go +++ b/beacon-chain/sync/initial-sync/verification.go @@ -15,7 +15,7 @@ var ( // ErrBatchSignatureMismatch is returned by VerifiedROBlobs when any of the blobs in the batch have a signature // which does not match the signature for the block with a corresponding root. ErrBatchSignatureMismatch = errors.New("Sidecar block header signature does not match signed block") - // ErrBlockRootMismatch is returned by VerifiedROBlobs in the scenario where the root of the given signed block + // ErrBatchBlockRootMismatch is returned by VerifiedROBlobs in the scenario where the root of the given signed block // does not match the block header in one of the corresponding sidecars. ErrBatchBlockRootMismatch = errors.New("Sidecar block header root does not match signed block") ) diff --git a/beacon-chain/sync/verify/blob_test.go b/beacon-chain/sync/verify/blob_test.go index e4b2adb09..b97a5d275 100644 --- a/beacon-chain/sync/verify/blob_test.go +++ b/beacon-chain/sync/verify/blob_test.go @@ -54,7 +54,7 @@ func TestBlobAlignsWithBlock(t *testing.T) { require.NoError(t, err) rob, err := blocks.NewROBlock(blk) require.NoError(t, err) - return rob, []blocks.ROBlob{blocks.ROBlob{}} + return rob, []blocks.ROBlob{{}} }, }, }