From 9d3af41acb15eb5ae6dae1972242cb266ed02f4d Mon Sep 17 00:00:00 2001 From: terence Date: Fri, 8 Mar 2024 16:12:26 -0800 Subject: [PATCH] Remove unused deneb code (#13712) * Remove unused deneb code * Gazelle --- .../depositsnapshot/deposit_cache_test.go | 8 ------ .../cache/depositsnapshot/deposit_tree.go | 2 -- beacon-chain/cache/proposer_indices_type.go | 6 ----- beacon-chain/das/BUILD.bazel | 1 - beacon-chain/das/availability_test.go | 11 -------- beacon-chain/db/errors.go | 3 --- beacon-chain/db/filesystem/BUILD.bazel | 1 - beacon-chain/db/filesystem/blob_test.go | 25 ------------------- beacon-chain/execution/errors.go | 3 --- beacon-chain/p2p/types/rpc_errors.go | 14 +++++------ 10 files changed, 7 insertions(+), 67 deletions(-) diff --git a/beacon-chain/cache/depositsnapshot/deposit_cache_test.go b/beacon-chain/cache/depositsnapshot/deposit_cache_test.go index 6aec9ac80..66fd4f61f 100644 --- a/beacon-chain/cache/depositsnapshot/deposit_cache_test.go +++ b/beacon-chain/cache/depositsnapshot/deposit_cache_test.go @@ -1189,11 +1189,3 @@ func BenchmarkDepositTree_HashTreeRootOldImplementation(b *testing.B) { require.NoError(b, err) } } - -func emptyEth1data() *ethpb.Eth1Data { - return ðpb.Eth1Data{ - DepositRoot: make([]byte, 32), - DepositCount: 0, - BlockHash: make([]byte, 32), - } -} diff --git a/beacon-chain/cache/depositsnapshot/deposit_tree.go b/beacon-chain/cache/depositsnapshot/deposit_tree.go index 20d591e9e..0f5e6cc6e 100644 --- a/beacon-chain/cache/depositsnapshot/deposit_tree.go +++ b/beacon-chain/cache/depositsnapshot/deposit_tree.go @@ -15,8 +15,6 @@ import ( ) var ( - // ErrEmptyExecutionBlock occurs when the execution block is nil. - ErrEmptyExecutionBlock = errors.New("empty execution block") // ErrInvalidSnapshotRoot occurs when the snapshot root does not match the calculated root. ErrInvalidSnapshotRoot = errors.New("snapshot root is invalid") // ErrInvalidDepositCount occurs when the value for mix in length is 0. diff --git a/beacon-chain/cache/proposer_indices_type.go b/beacon-chain/cache/proposer_indices_type.go index 219d7c634..a02db495f 100644 --- a/beacon-chain/cache/proposer_indices_type.go +++ b/beacon-chain/cache/proposer_indices_type.go @@ -1,15 +1,9 @@ package cache import ( - "errors" - "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" ) -// ErrNotProposerIndices will be returned when a cache object is not a pointer to -// a ProposerIndices struct. -var ErrNotProposerIndices = errors.New("object is not a proposer indices struct") - // ProposerIndices defines the cached struct for proposer indices. type ProposerIndices struct { BlockRoot [32]byte diff --git a/beacon-chain/das/BUILD.bazel b/beacon-chain/das/BUILD.bazel index 9db3cf89a..aa288ca4f 100644 --- a/beacon-chain/das/BUILD.bazel +++ b/beacon-chain/das/BUILD.bazel @@ -40,7 +40,6 @@ go_test( "//consensus-types/blocks:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", "//time/slots:go_default_library", diff --git a/beacon-chain/das/availability_test.go b/beacon-chain/das/availability_test.go index 4b6aa368a..e59830feb 100644 --- a/beacon-chain/das/availability_test.go +++ b/beacon-chain/das/availability_test.go @@ -13,7 +13,6 @@ import ( "github.com/prysmaticlabs/prysm/v5/consensus-types/blocks" "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" "github.com/prysmaticlabs/prysm/v5/encoding/bytesutil" - ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/v5/testing/require" "github.com/prysmaticlabs/prysm/v5/testing/util" "github.com/prysmaticlabs/prysm/v5/time/slots" @@ -114,16 +113,6 @@ func Test_commitmentsToCheck(t *testing.T) { } } -func daAlwaysSucceeds(_ [][]byte, _ []*ethpb.BlobSidecar) error { - return nil -} - -type mockDA struct { - t *testing.T - scs []blocks.ROBlob - err error -} - func TestLazilyPersistent_Missing(t *testing.T) { ctx := context.Background() store := filesystem.NewEphemeralBlobStorage(t) diff --git a/beacon-chain/db/errors.go b/beacon-chain/db/errors.go index 5ba269620..cc0c4b0e0 100644 --- a/beacon-chain/db/errors.go +++ b/beacon-chain/db/errors.go @@ -19,9 +19,6 @@ var ErrNotFoundState = kv.ErrNotFoundState // ErrNotFoundOriginBlockRoot wraps ErrNotFound for an error specific to the origin block root. var ErrNotFoundOriginBlockRoot = kv.ErrNotFoundOriginBlockRoot -// ErrNotFoundBackfillBlockRoot wraps ErrNotFound for an error specific to the backfill block root. -var ErrNotFoundBackfillBlockRoot = kv.ErrNotFoundBackfillBlockRoot - // IsNotFound allows callers to treat errors from a flat-file database, where the file record is missing, // as equivalent to db.ErrNotFound. func IsNotFound(err error) bool { diff --git a/beacon-chain/db/filesystem/BUILD.bazel b/beacon-chain/db/filesystem/BUILD.bazel index 9095da42e..49fbef671 100644 --- a/beacon-chain/db/filesystem/BUILD.bazel +++ b/beacon-chain/db/filesystem/BUILD.bazel @@ -44,7 +44,6 @@ go_test( "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", - "@com_github_pkg_errors//:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", "@com_github_spf13_afero//:go_default_library", ], diff --git a/beacon-chain/db/filesystem/blob_test.go b/beacon-chain/db/filesystem/blob_test.go index f70b84c88..e23c09daf 100644 --- a/beacon-chain/db/filesystem/blob_test.go +++ b/beacon-chain/db/filesystem/blob_test.go @@ -6,9 +6,7 @@ import ( "path" "sync" "testing" - "time" - "github.com/pkg/errors" ssz "github.com/prysmaticlabs/fastssz" "github.com/prysmaticlabs/prysm/v5/beacon-chain/verification" fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams" @@ -129,29 +127,6 @@ func TestBlobStorage_SaveBlobData(t *testing.T) { } // pollUntil polls a condition function until it returns true or a timeout is reached. -func pollUntil(t *testing.T, fs afero.Fs, expected int) error { - var remainingFolders []os.FileInfo - var err error - // Define the condition function for polling - conditionFunc := func() bool { - remainingFolders, err = afero.ReadDir(fs, ".") - require.NoError(t, err) - return len(remainingFolders) == expected - } - - startTime := time.Now() - for { - if conditionFunc() { - break // Condition met, exit the loop - } - if time.Since(startTime) > 30*time.Second { - return errors.New("timeout") - } - time.Sleep(1 * time.Second) // Adjust the sleep interval as needed - } - require.Equal(t, expected, len(remainingFolders)) - return nil -} func TestBlobIndicesBounds(t *testing.T) { fs, bs, err := NewEphemeralBlobStorageWithFs(t) diff --git a/beacon-chain/execution/errors.go b/beacon-chain/execution/errors.go index d6197c986..e536859ab 100644 --- a/beacon-chain/execution/errors.go +++ b/beacon-chain/execution/errors.go @@ -23,9 +23,6 @@ var ( ErrInvalidPayloadAttributes = errors.New("payload attributes are invalid / inconsistent") // ErrUnknownPayloadStatus when the payload status is unknown. ErrUnknownPayloadStatus = errors.New("unknown payload status") - // ErrConfigMismatch when the execution node's terminal total difficulty or - // terminal block hash received via the API mismatches Prysm's configuration value. - ErrConfigMismatch = errors.New("execution client configuration mismatch") // ErrAcceptedSyncingPayloadStatus when the status of the payload is syncing or accepted. ErrAcceptedSyncingPayloadStatus = errors.New("payload status is SYNCING or ACCEPTED") // ErrInvalidPayloadStatus when the status of the payload is invalid. diff --git a/beacon-chain/p2p/types/rpc_errors.go b/beacon-chain/p2p/types/rpc_errors.go index 6bed696b1..46381876c 100644 --- a/beacon-chain/p2p/types/rpc_errors.go +++ b/beacon-chain/p2p/types/rpc_errors.go @@ -8,11 +8,11 @@ var ( ErrInvalidFinalizedRoot = errors.New("invalid finalized root") ErrInvalidSequenceNum = errors.New("invalid sequence number provided") ErrGeneric = errors.New("internal service error") - ErrInvalidParent = errors.New("mismatched parent root") - ErrRateLimited = errors.New("rate limited") - ErrIODeadline = errors.New("i/o deadline exceeded") - ErrInvalidRequest = errors.New("invalid range, step or count") - ErrBlobLTMinRequest = errors.New("blob slot < minimum_request_epoch") - ErrMaxBlobReqExceeded = errors.New("requested more than MAX_REQUEST_BLOB_SIDECARS") - ErrResourceUnavailable = errors.New("resource requested unavailable") + + ErrRateLimited = errors.New("rate limited") + ErrIODeadline = errors.New("i/o deadline exceeded") + ErrInvalidRequest = errors.New("invalid range, step or count") + ErrBlobLTMinRequest = errors.New("blob slot < minimum_request_epoch") + ErrMaxBlobReqExceeded = errors.New("requested more than MAX_REQUEST_BLOB_SIDECARS") + ErrResourceUnavailable = errors.New("resource requested unavailable") )