From ea065543cd254b02286e08bd5f3843903013ea2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kapka?= Date: Thu, 24 Oct 2024 00:34:43 +0700 Subject: [PATCH 01/26] Set fields of wrapped proto object in light client setters (#14573) * Set fields of wrapped proto object in light client setters * changelog <3 --- CHANGELOG.md | 99 +++++++++++++++++++++------------------------------- 1 file changed, 39 insertions(+), 60 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d23a7a1fda..b7897867da5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on Keep a Changelog, and this project adheres to Semantic Versioning. -## [Unreleased](https://github.com/prysmaticlabs/prysm/compare/v5.1.2...HEAD) +## [Unreleased](https://github.com/prysmaticlabs/prysm/compare/v5.1.1...HEAD) ### Added @@ -27,11 +27,9 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve - Updated the default `scrape-interval` in `Client-stats` to 2 minutes to accommodate Beaconcha.in API rate limits. - Switch to compounding when consolidating with source==target. - Revert block db save when saving state fails. -- Return false from HasBlock if the block is being synced. +- Return false from HasBlock if the block is being synced. - Cleanup forkchoice on failed insertions. - Use read only validator for core processing to avoid unnecessary copying. -- Use ROBlock across block processing pipeline. -- Added missing Eth-Consensus-Version headers to GetBlockAttestationsV2 and GetAttesterSlashingsV2 endpoints. ### Deprecated @@ -45,41 +43,23 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve - Fixed mesh size by appending `gParams.Dhi = gossipSubDhi` - Fix skipping partial withdrawals count. -- wait for the async StreamEvent writer to exit before leaving the http handler, avoiding race condition panics [pr](https://github.com/prysmaticlabs/prysm/pull/14557) -- Certain deb files were returning a 404 which made building new docker images without an existing - cache impossible. This has been fixed with updates to rules_oci and bazel-lib. -- Fixed an issue where the length check between block body KZG commitments and the existing cache from the database was incompatible. +- recover from panics when writing the event stream [pr](https://github.com/prysmaticlabs/prysm/pull/14545) +- Return the correct light client payload proof. [PR](https://github.com/prysmaticlabs/prysm/pull/14565) +- Set fields of wrapped proto object in light client setters. [PR](https://github.com/prysmaticlabs/prysm/pull/14573) ### Security -## [v5.1.2](https://github.com/prysmaticlabs/prysm/compare/v5.1.1...v5.1.2) - 2024-10-16 - -This is a hotfix release with one change. - -Prysm v5.1.1 contains an updated implementation of the beacon api streaming events endpoint. This -new implementation contains a bug that can cause a panic in certain conditions. The issue is -difficult to reproduce reliably and we are still trying to determine the root cause, but in the -meantime we are issuing a patch that recovers from the panic to prevent the node from crashing. - -This only impacts the v5.1.1 release beacon api event stream endpoints. This endpoint is used by the -prysm REST mode validator (a feature which requires the validator to be configured to use the beacon -api intead of prysm's stock grpc endpoints) or accessory software that connects to the events api, -like https://github.com/ethpandaops/ethereum-metrics-exporter - -### Fixed - -- Recover from panics when writing the event stream [#14545](https://github.com/prysmaticlabs/prysm/pull/14545) ## [v5.1.1](https://github.com/prysmaticlabs/prysm/compare/v5.1.0...v5.1.1) - 2024-10-15 -This release has a number of features and improvements. Most notably, the feature flag -`--enable-experimental-state` has been flipped to "opt out" via `--disable-experimental-state`. +This release has a number of features and improvements. Most notably, the feature flag +`--enable-experimental-state` has been flipped to "opt out" via `--disable-experimental-state`. The experimental state management design has shown significant improvements in memory usage at runtime. Updates to libp2p's gossipsub have some bandwidith stability improvements with support for -IDONTWANT control messages. +IDONTWANT control messages. The gRPC gateway has been deprecated from Prysm in this release. If you need JSON data, consider the -standardized beacon-APIs. +standardized beacon-APIs. Updating to this release is recommended at your convenience. @@ -102,7 +82,6 @@ Updating to this release is recommended at your convenience. - fastssz version bump (better error messages). - SSE implementation that sheds stuck clients. [pr](https://github.com/prysmaticlabs/prysm/pull/14413) - Added GetPoolAttesterSlashingsV2 endpoint. -- Use engine API get-blobs for block subscriber to reduce block import latency and potentially reduce bandwidth. ### Changed @@ -121,7 +100,7 @@ Updating to this release is recommended at your convenience. - `grpc-gateway-corsdomain` is renamed to http-cors-domain. The old name can still be used as an alias. - `api-timeout` is changed from int flag to duration flag, default value updated. - Light client support: abstracted out the light client headers with different versions. -- `ApplyToEveryValidator` has been changed to prevent misuse bugs, it takes a closure that takes a `ReadOnlyValidator` and returns a raw pointer to a `Validator`. +- `ApplyToEveryValidator` has been changed to prevent misuse bugs, it takes a closure that takes a `ReadOnlyValidator` and returns a raw pointer to a `Validator`. - Removed gorilla mux library and replaced it with net/http updates in go 1.22. - Clean up `ProposeBlock` for validator client to reduce cognitive scoring and enable further changes. - Updated k8s-io/client-go to v0.30.4 and k8s-io/apimachinery to v0.30.4 @@ -132,7 +111,7 @@ Updating to this release is recommended at your convenience. - Updated Sepolia bootnodes. - Make committee aware packing the default by deprecating `--enable-committee-aware-packing`. - Moved `ConvertKzgCommitmentToVersionedHash` to the `primitives` package. -- Updated correlation penalty for EIP-7251. +- Updated correlation penalty for EIP-7251. ### Deprecated - `--disable-grpc-gateway` flag is deprecated due to grpc gateway removal. @@ -604,34 +583,34 @@ AVX support (eg Celeron) after the Deneb fork. This is not an issue for mainnet. - Linter: Wastedassign linter enabled to improve code quality. - API Enhancements: - - Added payload return in Wei for /eth/v3/validator/blocks. - - Added Holesky Deneb Epoch for better epoch management. + - Added payload return in Wei for /eth/v3/validator/blocks. + - Added Holesky Deneb Epoch for better epoch management. - Testing Enhancements: - - Clear cache in tests of core helpers to ensure test reliability. - - Added Debug State Transition Method for improved debugging. - - Backfilling test: Enabled backfill in E2E tests for more comprehensive coverage. + - Clear cache in tests of core helpers to ensure test reliability. + - Added Debug State Transition Method for improved debugging. + - Backfilling test: Enabled backfill in E2E tests for more comprehensive coverage. - API Updates: Re-enabled jwt on keymanager API for enhanced security. - Logging Improvements: Enhanced block by root log for better traceability. - Validator Client Improvements: - - Added Spans to Core Validator Methods for enhanced monitoring. - - Improved readability in validator client code for better maintenance (various commits). + - Added Spans to Core Validator Methods for enhanced monitoring. + - Improved readability in validator client code for better maintenance (various commits). ### Changed - Optimizations and Refinements: - - Lowered resource usage in certain processes for efficiency. - - Moved blob rpc validation closer to peer read for optimized processing. - - Cleaned up validate beacon block code for clarity and efficiency. - - Updated Sepolia Deneb fork epoch for alignment with network changes. - - Changed blob latency metrics to milliseconds for more precise measurement. - - Altered getLegacyDatabaseLocation message for better clarity. - - Improved wait for activation method for enhanced performance. - - Capitalized Aggregated Unaggregated Attestations Log for consistency. - - Modified HistoricalRoots usage for accuracy. - - Adjusted checking of attribute emptiness for efficiency. + - Lowered resource usage in certain processes for efficiency. + - Moved blob rpc validation closer to peer read for optimized processing. + - Cleaned up validate beacon block code for clarity and efficiency. + - Updated Sepolia Deneb fork epoch for alignment with network changes. + - Changed blob latency metrics to milliseconds for more precise measurement. + - Altered getLegacyDatabaseLocation message for better clarity. + - Improved wait for activation method for enhanced performance. + - Capitalized Aggregated Unaggregated Attestations Log for consistency. + - Modified HistoricalRoots usage for accuracy. + - Adjusted checking of attribute emptiness for efficiency. - Database Management: - - Moved --db-backup-output-dir as a deprecated flag for database management simplification. - - Added the Ability to Defragment the Beacon State for improved database performance. + - Moved --db-backup-output-dir as a deprecated flag for database management simplification. + - Added the Ability to Defragment the Beacon State for improved database performance. - Dependency Update: Bumped quic-go version from 0.39.3 to 0.39.4 for up-to-date dependencies. ### Removed @@ -642,12 +621,12 @@ AVX support (eg Celeron) after the Deneb fork. This is not an issue for mainnet. ### Fixed - Bug Fixes: - - Fixed off by one error for improved accuracy. - - Resolved small typo in error messages for clarity. - - Addressed minor issue in blsToExecChange validator for better validation. - - Corrected blobsidecar json tag for commitment inclusion proof. - - Fixed ssz post-requests content type check. - - Resolved issue with port logging in bootnode. + - Fixed off by one error for improved accuracy. + - Resolved small typo in error messages for clarity. + - Addressed minor issue in blsToExecChange validator for better validation. + - Corrected blobsidecar json tag for commitment inclusion proof. + - Fixed ssz post-requests content type check. + - Resolved issue with port logging in bootnode. - Test Fixes: Re-enabled Slasher E2E Test for more comprehensive testing. ### Security @@ -1074,9 +1053,9 @@ No security issues in thsi release. now features runtime detection, automatically enabling optimized code paths if your CPU supports it. - **Multiarch Containers Preview Available**: multiarch (:wave: arm64 support :wave:) containers will be offered for preview at the following locations: - - Beacon Chain: [gcr.io/prylabs-dev/prysm/beacon-chain:v4.1.0](gcr.io/prylabs-dev/prysm/beacon-chain:v4.1.0) - - Validator: [gcr.io/prylabs-dev/prysm/validator:v4.1.0](gcr.io/prylabs-dev/prysm/validator:v4.1.0) - - Please note that in the next cycle, we will exclusively use these containers at the canonical URLs. + - Beacon Chain: [gcr.io/prylabs-dev/prysm/beacon-chain:v4.1.0](gcr.io/prylabs-dev/prysm/beacon-chain:v4.1.0) + - Validator: [gcr.io/prylabs-dev/prysm/validator:v4.1.0](gcr.io/prylabs-dev/prysm/validator:v4.1.0) + - Please note that in the next cycle, we will exclusively use these containers at the canonical URLs. ### Added From ce6388f635d2f60ab4998a318ace3ea528978e9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kapka?= Date: Thu, 24 Oct 2024 00:34:43 +0700 Subject: [PATCH 02/26] Set fields of wrapped proto object in light client setters (#14573) * Set fields of wrapped proto object in light client setters * changelog <3 --- CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7897867da5..91c3ff280bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,9 +15,6 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve - Light client support: Consensus types for Electra - Added SubmitPoolAttesterSlashingV2 endpoint. - Added SubmitAggregateAndProofsRequestV2 endpoint. -- Updated the `beacon-chain/monitor` package to Electra. [PR](https://github.com/prysmaticlabs/prysm/pull/14562) -- Added ListAttestationsV2 endpoint. -- Add ability to rollback node's internal state during processing. ### Changed From 471b0c2f07a4a51d8f6b227bcdbef73955b36471 Mon Sep 17 00:00:00 2001 From: rkapka Date: Sat, 26 Oct 2024 20:19:12 +0700 Subject: [PATCH 03/26] align changelog with develop branch --- CHANGELOG.md | 100 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 61 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91c3ff280bd..71a23c0e4dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on Keep a Changelog, and this project adheres to Semantic Versioning. -## [Unreleased](https://github.com/prysmaticlabs/prysm/compare/v5.1.1...HEAD) +## [Unreleased](https://github.com/prysmaticlabs/prysm/compare/v5.1.2...HEAD) ### Added @@ -15,6 +15,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve - Light client support: Consensus types for Electra - Added SubmitPoolAttesterSlashingV2 endpoint. - Added SubmitAggregateAndProofsRequestV2 endpoint. +- Updated the `beacon-chain/monitor` package to Electra. [PR](https://github.com/prysmaticlabs/prysm/pull/14562) ### Changed @@ -24,9 +25,11 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve - Updated the default `scrape-interval` in `Client-stats` to 2 minutes to accommodate Beaconcha.in API rate limits. - Switch to compounding when consolidating with source==target. - Revert block db save when saving state fails. -- Return false from HasBlock if the block is being synced. +- Return false from HasBlock if the block is being synced. - Cleanup forkchoice on failed insertions. - Use read only validator for core processing to avoid unnecessary copying. +- Use ROBlock across block processing pipeline. +- Added missing Eth-Consensus-Version headers to GetBlockAttestationsV2 and GetAttesterSlashingsV2 endpoints. ### Deprecated @@ -40,23 +43,41 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve - Fixed mesh size by appending `gParams.Dhi = gossipSubDhi` - Fix skipping partial withdrawals count. -- recover from panics when writing the event stream [pr](https://github.com/prysmaticlabs/prysm/pull/14545) -- Return the correct light client payload proof. [PR](https://github.com/prysmaticlabs/prysm/pull/14565) -- Set fields of wrapped proto object in light client setters. [PR](https://github.com/prysmaticlabs/prysm/pull/14573) +- wait for the async StreamEvent writer to exit before leaving the http handler, avoiding race condition panics [pr](https://github.com/prysmaticlabs/prysm/pull/14557) +- Certain deb files were returning a 404 which made building new docker images without an existing + cache impossible. This has been fixed with updates to rules_oci and bazel-lib. +- Fixed an issue where the length check between block body KZG commitments and the existing cache from the database was incompatible. ### Security +## [v5.1.2](https://github.com/prysmaticlabs/prysm/compare/v5.1.1...v5.1.2) - 2024-10-16 + +This is a hotfix release with one change. + +Prysm v5.1.1 contains an updated implementation of the beacon api streaming events endpoint. This +new implementation contains a bug that can cause a panic in certain conditions. The issue is +difficult to reproduce reliably and we are still trying to determine the root cause, but in the +meantime we are issuing a patch that recovers from the panic to prevent the node from crashing. + +This only impacts the v5.1.1 release beacon api event stream endpoints. This endpoint is used by the +prysm REST mode validator (a feature which requires the validator to be configured to use the beacon +api intead of prysm's stock grpc endpoints) or accessory software that connects to the events api, +like https://github.com/ethpandaops/ethereum-metrics-exporter + +### Fixed + +- Recover from panics when writing the event stream [#14545](https://github.com/prysmaticlabs/prysm/pull/14545) ## [v5.1.1](https://github.com/prysmaticlabs/prysm/compare/v5.1.0...v5.1.1) - 2024-10-15 -This release has a number of features and improvements. Most notably, the feature flag -`--enable-experimental-state` has been flipped to "opt out" via `--disable-experimental-state`. +This release has a number of features and improvements. Most notably, the feature flag +`--enable-experimental-state` has been flipped to "opt out" via `--disable-experimental-state`. The experimental state management design has shown significant improvements in memory usage at runtime. Updates to libp2p's gossipsub have some bandwidith stability improvements with support for -IDONTWANT control messages. +IDONTWANT control messages. The gRPC gateway has been deprecated from Prysm in this release. If you need JSON data, consider the -standardized beacon-APIs. +standardized beacon-APIs. Updating to this release is recommended at your convenience. @@ -79,6 +100,7 @@ Updating to this release is recommended at your convenience. - fastssz version bump (better error messages). - SSE implementation that sheds stuck clients. [pr](https://github.com/prysmaticlabs/prysm/pull/14413) - Added GetPoolAttesterSlashingsV2 endpoint. +- Use engine API get-blobs for block subscriber to reduce block import latency and potentially reduce bandwidth. ### Changed @@ -97,7 +119,7 @@ Updating to this release is recommended at your convenience. - `grpc-gateway-corsdomain` is renamed to http-cors-domain. The old name can still be used as an alias. - `api-timeout` is changed from int flag to duration flag, default value updated. - Light client support: abstracted out the light client headers with different versions. -- `ApplyToEveryValidator` has been changed to prevent misuse bugs, it takes a closure that takes a `ReadOnlyValidator` and returns a raw pointer to a `Validator`. +- `ApplyToEveryValidator` has been changed to prevent misuse bugs, it takes a closure that takes a `ReadOnlyValidator` and returns a raw pointer to a `Validator`. - Removed gorilla mux library and replaced it with net/http updates in go 1.22. - Clean up `ProposeBlock` for validator client to reduce cognitive scoring and enable further changes. - Updated k8s-io/client-go to v0.30.4 and k8s-io/apimachinery to v0.30.4 @@ -108,7 +130,7 @@ Updating to this release is recommended at your convenience. - Updated Sepolia bootnodes. - Make committee aware packing the default by deprecating `--enable-committee-aware-packing`. - Moved `ConvertKzgCommitmentToVersionedHash` to the `primitives` package. -- Updated correlation penalty for EIP-7251. +- Updated correlation penalty for EIP-7251. ### Deprecated - `--disable-grpc-gateway` flag is deprecated due to grpc gateway removal. @@ -580,34 +602,34 @@ AVX support (eg Celeron) after the Deneb fork. This is not an issue for mainnet. - Linter: Wastedassign linter enabled to improve code quality. - API Enhancements: - - Added payload return in Wei for /eth/v3/validator/blocks. - - Added Holesky Deneb Epoch for better epoch management. + - Added payload return in Wei for /eth/v3/validator/blocks. + - Added Holesky Deneb Epoch for better epoch management. - Testing Enhancements: - - Clear cache in tests of core helpers to ensure test reliability. - - Added Debug State Transition Method for improved debugging. - - Backfilling test: Enabled backfill in E2E tests for more comprehensive coverage. + - Clear cache in tests of core helpers to ensure test reliability. + - Added Debug State Transition Method for improved debugging. + - Backfilling test: Enabled backfill in E2E tests for more comprehensive coverage. - API Updates: Re-enabled jwt on keymanager API for enhanced security. - Logging Improvements: Enhanced block by root log for better traceability. - Validator Client Improvements: - - Added Spans to Core Validator Methods for enhanced monitoring. - - Improved readability in validator client code for better maintenance (various commits). + - Added Spans to Core Validator Methods for enhanced monitoring. + - Improved readability in validator client code for better maintenance (various commits). ### Changed - Optimizations and Refinements: - - Lowered resource usage in certain processes for efficiency. - - Moved blob rpc validation closer to peer read for optimized processing. - - Cleaned up validate beacon block code for clarity and efficiency. - - Updated Sepolia Deneb fork epoch for alignment with network changes. - - Changed blob latency metrics to milliseconds for more precise measurement. - - Altered getLegacyDatabaseLocation message for better clarity. - - Improved wait for activation method for enhanced performance. - - Capitalized Aggregated Unaggregated Attestations Log for consistency. - - Modified HistoricalRoots usage for accuracy. - - Adjusted checking of attribute emptiness for efficiency. + - Lowered resource usage in certain processes for efficiency. + - Moved blob rpc validation closer to peer read for optimized processing. + - Cleaned up validate beacon block code for clarity and efficiency. + - Updated Sepolia Deneb fork epoch for alignment with network changes. + - Changed blob latency metrics to milliseconds for more precise measurement. + - Altered getLegacyDatabaseLocation message for better clarity. + - Improved wait for activation method for enhanced performance. + - Capitalized Aggregated Unaggregated Attestations Log for consistency. + - Modified HistoricalRoots usage for accuracy. + - Adjusted checking of attribute emptiness for efficiency. - Database Management: - - Moved --db-backup-output-dir as a deprecated flag for database management simplification. - - Added the Ability to Defragment the Beacon State for improved database performance. + - Moved --db-backup-output-dir as a deprecated flag for database management simplification. + - Added the Ability to Defragment the Beacon State for improved database performance. - Dependency Update: Bumped quic-go version from 0.39.3 to 0.39.4 for up-to-date dependencies. ### Removed @@ -618,12 +640,12 @@ AVX support (eg Celeron) after the Deneb fork. This is not an issue for mainnet. ### Fixed - Bug Fixes: - - Fixed off by one error for improved accuracy. - - Resolved small typo in error messages for clarity. - - Addressed minor issue in blsToExecChange validator for better validation. - - Corrected blobsidecar json tag for commitment inclusion proof. - - Fixed ssz post-requests content type check. - - Resolved issue with port logging in bootnode. + - Fixed off by one error for improved accuracy. + - Resolved small typo in error messages for clarity. + - Addressed minor issue in blsToExecChange validator for better validation. + - Corrected blobsidecar json tag for commitment inclusion proof. + - Fixed ssz post-requests content type check. + - Resolved issue with port logging in bootnode. - Test Fixes: Re-enabled Slasher E2E Test for more comprehensive testing. ### Security @@ -1050,9 +1072,9 @@ No security issues in thsi release. now features runtime detection, automatically enabling optimized code paths if your CPU supports it. - **Multiarch Containers Preview Available**: multiarch (:wave: arm64 support :wave:) containers will be offered for preview at the following locations: - - Beacon Chain: [gcr.io/prylabs-dev/prysm/beacon-chain:v4.1.0](gcr.io/prylabs-dev/prysm/beacon-chain:v4.1.0) - - Validator: [gcr.io/prylabs-dev/prysm/validator:v4.1.0](gcr.io/prylabs-dev/prysm/validator:v4.1.0) - - Please note that in the next cycle, we will exclusively use these containers at the canonical URLs. + - Beacon Chain: [gcr.io/prylabs-dev/prysm/beacon-chain:v4.1.0](gcr.io/prylabs-dev/prysm/beacon-chain:v4.1.0) + - Validator: [gcr.io/prylabs-dev/prysm/validator:v4.1.0](gcr.io/prylabs-dev/prysm/validator:v4.1.0) + - Please note that in the next cycle, we will exclusively use these containers at the canonical URLs. ### Added From 28af3d618ae0e33790392eea9d2ec378300a1bd7 Mon Sep 17 00:00:00 2001 From: rkapka Date: Sat, 26 Oct 2024 21:01:08 +0700 Subject: [PATCH 04/26] get files from gossip branch --- beacon-chain/p2p/BUILD.bazel | 1 + beacon-chain/p2p/gossip_scoring_params.go | 54 ++++++++ beacon-chain/p2p/gossip_topic_mappings.go | 3 + beacon-chain/p2p/topics.go | 8 ++ beacon-chain/sync/BUILD.bazel | 4 + beacon-chain/sync/service.go | 52 +++++--- beacon-chain/sync/subscriber.go | 16 ++- beacon-chain/sync/subscriber_light_client.go | 17 +++ beacon-chain/sync/validate_light_client.go | 130 +++++++++++++++++++ 9 files changed, 264 insertions(+), 21 deletions(-) create mode 100644 beacon-chain/sync/subscriber_light_client.go create mode 100644 beacon-chain/sync/validate_light_client.go diff --git a/beacon-chain/p2p/BUILD.bazel b/beacon-chain/p2p/BUILD.bazel index 7cb7e522711..d6897a6d5d9 100644 --- a/beacon-chain/p2p/BUILD.bazel +++ b/beacon-chain/p2p/BUILD.bazel @@ -69,6 +69,7 @@ go_library( "//monitoring/tracing/trace:go_default_library", "//network:go_default_library", "//network/forks:go_default_library", + "//proto/eth/v2:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//runtime:go_default_library", diff --git a/beacon-chain/p2p/gossip_scoring_params.go b/beacon-chain/p2p/gossip_scoring_params.go index afe66728343..2e522a31c5b 100644 --- a/beacon-chain/p2p/gossip_scoring_params.go +++ b/beacon-chain/p2p/gossip_scoring_params.go @@ -44,6 +44,12 @@ const ( // blsToExecutionChangeWeight specifies the scoring weight that we apply to // our bls to execution topic. blsToExecutionChangeWeight = 0.05 + // lightClientFinalityUpdateWeight specifies the scoring weight that we apply to + // our light client finality update topic. + lightClientFinalityUpdateWeight = 0.05 + // lightClientOptimisticUpdateWeight specifies the scoring weight that we apply to + // our light client optimistic update topic. + lightClientOptimisticUpdateWeight = 0.05 // maxInMeshScore describes the max score a peer can attain from being in the mesh. maxInMeshScore = 10 @@ -124,6 +130,10 @@ func (s *Service) topicScoreParams(topic string) (*pubsub.TopicScoreParams, erro case strings.Contains(topic, GossipBlobSidecarMessage): // TODO(Deneb): Using the default block scoring. But this should be updated. return defaultBlockTopicParams(), nil + case strings.Contains(topic, GossipLightClientFinalityUpdateMessage): + return defaultLightClientFinalityUpdateTopicParams(), nil + case strings.Contains(topic, GossipLightClientOptimisticUpdateMessage): + return defaultLightClientOptimisticUpdateTopicParams(), nil default: return nil, errors.Errorf("unrecognized topic provided for parameter registration: %s", topic) } @@ -503,6 +513,50 @@ func defaultBlsToExecutionChangeTopicParams() *pubsub.TopicScoreParams { } } +func defaultLightClientFinalityUpdateTopicParams() *pubsub.TopicScoreParams { + return &pubsub.TopicScoreParams{ + TopicWeight: lightClientFinalityUpdateWeight, + TimeInMeshWeight: maxInMeshScore / inMeshCap(), + TimeInMeshQuantum: inMeshTime(), + TimeInMeshCap: inMeshCap(), + FirstMessageDeliveriesWeight: 2, + FirstMessageDeliveriesDecay: scoreDecay(oneHundredEpochs), + FirstMessageDeliveriesCap: 5, + MeshMessageDeliveriesWeight: 0, + MeshMessageDeliveriesDecay: 0, + MeshMessageDeliveriesCap: 0, + MeshMessageDeliveriesThreshold: 0, + MeshMessageDeliveriesWindow: 0, + MeshMessageDeliveriesActivation: 0, + MeshFailurePenaltyWeight: 0, + MeshFailurePenaltyDecay: 0, + InvalidMessageDeliveriesWeight: -2000, + InvalidMessageDeliveriesDecay: scoreDecay(invalidDecayPeriod), + } +} + +func defaultLightClientOptimisticUpdateTopicParams() *pubsub.TopicScoreParams { + return &pubsub.TopicScoreParams{ + TopicWeight: lightClientOptimisticUpdateWeight, + TimeInMeshWeight: maxInMeshScore / inMeshCap(), + TimeInMeshQuantum: inMeshTime(), + TimeInMeshCap: inMeshCap(), + FirstMessageDeliveriesWeight: 2, + FirstMessageDeliveriesDecay: scoreDecay(oneHundredEpochs), + FirstMessageDeliveriesCap: 5, + MeshMessageDeliveriesWeight: 0, + MeshMessageDeliveriesDecay: 0, + MeshMessageDeliveriesCap: 0, + MeshMessageDeliveriesThreshold: 0, + MeshMessageDeliveriesWindow: 0, + MeshMessageDeliveriesActivation: 0, + MeshFailurePenaltyWeight: 0, + MeshFailurePenaltyDecay: 0, + InvalidMessageDeliveriesWeight: -2000, + InvalidMessageDeliveriesDecay: scoreDecay(invalidDecayPeriod), + } +} + func oneSlotDuration() time.Duration { return time.Duration(params.BeaconConfig().SecondsPerSlot) * time.Second } diff --git a/beacon-chain/p2p/gossip_topic_mappings.go b/beacon-chain/p2p/gossip_topic_mappings.go index d88a4499ce2..f2a6118d46a 100644 --- a/beacon-chain/p2p/gossip_topic_mappings.go +++ b/beacon-chain/p2p/gossip_topic_mappings.go @@ -5,6 +5,7 @@ import ( "github.com/prysmaticlabs/prysm/v5/config/params" "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" + "github.com/prysmaticlabs/prysm/v5/proto/eth/v2" ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" "google.golang.org/protobuf/proto" ) @@ -22,6 +23,8 @@ var gossipTopicMappings = map[string]func() proto.Message{ SyncCommitteeSubnetTopicFormat: func() proto.Message { return ðpb.SyncCommitteeMessage{} }, BlsToExecutionChangeSubnetTopicFormat: func() proto.Message { return ðpb.SignedBLSToExecutionChange{} }, BlobSubnetTopicFormat: func() proto.Message { return ðpb.BlobSidecar{} }, + LightClientFinalityUpdateTopicFormat: func() proto.Message { return ð.LightClientFinalityUpdate{} }, + LightClientOptimisticUpdateTopicFormat: func() proto.Message { return ð.LightClientOptimisticUpdate{} }, } // GossipTopicMappings is a function to return the assigned data type diff --git a/beacon-chain/p2p/topics.go b/beacon-chain/p2p/topics.go index 3187e36a5cf..966c5c4183b 100644 --- a/beacon-chain/p2p/topics.go +++ b/beacon-chain/p2p/topics.go @@ -30,6 +30,10 @@ const ( GossipBlsToExecutionChangeMessage = "bls_to_execution_change" // GossipBlobSidecarMessage is the name for the blob sidecar message type. GossipBlobSidecarMessage = "blob_sidecar" + // GossipLightClientFinalityUpdateMessage is the name for the light client finality update message type. + GossipLightClientFinalityUpdateMessage = "light_client_finality_update" + // GossipLightClientOptimisticUpdateMessage is the name for the light client optimistic update message type. + GossipLightClientOptimisticUpdateMessage = "light_client_optimistic_update" // Topic Formats // // AttestationSubnetTopicFormat is the topic format for the attestation subnet. @@ -52,4 +56,8 @@ const ( BlsToExecutionChangeSubnetTopicFormat = GossipProtocolAndDigest + GossipBlsToExecutionChangeMessage // BlobSubnetTopicFormat is the topic format for the blob subnet. BlobSubnetTopicFormat = GossipProtocolAndDigest + GossipBlobSidecarMessage + "_%d" + // LightClientFinalityUpdateTopicFormat is the topic format for the light client finality update subnet. + LightClientFinalityUpdateTopicFormat = GossipProtocolAndDigest + GossipLightClientFinalityUpdateMessage + // LightClientOptimisticUpdateTopicFormat is the topic format for the light client optimistic update subnet. + LightClientOptimisticUpdateTopicFormat = GossipProtocolAndDigest + GossipLightClientOptimisticUpdateMessage ) diff --git a/beacon-chain/sync/BUILD.bazel b/beacon-chain/sync/BUILD.bazel index 1d83ac98ad6..32712050479 100644 --- a/beacon-chain/sync/BUILD.bazel +++ b/beacon-chain/sync/BUILD.bazel @@ -38,6 +38,7 @@ go_library( "subscriber_blob_sidecar.go", "subscriber_bls_to_execution_change.go", "subscriber_handlers.go", + "subscriber_light_client.go", "subscriber_sync_committee_message.go", "subscriber_sync_contribution_proof.go", "subscription_topic_handler.go", @@ -48,6 +49,7 @@ go_library( "validate_beacon_blocks.go", "validate_blob.go", "validate_bls_to_execution_change.go", + "validate_light_client.go", "validate_proposer_slashing.go", "validate_sync_committee_message.go", "validate_sync_contribution_proof.go", @@ -114,6 +116,7 @@ go_library( "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/forks:go_default_library", + "//proto/eth/v2:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", @@ -139,6 +142,7 @@ go_library( "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_trailofbits_go_mutexasserts//:go_default_library", + "@io_opencensus_go//trace:go_default_library", "@io_opentelemetry_go_otel_trace//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", ], diff --git a/beacon-chain/sync/service.go b/beacon-chain/sync/service.go index 473d3d9709f..799ab29aade 100644 --- a/beacon-chain/sync/service.go +++ b/beacon-chain/sync/service.go @@ -39,6 +39,7 @@ import ( "github.com/prysmaticlabs/prysm/v5/config/params" "github.com/prysmaticlabs/prysm/v5/consensus-types/blocks" "github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces" + "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" leakybucket "github.com/prysmaticlabs/prysm/v5/container/leaky-bucket" ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/v5/runtime" @@ -75,27 +76,36 @@ var ( // Common type for functional p2p validation options. type validationFn func(ctx context.Context) (pubsub.ValidationResult, error) +type lcFinalityUpdateInfo struct { + slot primitives.Slot + hasSupermajority bool +} + +type lcOptimisticUpdateInfo struct { + slot primitives.Slot +} + // config to hold dependencies for the sync service. type config struct { - attestationNotifier operation.Notifier - p2p p2p.P2P - beaconDB db.NoHeadAccessDatabase - attPool attestations.Pool - exitPool voluntaryexits.PoolManager - slashingPool slashings.PoolManager - syncCommsPool synccommittee.Pool - blsToExecPool blstoexec.PoolManager - chain blockchainService - initialSync Checker - blockNotifier blockfeed.Notifier - operationNotifier operation.Notifier - executionReconstructor execution.Reconstructor - stateGen *stategen.State - slasherAttestationsFeed *event.Feed - slasherBlockHeadersFeed *event.Feed - clock *startup.Clock - stateNotifier statefeed.Notifier - blobStorage *filesystem.BlobStorage + attestationNotifier operation.Notifier + p2p p2p.P2P + beaconDB db.NoHeadAccessDatabase + attPool attestations.Pool + exitPool voluntaryexits.PoolManager + slashingPool slashings.PoolManager + syncCommsPool synccommittee.Pool + blsToExecPool blstoexec.PoolManager + chain blockchainService + initialSync Checker + blockNotifier blockfeed.Notifier + operationNotifier operation.Notifier + executionPayloadReconstructor execution.PayloadReconstructor + stateGen *stategen.State + slasherAttestationsFeed *event.Feed + slasherBlockHeadersFeed *event.Feed + clock *startup.Clock + stateNotifier statefeed.Notifier + blobStorage *filesystem.BlobStorage } // This defines the interface for interacting with block chain service @@ -158,6 +168,10 @@ type Service struct { newBlobVerifier verification.NewBlobVerifier availableBlocker coverage.AvailableBlocker ctxMap ContextByteVersions + lcFinalityUpdateLock sync.Mutex + lastLCFinalityUpdate *lcFinalityUpdateInfo + lcOptimisticUpdateLock sync.Mutex + lastLCOptimisticUpdate *lcOptimisticUpdateInfo } // NewService initializes new regular sync service. diff --git a/beacon-chain/sync/subscriber.go b/beacon-chain/sync/subscriber.go index 5d2f054b83d..4700f0074ae 100644 --- a/beacon-chain/sync/subscriber.go +++ b/beacon-chain/sync/subscriber.go @@ -24,12 +24,12 @@ import ( "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" "github.com/prysmaticlabs/prysm/v5/container/slice" "github.com/prysmaticlabs/prysm/v5/monitoring/tracing" - "github.com/prysmaticlabs/prysm/v5/monitoring/tracing/trace" "github.com/prysmaticlabs/prysm/v5/network/forks" ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/v5/runtime/messagehandler" "github.com/prysmaticlabs/prysm/v5/time/slots" "github.com/sirupsen/logrus" + "go.opencensus.io/trace" "google.golang.org/protobuf/proto" ) @@ -123,6 +123,18 @@ func (s *Service) registerSubscribers(epoch primitives.Epoch, digest [4]byte) { digest, ) } + s.subscribe( + p2p.LightClientFinalityUpdateTopicFormat, + s.validateLightClientFinalityUpdate, + s.lightClientFinalityUpdateSubscriber, + digest, + ) + s.subscribe( + p2p.LightClientOptimisticUpdateTopicFormat, + s.validateLightClientOptimisticUpdate, + s.lightClientOptimisticUpdateSubscriber, + digest, + ) } // New Gossip Topic in Capella @@ -208,7 +220,7 @@ func (s *Service) subscribeWithBase(topic string, validator wrappedVal, handle s } }() - span.SetAttributes(trace.StringAttribute("topic", topic)) + span.AddAttributes(trace.StringAttribute("topic", topic)) if msg.ValidatorData == nil { log.Error("Received nil message on pubsub") diff --git a/beacon-chain/sync/subscriber_light_client.go b/beacon-chain/sync/subscriber_light_client.go new file mode 100644 index 00000000000..8f9da30ea18 --- /dev/null +++ b/beacon-chain/sync/subscriber_light_client.go @@ -0,0 +1,17 @@ +package sync + +import ( + "context" + + "google.golang.org/protobuf/proto" +) + +// TODO: event feed + +func (s *Service) lightClientFinalityUpdateSubscriber(_ context.Context, msg proto.Message) error { + +} + +func (s *Service) lightClientOptimisticUpdateSubscriber(_ context.Context, msg proto.Message) error { + +} diff --git a/beacon-chain/sync/validate_light_client.go b/beacon-chain/sync/validate_light_client.go new file mode 100644 index 00000000000..fb29d50d36b --- /dev/null +++ b/beacon-chain/sync/validate_light_client.go @@ -0,0 +1,130 @@ +package sync + +import ( + "context" + "time" + + pubsub "github.com/libp2p/go-libp2p-pubsub" + "github.com/libp2p/go-libp2p/core/peer" + "github.com/prysmaticlabs/prysm/v5/config/params" + "github.com/prysmaticlabs/prysm/v5/monitoring/tracing" + "github.com/prysmaticlabs/prysm/v5/proto/eth/v2" + "github.com/prysmaticlabs/prysm/v5/time/slots" + "go.opencensus.io/trace" +) + +func (s *Service) validateLightClientFinalityUpdate(ctx context.Context, pid peer.ID, msg *pubsub.Message) (pubsub.ValidationResult, error) { + // Validation runs on publish (not just subscriptions), so we should approve any message from + // ourselves. + if pid == s.cfg.p2p.PeerID() { + return pubsub.ValidationAccept, nil + } + + // TODO keep? + // The head state will be too far away to validate any execution change. + if s.cfg.initialSync.Syncing() { + return pubsub.ValidationIgnore, nil + } + + ctx, span := trace.StartSpan(ctx, "sync.validateLightClientFinalityUpdate") + defer span.End() + + m, err := s.decodePubsubMessage(msg) + if err != nil { + tracing.AnnotateError(span, err) + return pubsub.ValidationReject, err + } + + update, ok := m.(*eth.LightClientFinalityUpdate) + if !ok { + return pubsub.ValidationReject, errWrongMessage + } + + s.lcFinalityUpdateLock.Lock() + defer s.lcFinalityUpdateLock.Unlock() + + last := s.lastLCFinalityUpdate + if last != nil { + // [IGNORE] The finalized_header.beacon.slot is greater than that of all previously forwarded finality_updates, + // or it matches the highest previously forwarded slot and also has a sync_aggregate indicating supermajority (> 2/3) + // sync committee participation while the previously forwarded finality_update for that slot did not indicate supermajority + if update.FinalizedHeader.Beacon.Slot < last.slot { + return pubsub.ValidationIgnore, nil + } + if update.FinalizedHeader.Beacon.Slot == last.slot && (last.hasSupermajority || !update.HasSupermajority()) { + return pubsub.ValidationIgnore, nil + } + } + // [IGNORE] The finality_update is received after the block at signature_slot was given enough time + // to propagate through the network -- i.e. validate that one-third of finality_update.signature_slot + // has transpired (SECONDS_PER_SLOT / INTERVALS_PER_SLOT seconds after the start of the slot, + // with a MAXIMUM_GOSSIP_CLOCK_DISPARITY allowance) + earliestValidTime := slots.StartTime(uint64(s.cfg.clock.GenesisTime().Unix()), update.FinalizedHeader.Beacon.Slot). + Add(time.Second * time.Duration(params.BeaconConfig().SecondsPerSlot/params.BeaconConfig().IntervalsPerSlot)). + Add(-params.BeaconConfig().MaximumGossipClockDisparityDuration()) + if s.cfg.clock.Now().Before(earliestValidTime) { + return pubsub.ValidationIgnore, nil + } + + s.lastLCFinalityUpdate = &lcFinalityUpdateInfo{ + slot: update.FinalizedHeader.Beacon.Slot, + hasSupermajority: update.HasSupermajority(), + } + + return pubsub.ValidationAccept, nil +} + +func (s *Service) validateLightClientOptimisticUpdate(ctx context.Context, pid peer.ID, msg *pubsub.Message) (pubsub.ValidationResult, error) { + // Validation runs on publish (not just subscriptions), so we should approve any message from + // ourselves. + if pid == s.cfg.p2p.PeerID() { + return pubsub.ValidationAccept, nil + } + + // TODO keep? + // The head state will be too far away to validate any execution change. + if s.cfg.initialSync.Syncing() { + return pubsub.ValidationIgnore, nil + } + + ctx, span := trace.StartSpan(ctx, "sync.validateLightClientOptimisticUpdate") + defer span.End() + + m, err := s.decodePubsubMessage(msg) + if err != nil { + tracing.AnnotateError(span, err) + return pubsub.ValidationReject, err + } + + update, ok := m.(*eth.LightClientOptimisticUpdate) + if !ok { + return pubsub.ValidationReject, errWrongMessage + } + + s.lcOptimisticUpdateLock.Lock() + defer s.lcOptimisticUpdateLock.Unlock() + + last := s.lastLCOptimisticUpdate + if last != nil { + // [IGNORE] The attested_header.beacon.slot is greater than that of all previously forwarded optimistic_updates + if update.AttestedHeader.Beacon.Slot <= last.slot { + return pubsub.ValidationIgnore, nil + } + } + // [IGNORE] The optimistic_update is received after the block at signature_slot was given enough time + // to propagate through the network -- i.e. validate that one-third of optimistic_update.signature_slot + // has transpired (SECONDS_PER_SLOT / INTERVALS_PER_SLOT seconds after the start of the slot, + // with a MAXIMUM_GOSSIP_CLOCK_DISPARITY allowance) + earliestValidTime := slots.StartTime(uint64(s.cfg.clock.GenesisTime().Unix()), update.AttestedHeader.Beacon.Slot). + Add(time.Second * time.Duration(params.BeaconConfig().SecondsPerSlot/params.BeaconConfig().IntervalsPerSlot)). + Add(-params.BeaconConfig().MaximumGossipClockDisparityDuration()) + if s.cfg.clock.Now().Before(earliestValidTime) { + return pubsub.ValidationIgnore, nil + } + + s.lastLCOptimisticUpdate = &lcOptimisticUpdateInfo{ + slot: update.AttestedHeader.Beacon.Slot, + } + + return pubsub.ValidationAccept, nil +} From 6bbdd59de71431eb8dc0c5be9faad85a503228c6 Mon Sep 17 00:00:00 2001 From: rkapka Date: Sat, 26 Oct 2024 21:40:12 +0700 Subject: [PATCH 05/26] get files from rpc branch --- beacon-chain/p2p/rpc_topic_mappings.go | 29 ++++++ beacon-chain/p2p/types/BUILD.bazel | 1 + beacon-chain/p2p/types/types.go | 98 ++++++++++++++++++--- beacon-chain/sync/BUILD.bazel | 2 + beacon-chain/sync/rpc.go | 17 ++-- beacon-chain/sync/rpc_light_client.go | 98 +++++++++++++++++++++ proto/prysm/v1alpha1/BUILD.bazel | 36 +++++++- proto/prysm/v1alpha1/non-core.ssz.go | 62 ++++++++++++- proto/prysm/v1alpha1/p2p_messages.pb.go | 112 ++++++++++++++++++++---- proto/prysm/v1alpha1/p2p_messages.proto | 13 +++ 10 files changed, 428 insertions(+), 40 deletions(-) create mode 100644 beacon-chain/sync/rpc_light_client.go diff --git a/beacon-chain/p2p/rpc_topic_mappings.go b/beacon-chain/p2p/rpc_topic_mappings.go index 7d9c5ebdff0..aa2fbb4c376 100644 --- a/beacon-chain/p2p/rpc_topic_mappings.go +++ b/beacon-chain/p2p/rpc_topic_mappings.go @@ -43,6 +43,18 @@ const BlobSidecarsByRangeName = "/blob_sidecars_by_range" // BlobSidecarsByRootName is the name for the BlobSidecarsByRoot v1 message topic. const BlobSidecarsByRootName = "/blob_sidecars_by_root" +// LightClientBootstrapName is the name for the LightClientBootstrap message topic, +const LightClientBootstrapName = "/light_client_bootstrap" + +// LightClientUpdatesByRangeName is the name for the LightClientUpdatesByRange topic. +const LightClientUpdatesByRangeName = "/light_client_updates_by_range" + +// LightClientFinalityUpdateName is the name for the LightClientFinalityUpdate topic. +const LightClientFinalityUpdateName = "/light_client_finality_update" + +// LightClientOptimisticUpdateName is the name for the LightClientOptimisticUpdate topic. +const LightClientOptimisticUpdateName = "/light_client_optimistic_update" + const ( // V1 RPC Topics // RPCStatusTopicV1 defines the v1 topic for the status rpc method. @@ -66,6 +78,18 @@ const ( // /eth2/beacon_chain/req/blob_sidecars_by_root/1/ RPCBlobSidecarsByRootTopicV1 = protocolPrefix + BlobSidecarsByRootName + SchemaVersionV1 + // RPCLightClientBootstrapTopicV1 is a topic for requesting a light client bootstrap. + RPCLightClientBootstrapTopicV1 = protocolPrefix + LightClientBootstrapName + SchemaVersionV1 + + // RPCLightClientUpdatesByRangeTopicV1 is a topic for requesting light client updates by range. + RPCLightClientUpdatesByRangeTopicV1 = protocolPrefix + LightClientUpdatesByRangeName + SchemaVersionV1 + + // RPCLightClientFinalityUpdateTopicV1 is a topic for requesting a light client finality update. + RPCLightClientFinalityUpdateTopicV1 = protocolPrefix + LightClientFinalityUpdateName + SchemaVersionV1 + + // RPCLightClientOptimisticUpdateTopicV1 is a topic for requesting a light client Optimistic update. + RPCLightClientOptimisticUpdateTopicV1 = protocolPrefix + LightClientOptimisticUpdateName + SchemaVersionV1 + // V2 RPC Topics // RPCBlocksByRangeTopicV2 defines v2 the topic for the blocks by range rpc method. RPCBlocksByRangeTopicV2 = protocolPrefix + BeaconBlocksByRangeMessageName + SchemaVersionV2 @@ -101,6 +125,11 @@ var RPCTopicMappings = map[string]interface{}{ RPCBlobSidecarsByRangeTopicV1: new(pb.BlobSidecarsByRangeRequest), // BlobSidecarsByRoot v1 Message RPCBlobSidecarsByRootTopicV1: new(p2ptypes.BlobSidecarsByRootReq), + // Light client + RPCLightClientBootstrapTopicV1: new(p2ptypes.LightClientBootstrapReq), + RPCLightClientUpdatesByRangeTopicV1: new(pb.LightClientUpdatesByRangeReq), + RPCLightClientFinalityUpdateTopicV1: new(interface{}), + RPCLightClientOptimisticUpdateTopicV1: new(interface{}), } // Maps all registered protocol prefixes. diff --git a/beacon-chain/p2p/types/BUILD.bazel b/beacon-chain/p2p/types/BUILD.bazel index a66fcefd9e0..2ecf4d8166e 100644 --- a/beacon-chain/p2p/types/BUILD.bazel +++ b/beacon-chain/p2p/types/BUILD.bazel @@ -17,6 +17,7 @@ go_library( "//validator/client:__pkg__", ], deps = [ + "//config/fieldparams:go_default_library", "//config/params:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", diff --git a/beacon-chain/p2p/types/types.go b/beacon-chain/p2p/types/types.go index 2ccda62f326..95dd762be7d 100644 --- a/beacon-chain/p2p/types/types.go +++ b/beacon-chain/p2p/types/types.go @@ -5,17 +5,20 @@ package types import ( "bytes" + "encoding/binary" "sort" "github.com/pkg/errors" ssz "github.com/prysmaticlabs/fastssz" + fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams" "github.com/prysmaticlabs/prysm/v5/config/params" eth "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" ) -const rootLength = 32 - -const maxErrorLength = 256 +const ( + maxErrorLength = 256 + lightClientUpdatesByRangeReqLength = 16 +) // SSZBytes is a bytes slice that satisfies the fast-ssz interface. type SSZBytes []byte @@ -34,7 +37,7 @@ func (b *SSZBytes) HashTreeRootWith(hh *ssz.Hasher) error { } // BeaconBlockByRootsReq specifies the block by roots request type. -type BeaconBlockByRootsReq [][rootLength]byte +type BeaconBlockByRootsReq [][fieldparams.RootLength]byte // MarshalSSZTo marshals the block by roots request with the provided byte slice. func (r *BeaconBlockByRootsReq) MarshalSSZTo(dst []byte) ([]byte, error) { @@ -59,25 +62,25 @@ func (r *BeaconBlockByRootsReq) MarshalSSZ() ([]byte, error) { // SizeSSZ returns the size of the serialized representation. func (r *BeaconBlockByRootsReq) SizeSSZ() int { - return len(*r) * rootLength + return len(*r) * fieldparams.RootLength } // UnmarshalSSZ unmarshals the provided bytes buffer into the // block by roots request object. func (r *BeaconBlockByRootsReq) UnmarshalSSZ(buf []byte) error { bufLen := len(buf) - maxLength := int(params.BeaconConfig().MaxRequestBlocks * rootLength) + maxLength := int(params.BeaconConfig().MaxRequestBlocks * fieldparams.RootLength) if bufLen > maxLength { return errors.Errorf("expected buffer with length of up to %d but received length %d", maxLength, bufLen) } - if bufLen%rootLength != 0 { + if bufLen%fieldparams.RootLength != 0 { return ssz.ErrIncorrectByteSize } - numOfRoots := bufLen / rootLength - roots := make([][rootLength]byte, 0, numOfRoots) + numOfRoots := bufLen / fieldparams.RootLength + roots := make([][fieldparams.RootLength]byte, 0, numOfRoots) for i := 0; i < numOfRoots; i++ { - var rt [rootLength]byte - copy(rt[:], buf[i*rootLength:(i+1)*rootLength]) + var rt [fieldparams.RootLength]byte + copy(rt[:], buf[i*fieldparams.RootLength:(i+1)*fieldparams.RootLength]) roots = append(roots, rt) } *r = roots @@ -211,3 +214,76 @@ func init() { sizer := ð.BlobIdentifier{} blobIdSize = sizer.SizeSSZ() } + +// LightClientBootstrapReq specifies the light client bootstrap request type. +type LightClientBootstrapReq [fieldparams.RootLength]byte + +// MarshalSSZTo marshals the block by roots request with the provided byte slice. +func (r LightClientBootstrapReq) MarshalSSZTo(dst []byte) ([]byte, error) { + marshalledObj, err := r.MarshalSSZ() + if err != nil { + return nil, err + } + return append(dst, marshalledObj...), nil +} + +// MarshalSSZ Marshals the block by roots request type into the serialized object. +func (r LightClientBootstrapReq) MarshalSSZ() ([]byte, error) { + return r[:], nil +} + +// SizeSSZ returns the size of the serialized representation. +func (r LightClientBootstrapReq) SizeSSZ() int { + return fieldparams.RootLength +} + +// UnmarshalSSZ unmarshals the provided bytes buffer into the +// block by roots request object. +func (r LightClientBootstrapReq) UnmarshalSSZ(buf []byte) error { + bufLen := len(buf) + if bufLen != fieldparams.RootLength { + return errors.Errorf("expected buffer with length of %d but received length %d", fieldparams.RootLength, bufLen) + } + copy(r[:], buf) + return nil +} + +// LightClientUpdatesByRangeReq specifies the block by roots request type. +type LightClientUpdatesByRangeReq struct { + startPeriod uint64 + count uint64 +} + +// MarshalSSZTo marshals the light client updates by range request with the provided byte slice. +func (r *LightClientUpdatesByRangeReq) MarshalSSZTo(dst []byte) ([]byte, error) { + marshalledObj, err := r.MarshalSSZ() + if err != nil { + return nil, err + } + return append(dst, marshalledObj...), nil +} + +// MarshalSSZ Marshals the light client updates by range request type into the serialized object. +func (r *LightClientUpdatesByRangeReq) MarshalSSZ() ([]byte, error) { + buf := make([]byte, 0, r.SizeSSZ()) + binary.LittleEndian.AppendUint64(buf, r.startPeriod) + binary.LittleEndian.AppendUint64(buf, r.count) + return buf, nil +} + +// SizeSSZ returns the size of the serialized representation. +func (r *LightClientUpdatesByRangeReq) SizeSSZ() int { + return lightClientUpdatesByRangeReqLength +} + +// UnmarshalSSZ unmarshals the provided bytes buffer into the +// block by roots request object. +func (r *LightClientUpdatesByRangeReq) UnmarshalSSZ(buf []byte) error { + bufLen := len(buf) + if bufLen != lightClientUpdatesByRangeReqLength { + return errors.Errorf("expected buffer with length of %d but received length %d", lightClientUpdatesByRangeReqLength, bufLen) + } + r.startPeriod = binary.LittleEndian.Uint64(buf[0:8]) + r.count = binary.LittleEndian.Uint64(buf[8:16]) + return nil +} diff --git a/beacon-chain/sync/BUILD.bazel b/beacon-chain/sync/BUILD.bazel index 32712050479..a690b63ed10 100644 --- a/beacon-chain/sync/BUILD.bazel +++ b/beacon-chain/sync/BUILD.bazel @@ -26,6 +26,7 @@ go_library( "rpc_blob_sidecars_by_root.go", "rpc_chunked_response.go", "rpc_goodbye.go", + "rpc_light_client.go", "rpc_metadata.go", "rpc_ping.go", "rpc_send_request.go", @@ -74,6 +75,7 @@ go_library( "//beacon-chain/core/feed/operation:go_default_library", "//beacon-chain/core/feed/state:go_default_library", "//beacon-chain/core/helpers:go_default_library", + "//beacon-chain/core/light-client:go_default_library", "//beacon-chain/core/signing:go_default_library", "//beacon-chain/core/transition:go_default_library", "//beacon-chain/core/transition/interop:go_default_library", diff --git a/beacon-chain/sync/rpc.go b/beacon-chain/sync/rpc.go index 1c067036f5e..0fe42e750a4 100644 --- a/beacon-chain/sync/rpc.go +++ b/beacon-chain/sync/rpc.go @@ -96,6 +96,9 @@ func (s *Service) registerRPCHandlersAltair() { p2p.RPCMetaDataTopicV2, s.metaDataHandler, ) + s.registerRPC( + p2p.RPCLightClientBootstrapTopicV1, + ) } func (s *Service) registerRPCHandlersDeneb() { @@ -156,8 +159,8 @@ func (s *Service) registerRPC(baseTopic string, handle rpcHandler) { ctx, span := trace.StartSpan(ctx, "sync.rpc") defer span.End() - span.SetAttributes(trace.StringAttribute("topic", topic)) - span.SetAttributes(trace.StringAttribute("peer", stream.Conn().RemotePeer().String())) + span.AddAttributes(trace.StringAttribute("topic", topic)) + span.AddAttributes(trace.StringAttribute("peer", stream.Conn().RemotePeer().String())) log := log.WithField("peer", stream.Conn().RemotePeer().String()).WithField("topic", string(stream.Protocol())) // Check before hand that peer is valid. @@ -179,7 +182,8 @@ func (s *Service) registerRPC(baseTopic string, handle rpcHandler) { return } - base, ok := p2p.RPCTopicMappings[baseTopic] + base, ok := p2p. + RPCTopicMappings[baseTopic] if !ok { log.Errorf("Could not retrieve base message for topic %s", baseTopic) return @@ -191,9 +195,12 @@ func (s *Service) registerRPC(baseTopic string, handle rpcHandler) { // Increment message received counter. messageReceivedCounter.WithLabelValues(topic).Inc() - // since metadata requests do not have any data in the payload, we + // since some requests do not have any data in the payload, we // do not decode anything. - if baseTopic == p2p.RPCMetaDataTopicV1 || baseTopic == p2p.RPCMetaDataTopicV2 { + if baseTopic == p2p.RPCMetaDataTopicV1 || + baseTopic == p2p.RPCMetaDataTopicV2 || + baseTopic == p2p.RPCLightClientFinalityUpdateTopicV1 || + baseTopic == p2p.RPCLightClientOptimisticUpdateTopicV1 { if err := handle(ctx, base, stream); err != nil { messageFailedProcessingCounter.WithLabelValues(topic).Inc() if !errors.Is(err, p2ptypes.ErrWrongForkDigestVersion) { diff --git a/beacon-chain/sync/rpc_light_client.go b/beacon-chain/sync/rpc_light_client.go new file mode 100644 index 00000000000..b8ed790eb5a --- /dev/null +++ b/beacon-chain/sync/rpc_light_client.go @@ -0,0 +1,98 @@ +package sync + +import ( + "context" + "fmt" + + libp2pcore "github.com/libp2p/go-libp2p/core" + "github.com/pkg/errors" + light_client "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/light-client" + "github.com/prysmaticlabs/prysm/v5/beacon-chain/db" + "github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p" + "github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p/types" + "github.com/prysmaticlabs/prysm/v5/config/params" + "github.com/prysmaticlabs/prysm/v5/encoding/bytesutil" + "github.com/prysmaticlabs/prysm/v5/monitoring/tracing" + "github.com/prysmaticlabs/prysm/v5/monitoring/tracing/trace" + "github.com/sirupsen/logrus" +) + +// blobSidecarByRootRPCHandler handles the /eth2/beacon_chain/req/blob_sidecars_by_root/1/ RPC request. +// spec: https://github.com/ethereum/consensus-specs/blob/a7e45db9ac2b60a33e144444969ad3ac0aae3d4c/specs/deneb/p2p-interface.md#blobsidecarsbyroot-v1 +func (s *Service) lightClientBootstrapRPCHandler(ctx context.Context, msg interface{}, stream libp2pcore.Stream) error { + ctx, span := trace.StartSpan(ctx, "sync.lightClientBootstrapRPCHandler") + defer span.End() + ctx, cancel := context.WithTimeout(ctx, ttfbTimeout) + defer cancel() + SetRPCStreamDeadlines(stream) + log := log.WithField("handler", p2p.LightClientBootstrapName[1:]) // slice the leading slash off the name var + req, ok := msg.(*types.LightClientBootstrapReq) + if !ok { + return errors.New("message is not type LightClientBootstrapReq") + } + + // TODO: rate limit? + block, err := s.cfg.beaconDB.Block(ctx, *req) + if err != nil { + s.writeErrorResponseToStream(responseCodeServerError) + } else if block.IsNil() { + s.writeErrorResponseToStream(responseCodeInvalidRequest) + } + + light_client.CreateLightClientBootstrap(ctx) + + for i := range blobIdents { + if err := ctx.Err(); err != nil { + closeStream(stream, log) + return err + } + + // Throttle request processing to no more than batchSize/sec. + if i != 0 && i%batchSize == 0 && ticker != nil { + <-ticker.C + } + s.rateLimiter.add(stream, 1) + root, idx := bytesutil.ToBytes32(blobIdents[i].BlockRoot), blobIdents[i].Index + sc, err := s.cfg.blobStorage.Get(root, idx) + if err != nil { + if db.IsNotFound(err) { + log.WithError(err).WithFields(logrus.Fields{ + "root": fmt.Sprintf("%#x", root), + "index": idx, + }).Debugf("Peer requested blob sidecar by root not found in db") + continue + } + log.WithError(err).Errorf("unexpected db error retrieving BlobSidecar, root=%x, index=%d", root, idx) + s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) + return err + } + + // If any root in the request content references a block earlier than minimum_request_epoch, + // peers MAY respond with error code 3: ResourceUnavailable or not include the blob in the response. + // note: we are deviating from the spec to allow requests for blobs that are before minimum_request_epoch, + // up to the beginning of the retention period. + if sc.Slot() < minReqSlot { + s.writeErrorResponseToStream(responseCodeResourceUnavailable, types.ErrBlobLTMinRequest.Error(), stream) + log.WithError(types.ErrBlobLTMinRequest). + Debugf("requested blob for block %#x before minimum_request_epoch", blobIdents[i].BlockRoot) + return types.ErrBlobLTMinRequest + } + + SetStreamWriteDeadline(stream, defaultWriteDuration) + if chunkErr := WriteBlobSidecarChunk(stream, s.cfg.chain, s.cfg.p2p.Encoding(), sc); chunkErr != nil { + log.WithError(chunkErr).Debug("Could not send a chunked response") + s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) + tracing.AnnotateError(span, chunkErr) + return chunkErr + } + } + closeStream(stream, log) + return nil +} + +func validateBlobByRootRequest(blobIdents types.BlobSidecarsByRootReq) error { + if uint64(len(blobIdents)) > params.BeaconConfig().MaxRequestBlobSidecars { + return types.ErrMaxBlobReqExceeded + } + return nil +} diff --git a/proto/prysm/v1alpha1/BUILD.bazel b/proto/prysm/v1alpha1/BUILD.bazel index 51ec7d96164..524409b9974 100644 --- a/proto/prysm/v1alpha1/BUILD.bazel +++ b/proto/prysm/v1alpha1/BUILD.bazel @@ -32,6 +32,7 @@ proto_library( deps = [ "//proto/engine/v1:proto", "//proto/eth/ext:proto", + "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_proto", "@com_google_protobuf//:any_proto", "@com_google_protobuf//:descriptor_proto", "@com_google_protobuf//:empty_proto", @@ -263,6 +264,7 @@ ssz_gen_marshal( objs = [ "BeaconBlocksByRangeRequest", "BlobSidecarsByRangeRequest", + "LightClientUpdatesByRangeReq", "MetaDataV0", "MetaDataV1", "SignedValidatorRegistrationV1", @@ -286,6 +288,7 @@ go_proto_library( "//proto/engine/v1:go_default_library", "//proto/eth/ext:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@googleapis//google/api:annotations_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", @@ -299,6 +302,29 @@ go_proto_library( ], ) +go_proto_library( + name = "go_grpc_gateway_library", + compilers = [ + "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-grpc-gateway:go_gen_grpc_gateway", + ], + embed = [":go_proto"], + importpath = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1", + protos = [":proto"], + visibility = ["//visibility:private"], + deps = [ + "//proto/engine/v1:go_default_library", + "//proto/eth/ext:go_default_library", + "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", + "@com_github_prysmaticlabs_go_bitfield//:go_default_library", + "@googleapis//google/api:annotations_go_proto", + "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", + "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", + "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", + "@org_golang_google_protobuf//types/descriptorpb:go_default_library", + "@org_golang_google_protobuf//types/known/emptypb:go_default_library", + ], +) + go_library( name = "go_default_library", srcs = [ @@ -316,7 +342,9 @@ go_library( ":ssz_generated_non_core", # keep ":ssz_generated_phase0", # keep ], - embed = [":go_proto"], + embed = [ + ":go_grpc_gateway_library", + ], importpath = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1", visibility = ["//visibility:public"], deps = SSZ_DEPS + [ @@ -325,9 +353,11 @@ go_library( "//proto/engine/v1:go_default_library", "//proto/eth/ext:go_default_library", "//runtime/version:go_default_library", - "//consensus-types/primitives:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", + "@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library", + "@com_github_grpc_ecosystem_grpc_gateway_v2//utilities:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", # keep "@googleapis//google/api:annotations_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", @@ -338,7 +368,6 @@ go_library( "@org_golang_google_grpc//grpclog:go_default_library", "@org_golang_google_grpc//metadata:go_default_library", "@org_golang_google_grpc//status:go_default_library", - "@org_golang_google_protobuf//proto:go_default_library", "@org_golang_google_protobuf//reflect/protoreflect:go_default_library", "@org_golang_google_protobuf//runtime/protoimpl:go_default_library", "@org_golang_google_protobuf//types/descriptorpb:go_default_library", @@ -353,7 +382,6 @@ ssz_proto_files( "beacon_block.proto", "beacon_state.proto", "blobs.proto", - "light_client.proto", "sync_committee.proto", "withdrawals.proto", ], diff --git a/proto/prysm/v1alpha1/non-core.ssz.go b/proto/prysm/v1alpha1/non-core.ssz.go index 2630eec1ccb..859a9dc1b3e 100644 --- a/proto/prysm/v1alpha1/non-core.ssz.go +++ b/proto/prysm/v1alpha1/non-core.ssz.go @@ -1,5 +1,5 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: bfd7d6b556134c3bd236b880245717aa01ae79573b33f2746a08c165ba5dcedb +// Hash: 61016ffa736065f82cfed43813dfb5f1b43b775b91b71470c66da266ac9fd837 package eth import ( @@ -611,6 +611,66 @@ func (b *BlobSidecarsByRangeRequest) HashTreeRootWith(hh *ssz.Hasher) (err error return } +// MarshalSSZ ssz marshals the LightClientUpdatesByRangeReq object +func (l *LightClientUpdatesByRangeReq) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(l) +} + +// MarshalSSZTo ssz marshals the LightClientUpdatesByRangeReq object to a target array +func (l *LightClientUpdatesByRangeReq) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'StartPeriod' + dst = ssz.MarshalUint64(dst, l.StartPeriod) + + // Field (1) 'Count' + dst = ssz.MarshalUint64(dst, l.Count) + + return +} + +// UnmarshalSSZ ssz unmarshals the LightClientUpdatesByRangeReq object +func (l *LightClientUpdatesByRangeReq) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 16 { + return ssz.ErrSize + } + + // Field (0) 'StartPeriod' + l.StartPeriod = ssz.UnmarshallUint64(buf[0:8]) + + // Field (1) 'Count' + l.Count = ssz.UnmarshallUint64(buf[8:16]) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the LightClientUpdatesByRangeReq object +func (l *LightClientUpdatesByRangeReq) SizeSSZ() (size int) { + size = 16 + return +} + +// HashTreeRoot ssz hashes the LightClientUpdatesByRangeReq object +func (l *LightClientUpdatesByRangeReq) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(l) +} + +// HashTreeRootWith ssz hashes the LightClientUpdatesByRangeReq object with a hasher +func (l *LightClientUpdatesByRangeReq) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'StartPeriod' + hh.PutUint64(l.StartPeriod) + + // Field (1) 'Count' + hh.PutUint64(l.Count) + + hh.Merkleize(indx) + return +} + // MarshalSSZ ssz marshals the DepositSnapshot object func (d *DepositSnapshot) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(d) diff --git a/proto/prysm/v1alpha1/p2p_messages.pb.go b/proto/prysm/v1alpha1/p2p_messages.pb.go index 5afd437c2f7..97bb81dfab3 100755 --- a/proto/prysm/v1alpha1/p2p_messages.pb.go +++ b/proto/prysm/v1alpha1/p2p_messages.pb.go @@ -403,6 +403,61 @@ func (x *BlobSidecarsByRangeRequest) GetCount() uint64 { return 0 } +type LightClientUpdatesByRangeReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StartPeriod uint64 `protobuf:"varint,1,opt,name=start_period,json=startPeriod,proto3" json:"start_period,omitempty"` + Count uint64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` +} + +func (x *LightClientUpdatesByRangeReq) Reset() { + *x = LightClientUpdatesByRangeReq{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_prysm_v1alpha1_p2p_messages_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LightClientUpdatesByRangeReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LightClientUpdatesByRangeReq) ProtoMessage() {} + +func (x *LightClientUpdatesByRangeReq) ProtoReflect() protoreflect.Message { + mi := &file_proto_prysm_v1alpha1_p2p_messages_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LightClientUpdatesByRangeReq.ProtoReflect.Descriptor instead. +func (*LightClientUpdatesByRangeReq) Descriptor() ([]byte, []int) { + return file_proto_prysm_v1alpha1_p2p_messages_proto_rawDescGZIP(), []int{6} +} + +func (x *LightClientUpdatesByRangeReq) GetStartPeriod() uint64 { + if x != nil { + return x.StartPeriod + } + return 0 +} + +func (x *LightClientUpdatesByRangeReq) GetCount() uint64 { + if x != nil { + return x.Count + } + return 0 +} + var File_proto_prysm_v1alpha1_p2p_messages_proto protoreflect.FileDescriptor var file_proto_prysm_v1alpha1_p2p_messages_proto_rawDesc = []byte{ @@ -492,17 +547,23 @@ var file_proto_prysm_v1alpha1_p2p_messages_proto_rawDesc = []byte{ 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x53, 0x6c, 0x6f, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x9b, 0x01, 0x0a, 0x19, 0x6f, 0x72, - 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, - 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x10, 0x50, 0x32, 0x50, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, - 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x31, 0x3b, 0x65, 0x74, 0x68, 0xaa, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, - 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, - 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x76, - 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x57, 0x0a, 0x1c, 0x4c, 0x69, 0x67, + 0x68, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x42, + 0x79, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x14, 0x0a, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x42, 0x9b, 0x01, 0x0a, 0x19, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, + 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x42, 0x10, 0x50, 0x32, 0x50, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, + 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, + 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x65, 0x74, 0x68, + 0xaa, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, + 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, + 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -517,14 +578,15 @@ func file_proto_prysm_v1alpha1_p2p_messages_proto_rawDescGZIP() []byte { return file_proto_prysm_v1alpha1_p2p_messages_proto_rawDescData } -var file_proto_prysm_v1alpha1_p2p_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_proto_prysm_v1alpha1_p2p_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_proto_prysm_v1alpha1_p2p_messages_proto_goTypes = []interface{}{ - (*Status)(nil), // 0: ethereum.eth.v1alpha1.Status - (*BeaconBlocksByRangeRequest)(nil), // 1: ethereum.eth.v1alpha1.BeaconBlocksByRangeRequest - (*ENRForkID)(nil), // 2: ethereum.eth.v1alpha1.ENRForkID - (*MetaDataV0)(nil), // 3: ethereum.eth.v1alpha1.MetaDataV0 - (*MetaDataV1)(nil), // 4: ethereum.eth.v1alpha1.MetaDataV1 - (*BlobSidecarsByRangeRequest)(nil), // 5: ethereum.eth.v1alpha1.BlobSidecarsByRangeRequest + (*Status)(nil), // 0: ethereum.eth.v1alpha1.Status + (*BeaconBlocksByRangeRequest)(nil), // 1: ethereum.eth.v1alpha1.BeaconBlocksByRangeRequest + (*ENRForkID)(nil), // 2: ethereum.eth.v1alpha1.ENRForkID + (*MetaDataV0)(nil), // 3: ethereum.eth.v1alpha1.MetaDataV0 + (*MetaDataV1)(nil), // 4: ethereum.eth.v1alpha1.MetaDataV1 + (*BlobSidecarsByRangeRequest)(nil), // 5: ethereum.eth.v1alpha1.BlobSidecarsByRangeRequest + (*LightClientUpdatesByRangeReq)(nil), // 6: ethereum.eth.v1alpha1.LightClientUpdatesByRangeReq } var file_proto_prysm_v1alpha1_p2p_messages_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type @@ -612,6 +674,18 @@ func file_proto_prysm_v1alpha1_p2p_messages_proto_init() { return nil } } + file_proto_prysm_v1alpha1_p2p_messages_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LightClientUpdatesByRangeReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -619,7 +693,7 @@ func file_proto_prysm_v1alpha1_p2p_messages_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_prysm_v1alpha1_p2p_messages_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 7, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/prysm/v1alpha1/p2p_messages.proto b/proto/prysm/v1alpha1/p2p_messages.proto index 8ba1d36c88c..4ede0604566 100644 --- a/proto/prysm/v1alpha1/p2p_messages.proto +++ b/proto/prysm/v1alpha1/p2p_messages.proto @@ -70,3 +70,16 @@ message BlobSidecarsByRangeRequest { uint64 start_slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"]; uint64 count = 2; } + +/* + Spec Definition: + ( + start_period: uint64 + count: uint64 + ) +*/ +message LightClientUpdatesByRangeReq { + uint64 start_period = 1; + uint64 count = 2; +} + From 0751271b51ef9965a30326813ed3638b29f2fa74 Mon Sep 17 00:00:00 2001 From: rkapka Date: Mon, 28 Oct 2024 14:01:38 +0700 Subject: [PATCH 06/26] in prog --- api/client/beacon/BUILD.bazel | 2 - api/client/builder/BUILD.bazel | 2 - api/client/builder/testing/BUILD.bazel | 1 - api/server/structs/BUILD.bazel | 6 +- api/server/structs/conversions_lightclient.go | 34 ++ beacon-chain/blockchain/BUILD.bazel | 2 - beacon-chain/blockchain/testing/BUILD.bazel | 1 - beacon-chain/builder/BUILD.bazel | 2 - beacon-chain/builder/testing/BUILD.bazel | 1 - beacon-chain/cache/BUILD.bazel | 2 - .../cache/depositsnapshot/BUILD.bazel | 2 - beacon-chain/core/altair/BUILD.bazel | 2 - beacon-chain/core/blocks/BUILD.bazel | 2 - beacon-chain/core/capella/BUILD.bazel | 2 - beacon-chain/core/deneb/BUILD.bazel | 2 - beacon-chain/core/electra/BUILD.bazel | 2 - beacon-chain/core/epoch/BUILD.bazel | 2 - .../core/epoch/precompute/BUILD.bazel | 2 - beacon-chain/core/execution/BUILD.bazel | 2 - beacon-chain/core/feed/operation/BUILD.bazel | 1 - beacon-chain/core/helpers/BUILD.bazel | 2 - beacon-chain/core/light-client/BUILD.bazel | 2 - beacon-chain/core/light-client/lightclient.go | 102 ++++++ beacon-chain/core/signing/BUILD.bazel | 2 - beacon-chain/core/time/BUILD.bazel | 1 - beacon-chain/core/transition/BUILD.bazel | 2 - .../core/transition/stateutils/BUILD.bazel | 2 - beacon-chain/core/validators/BUILD.bazel | 2 - beacon-chain/db/filesystem/BUILD.bazel | 2 - beacon-chain/db/iface/BUILD.bazel | 1 - beacon-chain/db/iface/interface.go | 1 + beacon-chain/db/kv/BUILD.bazel | 2 - beacon-chain/db/kv/lightclient.go | 4 + beacon-chain/db/slasherkv/BUILD.bazel | 2 - .../deterministic-genesis/BUILD.bazel | 1 - beacon-chain/execution/BUILD.bazel | 2 - beacon-chain/execution/testing/BUILD.bazel | 1 - .../forkchoice/doubly-linked-tree/BUILD.bazel | 2 - beacon-chain/forkchoice/types/BUILD.bazel | 1 - beacon-chain/monitor/BUILD.bazel | 2 - beacon-chain/node/BUILD.bazel | 1 - .../operations/attestations/BUILD.bazel | 2 - .../operations/attestations/kv/BUILD.bazel | 2 - .../operations/attestations/mock/BUILD.bazel | 5 +- beacon-chain/operations/blstoexec/BUILD.bazel | 2 - .../operations/blstoexec/mock/BUILD.bazel | 1 - beacon-chain/operations/slashings/BUILD.bazel | 2 - .../operations/slashings/mock/BUILD.bazel | 5 +- .../operations/synccommittee/BUILD.bazel | 6 +- .../operations/voluntaryexits/BUILD.bazel | 2 - .../voluntaryexits/mock/BUILD.bazel | 1 - beacon-chain/p2p/BUILD.bazel | 3 - beacon-chain/p2p/encoder/BUILD.bazel | 1 - beacon-chain/p2p/gossip_topic_mappings.go | 21 +- beacon-chain/p2p/peers/BUILD.bazel | 2 - beacon-chain/p2p/peers/peerdata/BUILD.bazel | 1 - beacon-chain/p2p/peers/scorers/BUILD.bazel | 2 - beacon-chain/p2p/testing/BUILD.bazel | 1 - beacon-chain/p2p/types/BUILD.bazel | 2 - beacon-chain/p2p/types/rpc_errors.go | 1 + beacon-chain/rpc/BUILD.bazel | 1 - beacon-chain/rpc/core/BUILD.bazel | 2 - beacon-chain/rpc/eth/beacon/BUILD.bazel | 2 - beacon-chain/rpc/eth/blob/BUILD.bazel | 1 - beacon-chain/rpc/eth/builder/BUILD.bazel | 1 - beacon-chain/rpc/eth/events/BUILD.bazel | 2 - beacon-chain/rpc/eth/helpers/BUILD.bazel | 1 - beacon-chain/rpc/eth/light-client/BUILD.bazel | 2 - beacon-chain/rpc/eth/light-client/handlers.go | 2 +- beacon-chain/rpc/eth/light-client/helpers.go | 74 +--- beacon-chain/rpc/eth/node/BUILD.bazel | 2 - beacon-chain/rpc/eth/rewards/BUILD.bazel | 1 - beacon-chain/rpc/eth/validator/BUILD.bazel | 2 - beacon-chain/rpc/lookup/BUILD.bazel | 1 - beacon-chain/rpc/prysm/beacon/BUILD.bazel | 2 - beacon-chain/rpc/prysm/node/BUILD.bazel | 1 - .../rpc/prysm/v1alpha1/beacon/BUILD.bazel | 2 - .../rpc/prysm/v1alpha1/debug/BUILD.bazel | 2 - .../rpc/prysm/v1alpha1/node/BUILD.bazel | 2 - .../validator/proposer_attestations.go | 1 + beacon-chain/rpc/prysm/validator/BUILD.bazel | 2 - beacon-chain/rpc/testutil/BUILD.bazel | 1 - beacon-chain/slasher/BUILD.bazel | 2 - beacon-chain/slasher/types/BUILD.bazel | 5 +- beacon-chain/state/BUILD.bazel | 1 - beacon-chain/state/fieldtrie/BUILD.bazel | 2 - beacon-chain/state/genesis/BUILD.bazel | 1 - beacon-chain/state/state-native/BUILD.bazel | 2 - beacon-chain/state/stategen/BUILD.bazel | 2 - beacon-chain/state/stateutil/BUILD.bazel | 2 - beacon-chain/state/testing/BUILD.bazel | 1 - beacon-chain/sync/BUILD.bazel | 5 - beacon-chain/sync/backfill/BUILD.bazel | 1 - beacon-chain/sync/initial-sync/BUILD.bazel | 2 - beacon-chain/sync/rpc.go | 17 +- beacon-chain/sync/rpc_chunked_response.go | 96 ++++++ beacon-chain/sync/rpc_light_client.go | 91 ++--- beacon-chain/sync/service.go | 38 +- beacon-chain/sync/subscriber.go | 4 +- beacon-chain/sync/subscriber_light_client.go | 4 +- beacon-chain/sync/validate_light_client.go | 22 +- beacon-chain/verification/BUILD.bazel | 2 - cmd/prysmctl/p2p/BUILD.bazel | 1 - cmd/prysmctl/testnet/BUILD.bazel | 1 - cmd/validator/accounts/BUILD.bazel | 2 - consensus-types/blocks/BUILD.bazel | 2 - consensus-types/blocks/testing/BUILD.bazel | 1 - consensus-types/forkchoice/BUILD.bazel | 5 +- consensus-types/interfaces/BUILD.bazel | 2 - consensus-types/light-client/BUILD.bazel | 1 - consensus-types/mock/BUILD.bazel | 1 - consensus-types/wrapper/BUILD.bazel | 1 - container/trie/BUILD.bazel | 2 - contracts/deposit/BUILD.bazel | 2 - crypto/hash/BUILD.bazel | 1 - encoding/ssz/BUILD.bazel | 2 - encoding/ssz/detect/BUILD.bazel | 2 - encoding/ssz/equality/BUILD.bazel | 1 - monitoring/clientstats/BUILD.bazel | 1 - network/forks/BUILD.bazel | 2 - proto/migration/BUILD.bazel | 2 - proto/prysm/v1alpha1/BUILD.bazel | 32 +- proto/prysm/v1alpha1/attestation/BUILD.bazel | 2 - .../aggregation/attestations/BUILD.bazel | 2 - .../aggregation/sync_contribution/BUILD.bazel | 2 - .../aggregation/testing/BUILD.bazel | 1 - proto/prysm/v1alpha1/electra.ssz.go | 326 ++---------------- proto/prysm/v1alpha1/light_client.pb.go | 4 +- proto/prysm/v1alpha1/light_client.proto | 2 +- proto/prysm/v1alpha1/metadata/BUILD.bazel | 1 - proto/prysm/v1alpha1/slashings/BUILD.bazel | 6 +- runtime/interop/BUILD.bazel | 2 - testing/assertions/BUILD.bazel | 1 - testing/benchmark/BUILD.bazel | 1 - testing/endtoend/components/eth1/BUILD.bazel | 1 - testing/endtoend/evaluators/BUILD.bazel | 1 - .../endtoend/evaluators/beaconapi/BUILD.bazel | 1 - testing/endtoend/helpers/BUILD.bazel | 1 - testing/middleware/builder/BUILD.bazel | 1 - testing/mock/BUILD.bazel | 1 - testing/slasher/simulator/BUILD.bazel | 2 - .../spectest/general/deneb/kzg/BUILD.bazel | 1 - .../altair/epoch_processing/BUILD.bazel | 1 - .../shared/altair/finality/BUILD.bazel | 1 - .../spectest/shared/altair/fork/BUILD.bazel | 1 - .../shared/altair/operations/BUILD.bazel | 1 - .../shared/altair/rewards/BUILD.bazel | 1 - .../spectest/shared/altair/sanity/BUILD.bazel | 1 - .../shared/altair/ssz_static/BUILD.bazel | 1 - .../bellatrix/epoch_processing/BUILD.bazel | 1 - .../shared/bellatrix/finality/BUILD.bazel | 1 - .../shared/bellatrix/fork/BUILD.bazel | 1 - .../shared/bellatrix/operations/BUILD.bazel | 1 - .../shared/bellatrix/rewards/BUILD.bazel | 1 - .../shared/bellatrix/sanity/BUILD.bazel | 1 - .../shared/bellatrix/ssz_static/BUILD.bazel | 1 - .../capella/epoch_processing/BUILD.bazel | 1 - .../shared/capella/finality/BUILD.bazel | 1 - .../spectest/shared/capella/fork/BUILD.bazel | 1 - .../shared/capella/operations/BUILD.bazel | 1 - .../shared/capella/rewards/BUILD.bazel | 1 - .../shared/capella/sanity/BUILD.bazel | 1 - .../shared/capella/ssz_static/BUILD.bazel | 1 - .../shared/common/forkchoice/BUILD.bazel | 2 - .../shared/common/operations/BUILD.bazel | 1 - .../shared/common/ssz_static/BUILD.bazel | 1 - .../shared/deneb/epoch_processing/BUILD.bazel | 1 - .../shared/deneb/finality/BUILD.bazel | 1 - .../spectest/shared/deneb/fork/BUILD.bazel | 1 - .../shared/deneb/operations/BUILD.bazel | 1 - .../spectest/shared/deneb/rewards/BUILD.bazel | 1 - .../spectest/shared/deneb/sanity/BUILD.bazel | 1 - .../shared/deneb/ssz_static/BUILD.bazel | 1 - .../electra/epoch_processing/BUILD.bazel | 1 - .../shared/electra/finality/BUILD.bazel | 1 - .../spectest/shared/electra/fork/BUILD.bazel | 1 - .../shared/electra/operations/BUILD.bazel | 1 - .../shared/electra/rewards/BUILD.bazel | 1 - .../shared/electra/sanity/BUILD.bazel | 1 - .../shared/electra/ssz_static/BUILD.bazel | 1 - .../phase0/epoch_processing/BUILD.bazel | 1 - .../shared/phase0/finality/BUILD.bazel | 1 - .../shared/phase0/operations/BUILD.bazel | 1 - .../shared/phase0/rewards/BUILD.bazel | 1 - .../spectest/shared/phase0/sanity/BUILD.bazel | 1 - .../shared/phase0/ssz_static/BUILD.bazel | 1 - testing/util/BUILD.bazel | 2 - testing/validator-mock/BUILD.bazel | 1 - tools/benchmark-files-gen/BUILD.bazel | 1 - tools/bootnode/BUILD.bazel | 1 - tools/eth1voting/BUILD.bazel | 1 - tools/exploredb/BUILD.bazel | 1 - tools/forkchecker/BUILD.bazel | 1 - tools/pcli/BUILD.bazel | 1 - validator/accounts/BUILD.bazel | 2 - validator/accounts/testing/BUILD.bazel | 1 - validator/client/BUILD.bazel | 2 - validator/client/beacon-api/BUILD.bazel | 2 - validator/client/beacon-api/mock/BUILD.bazel | 1 - .../beacon-api/test-helpers/BUILD.bazel | 1 - validator/client/grpc-api/BUILD.bazel | 2 - validator/client/iface/BUILD.bazel | 1 - validator/client/testutil/BUILD.bazel | 1 - validator/db/BUILD.bazel | 2 - validator/db/filesystem/BUILD.bazel | 2 - validator/db/iface/BUILD.bazel | 1 - validator/db/kv/BUILD.bazel | 2 - validator/helpers/BUILD.bazel | 1 - .../remote-web3signer/v1/BUILD.bazel | 2 - .../remote-web3signer/v1/mock/BUILD.bazel | 1 - validator/rpc/BUILD.bazel | 1 - .../slashing-protection-history/BUILD.bazel | 1 - validator/testing/BUILD.bazel | 1 - 213 files changed, 384 insertions(+), 798 deletions(-) diff --git a/api/client/beacon/BUILD.bazel b/api/client/beacon/BUILD.bazel index 11e8ecb2e73..a17c889d8f2 100644 --- a/api/client/beacon/BUILD.bazel +++ b/api/client/beacon/BUILD.bazel @@ -24,7 +24,6 @@ go_library( "//encoding/ssz/detect:go_default_library", "//io/file:go_default_library", "//network/forks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", @@ -52,7 +51,6 @@ go_test( "//consensus-types/primitives:go_default_library", "//encoding/ssz/detect:go_default_library", "//network/forks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/api/client/builder/BUILD.bazel b/api/client/builder/BUILD.bazel index b37b48b6b63..b307bf2a080 100644 --- a/api/client/builder/BUILD.bazel +++ b/api/client/builder/BUILD.bazel @@ -23,7 +23,6 @@ go_library( "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -50,7 +49,6 @@ go_test( "//encoding/bytesutil:go_default_library", "//math:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/api/client/builder/testing/BUILD.bazel b/api/client/builder/testing/BUILD.bazel index 6e99669d4d0..b62946618ef 100644 --- a/api/client/builder/testing/BUILD.bazel +++ b/api/client/builder/testing/BUILD.bazel @@ -11,6 +11,5 @@ go_library( "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", ], ) diff --git a/api/server/structs/BUILD.bazel b/api/server/structs/BUILD.bazel index 54ed0b02a9e..6a8851caa72 100644 --- a/api/server/structs/BUILD.bazel +++ b/api/server/structs/BUILD.bazel @@ -36,7 +36,6 @@ go_library( "//math:go_default_library", "//proto/engine/v1:go_default_library", "//proto/eth/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", @@ -48,8 +47,5 @@ go_test( name = "go_default_test", srcs = ["conversions_test.go"], embed = [":go_default_library"], - deps = [ - "//proto/prysm/v1alpha1:go_default_library", - "//testing/require:go_default_library", - ], + deps = ["//testing/require:go_default_library"], ) diff --git a/api/server/structs/conversions_lightclient.go b/api/server/structs/conversions_lightclient.go index 2fc3d70e0c2..9c80b92a3ff 100644 --- a/api/server/structs/conversions_lightclient.go +++ b/api/server/structs/conversions_lightclient.go @@ -11,6 +11,40 @@ import ( "github.com/prysmaticlabs/prysm/v5/runtime/version" ) +func LightClientBootsrapFromConsensus(bootstrap interfaces.LightClientBootstrap) (*LightClientBootstrap, error) { + header, err := lightClientHeaderToJSON(bootstrap.Header()) + if err != nil { + return nil, errors.Wrap(err, "could not marshal light client header") + } + + var jsonBranch []string + if bootstrap.Version() >= version.Electra { + branch, err := bootstrap.CurrentSyncCommitteeBranchElectra() + if err != nil { + return nil, err + } + jsonBranch = make([]string, len(branch)) + for i, item := range branch { + jsonBranch[i] = hexutil.Encode(item[:]) + } + } else { + branch, err := bootstrap.CurrentSyncCommitteeBranch() + if err != nil { + return nil, err + } + jsonBranch = make([]string, len(branch)) + for i, item := range branch { + jsonBranch[i] = hexutil.Encode(item[:]) + } + } + + return &LightClientBootstrap{ + Header: header, + CurrentSyncCommittee: SyncCommitteeFromConsensus(bootstrap.CurrentSyncCommittee()), + CurrentSyncCommitteeBranch: jsonBranch, + }, nil +} + func LightClientUpdateFromConsensus(update interfaces.LightClientUpdate) (*LightClientUpdate, error) { attestedHeader, err := lightClientHeaderToJSON(update.AttestedHeader()) if err != nil { diff --git a/beacon-chain/blockchain/BUILD.bazel b/beacon-chain/blockchain/BUILD.bazel index 2dc6f11a87f..454a0a96997 100644 --- a/beacon-chain/blockchain/BUILD.bazel +++ b/beacon-chain/blockchain/BUILD.bazel @@ -84,7 +84,6 @@ go_library( "//monitoring/tracing/trace:go_default_library", "//proto/engine/v1:go_default_library", "//proto/eth/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//runtime/version:go_default_library", "//time:go_default_library", @@ -171,7 +170,6 @@ go_test( "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", "//proto/eth/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/blockchain/testing/BUILD.bazel b/beacon-chain/blockchain/testing/BUILD.bazel index 600d086e34f..47eb44db78e 100644 --- a/beacon-chain/blockchain/testing/BUILD.bazel +++ b/beacon-chain/blockchain/testing/BUILD.bazel @@ -30,7 +30,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", ], diff --git a/beacon-chain/builder/BUILD.bazel b/beacon-chain/builder/BUILD.bazel index f115fbeb845..0f118554527 100644 --- a/beacon-chain/builder/BUILD.bazel +++ b/beacon-chain/builder/BUILD.bazel @@ -21,7 +21,6 @@ go_library( "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", "@com_github_prometheus_client_golang//prometheus/promauto:go_default_library", @@ -39,7 +38,6 @@ go_test( "//beacon-chain/blockchain/testing:go_default_library", "//beacon-chain/db/testing:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", ], diff --git a/beacon-chain/builder/testing/BUILD.bazel b/beacon-chain/builder/testing/BUILD.bazel index 33fe5931eb6..e83c3081347 100644 --- a/beacon-chain/builder/testing/BUILD.bazel +++ b/beacon-chain/builder/testing/BUILD.bazel @@ -15,7 +15,6 @@ go_library( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", diff --git a/beacon-chain/cache/BUILD.bazel b/beacon-chain/cache/BUILD.bazel index 3defcdfac58..ef01127f8bb 100644 --- a/beacon-chain/cache/BUILD.bazel +++ b/beacon-chain/cache/BUILD.bazel @@ -47,7 +47,6 @@ go_library( "//encoding/bytesutil:go_default_library", "//math:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_hashicorp_golang_lru//:go_default_library", @@ -89,7 +88,6 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/cache/depositsnapshot/BUILD.bazel b/beacon-chain/cache/depositsnapshot/BUILD.bazel index de6e52e5ee9..12a1dc603d8 100644 --- a/beacon-chain/cache/depositsnapshot/BUILD.bazel +++ b/beacon-chain/cache/depositsnapshot/BUILD.bazel @@ -20,7 +20,6 @@ go_library( "//encoding/bytesutil:go_default_library", "//math:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", @@ -50,7 +49,6 @@ go_test( "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/core/altair/BUILD.bazel b/beacon-chain/core/altair/BUILD.bazel index e73e251e33d..07867344b09 100644 --- a/beacon-chain/core/altair/BUILD.bazel +++ b/beacon-chain/core/altair/BUILD.bazel @@ -35,7 +35,6 @@ go_library( "//encoding/bytesutil:go_default_library", "//math:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", @@ -77,7 +76,6 @@ go_test( "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//math:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", diff --git a/beacon-chain/core/blocks/BUILD.bazel b/beacon-chain/core/blocks/BUILD.bazel index 64d5861acd6..3d103f92fa4 100644 --- a/beacon-chain/core/blocks/BUILD.bazel +++ b/beacon-chain/core/blocks/BUILD.bazel @@ -43,7 +43,6 @@ go_library( "//monitoring/tracing/trace:go_default_library", "//network/forks:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/slashings:go_default_library", "//runtime/version:go_default_library", @@ -99,7 +98,6 @@ go_test( "//encoding/bytesutil:go_default_library", "//encoding/ssz:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/attestations:go_default_library", diff --git a/beacon-chain/core/capella/BUILD.bazel b/beacon-chain/core/capella/BUILD.bazel index d42f80bec08..f182009137c 100644 --- a/beacon-chain/core/capella/BUILD.bazel +++ b/beacon-chain/core/capella/BUILD.bazel @@ -11,7 +11,6 @@ go_library( "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", ], ) @@ -24,7 +23,6 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", ], diff --git a/beacon-chain/core/deneb/BUILD.bazel b/beacon-chain/core/deneb/BUILD.bazel index 4bfaf5f9102..15c6593c32a 100644 --- a/beacon-chain/core/deneb/BUILD.bazel +++ b/beacon-chain/core/deneb/BUILD.bazel @@ -11,7 +11,6 @@ go_library( "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", ], ) @@ -23,7 +22,6 @@ go_test( "//beacon-chain/core/time:go_default_library", "//config/params:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", ], diff --git a/beacon-chain/core/electra/BUILD.bazel b/beacon-chain/core/electra/BUILD.bazel index 35ef921f3ef..8ec13ea3a0d 100644 --- a/beacon-chain/core/electra/BUILD.bazel +++ b/beacon-chain/core/electra/BUILD.bazel @@ -37,7 +37,6 @@ go_library( "//math:go_default_library", "//monitoring/tracing/trace:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", @@ -77,7 +76,6 @@ go_test( "//crypto/bls/common:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/core/epoch/BUILD.bazel b/beacon-chain/core/epoch/BUILD.bazel index 3a3ea5c5eec..bc056c663ca 100644 --- a/beacon-chain/core/epoch/BUILD.bazel +++ b/beacon-chain/core/epoch/BUILD.bazel @@ -21,7 +21,6 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//math:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "@com_github_pkg_errors//:go_default_library", ], @@ -46,7 +45,6 @@ go_test( "//config/fieldparams:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/core/epoch/precompute/BUILD.bazel b/beacon-chain/core/epoch/precompute/BUILD.bazel index d16cd58091b..5858c0799f7 100644 --- a/beacon-chain/core/epoch/precompute/BUILD.bazel +++ b/beacon-chain/core/epoch/precompute/BUILD.bazel @@ -25,7 +25,6 @@ go_library( "//math:go_default_library", "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", @@ -55,7 +54,6 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//math:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", diff --git a/beacon-chain/core/execution/BUILD.bazel b/beacon-chain/core/execution/BUILD.bazel index 460118b8ec6..96370764040 100644 --- a/beacon-chain/core/execution/BUILD.bazel +++ b/beacon-chain/core/execution/BUILD.bazel @@ -16,7 +16,6 @@ go_library( "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", ], ) @@ -28,7 +27,6 @@ go_test( "//beacon-chain/core/time:go_default_library", "//config/params:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", ], diff --git a/beacon-chain/core/feed/operation/BUILD.bazel b/beacon-chain/core/feed/operation/BUILD.bazel index 0d475e92d8c..2e8bb6abe7b 100644 --- a/beacon-chain/core/feed/operation/BUILD.bazel +++ b/beacon-chain/core/feed/operation/BUILD.bazel @@ -11,6 +11,5 @@ go_library( deps = [ "//async/event:go_default_library", "//consensus-types/blocks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", ], ) diff --git a/beacon-chain/core/helpers/BUILD.bazel b/beacon-chain/core/helpers/BUILD.bazel index 090a57458a6..85cda16e893 100644 --- a/beacon-chain/core/helpers/BUILD.bazel +++ b/beacon-chain/core/helpers/BUILD.bazel @@ -34,7 +34,6 @@ go_library( "//encoding/bytesutil:go_default_library", "//math:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time:go_default_library", "//time/slots:go_default_library", @@ -79,7 +78,6 @@ go_test( "//container/slice:go_default_library", "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/core/light-client/BUILD.bazel b/beacon-chain/core/light-client/BUILD.bazel index ecf6b8f71a7..28906c18019 100644 --- a/beacon-chain/core/light-client/BUILD.bazel +++ b/beacon-chain/core/light-client/BUILD.bazel @@ -17,7 +17,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//encoding/ssz:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -35,7 +34,6 @@ go_test( "//consensus-types/blocks:go_default_library", "//encoding/ssz:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", "@com_github_pkg_errors//:go_default_library", diff --git a/beacon-chain/core/light-client/lightclient.go b/beacon-chain/core/light-client/lightclient.go index d07813fc7a5..35d2103c5b8 100644 --- a/beacon-chain/core/light-client/lightclient.go +++ b/beacon-chain/core/light-client/lightclient.go @@ -23,6 +23,108 @@ import ( "google.golang.org/protobuf/proto" ) +const ( + FinalityBranchNumOfLeaves = 6 +) + +func NewLightClientBootstrapFromBeaconState( + ctx context.Context, + currentSlot primitives.Slot, + state state.BeaconState, + block interfaces.ReadOnlySignedBeaconBlock, +) (interfaces.LightClientBootstrap, error) { + // assert compute_epoch_at_slot(state.slot) >= ALTAIR_FORK_EPOCH + if slots.ToEpoch(state.Slot()) < params.BeaconConfig().AltairForkEpoch { + return nil, fmt.Errorf("light client bootstrap is not supported before Altair, invalid slot %d", state.Slot()) + } + + // assert state.slot == state.latest_block_header.slot + latestBlockHeader := state.LatestBlockHeader() + if state.Slot() != latestBlockHeader.Slot { + return nil, fmt.Errorf("state slot %d not equal to latest block header slot %d", state.Slot(), latestBlockHeader.Slot) + } + + // header.state_root = hash_tree_root(state) + stateRoot, err := state.HashTreeRoot(ctx) + if err != nil { + return nil, errors.Wrap(err, "could not get state root") + } + latestBlockHeader.StateRoot = stateRoot[:] + + // assert hash_tree_root(header) == hash_tree_root(block.message) + latestBlockHeaderRoot, err := latestBlockHeader.HashTreeRoot() + if err != nil { + return nil, errors.Wrap(err, "could not get latest block header root") + } + beaconBlockRoot, err := block.Block().HashTreeRoot() + if err != nil { + return nil, errors.Wrap(err, "could not get block root") + } + if latestBlockHeaderRoot != beaconBlockRoot { + return nil, fmt.Errorf("latest block header root %#x not equal to block root %#x", latestBlockHeaderRoot, beaconBlockRoot) + } + + lightClientHeader, err := BlockToLightClientHeader(ctx, currentSlot, block) + if err != nil { + return nil, errors.Wrap(err, "could not convert block to light client header") + } + currentSyncCommittee, err := state.CurrentSyncCommittee() + if err != nil { + return nil, errors.Wrap(err, "could not get current sync committee") + } + currentSyncCommitteeProof, err := state.CurrentSyncCommitteeProof(ctx) + if err != nil { + return nil, errors.Wrap(err, "could not get current sync committee proof") + } + + currentEpoch := slots.ToEpoch(currentSlot) + + var m proto.Message + if currentEpoch >= params.BeaconConfig().ElectraForkEpoch { + h, ok := lightClientHeader.Proto().(*pb.LightClientHeaderDeneb) + if !ok { + return nil, fmt.Errorf("light client header type %T is not %T", h, &pb.LightClientHeaderDeneb{}) + } + m = &pb.LightClientBootstrapElectra{ + Header: h, + CurrentSyncCommittee: currentSyncCommittee, + CurrentSyncCommitteeBranch: currentSyncCommitteeProof, + } + } else if currentEpoch >= params.BeaconConfig().DenebForkEpoch { + h, ok := lightClientHeader.Proto().(*pb.LightClientHeaderDeneb) + if !ok { + return nil, fmt.Errorf("light client header type %T is not %T", h, &pb.LightClientHeaderDeneb{}) + } + m = &pb.LightClientBootstrapDeneb{ + Header: h, + CurrentSyncCommittee: currentSyncCommittee, + CurrentSyncCommitteeBranch: currentSyncCommitteeProof, + } + } else if currentEpoch >= params.BeaconConfig().CapellaForkEpoch { + h, ok := lightClientHeader.Proto().(*pb.LightClientHeaderCapella) + if !ok { + return nil, fmt.Errorf("light client header type %T is not %T", h, &pb.LightClientHeaderCapella{}) + } + m = &pb.LightClientBootstrapCapella{ + Header: h, + CurrentSyncCommittee: currentSyncCommittee, + CurrentSyncCommitteeBranch: currentSyncCommitteeProof, + } + } else { + h, ok := lightClientHeader.Proto().(*pb.LightClientHeaderAltair) + if !ok { + return nil, fmt.Errorf("light client header type %T is not %T", h, &pb.LightClientHeaderAltair{}) + } + m = &pb.LightClientBootstrapAltair{ + Header: h, + CurrentSyncCommittee: currentSyncCommittee, + CurrentSyncCommitteeBranch: currentSyncCommitteeProof, + } + } + + return light_client.NewWrappedBootstrap(m) +} + func NewLightClientFinalityUpdateFromBeaconState( ctx context.Context, currentSlot primitives.Slot, diff --git a/beacon-chain/core/signing/BUILD.bazel b/beacon-chain/core/signing/BUILD.bazel index 58556761efd..b8d25f7eb51 100644 --- a/beacon-chain/core/signing/BUILD.bazel +++ b/beacon-chain/core/signing/BUILD.bazel @@ -15,7 +15,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", ], @@ -38,7 +37,6 @@ go_test( "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/core/time/BUILD.bazel b/beacon-chain/core/time/BUILD.bazel index 295de1e912e..a0692598e61 100644 --- a/beacon-chain/core/time/BUILD.bazel +++ b/beacon-chain/core/time/BUILD.bazel @@ -23,7 +23,6 @@ go_test( "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/core/transition/BUILD.bazel b/beacon-chain/core/transition/BUILD.bazel index be7d42ada04..1e06371484d 100644 --- a/beacon-chain/core/transition/BUILD.bazel +++ b/beacon-chain/core/transition/BUILD.bazel @@ -43,7 +43,6 @@ go_library( "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", @@ -90,7 +89,6 @@ go_test( "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", diff --git a/beacon-chain/core/transition/stateutils/BUILD.bazel b/beacon-chain/core/transition/stateutils/BUILD.bazel index fa0fa1dce1d..ac4717ca529 100644 --- a/beacon-chain/core/transition/stateutils/BUILD.bazel +++ b/beacon-chain/core/transition/stateutils/BUILD.bazel @@ -12,7 +12,6 @@ go_library( "//config/fieldparams:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", ], ) @@ -26,7 +25,6 @@ go_test( "//config/fieldparams:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", ], diff --git a/beacon-chain/core/validators/BUILD.bazel b/beacon-chain/core/validators/BUILD.bazel index 8c341f4c791..8a86afc7e96 100644 --- a/beacon-chain/core/validators/BUILD.bazel +++ b/beacon-chain/core/validators/BUILD.bazel @@ -19,7 +19,6 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//math:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -40,7 +39,6 @@ go_test( "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/db/filesystem/BUILD.bazel b/beacon-chain/db/filesystem/BUILD.bazel index e4008d70072..fb615e430ba 100644 --- a/beacon-chain/db/filesystem/BUILD.bazel +++ b/beacon-chain/db/filesystem/BUILD.bazel @@ -20,7 +20,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/logging:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", @@ -45,7 +44,6 @@ go_test( "//config/fieldparams: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", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/beacon-chain/db/iface/BUILD.bazel b/beacon-chain/db/iface/BUILD.bazel index 81929a26a47..fe14c8faf3b 100644 --- a/beacon-chain/db/iface/BUILD.bazel +++ b/beacon-chain/db/iface/BUILD.bazel @@ -18,7 +18,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//monitoring/backup:go_default_library", "//proto/dbval:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", ], ) diff --git a/beacon-chain/db/iface/interface.go b/beacon-chain/db/iface/interface.go index fc2ef7af4fa..6d3172d6c6c 100644 --- a/beacon-chain/db/iface/interface.go +++ b/beacon-chain/db/iface/interface.go @@ -57,6 +57,7 @@ type ReadOnlyDatabase interface { FeeRecipientByValidatorID(ctx context.Context, id primitives.ValidatorIndex) (common.Address, error) RegistrationByValidatorID(ctx context.Context, id primitives.ValidatorIndex) (*ethpb.ValidatorRegistrationV1, error) // light client operations + LightClientBootstrap(ctx context.Context, root [32]byte) (interfaces.LightClientBootstrap, error) LightClientUpdates(ctx context.Context, startPeriod, endPeriod uint64) (map[uint64]interfaces.LightClientUpdate, error) LightClientUpdate(ctx context.Context, period uint64) (interfaces.LightClientUpdate, error) diff --git a/beacon-chain/db/kv/BUILD.bazel b/beacon-chain/db/kv/BUILD.bazel index 714bfb1f26d..27516369d7f 100644 --- a/beacon-chain/db/kv/BUILD.bazel +++ b/beacon-chain/db/kv/BUILD.bazel @@ -54,7 +54,6 @@ go_library( "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", "//proto/dbval:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time:go_default_library", "//time/slots:go_default_library", @@ -117,7 +116,6 @@ go_test( "//encoding/bytesutil:go_default_library", "//proto/dbval:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/testing:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", diff --git a/beacon-chain/db/kv/lightclient.go b/beacon-chain/db/kv/lightclient.go index f4cf94668d3..2c7901335df 100644 --- a/beacon-chain/db/kv/lightclient.go +++ b/beacon-chain/db/kv/lightclient.go @@ -17,6 +17,10 @@ import ( "google.golang.org/protobuf/proto" ) +func (s *Store) LightClientBootstrap(ctx context.Context, root [32]byte) (interfaces.LightClientBootstrap, error) { + return nil, nil +} + func (s *Store) SaveLightClientUpdate(ctx context.Context, period uint64, update interfaces.LightClientUpdate) error { _, span := trace.StartSpan(ctx, "BeaconDB.SaveLightClientUpdate") defer span.End() diff --git a/beacon-chain/db/slasherkv/BUILD.bazel b/beacon-chain/db/slasherkv/BUILD.bazel index 3c9fe389817..c115b162015 100644 --- a/beacon-chain/db/slasherkv/BUILD.bazel +++ b/beacon-chain/db/slasherkv/BUILD.bazel @@ -21,7 +21,6 @@ go_library( "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@com_github_golang_snappy//:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -49,7 +48,6 @@ go_test( "//config/params: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", "//time/slots:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/beacon-chain/deterministic-genesis/BUILD.bazel b/beacon-chain/deterministic-genesis/BUILD.bazel index 32267dc50f3..ed678b6b13b 100644 --- a/beacon-chain/deterministic-genesis/BUILD.bazel +++ b/beacon-chain/deterministic-genesis/BUILD.bazel @@ -15,7 +15,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime:go_default_library", "//runtime/interop:go_default_library", "//time/slots:go_default_library", diff --git a/beacon-chain/execution/BUILD.bazel b/beacon-chain/execution/BUILD.bazel index b33fb4d0d8a..7a8c67476c7 100644 --- a/beacon-chain/execution/BUILD.bazel +++ b/beacon-chain/execution/BUILD.bazel @@ -55,7 +55,6 @@ go_library( "//network:go_default_library", "//network/authorization:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time:go_default_library", "//time/slots:go_default_library", @@ -124,7 +123,6 @@ go_test( "//encoding/bytesutil:go_default_library", "//monitoring/clientstats:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/execution/testing/BUILD.bazel b/beacon-chain/execution/testing/BUILD.bazel index ba5b27f98f6..d432c3c7595 100644 --- a/beacon-chain/execution/testing/BUILD.bazel +++ b/beacon-chain/execution/testing/BUILD.bazel @@ -24,7 +24,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_ethereum_go_ethereum//accounts/abi/bind/backends:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", diff --git a/beacon-chain/forkchoice/doubly-linked-tree/BUILD.bazel b/beacon-chain/forkchoice/doubly-linked-tree/BUILD.bazel index 1bf47ea02a4..56e4088cff0 100644 --- a/beacon-chain/forkchoice/doubly-linked-tree/BUILD.bazel +++ b/beacon-chain/forkchoice/doubly-linked-tree/BUILD.bazel @@ -34,7 +34,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -73,7 +72,6 @@ go_test( "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/forkchoice/types/BUILD.bazel b/beacon-chain/forkchoice/types/BUILD.bazel index c6c258b94ed..57724c2a7b4 100644 --- a/beacon-chain/forkchoice/types/BUILD.bazel +++ b/beacon-chain/forkchoice/types/BUILD.bazel @@ -9,6 +9,5 @@ go_library( "//config/fieldparams:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", ], ) diff --git a/beacon-chain/monitor/BUILD.bazel b/beacon-chain/monitor/BUILD.bazel index 2145a6c1128..b538ebcf831 100644 --- a/beacon-chain/monitor/BUILD.bazel +++ b/beacon-chain/monitor/BUILD.bazel @@ -28,7 +28,6 @@ go_library( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", @@ -60,7 +59,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/node/BUILD.bazel b/beacon-chain/node/BUILD.bazel index a310daf40b2..a1e10ed12eb 100644 --- a/beacon-chain/node/BUILD.bazel +++ b/beacon-chain/node/BUILD.bazel @@ -95,7 +95,6 @@ go_test( "//config/fieldparams:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime:go_default_library", "//runtime/interop:go_default_library", "//testing/assert:go_default_library", diff --git a/beacon-chain/operations/attestations/BUILD.bazel b/beacon-chain/operations/attestations/BUILD.bazel index 451b1cba93b..01729ad4d45 100644 --- a/beacon-chain/operations/attestations/BUILD.bazel +++ b/beacon-chain/operations/attestations/BUILD.bazel @@ -22,7 +22,6 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/attestations:go_default_library", "//time:go_default_library", @@ -52,7 +51,6 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/attestations:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/operations/attestations/kv/BUILD.bazel b/beacon-chain/operations/attestations/kv/BUILD.bazel index ab66a61f769..fab1f32d126 100644 --- a/beacon-chain/operations/attestations/kv/BUILD.bazel +++ b/beacon-chain/operations/attestations/kv/BUILD.bazel @@ -17,7 +17,6 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/attestations:go_default_library", "//runtime/version:go_default_library", @@ -42,7 +41,6 @@ go_test( "//config/fieldparams:go_default_library", "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/operations/attestations/mock/BUILD.bazel b/beacon-chain/operations/attestations/mock/BUILD.bazel index 1976c31f5e1..ddcca01940d 100644 --- a/beacon-chain/operations/attestations/mock/BUILD.bazel +++ b/beacon-chain/operations/attestations/mock/BUILD.bazel @@ -6,8 +6,5 @@ go_library( srcs = ["mock.go"], importpath = "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/attestations/mock", visibility = ["//visibility:public"], - deps = [ - "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", - ], + deps = ["//consensus-types/primitives:go_default_library"], ) diff --git a/beacon-chain/operations/blstoexec/BUILD.bazel b/beacon-chain/operations/blstoexec/BUILD.bazel index eb00d06ee98..ffea73a73dd 100644 --- a/beacon-chain/operations/blstoexec/BUILD.bazel +++ b/beacon-chain/operations/blstoexec/BUILD.bazel @@ -16,7 +16,6 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//container/doubly-linked-list:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", "@com_github_prometheus_client_golang//prometheus/promauto:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", @@ -38,7 +37,6 @@ go_test( "//crypto/bls/common:go_default_library", "//crypto/hash:go_default_library", "//encoding/ssz:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", ], diff --git a/beacon-chain/operations/blstoexec/mock/BUILD.bazel b/beacon-chain/operations/blstoexec/mock/BUILD.bazel index a55b32f649d..f484f7a6eba 100644 --- a/beacon-chain/operations/blstoexec/mock/BUILD.bazel +++ b/beacon-chain/operations/blstoexec/mock/BUILD.bazel @@ -9,6 +9,5 @@ go_library( deps = [ "//beacon-chain/state:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", ], ) diff --git a/beacon-chain/operations/slashings/BUILD.bazel b/beacon-chain/operations/slashings/BUILD.bazel index f4f21b7bb4a..7ac9a429f94 100644 --- a/beacon-chain/operations/slashings/BUILD.bazel +++ b/beacon-chain/operations/slashings/BUILD.bazel @@ -24,7 +24,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//container/slice:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", "@com_github_prometheus_client_golang//prometheus/promauto:go_default_library", @@ -49,7 +48,6 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/operations/slashings/mock/BUILD.bazel b/beacon-chain/operations/slashings/mock/BUILD.bazel index 27ad0173356..8b0bad61350 100644 --- a/beacon-chain/operations/slashings/mock/BUILD.bazel +++ b/beacon-chain/operations/slashings/mock/BUILD.bazel @@ -6,8 +6,5 @@ go_library( srcs = ["mock.go"], importpath = "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/slashings/mock", visibility = ["//visibility:public"], - deps = [ - "//beacon-chain/state:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", - ], + deps = ["//beacon-chain/state:go_default_library"], ) diff --git a/beacon-chain/operations/synccommittee/BUILD.bazel b/beacon-chain/operations/synccommittee/BUILD.bazel index b2dc7ee4e0f..d7a4045cd79 100644 --- a/beacon-chain/operations/synccommittee/BUILD.bazel +++ b/beacon-chain/operations/synccommittee/BUILD.bazel @@ -15,7 +15,6 @@ go_library( deps = [ "//consensus-types/primitives:go_default_library", "//container/queue:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", "@com_github_prometheus_client_golang//prometheus/promauto:go_default_library", @@ -29,8 +28,5 @@ go_test( "message_test.go", ], embed = [":go_default_library"], - deps = [ - "//proto/prysm/v1alpha1:go_default_library", - "//testing/require:go_default_library", - ], + deps = ["//testing/require:go_default_library"], ) diff --git a/beacon-chain/operations/voluntaryexits/BUILD.bazel b/beacon-chain/operations/voluntaryexits/BUILD.bazel index b7924a805f0..0d06dce5670 100644 --- a/beacon-chain/operations/voluntaryexits/BUILD.bazel +++ b/beacon-chain/operations/voluntaryexits/BUILD.bazel @@ -16,7 +16,6 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//container/doubly-linked-list:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", ], @@ -35,7 +34,6 @@ go_test( "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", "//crypto/bls/common:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//time/slots:go_default_library", diff --git a/beacon-chain/operations/voluntaryexits/mock/BUILD.bazel b/beacon-chain/operations/voluntaryexits/mock/BUILD.bazel index a2d8dbc00c7..8c0a6355ea7 100644 --- a/beacon-chain/operations/voluntaryexits/mock/BUILD.bazel +++ b/beacon-chain/operations/voluntaryexits/mock/BUILD.bazel @@ -9,6 +9,5 @@ go_library( deps = [ "//beacon-chain/state:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", ], ) diff --git a/beacon-chain/p2p/BUILD.bazel b/beacon-chain/p2p/BUILD.bazel index d6897a6d5d9..47a03c187c5 100644 --- a/beacon-chain/p2p/BUILD.bazel +++ b/beacon-chain/p2p/BUILD.bazel @@ -69,8 +69,6 @@ go_library( "//monitoring/tracing/trace:go_default_library", "//network:go_default_library", "//network/forks:go_default_library", - "//proto/eth/v2:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//runtime:go_default_library", "//runtime/version:go_default_library", @@ -161,7 +159,6 @@ go_test( "//network:go_default_library", "//network/forks:go_default_library", "//proto/eth/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/testing:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", diff --git a/beacon-chain/p2p/encoder/BUILD.bazel b/beacon-chain/p2p/encoder/BUILD.bazel index 27c5f71bddc..580707d154c 100644 --- a/beacon-chain/p2p/encoder/BUILD.bazel +++ b/beacon-chain/p2p/encoder/BUILD.bazel @@ -34,7 +34,6 @@ go_test( embed = [":go_default_library"], deps = [ "//config/params:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/p2p/gossip_topic_mappings.go b/beacon-chain/p2p/gossip_topic_mappings.go index f2a6118d46a..f370b4a6526 100644 --- a/beacon-chain/p2p/gossip_topic_mappings.go +++ b/beacon-chain/p2p/gossip_topic_mappings.go @@ -5,7 +5,6 @@ import ( "github.com/prysmaticlabs/prysm/v5/config/params" "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" - "github.com/prysmaticlabs/prysm/v5/proto/eth/v2" ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" "google.golang.org/protobuf/proto" ) @@ -23,8 +22,8 @@ var gossipTopicMappings = map[string]func() proto.Message{ SyncCommitteeSubnetTopicFormat: func() proto.Message { return ðpb.SyncCommitteeMessage{} }, BlsToExecutionChangeSubnetTopicFormat: func() proto.Message { return ðpb.SignedBLSToExecutionChange{} }, BlobSubnetTopicFormat: func() proto.Message { return ðpb.BlobSidecar{} }, - LightClientFinalityUpdateTopicFormat: func() proto.Message { return ð.LightClientFinalityUpdate{} }, - LightClientOptimisticUpdateTopicFormat: func() proto.Message { return ð.LightClientOptimisticUpdate{} }, + LightClientFinalityUpdateTopicFormat: func() proto.Message { return ðpb.LightClientFinalityUpdateAltair{} }, + LightClientOptimisticUpdateTopicFormat: func() proto.Message { return ðpb.LightClientOptimisticUpdateAltair{} }, } // GossipTopicMappings is a function to return the assigned data type @@ -63,6 +62,22 @@ func GossipTopicMappings(topic string, epoch primitives.Epoch) proto.Message { return ðpb.SignedAggregateAttestationAndProofElectra{} } return gossipMessage(topic) + case LightClientFinalityUpdateTopicFormat: + if epoch >= params.BeaconConfig().DenebForkEpoch { + return ðpb.LightClientFinalityUpdateDeneb{} + } + if epoch >= params.BeaconConfig().CapellaForkEpoch { + return ðpb.LightClientFinalityUpdateCapella{} + } + return gossipMessage(topic) + case LightClientOptimisticUpdateTopicFormat: + if epoch >= params.BeaconConfig().DenebForkEpoch { + return ðpb.LightClientOptimisticUpdateDeneb{} + } + if epoch >= params.BeaconConfig().CapellaForkEpoch { + return ðpb.LightClientOptimisticUpdateCapella{} + } + return gossipMessage(topic) default: return gossipMessage(topic) } diff --git a/beacon-chain/p2p/peers/BUILD.bazel b/beacon-chain/p2p/peers/BUILD.bazel index f2f8535f544..aab7ad24bd0 100644 --- a/beacon-chain/p2p/peers/BUILD.bazel +++ b/beacon-chain/p2p/peers/BUILD.bazel @@ -22,7 +22,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//crypto/rand:go_default_library", "//math:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//time:go_default_library", "//time/slots:go_default_library", @@ -55,7 +54,6 @@ go_test( "//consensus-types/primitives:go_default_library", "//consensus-types/wrapper:go_default_library", "//proto/eth/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enr:go_default_library", diff --git a/beacon-chain/p2p/peers/peerdata/BUILD.bazel b/beacon-chain/p2p/peers/peerdata/BUILD.bazel index 8afc65bedf3..a8dbe51a91e 100644 --- a/beacon-chain/p2p/peers/peerdata/BUILD.bazel +++ b/beacon-chain/p2p/peers/peerdata/BUILD.bazel @@ -6,7 +6,6 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p/peers/peerdata", visibility = ["//beacon-chain:__subpackages__"], deps = [ - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enr:go_default_library", "@com_github_libp2p_go_libp2p//core/network:go_default_library", diff --git a/beacon-chain/p2p/peers/scorers/BUILD.bazel b/beacon-chain/p2p/peers/scorers/BUILD.bazel index e6eb6a277c8..5cc95727d65 100644 --- a/beacon-chain/p2p/peers/scorers/BUILD.bazel +++ b/beacon-chain/p2p/peers/scorers/BUILD.bazel @@ -18,7 +18,6 @@ go_library( "//config/features:go_default_library", "//consensus-types/primitives:go_default_library", "//crypto/rand:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_libp2p_go_libp2p//core/peer:go_default_library", ], ) @@ -42,7 +41,6 @@ go_test( "//config/features:go_default_library", "//consensus-types/primitives:go_default_library", "//crypto/rand:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//time:go_default_library", diff --git a/beacon-chain/p2p/testing/BUILD.bazel b/beacon-chain/p2p/testing/BUILD.bazel index 18765496b86..cf987dd074d 100644 --- a/beacon-chain/p2p/testing/BUILD.bazel +++ b/beacon-chain/p2p/testing/BUILD.bazel @@ -20,7 +20,6 @@ go_library( "//beacon-chain/p2p/encoder:go_default_library", "//beacon-chain/p2p/peers:go_default_library", "//beacon-chain/p2p/peers/scorers:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//testing/require:go_default_library", "@com_github_ethereum_go_ethereum//crypto:go_default_library", diff --git a/beacon-chain/p2p/types/BUILD.bazel b/beacon-chain/p2p/types/BUILD.bazel index 2ecf4d8166e..fb444124183 100644 --- a/beacon-chain/p2p/types/BUILD.bazel +++ b/beacon-chain/p2p/types/BUILD.bazel @@ -25,7 +25,6 @@ go_library( "//consensus-types/wrapper:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", @@ -43,7 +42,6 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/p2p/types/rpc_errors.go b/beacon-chain/p2p/types/rpc_errors.go index 46381876c11..2ca23d120e9 100644 --- a/beacon-chain/p2p/types/rpc_errors.go +++ b/beacon-chain/p2p/types/rpc_errors.go @@ -5,6 +5,7 @@ import "errors" var ( ErrWrongForkDigestVersion = errors.New("wrong fork digest version") ErrInvalidEpoch = errors.New("invalid epoch") + ErrInvalidRoot = errors.New("invalid root") ErrInvalidFinalizedRoot = errors.New("invalid finalized root") ErrInvalidSequenceNum = errors.New("invalid sequence number provided") ErrGeneric = errors.New("internal service error") diff --git a/beacon-chain/rpc/BUILD.bazel b/beacon-chain/rpc/BUILD.bazel index dbb213a6559..ab4b8f9e2c3 100644 --- a/beacon-chain/rpc/BUILD.bazel +++ b/beacon-chain/rpc/BUILD.bazel @@ -54,7 +54,6 @@ go_library( "//config/params:go_default_library", "//io/logs:go_default_library", "//monitoring/tracing:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_grpc_ecosystem_go_grpc_middleware//:go_default_library", "@com_github_grpc_ecosystem_go_grpc_middleware//recovery:go_default_library", "@com_github_grpc_ecosystem_go_grpc_middleware//tracing/opentracing:go_default_library", diff --git a/beacon-chain/rpc/core/BUILD.bazel b/beacon-chain/rpc/core/BUILD.bazel index b59af863533..c1b5c3efee6 100644 --- a/beacon-chain/rpc/core/BUILD.bazel +++ b/beacon-chain/rpc/core/BUILD.bazel @@ -37,7 +37,6 @@ go_library( "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time:go_default_library", "//time/slots:go_default_library", @@ -56,7 +55,6 @@ go_test( "//beacon-chain/cache:go_default_library", "//config/params:go_default_library", "//consensus-types/validator:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", ], diff --git a/beacon-chain/rpc/eth/beacon/BUILD.bazel b/beacon-chain/rpc/eth/beacon/BUILD.bazel index 3b44d87bb90..d0422b43893 100644 --- a/beacon-chain/rpc/eth/beacon/BUILD.bazel +++ b/beacon-chain/rpc/eth/beacon/BUILD.bazel @@ -54,7 +54,6 @@ go_library( "//encoding/bytesutil:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", @@ -111,7 +110,6 @@ go_test( "//encoding/bytesutil:go_default_library", "//encoding/ssz:go_default_library", "//network/httputil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/mock:go_default_library", diff --git a/beacon-chain/rpc/eth/blob/BUILD.bazel b/beacon-chain/rpc/eth/blob/BUILD.bazel index 85f48f9bbc7..ade6012c5a7 100644 --- a/beacon-chain/rpc/eth/blob/BUILD.bazel +++ b/beacon-chain/rpc/eth/blob/BUILD.bazel @@ -36,7 +36,6 @@ go_test( "//config/fieldparams:go_default_library", "//config/params:go_default_library", "//network/httputil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/rpc/eth/builder/BUILD.bazel b/beacon-chain/rpc/eth/builder/BUILD.bazel index dd0663e2dda..36be4b01020 100644 --- a/beacon-chain/rpc/eth/builder/BUILD.bazel +++ b/beacon-chain/rpc/eth/builder/BUILD.bazel @@ -37,7 +37,6 @@ go_test( "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", "//network/httputil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/rpc/eth/events/BUILD.bazel b/beacon-chain/rpc/eth/events/BUILD.bazel index da308f79785..dcb9ce41530 100644 --- a/beacon-chain/rpc/eth/events/BUILD.bazel +++ b/beacon-chain/rpc/eth/events/BUILD.bazel @@ -27,7 +27,6 @@ go_library( "//network/httputil:go_default_library", "//proto/eth/v1:go_default_library", "//proto/eth/v2:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", @@ -55,7 +54,6 @@ go_test( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//proto/eth/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", diff --git a/beacon-chain/rpc/eth/helpers/BUILD.bazel b/beacon-chain/rpc/eth/helpers/BUILD.bazel index c9e1b5ff4b4..df1d490f242 100644 --- a/beacon-chain/rpc/eth/helpers/BUILD.bazel +++ b/beacon-chain/rpc/eth/helpers/BUILD.bazel @@ -52,7 +52,6 @@ go_test( "//proto/engine/v1:go_default_library", "//proto/eth/v1:go_default_library", "//proto/migration:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/rpc/eth/light-client/BUILD.bazel b/beacon-chain/rpc/eth/light-client/BUILD.bazel index f4bf65404a2..6912951765d 100644 --- a/beacon-chain/rpc/eth/light-client/BUILD.bazel +++ b/beacon-chain/rpc/eth/light-client/BUILD.bazel @@ -18,7 +18,6 @@ go_library( "//beacon-chain/rpc/eth/shared:go_default_library", "//beacon-chain/rpc/lookup:go_default_library", "//beacon-chain/state:go_default_library", - "//config/fieldparams:go_default_library", "//config/params:go_default_library", "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", @@ -54,7 +53,6 @@ go_test( "//consensus-types/light-client:go_default_library", "//consensus-types/primitives:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/rpc/eth/light-client/handlers.go b/beacon-chain/rpc/eth/light-client/handlers.go index 91746c5db13..279a51acc64 100644 --- a/beacon-chain/rpc/eth/light-client/handlers.go +++ b/beacon-chain/rpc/eth/light-client/handlers.go @@ -45,7 +45,7 @@ func (s *Server) GetLightClientBootstrap(w http.ResponseWriter, req *http.Reques return } - bootstrap, err := createLightClientBootstrap(ctx, s.ChainInfoFetcher.CurrentSlot(), state, blk) + bootstrap, err := newLightClientBootstrapFromBeaconState(ctx, s.ChainInfoFetcher.CurrentSlot(), state, blk) if err != nil { httputil.HandleError(w, "could not get light client bootstrap: "+err.Error(), http.StatusInternalServerError) return diff --git a/beacon-chain/rpc/eth/light-client/helpers.go b/beacon-chain/rpc/eth/light-client/helpers.go index 39779735bca..2c43366d901 100644 --- a/beacon-chain/rpc/eth/light-client/helpers.go +++ b/beacon-chain/rpc/eth/light-client/helpers.go @@ -2,8 +2,6 @@ package lightclient import ( "context" - "encoding/json" - "fmt" "reflect" "github.com/ethereum/go-ethereum/common/hexutil" @@ -21,82 +19,18 @@ import ( "github.com/prysmaticlabs/prysm/v5/time/slots" ) -func createLightClientBootstrap( +func newLightClientBootstrapFromBeaconState( ctx context.Context, currentSlot primitives.Slot, state state.BeaconState, block interfaces.ReadOnlySignedBeaconBlock, ) (*structs.LightClientBootstrap, error) { - // assert compute_epoch_at_slot(state.slot) >= ALTAIR_FORK_EPOCH - if slots.ToEpoch(state.Slot()) < params.BeaconConfig().AltairForkEpoch { - return nil, fmt.Errorf("light client bootstrap is not supported before Altair, invalid slot %d", state.Slot()) - } - - // assert state.slot == state.latest_block_header.slot - latestBlockHeader := state.LatestBlockHeader() - if state.Slot() != latestBlockHeader.Slot { - return nil, fmt.Errorf("state slot %d not equal to latest block header slot %d", state.Slot(), latestBlockHeader.Slot) - } - - // header.state_root = hash_tree_root(state) - stateRoot, err := state.HashTreeRoot(ctx) - if err != nil { - return nil, errors.Wrap(err, "could not get state root") - } - latestBlockHeader.StateRoot = stateRoot[:] - - // assert hash_tree_root(header) == hash_tree_root(block.message) - latestBlockHeaderRoot, err := latestBlockHeader.HashTreeRoot() - if err != nil { - return nil, errors.Wrap(err, "could not get latest block header root") - } - beaconBlockRoot, err := block.Block().HashTreeRoot() - if err != nil { - return nil, errors.Wrap(err, "could not get block root") - } - if latestBlockHeaderRoot != beaconBlockRoot { - return nil, fmt.Errorf("latest block header root %#x not equal to block root %#x", latestBlockHeaderRoot, beaconBlockRoot) - } - - lightClientHeader, err := lightclient.BlockToLightClientHeader(ctx, currentSlot, block) - if err != nil { - return nil, errors.Wrap(err, "could not convert block to light client header") - } - - apiLightClientHeader := &structs.LightClientHeader{ - Beacon: structs.BeaconBlockHeaderFromConsensus(lightClientHeader.Beacon()), - } - - headerJSON, err := json.Marshal(apiLightClientHeader) - if err != nil { - return nil, errors.Wrap(err, "could not convert header to raw message") - } - currentSyncCommittee, err := state.CurrentSyncCommittee() - if err != nil { - return nil, errors.Wrap(err, "could not get current sync committee") - } - currentSyncCommitteeProof, err := state.CurrentSyncCommitteeProof(ctx) + bootstrap, err := lightclient.NewLightClientBootstrapFromBeaconState(ctx, currentSlot, state, block) if err != nil { - return nil, errors.Wrap(err, "could not get current sync committee proof") - } - - var branch []string - if state.Version() >= version.Electra { - branch = make([]string, fieldparams.SyncCommitteeBranchDepthElectra) - } else { - branch = make([]string, fieldparams.SyncCommitteeBranchDepth) - } - for i, proof := range currentSyncCommitteeProof { - branch[i] = hexutil.Encode(proof) - } - - result := &structs.LightClientBootstrap{ - Header: headerJSON, - CurrentSyncCommittee: structs.SyncCommitteeFromConsensus(currentSyncCommittee), - CurrentSyncCommitteeBranch: branch, + return nil, err } - return result, nil + return structs.LightClientBootsrapFromConsensus(bootstrap) } func newLightClientFinalityUpdateFromBeaconState( diff --git a/beacon-chain/rpc/eth/node/BUILD.bazel b/beacon-chain/rpc/eth/node/BUILD.bazel index 5b35395a1b3..9d3b25185a7 100644 --- a/beacon-chain/rpc/eth/node/BUILD.bazel +++ b/beacon-chain/rpc/eth/node/BUILD.bazel @@ -23,7 +23,6 @@ go_library( "//network/httputil:go_default_library", "//proto/eth/v1:go_default_library", "//proto/migration:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_libp2p_go_libp2p//core/peer:go_default_library", @@ -50,7 +49,6 @@ go_test( "//consensus-types/primitives:go_default_library", "//consensus-types/wrapper:go_default_library", "//network/httputil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/rpc/eth/rewards/BUILD.bazel b/beacon-chain/rpc/eth/rewards/BUILD.bazel index 7636fab75e5..3926e3c605a 100644 --- a/beacon-chain/rpc/eth/rewards/BUILD.bazel +++ b/beacon-chain/rpc/eth/rewards/BUILD.bazel @@ -62,7 +62,6 @@ go_test( "//crypto/bls/blst:go_default_library", "//encoding/bytesutil:go_default_library", "//network/httputil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/rpc/eth/validator/BUILD.bazel b/beacon-chain/rpc/eth/validator/BUILD.bazel index ed434774d47..8427851162c 100644 --- a/beacon-chain/rpc/eth/validator/BUILD.bazel +++ b/beacon-chain/rpc/eth/validator/BUILD.bazel @@ -39,7 +39,6 @@ go_library( "//encoding/bytesutil:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", @@ -84,7 +83,6 @@ go_test( "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//network/httputil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/mock:go_default_library", diff --git a/beacon-chain/rpc/lookup/BUILD.bazel b/beacon-chain/rpc/lookup/BUILD.bazel index 59ae22c64af..9273767a76d 100644 --- a/beacon-chain/rpc/lookup/BUILD.bazel +++ b/beacon-chain/rpc/lookup/BUILD.bazel @@ -50,7 +50,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/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/rpc/prysm/beacon/BUILD.bazel b/beacon-chain/rpc/prysm/beacon/BUILD.bazel index d750ef3bbe2..46e4d2d6f9c 100644 --- a/beacon-chain/rpc/prysm/beacon/BUILD.bazel +++ b/beacon-chain/rpc/prysm/beacon/BUILD.bazel @@ -30,7 +30,6 @@ go_library( "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", "//proto/eth/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -66,7 +65,6 @@ go_test( "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//network/httputil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/rpc/prysm/node/BUILD.bazel b/beacon-chain/rpc/prysm/node/BUILD.bazel index cea92902b96..9535ccaff04 100644 --- a/beacon-chain/rpc/prysm/node/BUILD.bazel +++ b/beacon-chain/rpc/prysm/node/BUILD.bazel @@ -19,7 +19,6 @@ go_library( "//beacon-chain/sync:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_libp2p_go_libp2p//core/network:go_default_library", "@com_github_libp2p_go_libp2p//core/peer:go_default_library", "@com_github_pkg_errors//:go_default_library", diff --git a/beacon-chain/rpc/prysm/v1alpha1/beacon/BUILD.bazel b/beacon-chain/rpc/prysm/v1alpha1/beacon/BUILD.bazel index 81c180d28d4..48f27303596 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/beacon/BUILD.bazel +++ b/beacon-chain/rpc/prysm/v1alpha1/beacon/BUILD.bazel @@ -43,7 +43,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//container/slice:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", @@ -101,7 +100,6 @@ go_test( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/rpc/prysm/v1alpha1/debug/BUILD.bazel b/beacon-chain/rpc/prysm/v1alpha1/debug/BUILD.bazel index 1b6c7c66803..f97d60d2304 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/debug/BUILD.bazel +++ b/beacon-chain/rpc/prysm/v1alpha1/debug/BUILD.bazel @@ -21,7 +21,6 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "@com_github_ethereum_go_ethereum//log:go_default_library", "@com_github_golang_protobuf//ptypes/empty", @@ -54,7 +53,6 @@ go_test( "//config/fieldparams:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/rpc/prysm/v1alpha1/node/BUILD.bazel b/beacon-chain/rpc/prysm/v1alpha1/node/BUILD.bazel index 7331e4ddab5..106090d69b6 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/node/BUILD.bazel +++ b/beacon-chain/rpc/prysm/v1alpha1/node/BUILD.bazel @@ -13,7 +13,6 @@ go_library( "//beacon-chain/sync:go_default_library", "//io/logs:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "@com_github_golang_protobuf//ptypes/empty", "@com_github_golang_protobuf//ptypes/timestamp", @@ -39,7 +38,6 @@ go_test( "//beacon-chain/rpc/testutil:go_default_library", "//beacon-chain/sync/initial-sync/testing:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_attestations.go b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_attestations.go index 4446f853f2e..8c56049ca03 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_attestations.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_attestations.go @@ -128,6 +128,7 @@ func (a proposerAtts) filter(ctx context.Context, st state.BeaconState) (propose validAtts := make([]ethpb.Att, 0, len(a)) invalidAtts := make([]ethpb.Att, 0, len(a)) + primitives.Slot(0).Add(uint64(params.BeaconConfig().SlotsPerEpoch) * uint64(params.BeaconConfig().EpochsPerSyncCommitteePeriod)) for _, att := range a { if err := blocks.VerifyAttestationNoVerifySignature(ctx, st, att); err == nil { validAtts = append(validAtts, att) diff --git a/beacon-chain/rpc/prysm/validator/BUILD.bazel b/beacon-chain/rpc/prysm/validator/BUILD.bazel index 22baf6da1d2..ec9b345dd3a 100644 --- a/beacon-chain/rpc/prysm/validator/BUILD.bazel +++ b/beacon-chain/rpc/prysm/validator/BUILD.bazel @@ -19,7 +19,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -55,7 +54,6 @@ go_test( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/rpc/testutil/BUILD.bazel b/beacon-chain/rpc/testutil/BUILD.bazel index 10980a7152f..3eb7eaace6b 100644 --- a/beacon-chain/rpc/testutil/BUILD.bazel +++ b/beacon-chain/rpc/testutil/BUILD.bazel @@ -21,7 +21,6 @@ go_library( "//consensus-types/interfaces: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", ], diff --git a/beacon-chain/slasher/BUILD.bazel b/beacon-chain/slasher/BUILD.bazel index b0f0391ac11..22bbe0a4123 100644 --- a/beacon-chain/slasher/BUILD.bazel +++ b/beacon-chain/slasher/BUILD.bazel @@ -40,7 +40,6 @@ go_library( "//container/slice:go_default_library", "//encoding/bytesutil:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", @@ -82,7 +81,6 @@ go_test( "//crypto/bls:go_default_library", "//crypto/bls/common:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/slasher/types/BUILD.bazel b/beacon-chain/slasher/types/BUILD.bazel index 1da07521179..0fdb98fcfba 100644 --- a/beacon-chain/slasher/types/BUILD.bazel +++ b/beacon-chain/slasher/types/BUILD.bazel @@ -9,8 +9,5 @@ go_library( "//cmd/prysmctl:__subpackages__", "//testing/slasher/simulator:__subpackages__", ], - deps = [ - "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", - ], + deps = ["//consensus-types/primitives:go_default_library"], ) diff --git a/beacon-chain/state/BUILD.bazel b/beacon-chain/state/BUILD.bazel index 295cfa2110d..0e1c299ba8a 100644 --- a/beacon-chain/state/BUILD.bazel +++ b/beacon-chain/state/BUILD.bazel @@ -15,7 +15,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", "@com_github_prometheus_client_golang//prometheus/promauto:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", diff --git a/beacon-chain/state/fieldtrie/BUILD.bazel b/beacon-chain/state/fieldtrie/BUILD.bazel index d988845232e..f79bc9d7bdd 100644 --- a/beacon-chain/state/fieldtrie/BUILD.bazel +++ b/beacon-chain/state/fieldtrie/BUILD.bazel @@ -14,7 +14,6 @@ go_library( "//beacon-chain/state/stateutil:go_default_library", "//container/multi-value-slice:go_default_library", "//math:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", ], ) @@ -36,7 +35,6 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//container/multi-value-slice:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/state/genesis/BUILD.bazel b/beacon-chain/state/genesis/BUILD.bazel index 2c5a225e98a..7ad97141c4f 100644 --- a/beacon-chain/state/genesis/BUILD.bazel +++ b/beacon-chain/state/genesis/BUILD.bazel @@ -16,7 +16,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_golang_snappy//:go_default_library", ], ) diff --git a/beacon-chain/state/state-native/BUILD.bazel b/beacon-chain/state/state-native/BUILD.bazel index 6d14d26723d..6febe70dc32 100644 --- a/beacon-chain/state/state-native/BUILD.bazel +++ b/beacon-chain/state/state-native/BUILD.bazel @@ -74,7 +74,6 @@ go_library( "//math:go_default_library", "//monitoring/tracing/trace:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -143,7 +142,6 @@ go_test( "//crypto/rand:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", diff --git a/beacon-chain/state/stategen/BUILD.bazel b/beacon-chain/state/stategen/BUILD.bazel index d6d90003346..6a5f8c53ee1 100644 --- a/beacon-chain/state/stategen/BUILD.bazel +++ b/beacon-chain/state/stategen/BUILD.bazel @@ -36,7 +36,6 @@ go_library( "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@com_github_hashicorp_golang_lru//:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -81,7 +80,6 @@ go_test( "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/state/stateutil/BUILD.bazel b/beacon-chain/state/stateutil/BUILD.bazel index b9270e81c7e..34178756953 100644 --- a/beacon-chain/state/stateutil/BUILD.bazel +++ b/beacon-chain/state/stateutil/BUILD.bazel @@ -37,7 +37,6 @@ go_library( "//encoding/bytesutil:go_default_library", "//encoding/ssz:go_default_library", "//math:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", ], @@ -66,7 +65,6 @@ go_test( "//encoding/bytesutil:go_default_library", "//encoding/ssz:go_default_library", "//math:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/state/testing/BUILD.bazel b/beacon-chain/state/testing/BUILD.bazel index 0a053d670a2..a9468fa4b19 100644 --- a/beacon-chain/state/testing/BUILD.bazel +++ b/beacon-chain/state/testing/BUILD.bazel @@ -24,7 +24,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//crypto/bls/common:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", diff --git a/beacon-chain/sync/BUILD.bazel b/beacon-chain/sync/BUILD.bazel index a690b63ed10..13b9faa8464 100644 --- a/beacon-chain/sync/BUILD.bazel +++ b/beacon-chain/sync/BUILD.bazel @@ -75,7 +75,6 @@ go_library( "//beacon-chain/core/feed/operation:go_default_library", "//beacon-chain/core/feed/state:go_default_library", "//beacon-chain/core/helpers:go_default_library", - "//beacon-chain/core/light-client:go_default_library", "//beacon-chain/core/signing:go_default_library", "//beacon-chain/core/transition:go_default_library", "//beacon-chain/core/transition/interop:go_default_library", @@ -118,8 +117,6 @@ go_library( "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/forks:go_default_library", - "//proto/eth/v2:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//runtime:go_default_library", @@ -144,7 +141,6 @@ go_library( "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_trailofbits_go_mutexasserts//:go_default_library", - "@io_opencensus_go//trace:go_default_library", "@io_opentelemetry_go_otel_trace//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", ], @@ -247,7 +243,6 @@ go_test( "//network/forks:go_default_library", "//proto/engine/v1:go_default_library", "//proto/eth/v2:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//testing/assert:go_default_library", diff --git a/beacon-chain/sync/backfill/BUILD.bazel b/beacon-chain/sync/backfill/BUILD.bazel index 90e7dbbd44a..68d69dcbdcc 100644 --- a/beacon-chain/sync/backfill/BUILD.bazel +++ b/beacon-chain/sync/backfill/BUILD.bazel @@ -37,7 +37,6 @@ go_library( "//encoding/bytesutil:go_default_library", "//network/forks:go_default_library", "//proto/dbval:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", diff --git a/beacon-chain/sync/initial-sync/BUILD.bazel b/beacon-chain/sync/initial-sync/BUILD.bazel index 1291f2fc20f..94a21d3276c 100644 --- a/beacon-chain/sync/initial-sync/BUILD.bazel +++ b/beacon-chain/sync/initial-sync/BUILD.bazel @@ -40,7 +40,6 @@ go_library( "//crypto/rand:go_default_library", "//math:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime:go_default_library", "//runtime/version:go_default_library", "//time:go_default_library", @@ -94,7 +93,6 @@ go_test( "//container/slice:go_default_library", "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/sync/rpc.go b/beacon-chain/sync/rpc.go index 0fe42e750a4..4ae35c73590 100644 --- a/beacon-chain/sync/rpc.go +++ b/beacon-chain/sync/rpc.go @@ -98,6 +98,19 @@ func (s *Service) registerRPCHandlersAltair() { ) s.registerRPC( p2p.RPCLightClientBootstrapTopicV1, + s.lightClientBootstrapRPCHandler, + ) + s.registerRPC( + p2p.RPCLightClientUpdatesByRangeTopicV1, + s.lightClientUpdatesByRangeRPCHandler, + ) + s.registerRPC( + p2p.RPCLightClientFinalityUpdateTopicV1, + s.lightClientFinalityUpdateRPCHandler, + ) + s.registerRPC( + p2p.RPCLightClientOptimisticUpdateTopicV1, + s.lightClientOptimisticUpdateRPCHandler, ) } @@ -159,8 +172,8 @@ func (s *Service) registerRPC(baseTopic string, handle rpcHandler) { ctx, span := trace.StartSpan(ctx, "sync.rpc") defer span.End() - span.AddAttributes(trace.StringAttribute("topic", topic)) - span.AddAttributes(trace.StringAttribute("peer", stream.Conn().RemotePeer().String())) + span.SetAttributes(trace.StringAttribute("topic", topic)) + span.SetAttributes(trace.StringAttribute("peer", stream.Conn().RemotePeer().String())) log := log.WithField("peer", stream.Conn().RemotePeer().String()).WithField("topic", string(stream.Protocol())) // Check before hand that peer is valid. diff --git a/beacon-chain/sync/rpc_chunked_response.go b/beacon-chain/sync/rpc_chunked_response.go index 6eac6fc8ff3..42564f2d4d1 100644 --- a/beacon-chain/sync/rpc_chunked_response.go +++ b/beacon-chain/sync/rpc_chunked_response.go @@ -155,3 +155,99 @@ func WriteBlobSidecarChunk(stream libp2pcore.Stream, tor blockchain.TemporalOrac _, err = encoding.EncodeWithMaxLength(stream, sidecar) return err } + +func WriteLightClientBootstrapChunk( + stream libp2pcore.Stream, + tor blockchain.TemporalOracle, + encoding encoder.NetworkEncoding, + bootstrap interfaces.LightClientBootstrap, +) error { + if _, err := stream.Write([]byte{responseCodeSuccess}); err != nil { + return err + } + + var obtainedCtx []byte + valRoot := tor.GenesisValidatorsRoot() + switch v := bootstrap.Version(); v { + case version.Altair: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().AltairForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + case version.Capella: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().CapellaForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + case version.Deneb: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().DenebForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + case version.Electra: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().ElectraForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + default: + return errors.Wrapf(ErrUnrecognizedVersion, "light client boostrap version %s is not recognized", version.String(v)) + } + + if err := writeContextToStream(obtainedCtx, stream); err != nil { + return err + } + _, err := encoding.EncodeWithMaxLength(stream, bootstrap) + return err +} + +func WriteLightClientBootstrapChunk( + stream libp2pcore.Stream, + tor blockchain.TemporalOracle, + encoding encoder.NetworkEncoding, + bootstrap interfaces.LightClientBootstrap, +) error { + if _, err := stream.Write([]byte{responseCodeSuccess}); err != nil { + return err + } + + var obtainedCtx []byte + valRoot := tor.GenesisValidatorsRoot() + switch v := bootstrap.Version(); v { + case version.Altair: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().AltairForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + case version.Capella: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().CapellaForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + case version.Deneb: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().DenebForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + case version.Electra: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().ElectraForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + default: + return errors.Wrapf(ErrUnrecognizedVersion, "light client boostrap version %s is not recognized", version.String(v)) + } + + if err := writeContextToStream(obtainedCtx, stream); err != nil { + return err + } + _, err := encoding.EncodeWithMaxLength(stream, bootstrap) + return err +} diff --git a/beacon-chain/sync/rpc_light_client.go b/beacon-chain/sync/rpc_light_client.go index b8ed790eb5a..48478176c7f 100644 --- a/beacon-chain/sync/rpc_light_client.go +++ b/beacon-chain/sync/rpc_light_client.go @@ -5,16 +5,9 @@ import ( "fmt" libp2pcore "github.com/libp2p/go-libp2p/core" - "github.com/pkg/errors" - light_client "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/light-client" - "github.com/prysmaticlabs/prysm/v5/beacon-chain/db" "github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p" "github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p/types" - "github.com/prysmaticlabs/prysm/v5/config/params" - "github.com/prysmaticlabs/prysm/v5/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/v5/monitoring/tracing" "github.com/prysmaticlabs/prysm/v5/monitoring/tracing/trace" - "github.com/sirupsen/logrus" ) // blobSidecarByRootRPCHandler handles the /eth2/beacon_chain/req/blob_sidecars_by_root/1/ RPC request. @@ -24,75 +17,43 @@ func (s *Service) lightClientBootstrapRPCHandler(ctx context.Context, msg interf defer span.End() ctx, cancel := context.WithTimeout(ctx, ttfbTimeout) defer cancel() - SetRPCStreamDeadlines(stream) + + // TODO: What should we log? log := log.WithField("handler", p2p.LightClientBootstrapName[1:]) // slice the leading slash off the name var - req, ok := msg.(*types.LightClientBootstrapReq) + + SetRPCStreamDeadlines(stream) + if err := s.rateLimiter.validateRequest(stream, 1); err != nil { + return err + } + s.rateLimiter.add(stream, 1) + + rawMsg, ok := msg.(*types.LightClientBootstrapReq) if !ok { - return errors.New("message is not type LightClientBootstrapReq") + return fmt.Errorf("message is not type %T", &types.LightClientBootstrapReq{}) } + blkRoot := *rawMsg - // TODO: rate limit? - block, err := s.cfg.beaconDB.Block(ctx, *req) + bootstrap, err := s.cfg.beaconDB.LightClientBootstrap(ctx, blkRoot) if err != nil { - s.writeErrorResponseToStream(responseCodeServerError) - } else if block.IsNil() { - s.writeErrorResponseToStream(responseCodeInvalidRequest) + s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) + return err + } + if err = WriteLightClientBootstrapChunk(stream, s.cfg.clock, s.cfg.p2p.Encoding(), bootstrap); err != nil { + return err } - light_client.CreateLightClientBootstrap(ctx) - - for i := range blobIdents { - if err := ctx.Err(); err != nil { - closeStream(stream, log) - return err - } - - // Throttle request processing to no more than batchSize/sec. - if i != 0 && i%batchSize == 0 && ticker != nil { - <-ticker.C - } - s.rateLimiter.add(stream, 1) - root, idx := bytesutil.ToBytes32(blobIdents[i].BlockRoot), blobIdents[i].Index - sc, err := s.cfg.blobStorage.Get(root, idx) - if err != nil { - if db.IsNotFound(err) { - log.WithError(err).WithFields(logrus.Fields{ - "root": fmt.Sprintf("%#x", root), - "index": idx, - }).Debugf("Peer requested blob sidecar by root not found in db") - continue - } - log.WithError(err).Errorf("unexpected db error retrieving BlobSidecar, root=%x, index=%d", root, idx) - s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) - return err - } + closeStream(stream, log) + return nil +} - // If any root in the request content references a block earlier than minimum_request_epoch, - // peers MAY respond with error code 3: ResourceUnavailable or not include the blob in the response. - // note: we are deviating from the spec to allow requests for blobs that are before minimum_request_epoch, - // up to the beginning of the retention period. - if sc.Slot() < minReqSlot { - s.writeErrorResponseToStream(responseCodeResourceUnavailable, types.ErrBlobLTMinRequest.Error(), stream) - log.WithError(types.ErrBlobLTMinRequest). - Debugf("requested blob for block %#x before minimum_request_epoch", blobIdents[i].BlockRoot) - return types.ErrBlobLTMinRequest - } +func (s *Service) lightClientUpdatesByRangeRPCHandler(ctx context.Context, msg interface{}, stream libp2pcore.Stream) error { + return nil +} - SetStreamWriteDeadline(stream, defaultWriteDuration) - if chunkErr := WriteBlobSidecarChunk(stream, s.cfg.chain, s.cfg.p2p.Encoding(), sc); chunkErr != nil { - log.WithError(chunkErr).Debug("Could not send a chunked response") - s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) - tracing.AnnotateError(span, chunkErr) - return chunkErr - } - } - closeStream(stream, log) +func (s *Service) lightClientFinalityUpdateRPCHandler(ctx context.Context, msg interface{}, stream libp2pcore.Stream) error { return nil } -func validateBlobByRootRequest(blobIdents types.BlobSidecarsByRootReq) error { - if uint64(len(blobIdents)) > params.BeaconConfig().MaxRequestBlobSidecars { - return types.ErrMaxBlobReqExceeded - } +func (s *Service) lightClientOptimisticUpdateRPCHandler(ctx context.Context, msg interface{}, stream libp2pcore.Stream) error { return nil } diff --git a/beacon-chain/sync/service.go b/beacon-chain/sync/service.go index 799ab29aade..26d610dcf54 100644 --- a/beacon-chain/sync/service.go +++ b/beacon-chain/sync/service.go @@ -87,25 +87,25 @@ type lcOptimisticUpdateInfo struct { // config to hold dependencies for the sync service. type config struct { - attestationNotifier operation.Notifier - p2p p2p.P2P - beaconDB db.NoHeadAccessDatabase - attPool attestations.Pool - exitPool voluntaryexits.PoolManager - slashingPool slashings.PoolManager - syncCommsPool synccommittee.Pool - blsToExecPool blstoexec.PoolManager - chain blockchainService - initialSync Checker - blockNotifier blockfeed.Notifier - operationNotifier operation.Notifier - executionPayloadReconstructor execution.PayloadReconstructor - stateGen *stategen.State - slasherAttestationsFeed *event.Feed - slasherBlockHeadersFeed *event.Feed - clock *startup.Clock - stateNotifier statefeed.Notifier - blobStorage *filesystem.BlobStorage + attestationNotifier operation.Notifier + p2p p2p.P2P + beaconDB db.NoHeadAccessDatabase + attPool attestations.Pool + exitPool voluntaryexits.PoolManager + slashingPool slashings.PoolManager + syncCommsPool synccommittee.Pool + blsToExecPool blstoexec.PoolManager + chain blockchainService + initialSync Checker + blockNotifier blockfeed.Notifier + operationNotifier operation.Notifier + executionReconstructor execution.Reconstructor + stateGen *stategen.State + slasherAttestationsFeed *event.Feed + slasherBlockHeadersFeed *event.Feed + clock *startup.Clock + stateNotifier statefeed.Notifier + blobStorage *filesystem.BlobStorage } // This defines the interface for interacting with block chain service diff --git a/beacon-chain/sync/subscriber.go b/beacon-chain/sync/subscriber.go index 4700f0074ae..3406bd17183 100644 --- a/beacon-chain/sync/subscriber.go +++ b/beacon-chain/sync/subscriber.go @@ -24,12 +24,12 @@ import ( "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" "github.com/prysmaticlabs/prysm/v5/container/slice" "github.com/prysmaticlabs/prysm/v5/monitoring/tracing" + "github.com/prysmaticlabs/prysm/v5/monitoring/tracing/trace" "github.com/prysmaticlabs/prysm/v5/network/forks" ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/v5/runtime/messagehandler" "github.com/prysmaticlabs/prysm/v5/time/slots" "github.com/sirupsen/logrus" - "go.opencensus.io/trace" "google.golang.org/protobuf/proto" ) @@ -220,7 +220,7 @@ func (s *Service) subscribeWithBase(topic string, validator wrappedVal, handle s } }() - span.AddAttributes(trace.StringAttribute("topic", topic)) + span.SetAttributes(trace.StringAttribute("topic", topic)) if msg.ValidatorData == nil { log.Error("Received nil message on pubsub") diff --git a/beacon-chain/sync/subscriber_light_client.go b/beacon-chain/sync/subscriber_light_client.go index 8f9da30ea18..288d941d6c8 100644 --- a/beacon-chain/sync/subscriber_light_client.go +++ b/beacon-chain/sync/subscriber_light_client.go @@ -9,9 +9,9 @@ import ( // TODO: event feed func (s *Service) lightClientFinalityUpdateSubscriber(_ context.Context, msg proto.Message) error { - + return nil } func (s *Service) lightClientOptimisticUpdateSubscriber(_ context.Context, msg proto.Message) error { - + return nil } diff --git a/beacon-chain/sync/validate_light_client.go b/beacon-chain/sync/validate_light_client.go index fb29d50d36b..42303c9ec0f 100644 --- a/beacon-chain/sync/validate_light_client.go +++ b/beacon-chain/sync/validate_light_client.go @@ -7,10 +7,10 @@ import ( pubsub "github.com/libp2p/go-libp2p-pubsub" "github.com/libp2p/go-libp2p/core/peer" "github.com/prysmaticlabs/prysm/v5/config/params" + "github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces" "github.com/prysmaticlabs/prysm/v5/monitoring/tracing" - "github.com/prysmaticlabs/prysm/v5/proto/eth/v2" + "github.com/prysmaticlabs/prysm/v5/monitoring/tracing/trace" "github.com/prysmaticlabs/prysm/v5/time/slots" - "go.opencensus.io/trace" ) func (s *Service) validateLightClientFinalityUpdate(ctx context.Context, pid peer.ID, msg *pubsub.Message) (pubsub.ValidationResult, error) { @@ -35,7 +35,7 @@ func (s *Service) validateLightClientFinalityUpdate(ctx context.Context, pid pee return pubsub.ValidationReject, err } - update, ok := m.(*eth.LightClientFinalityUpdate) + update, ok := m.(interfaces.LightClientFinalityUpdate) if !ok { return pubsub.ValidationReject, errWrongMessage } @@ -48,10 +48,10 @@ func (s *Service) validateLightClientFinalityUpdate(ctx context.Context, pid pee // [IGNORE] The finalized_header.beacon.slot is greater than that of all previously forwarded finality_updates, // or it matches the highest previously forwarded slot and also has a sync_aggregate indicating supermajority (> 2/3) // sync committee participation while the previously forwarded finality_update for that slot did not indicate supermajority - if update.FinalizedHeader.Beacon.Slot < last.slot { + if update.FinalizedHeader().Beacon().Slot < last.slot { return pubsub.ValidationIgnore, nil } - if update.FinalizedHeader.Beacon.Slot == last.slot && (last.hasSupermajority || !update.HasSupermajority()) { + if update.FinalizedHeader().Beacon().Slot == last.slot && (last.hasSupermajority || !update.HasSupermajority()) { return pubsub.ValidationIgnore, nil } } @@ -59,7 +59,7 @@ func (s *Service) validateLightClientFinalityUpdate(ctx context.Context, pid pee // to propagate through the network -- i.e. validate that one-third of finality_update.signature_slot // has transpired (SECONDS_PER_SLOT / INTERVALS_PER_SLOT seconds after the start of the slot, // with a MAXIMUM_GOSSIP_CLOCK_DISPARITY allowance) - earliestValidTime := slots.StartTime(uint64(s.cfg.clock.GenesisTime().Unix()), update.FinalizedHeader.Beacon.Slot). + earliestValidTime := slots.StartTime(uint64(s.cfg.clock.GenesisTime().Unix()), update.FinalizedHeader().Beacon().Slot). Add(time.Second * time.Duration(params.BeaconConfig().SecondsPerSlot/params.BeaconConfig().IntervalsPerSlot)). Add(-params.BeaconConfig().MaximumGossipClockDisparityDuration()) if s.cfg.clock.Now().Before(earliestValidTime) { @@ -67,7 +67,7 @@ func (s *Service) validateLightClientFinalityUpdate(ctx context.Context, pid pee } s.lastLCFinalityUpdate = &lcFinalityUpdateInfo{ - slot: update.FinalizedHeader.Beacon.Slot, + slot: update.FinalizedHeader().Beacon().Slot, hasSupermajority: update.HasSupermajority(), } @@ -96,7 +96,7 @@ func (s *Service) validateLightClientOptimisticUpdate(ctx context.Context, pid p return pubsub.ValidationReject, err } - update, ok := m.(*eth.LightClientOptimisticUpdate) + update, ok := m.(interfaces.LightClientOptimisticUpdate) if !ok { return pubsub.ValidationReject, errWrongMessage } @@ -107,7 +107,7 @@ func (s *Service) validateLightClientOptimisticUpdate(ctx context.Context, pid p last := s.lastLCOptimisticUpdate if last != nil { // [IGNORE] The attested_header.beacon.slot is greater than that of all previously forwarded optimistic_updates - if update.AttestedHeader.Beacon.Slot <= last.slot { + if update.AttestedHeader().Beacon().Slot <= last.slot { return pubsub.ValidationIgnore, nil } } @@ -115,7 +115,7 @@ func (s *Service) validateLightClientOptimisticUpdate(ctx context.Context, pid p // to propagate through the network -- i.e. validate that one-third of optimistic_update.signature_slot // has transpired (SECONDS_PER_SLOT / INTERVALS_PER_SLOT seconds after the start of the slot, // with a MAXIMUM_GOSSIP_CLOCK_DISPARITY allowance) - earliestValidTime := slots.StartTime(uint64(s.cfg.clock.GenesisTime().Unix()), update.AttestedHeader.Beacon.Slot). + earliestValidTime := slots.StartTime(uint64(s.cfg.clock.GenesisTime().Unix()), update.AttestedHeader().Beacon().Slot). Add(time.Second * time.Duration(params.BeaconConfig().SecondsPerSlot/params.BeaconConfig().IntervalsPerSlot)). Add(-params.BeaconConfig().MaximumGossipClockDisparityDuration()) if s.cfg.clock.Now().Before(earliestValidTime) { @@ -123,7 +123,7 @@ func (s *Service) validateLightClientOptimisticUpdate(ctx context.Context, pid p } s.lastLCOptimisticUpdate = &lcOptimisticUpdateInfo{ - slot: update.AttestedHeader.Beacon.Slot, + slot: update.AttestedHeader().Beacon().Slot, } return pubsub.ValidationAccept, nil diff --git a/beacon-chain/verification/BUILD.bazel b/beacon-chain/verification/BUILD.bazel index fa95e5451e6..6b863a8bb6c 100644 --- a/beacon-chain/verification/BUILD.bazel +++ b/beacon-chain/verification/BUILD.bazel @@ -32,7 +32,6 @@ go_library( "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//network/forks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/logging:go_default_library", "//time/slots:go_default_library", "@com_github_hashicorp_golang_lru//:go_default_library", @@ -65,7 +64,6 @@ go_test( "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/cmd/prysmctl/p2p/BUILD.bazel b/cmd/prysmctl/p2p/BUILD.bazel index 712f4756a89..415877c3d0d 100644 --- a/cmd/prysmctl/p2p/BUILD.bazel +++ b/cmd/prysmctl/p2p/BUILD.bazel @@ -32,7 +32,6 @@ go_library( "//monitoring/tracing/trace:go_default_library", "//network:go_default_library", "//network/forks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", diff --git a/cmd/prysmctl/testnet/BUILD.bazel b/cmd/prysmctl/testnet/BUILD.bazel index c0e1f07e8f4..744c3f321cb 100644 --- a/cmd/prysmctl/testnet/BUILD.bazel +++ b/cmd/prysmctl/testnet/BUILD.bazel @@ -14,7 +14,6 @@ go_library( "//config/params:go_default_library", "//container/trie:go_default_library", "//io/file:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//runtime/version:go_default_library", "@com_github_ethereum_go_ethereum//core:go_default_library", diff --git a/cmd/validator/accounts/BUILD.bazel b/cmd/validator/accounts/BUILD.bazel index e9b072c623f..7dcfbf1861b 100644 --- a/cmd/validator/accounts/BUILD.bazel +++ b/cmd/validator/accounts/BUILD.bazel @@ -19,7 +19,6 @@ go_library( "//cmd/validator/flags:go_default_library", "//config/features:go_default_library", "//io/prompt:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/tos:go_default_library", "//validator/accounts:go_default_library", "//validator/accounts/iface:go_default_library", @@ -55,7 +54,6 @@ go_test( "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/validator-mock:go_default_library", diff --git a/consensus-types/blocks/BUILD.bazel b/consensus-types/blocks/BUILD.bazel index 32ba9157fe4..a92589f6df7 100644 --- a/consensus-types/blocks/BUILD.bazel +++ b/consensus-types/blocks/BUILD.bazel @@ -30,7 +30,6 @@ go_library( "//encoding/ssz:go_default_library", "//monitoring/tracing/trace:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//runtime/version:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -61,7 +60,6 @@ go_test( "//container/trie:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", diff --git a/consensus-types/blocks/testing/BUILD.bazel b/consensus-types/blocks/testing/BUILD.bazel index 32cb182180b..f83ad46fa60 100644 --- a/consensus-types/blocks/testing/BUILD.bazel +++ b/consensus-types/blocks/testing/BUILD.bazel @@ -13,7 +13,6 @@ go_library( "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", ], ) diff --git a/consensus-types/forkchoice/BUILD.bazel b/consensus-types/forkchoice/BUILD.bazel index e9cd60765b6..3ddf22c6c72 100644 --- a/consensus-types/forkchoice/BUILD.bazel +++ b/consensus-types/forkchoice/BUILD.bazel @@ -5,8 +5,5 @@ go_library( srcs = ["types.go"], importpath = "github.com/prysmaticlabs/prysm/v5/consensus-types/forkchoice", visibility = ["//visibility:public"], - deps = [ - "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", - ], + deps = ["//consensus-types/primitives:go_default_library"], ) diff --git a/consensus-types/interfaces/BUILD.bazel b/consensus-types/interfaces/BUILD.bazel index 51b9c89816c..557ac8fbf1d 100644 --- a/consensus-types/interfaces/BUILD.bazel +++ b/consensus-types/interfaces/BUILD.bazel @@ -15,7 +15,6 @@ go_library( "//config/fieldparams:go_default_library", "//consensus-types/primitives:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//runtime/version:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -35,7 +34,6 @@ go_test( "//config/fieldparams:go_default_library", "//consensus-types/blocks:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/consensus-types/light-client/BUILD.bazel b/consensus-types/light-client/BUILD.bazel index 78432c8eecb..5f284cdedc2 100644 --- a/consensus-types/light-client/BUILD.bazel +++ b/consensus-types/light-client/BUILD.bazel @@ -20,7 +20,6 @@ go_library( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", diff --git a/consensus-types/mock/BUILD.bazel b/consensus-types/mock/BUILD.bazel index e7ce82febd6..e8adf862cc6 100644 --- a/consensus-types/mock/BUILD.bazel +++ b/consensus-types/mock/BUILD.bazel @@ -11,7 +11,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//proto/engine/v1:go_default_library", "//proto/eth/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", diff --git a/consensus-types/wrapper/BUILD.bazel b/consensus-types/wrapper/BUILD.bazel index d4e5da02244..e108effa0b6 100644 --- a/consensus-types/wrapper/BUILD.bazel +++ b/consensus-types/wrapper/BUILD.bazel @@ -6,7 +6,6 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/v5/consensus-types/wrapper", visibility = ["//visibility:public"], deps = [ - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//runtime/version:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", diff --git a/container/trie/BUILD.bazel b/container/trie/BUILD.bazel index 0cd71124692..0183c4bf789 100644 --- a/container/trie/BUILD.bazel +++ b/container/trie/BUILD.bazel @@ -11,7 +11,6 @@ go_library( deps = [ "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", ], ) @@ -31,7 +30,6 @@ go_test( "//contracts/deposit/mock:go_default_library", "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "@com_github_ethereum_go_ethereum//accounts/abi/bind:go_default_library", diff --git a/contracts/deposit/BUILD.bazel b/contracts/deposit/BUILD.bazel index 0964bc0d8dd..4b9ef43b4dd 100644 --- a/contracts/deposit/BUILD.bazel +++ b/contracts/deposit/BUILD.bazel @@ -15,7 +15,6 @@ go_library( "//config/params:go_default_library", "//crypto/bls:go_default_library", "//crypto/hash:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_ethereum_go_ethereum//:go_default_library", "@com_github_ethereum_go_ethereum//accounts/abi:go_default_library", "@com_github_ethereum_go_ethereum//accounts/abi/bind:go_default_library", @@ -41,7 +40,6 @@ go_test( "//container/trie:go_default_library", "//contracts/deposit/mock:go_default_library", "//crypto/bls:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/crypto/hash/BUILD.bazel b/crypto/hash/BUILD.bazel index 409b2fd2bc0..3515ad9952f 100644 --- a/crypto/hash/BUILD.bazel +++ b/crypto/hash/BUILD.bazel @@ -23,7 +23,6 @@ go_test( ":go_default_library", "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/testing:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/encoding/ssz/BUILD.bazel b/encoding/ssz/BUILD.bazel index 90f31e0f4b2..3da5699debd 100644 --- a/encoding/ssz/BUILD.bazel +++ b/encoding/ssz/BUILD.bazel @@ -17,7 +17,6 @@ go_library( "//crypto/hash/htr:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_minio_sha256_simd//:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", @@ -43,7 +42,6 @@ go_test( "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "@com_github_pkg_errors//:go_default_library", diff --git a/encoding/ssz/detect/BUILD.bazel b/encoding/ssz/detect/BUILD.bazel index c409403fc96..4ad8845419e 100644 --- a/encoding/ssz/detect/BUILD.bazel +++ b/encoding/ssz/detect/BUILD.bazel @@ -18,7 +18,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//network/forks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -40,7 +39,6 @@ go_test( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/encoding/ssz/equality/BUILD.bazel b/encoding/ssz/equality/BUILD.bazel index 4c67be0035a..c810c92bb2b 100644 --- a/encoding/ssz/equality/BUILD.bazel +++ b/encoding/ssz/equality/BUILD.bazel @@ -16,7 +16,6 @@ go_test( srcs = ["deep_equal_test.go"], deps = [ ":go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", ], ) diff --git a/monitoring/clientstats/BUILD.bazel b/monitoring/clientstats/BUILD.bazel index abfc754bec5..279c986592b 100644 --- a/monitoring/clientstats/BUILD.bazel +++ b/monitoring/clientstats/BUILD.bazel @@ -11,7 +11,6 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/v5/monitoring/clientstats", visibility = ["//visibility:public"], deps = [ - "//proto/prysm/v1alpha1:go_default_library", "@com_github_prometheus_client_model//go:go_default_library", "@com_github_prometheus_prom2json//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", diff --git a/network/forks/BUILD.bazel b/network/forks/BUILD.bazel index 3d84e93ec32..f66fdbb90a4 100644 --- a/network/forks/BUILD.bazel +++ b/network/forks/BUILD.bazel @@ -15,7 +15,6 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", ], @@ -32,7 +31,6 @@ go_test( "//beacon-chain/core/signing:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", ], diff --git a/proto/migration/BUILD.bazel b/proto/migration/BUILD.bazel index 154b51281fe..2ea8405c1f1 100644 --- a/proto/migration/BUILD.bazel +++ b/proto/migration/BUILD.bazel @@ -13,7 +13,6 @@ go_library( "//encoding/bytesutil:go_default_library", "//proto/eth/v1:go_default_library", "//proto/eth/v2:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", ], ) @@ -28,7 +27,6 @@ go_test( deps = [ "//consensus-types/primitives:go_default_library", "//proto/eth/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", ], diff --git a/proto/prysm/v1alpha1/BUILD.bazel b/proto/prysm/v1alpha1/BUILD.bazel index 524409b9974..6ad6ab187cf 100644 --- a/proto/prysm/v1alpha1/BUILD.bazel +++ b/proto/prysm/v1alpha1/BUILD.bazel @@ -32,7 +32,6 @@ proto_library( deps = [ "//proto/engine/v1:proto", "//proto/eth/ext:proto", - "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_proto", "@com_google_protobuf//:any_proto", "@com_google_protobuf//:descriptor_proto", "@com_google_protobuf//:empty_proto", @@ -288,7 +287,6 @@ go_proto_library( "//proto/engine/v1:go_default_library", "//proto/eth/ext:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@googleapis//google/api:annotations_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", @@ -302,29 +300,6 @@ go_proto_library( ], ) -go_proto_library( - name = "go_grpc_gateway_library", - compilers = [ - "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-grpc-gateway:go_gen_grpc_gateway", - ], - embed = [":go_proto"], - importpath = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1", - protos = [":proto"], - visibility = ["//visibility:private"], - deps = [ - "//proto/engine/v1:go_default_library", - "//proto/eth/ext:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", - "@com_github_prysmaticlabs_go_bitfield//:go_default_library", - "@googleapis//google/api:annotations_go_proto", - "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", - "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", - "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", - "@org_golang_google_protobuf//types/descriptorpb:go_default_library", - "@org_golang_google_protobuf//types/known/emptypb:go_default_library", - ], -) - go_library( name = "go_default_library", srcs = [ @@ -342,9 +317,6 @@ go_library( ":ssz_generated_non_core", # keep ":ssz_generated_phase0", # keep ], - embed = [ - ":go_grpc_gateway_library", - ], importpath = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1", visibility = ["//visibility:public"], deps = SSZ_DEPS + [ @@ -355,9 +327,6 @@ go_library( "//runtime/version:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", - "@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//utilities:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", # keep "@googleapis//google/api:annotations_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", @@ -382,6 +351,7 @@ ssz_proto_files( "beacon_block.proto", "beacon_state.proto", "blobs.proto", + "light_client.proto", "sync_committee.proto", "withdrawals.proto", ], diff --git a/proto/prysm/v1alpha1/attestation/BUILD.bazel b/proto/prysm/v1alpha1/attestation/BUILD.bazel index c27b0bf90d3..c3ba6652ee2 100644 --- a/proto/prysm/v1alpha1/attestation/BUILD.bazel +++ b/proto/prysm/v1alpha1/attestation/BUILD.bazel @@ -16,7 +16,6 @@ go_library( "//crypto/bls:go_default_library", "//crypto/hash:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", @@ -34,7 +33,6 @@ go_test( "//config/fieldparams:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/proto/prysm/v1alpha1/attestation/aggregation/attestations/BUILD.bazel b/proto/prysm/v1alpha1/attestation/aggregation/attestations/BUILD.bazel index 1d67021b256..6a8dfac77e8 100644 --- a/proto/prysm/v1alpha1/attestation/aggregation/attestations/BUILD.bazel +++ b/proto/prysm/v1alpha1/attestation/aggregation/attestations/BUILD.bazel @@ -10,7 +10,6 @@ go_library( visibility = ["//visibility:public"], deps = [ "//crypto/bls:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation:go_default_library", "//runtime/version:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -30,7 +29,6 @@ go_test( "//config/params:go_default_library", "//crypto/bls:go_default_library", "//encoding/ssz/equality:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/testing:go_default_library", "//testing/assert:go_default_library", diff --git a/proto/prysm/v1alpha1/attestation/aggregation/sync_contribution/BUILD.bazel b/proto/prysm/v1alpha1/attestation/aggregation/sync_contribution/BUILD.bazel index d644dfb4751..48ee7c73886 100644 --- a/proto/prysm/v1alpha1/attestation/aggregation/sync_contribution/BUILD.bazel +++ b/proto/prysm/v1alpha1/attestation/aggregation/sync_contribution/BUILD.bazel @@ -10,7 +10,6 @@ go_library( visibility = ["//visibility:public"], deps = [ "//crypto/bls:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", @@ -23,7 +22,6 @@ go_test( embed = [":go_default_library"], deps = [ "//crypto/bls:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/testing:go_default_library", "//testing/assert:go_default_library", diff --git a/proto/prysm/v1alpha1/attestation/aggregation/testing/BUILD.bazel b/proto/prysm/v1alpha1/attestation/aggregation/testing/BUILD.bazel index 220bbe96bfb..159477e2e82 100644 --- a/proto/prysm/v1alpha1/attestation/aggregation/testing/BUILD.bazel +++ b/proto/prysm/v1alpha1/attestation/aggregation/testing/BUILD.bazel @@ -9,7 +9,6 @@ go_library( deps = [ "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//time:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", ], diff --git a/proto/prysm/v1alpha1/electra.ssz.go b/proto/prysm/v1alpha1/electra.ssz.go index 95a8c2fe87e..47298aab030 100644 --- a/proto/prysm/v1alpha1/electra.ssz.go +++ b/proto/prysm/v1alpha1/electra.ssz.go @@ -1,5 +1,5 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: 734bb55036e8fc3dc75bec7202483b74acd4f33b48e3e9956ffd5cd8de0a07f1 +// Hash: 007354908a3d6e7c735330bd4999fc70df71e307e7270a4f8935ff88d98af8c0 package eth import ( @@ -862,215 +862,6 @@ func (s *SignedBeaconBlockContentsElectra) HashTreeRootWith(hh *ssz.Hasher) (err return } -// MarshalSSZ ssz marshals the BeaconBlockContentsElectra object -func (b *BeaconBlockContentsElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockContentsElectra object to a target array -func (b *BeaconBlockContentsElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(12) - - // Offset (0) 'Block' - dst = ssz.WriteOffset(dst, offset) - if b.Block == nil { - b.Block = new(BeaconBlockElectra) - } - offset += b.Block.SizeSSZ() - - // Offset (1) 'KzgProofs' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.KzgProofs) * 48 - - // Offset (2) 'Blobs' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Blobs) * 131072 - - // Field (0) 'Block' - if dst, err = b.Block.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'KzgProofs' - if size := len(b.KzgProofs); size > 4096 { - err = ssz.ErrListTooBigFn("--.KzgProofs", size, 4096) - return - } - for ii := 0; ii < len(b.KzgProofs); ii++ { - if size := len(b.KzgProofs[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.KzgProofs[ii]", size, 48) - return - } - dst = append(dst, b.KzgProofs[ii]...) - } - - // Field (2) 'Blobs' - if size := len(b.Blobs); size > 4096 { - err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) - return - } - for ii := 0; ii < len(b.Blobs); ii++ { - if size := len(b.Blobs[ii]); size != 131072 { - err = ssz.ErrBytesLengthFn("--.Blobs[ii]", size, 131072) - return - } - dst = append(dst, b.Blobs[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockContentsElectra object -func (b *BeaconBlockContentsElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 12 { - return ssz.ErrSize - } - - tail := buf - var o0, o1, o2 uint64 - - // Offset (0) 'Block' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 != 12 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (1) 'KzgProofs' - if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { - return ssz.ErrOffset - } - - // Offset (2) 'Blobs' - if o2 = ssz.ReadOffset(buf[8:12]); o2 > size || o1 > o2 { - return ssz.ErrOffset - } - - // Field (0) 'Block' - { - buf = tail[o0:o1] - if b.Block == nil { - b.Block = new(BeaconBlockElectra) - } - if err = b.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (1) 'KzgProofs' - { - buf = tail[o1:o2] - num, err := ssz.DivideInt2(len(buf), 48, 4096) - if err != nil { - return err - } - b.KzgProofs = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.KzgProofs[ii]) == 0 { - b.KzgProofs[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) - } - b.KzgProofs[ii] = append(b.KzgProofs[ii], buf[ii*48:(ii+1)*48]...) - } - } - - // Field (2) 'Blobs' - { - buf = tail[o2:] - num, err := ssz.DivideInt2(len(buf), 131072, 4096) - if err != nil { - return err - } - b.Blobs = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.Blobs[ii]) == 0 { - b.Blobs[ii] = make([]byte, 0, len(buf[ii*131072:(ii+1)*131072])) - } - b.Blobs[ii] = append(b.Blobs[ii], buf[ii*131072:(ii+1)*131072]...) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockContentsElectra object -func (b *BeaconBlockContentsElectra) SizeSSZ() (size int) { - size = 12 - - // Field (0) 'Block' - if b.Block == nil { - b.Block = new(BeaconBlockElectra) - } - size += b.Block.SizeSSZ() - - // Field (1) 'KzgProofs' - size += len(b.KzgProofs) * 48 - - // Field (2) 'Blobs' - size += len(b.Blobs) * 131072 - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockContentsElectra object -func (b *BeaconBlockContentsElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockContentsElectra object with a hasher -func (b *BeaconBlockContentsElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Block' - if err = b.Block.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'KzgProofs' - { - if size := len(b.KzgProofs); size > 4096 { - err = ssz.ErrListTooBigFn("--.KzgProofs", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.KzgProofs { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.KzgProofs)) - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - - // Field (2) 'Blobs' - { - if size := len(b.Blobs); size > 4096 { - err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.Blobs { - if len(i) != 131072 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.Blobs)) - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - - hh.Merkleize(indx) - return -} - // MarshalSSZ ssz marshals the SignedBeaconBlockElectra object func (s *SignedBeaconBlockElectra) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(s) @@ -4667,7 +4458,7 @@ func (l *LightClientFinalityUpdateElectra) MarshalSSZ() ([]byte, error) { // MarshalSSZTo ssz marshals the LightClientFinalityUpdateElectra object to a target array func (l *LightClientFinalityUpdateElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf - offset := int(180) + offset := int(400) // Offset (0) 'AttestedHeader' dst = ssz.WriteOffset(dst, offset) @@ -4683,11 +4474,17 @@ func (l *LightClientFinalityUpdateElectra) MarshalSSZTo(buf []byte) (dst []byte, } offset += l.FinalizedHeader.SizeSSZ() - // Offset (2) 'FinalityBranch' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(l.FinalityBranch); ii++ { - offset += 4 - offset += len(l.FinalityBranch[ii]) + // Field (2) 'FinalityBranch' + if size := len(l.FinalityBranch); size != 7 { + err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 7) + return + } + for ii := 0; ii < 7; ii++ { + if size := len(l.FinalityBranch[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32) + return + } + dst = append(dst, l.FinalityBranch[ii]...) } // Field (3) 'SyncAggregate' @@ -4711,26 +4508,6 @@ func (l *LightClientFinalityUpdateElectra) MarshalSSZTo(buf []byte) (dst []byte, return } - // Field (2) 'FinalityBranch' - if size := len(l.FinalityBranch); size > 7 { - err = ssz.ErrListTooBigFn("--.FinalityBranch", size, 7) - return - } - { - offset = 4 * len(l.FinalityBranch) - for ii := 0; ii < len(l.FinalityBranch); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += len(l.FinalityBranch[ii]) - } - } - for ii := 0; ii < len(l.FinalityBranch); ii++ { - if size := len(l.FinalityBranch[ii]); size > 32 { - err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32) - return - } - dst = append(dst, l.FinalityBranch[ii]...) - } - return } @@ -4738,19 +4515,19 @@ func (l *LightClientFinalityUpdateElectra) MarshalSSZTo(buf []byte) (dst []byte, func (l *LightClientFinalityUpdateElectra) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) - if size < 180 { + if size < 400 { return ssz.ErrSize } tail := buf - var o0, o1, o2 uint64 + var o0, o1 uint64 // Offset (0) 'AttestedHeader' if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { return ssz.ErrOffset } - if o0 != 180 { + if o0 != 400 { return ssz.ErrInvalidVariableOffset } @@ -4759,21 +4536,25 @@ func (l *LightClientFinalityUpdateElectra) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - // Offset (2) 'FinalityBranch' - if o2 = ssz.ReadOffset(buf[8:12]); o2 > size || o1 > o2 { - return ssz.ErrOffset + // Field (2) 'FinalityBranch' + l.FinalityBranch = make([][]byte, 7) + for ii := 0; ii < 7; ii++ { + if cap(l.FinalityBranch[ii]) == 0 { + l.FinalityBranch[ii] = make([]byte, 0, len(buf[8:232][ii*32:(ii+1)*32])) + } + l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[8:232][ii*32:(ii+1)*32]...) } // Field (3) 'SyncAggregate' if l.SyncAggregate == nil { l.SyncAggregate = new(SyncAggregate) } - if err = l.SyncAggregate.UnmarshalSSZ(buf[12:172]); err != nil { + if err = l.SyncAggregate.UnmarshalSSZ(buf[232:392]); err != nil { return err } // Field (4) 'SignatureSlot' - l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[172:180])) + l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[392:400])) // Field (0) 'AttestedHeader' { @@ -4788,7 +4569,7 @@ func (l *LightClientFinalityUpdateElectra) UnmarshalSSZ(buf []byte) error { // Field (1) 'FinalizedHeader' { - buf = tail[o1:o2] + buf = tail[o1:] if l.FinalizedHeader == nil { l.FinalizedHeader = new(LightClientHeaderDeneb) } @@ -4796,35 +4577,12 @@ func (l *LightClientFinalityUpdateElectra) UnmarshalSSZ(buf []byte) error { return err } } - - // Field (2) 'FinalityBranch' - { - buf = tail[o2:] - num, err := ssz.DecodeDynamicLength(buf, 7) - if err != nil { - return err - } - l.FinalityBranch = make([][]byte, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if len(buf) > 32 { - return ssz.ErrBytesLength - } - if cap(l.FinalityBranch[indx]) == 0 { - l.FinalityBranch[indx] = make([]byte, 0, len(buf)) - } - l.FinalityBranch[indx] = append(l.FinalityBranch[indx], buf...) - return nil - }) - if err != nil { - return err - } - } return err } // SizeSSZ returns the ssz encoded size in bytes for the LightClientFinalityUpdateElectra object func (l *LightClientFinalityUpdateElectra) SizeSSZ() (size int) { - size = 180 + size = 400 // Field (0) 'AttestedHeader' if l.AttestedHeader == nil { @@ -4838,12 +4596,6 @@ func (l *LightClientFinalityUpdateElectra) SizeSSZ() (size int) { } size += l.FinalizedHeader.SizeSSZ() - // Field (2) 'FinalityBranch' - for ii := 0; ii < len(l.FinalityBranch); ii++ { - size += 4 - size += len(l.FinalityBranch[ii]) - } - return } @@ -4868,25 +4620,19 @@ func (l *LightClientFinalityUpdateElectra) HashTreeRootWith(hh *ssz.Hasher) (err // Field (2) 'FinalityBranch' { - subIndx := hh.Index() - num := uint64(len(l.FinalityBranch)) - if num > 7 { - err = ssz.ErrIncorrectListSize + if size := len(l.FinalityBranch); size != 7 { + err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 7) return } - for _, elem := range l.FinalityBranch { - { - elemIndx := hh.Index() - byteLen := uint64(len(elem)) - if byteLen > 32 { - err = ssz.ErrIncorrectListSize - return - } - hh.AppendBytes32(elem) - hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) + subIndx := hh.Index() + for _, i := range l.FinalityBranch { + if len(i) != 32 { + err = ssz.ErrBytesLength + return } + hh.Append(i) } - hh.MerkleizeWithMixin(subIndx, num, 7) + hh.Merkleize(subIndx) } // Field (3) 'SyncAggregate' diff --git a/proto/prysm/v1alpha1/light_client.pb.go b/proto/prysm/v1alpha1/light_client.pb.go index 28747e52776..54c065d3036 100755 --- a/proto/prysm/v1alpha1/light_client.pb.go +++ b/proto/prysm/v1alpha1/light_client.pb.go @@ -1073,7 +1073,7 @@ type LightClientFinalityUpdateElectra struct { AttestedHeader *LightClientHeaderDeneb `protobuf:"bytes,1,opt,name=attested_header,json=attestedHeader,proto3" json:"attested_header,omitempty"` FinalizedHeader *LightClientHeaderDeneb `protobuf:"bytes,2,opt,name=finalized_header,json=finalizedHeader,proto3" json:"finalized_header,omitempty"` - FinalityBranch [][]byte `protobuf:"bytes,3,rep,name=finality_branch,json=finalityBranch,proto3" json:"finality_branch,omitempty" ssz-max:"7,32"` + FinalityBranch [][]byte `protobuf:"bytes,3,rep,name=finality_branch,json=finalityBranch,proto3" json:"finality_branch,omitempty" ssz-size:"7,32"` SyncAggregate *SyncAggregate `protobuf:"bytes,4,opt,name=sync_aggregate,json=syncAggregate,proto3" json:"sync_aggregate,omitempty"` SignatureSlot github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot `protobuf:"varint,5,opt,name=signature_slot,json=signatureSlot,proto3" json:"signature_slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"` } @@ -1703,7 +1703,7 @@ var file_proto_prysm_v1alpha1_light_client_proto_rawDesc = []byte{ 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x44, 0x65, 0x6e, 0x65, 0x62, 0x52, 0x0f, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x0f, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, - 0x68, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x08, 0x92, 0xb5, 0x18, 0x04, 0x37, 0x2c, 0x33, + 0x68, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x08, 0x8a, 0xb5, 0x18, 0x04, 0x37, 0x2c, 0x33, 0x32, 0x52, 0x0e, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x4b, 0x0a, 0x0e, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x74, 0x68, 0x65, diff --git a/proto/prysm/v1alpha1/light_client.proto b/proto/prysm/v1alpha1/light_client.proto index 57a12aa0d82..ee80fbe4625 100644 --- a/proto/prysm/v1alpha1/light_client.proto +++ b/proto/prysm/v1alpha1/light_client.proto @@ -134,7 +134,7 @@ message LightClientFinalityUpdateDeneb { message LightClientFinalityUpdateElectra { LightClientHeaderDeneb attested_header = 1; LightClientHeaderDeneb finalized_header = 2; - repeated bytes finality_branch = 3 [(ethereum.eth.ext.ssz_max) = "7,32"]; + repeated bytes finality_branch = 3 [(ethereum.eth.ext.ssz_size) = "7,32"]; SyncAggregate sync_aggregate = 4; uint64 signature_slot = 5 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"]; } diff --git a/proto/prysm/v1alpha1/metadata/BUILD.bazel b/proto/prysm/v1alpha1/metadata/BUILD.bazel index 8fb42dda10c..597669e949f 100644 --- a/proto/prysm/v1alpha1/metadata/BUILD.bazel +++ b/proto/prysm/v1alpha1/metadata/BUILD.bazel @@ -6,7 +6,6 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1/metadata", visibility = ["//visibility:public"], deps = [ - "//proto/prysm/v1alpha1:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", ], diff --git a/proto/prysm/v1alpha1/slashings/BUILD.bazel b/proto/prysm/v1alpha1/slashings/BUILD.bazel index 06d77ece799..1b658cc77f2 100644 --- a/proto/prysm/v1alpha1/slashings/BUILD.bazel +++ b/proto/prysm/v1alpha1/slashings/BUILD.bazel @@ -8,7 +8,6 @@ go_library( ], importpath = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1/slashings", visibility = ["//visibility:public"], - deps = ["//proto/prysm/v1alpha1:go_default_library"], ) go_test( @@ -18,8 +17,5 @@ go_test( "surround_votes_test.go", ], embed = [":go_default_library"], - deps = [ - "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", - ], + deps = ["//consensus-types/primitives:go_default_library"], ) diff --git a/runtime/interop/BUILD.bazel b/runtime/interop/BUILD.bazel index 454b309e009..35cb7fd9675 100644 --- a/runtime/interop/BUILD.bazel +++ b/runtime/interop/BUILD.bazel @@ -30,7 +30,6 @@ go_library( "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time:go_default_library", "//time/slots:go_default_library", @@ -61,7 +60,6 @@ go_test( "//config/params:go_default_library", "//container/trie:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/testing/assertions/BUILD.bazel b/testing/assertions/BUILD.bazel index ae67367cf25..e9aad2fe3a0 100644 --- a/testing/assertions/BUILD.bazel +++ b/testing/assertions/BUILD.bazel @@ -18,7 +18,6 @@ go_test( srcs = ["assertions_test.go"], deps = [ ":go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/testing:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/testing/benchmark/BUILD.bazel b/testing/benchmark/BUILD.bazel index 25fe63b06c9..b6309636bae 100644 --- a/testing/benchmark/BUILD.bazel +++ b/testing/benchmark/BUILD.bazel @@ -10,7 +10,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@io_bazel_rules_go//go/tools/bazel:go_default_library", ], ) diff --git a/testing/endtoend/components/eth1/BUILD.bazel b/testing/endtoend/components/eth1/BUILD.bazel index 46bc9c0a7c9..3f966e531cf 100644 --- a/testing/endtoend/components/eth1/BUILD.bazel +++ b/testing/endtoend/components/eth1/BUILD.bazel @@ -21,7 +21,6 @@ go_library( "//crypto/rand:go_default_library", "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//testing/endtoend/helpers:go_default_library", "//testing/endtoend/params:go_default_library", diff --git a/testing/endtoend/evaluators/BUILD.bazel b/testing/endtoend/evaluators/BUILD.bazel index 3b59c0095cf..8abb98a15ae 100644 --- a/testing/endtoend/evaluators/BUILD.bazel +++ b/testing/endtoend/evaluators/BUILD.bazel @@ -40,7 +40,6 @@ go_library( "//encoding/ssz/detect:go_default_library", "//network/forks:go_default_library", "//network/httputil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//runtime/version:go_default_library", "//testing/endtoend/components:go_default_library", diff --git a/testing/endtoend/evaluators/beaconapi/BUILD.bazel b/testing/endtoend/evaluators/beaconapi/BUILD.bazel index 5a8dcf275ef..c952726d514 100644 --- a/testing/endtoend/evaluators/beaconapi/BUILD.bazel +++ b/testing/endtoend/evaluators/beaconapi/BUILD.bazel @@ -16,7 +16,6 @@ go_library( "//api/server/structs:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/endtoend/params:go_default_library", "//testing/endtoend/policies:go_default_library", "//testing/endtoend/types:go_default_library", diff --git a/testing/endtoend/helpers/BUILD.bazel b/testing/endtoend/helpers/BUILD.bazel index db224254262..530e94450b3 100644 --- a/testing/endtoend/helpers/BUILD.bazel +++ b/testing/endtoend/helpers/BUILD.bazel @@ -12,7 +12,6 @@ go_library( visibility = ["//testing/endtoend:__subpackages__"], deps = [ "//config/params:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/endtoend/params:go_default_library", "//testing/endtoend/types:go_default_library", "//time:go_default_library", diff --git a/testing/middleware/builder/BUILD.bazel b/testing/middleware/builder/BUILD.bazel index 90473fe94d1..3003679b9ad 100644 --- a/testing/middleware/builder/BUILD.bazel +++ b/testing/middleware/builder/BUILD.bazel @@ -22,7 +22,6 @@ go_library( "//network:go_default_library", "//network/authorization:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_ethereum_go_ethereum//beacon/engine:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", diff --git a/testing/mock/BUILD.bazel b/testing/mock/BUILD.bazel index ffbb688cae5..7046877bd47 100644 --- a/testing/mock/BUILD.bazel +++ b/testing/mock/BUILD.bazel @@ -15,7 +15,6 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/v5/testing/mock", visibility = ["//visibility:public"], deps = [ - "//proto/prysm/v1alpha1:go_default_library", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//metadata:go_default_library", "@org_golang_google_protobuf//types/known/emptypb:go_default_library", diff --git a/testing/slasher/simulator/BUILD.bazel b/testing/slasher/simulator/BUILD.bazel index 679ded28376..e2e7b3a954c 100644 --- a/testing/slasher/simulator/BUILD.bazel +++ b/testing/slasher/simulator/BUILD.bazel @@ -31,7 +31,6 @@ go_library( "//crypto/bls:go_default_library", "//crypto/rand:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", @@ -53,7 +52,6 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/slashings:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/general/deneb/kzg/BUILD.bazel b/testing/spectest/general/deneb/kzg/BUILD.bazel index 90b3f91dde8..2052f54d8b6 100644 --- a/testing/spectest/general/deneb/kzg/BUILD.bazel +++ b/testing/spectest/general/deneb/kzg/BUILD.bazel @@ -11,7 +11,6 @@ go_test( deps = [ "//beacon-chain/blockchain/kzg:go_default_library", "//consensus-types/blocks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/altair/epoch_processing/BUILD.bazel b/testing/spectest/shared/altair/epoch_processing/BUILD.bazel index d566fdbd43a..2fc9ee5a560 100644 --- a/testing/spectest/shared/altair/epoch_processing/BUILD.bazel +++ b/testing/spectest/shared/altair/epoch_processing/BUILD.bazel @@ -27,7 +27,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/altair/finality/BUILD.bazel b/testing/spectest/shared/altair/finality/BUILD.bazel index 51a802755b8..be1629931eb 100644 --- a/testing/spectest/shared/altair/finality/BUILD.bazel +++ b/testing/spectest/shared/altair/finality/BUILD.bazel @@ -12,7 +12,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/altair/fork/BUILD.bazel b/testing/spectest/shared/altair/fork/BUILD.bazel index 2729cd699e4..3d1a791bc3f 100644 --- a/testing/spectest/shared/altair/fork/BUILD.bazel +++ b/testing/spectest/shared/altair/fork/BUILD.bazel @@ -17,7 +17,6 @@ go_library( "//config/params:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/altair/operations/BUILD.bazel b/testing/spectest/shared/altair/operations/BUILD.bazel index 05aeecc89e8..abb25075a64 100644 --- a/testing/spectest/shared/altair/operations/BUILD.bazel +++ b/testing/spectest/shared/altair/operations/BUILD.bazel @@ -21,7 +21,6 @@ go_library( "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/spectest/shared/common/operations:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/altair/rewards/BUILD.bazel b/testing/spectest/shared/altair/rewards/BUILD.bazel index ad8a6f73740..a3c169ada03 100644 --- a/testing/spectest/shared/altair/rewards/BUILD.bazel +++ b/testing/spectest/shared/altair/rewards/BUILD.bazel @@ -10,7 +10,6 @@ go_library( "//beacon-chain/core/altair:go_default_library", "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/state/state-native:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/altair/sanity/BUILD.bazel b/testing/spectest/shared/altair/sanity/BUILD.bazel index af8b85ac6ca..d64c45cfa32 100644 --- a/testing/spectest/shared/altair/sanity/BUILD.bazel +++ b/testing/spectest/shared/altair/sanity/BUILD.bazel @@ -16,7 +16,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/altair/ssz_static/BUILD.bazel b/testing/spectest/shared/altair/ssz_static/BUILD.bazel index 1161580b94f..20d8b925d1e 100644 --- a/testing/spectest/shared/altair/ssz_static/BUILD.bazel +++ b/testing/spectest/shared/altair/ssz_static/BUILD.bazel @@ -8,7 +8,6 @@ go_library( visibility = ["//testing/spectest:__subpackages__"], deps = [ "//beacon-chain/state/state-native:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/shared/common/ssz_static:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/testing/spectest/shared/bellatrix/epoch_processing/BUILD.bazel b/testing/spectest/shared/bellatrix/epoch_processing/BUILD.bazel index 03ac47eaec8..c3a3fc7b732 100644 --- a/testing/spectest/shared/bellatrix/epoch_processing/BUILD.bazel +++ b/testing/spectest/shared/bellatrix/epoch_processing/BUILD.bazel @@ -27,7 +27,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/bellatrix/finality/BUILD.bazel b/testing/spectest/shared/bellatrix/finality/BUILD.bazel index 1f54e632a6a..41078bef281 100644 --- a/testing/spectest/shared/bellatrix/finality/BUILD.bazel +++ b/testing/spectest/shared/bellatrix/finality/BUILD.bazel @@ -12,7 +12,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/bellatrix/fork/BUILD.bazel b/testing/spectest/shared/bellatrix/fork/BUILD.bazel index f501094c09a..7b2705c7ff4 100644 --- a/testing/spectest/shared/bellatrix/fork/BUILD.bazel +++ b/testing/spectest/shared/bellatrix/fork/BUILD.bazel @@ -17,7 +17,6 @@ go_library( "//config/params:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/bellatrix/operations/BUILD.bazel b/testing/spectest/shared/bellatrix/operations/BUILD.bazel index 8ab888a3ddd..417763b9af4 100644 --- a/testing/spectest/shared/bellatrix/operations/BUILD.bazel +++ b/testing/spectest/shared/bellatrix/operations/BUILD.bazel @@ -22,7 +22,6 @@ go_library( "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/spectest/shared/common/operations:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/bellatrix/rewards/BUILD.bazel b/testing/spectest/shared/bellatrix/rewards/BUILD.bazel index 83004d18ff1..dd4d90afbbd 100644 --- a/testing/spectest/shared/bellatrix/rewards/BUILD.bazel +++ b/testing/spectest/shared/bellatrix/rewards/BUILD.bazel @@ -10,7 +10,6 @@ go_library( "//beacon-chain/core/altair:go_default_library", "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/state/state-native:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/bellatrix/sanity/BUILD.bazel b/testing/spectest/shared/bellatrix/sanity/BUILD.bazel index db8a5d07dc0..d6aea1968eb 100644 --- a/testing/spectest/shared/bellatrix/sanity/BUILD.bazel +++ b/testing/spectest/shared/bellatrix/sanity/BUILD.bazel @@ -16,7 +16,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/bellatrix/ssz_static/BUILD.bazel b/testing/spectest/shared/bellatrix/ssz_static/BUILD.bazel index fb7d21d5e01..646426fea5f 100644 --- a/testing/spectest/shared/bellatrix/ssz_static/BUILD.bazel +++ b/testing/spectest/shared/bellatrix/ssz_static/BUILD.bazel @@ -9,7 +9,6 @@ go_library( deps = [ "//beacon-chain/state/state-native:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/shared/common/ssz_static:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/testing/spectest/shared/capella/epoch_processing/BUILD.bazel b/testing/spectest/shared/capella/epoch_processing/BUILD.bazel index 9fd12223eb3..c4e99e41198 100644 --- a/testing/spectest/shared/capella/epoch_processing/BUILD.bazel +++ b/testing/spectest/shared/capella/epoch_processing/BUILD.bazel @@ -27,7 +27,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/capella/finality/BUILD.bazel b/testing/spectest/shared/capella/finality/BUILD.bazel index 5d7f56aa8aa..89d679e5ce6 100644 --- a/testing/spectest/shared/capella/finality/BUILD.bazel +++ b/testing/spectest/shared/capella/finality/BUILD.bazel @@ -12,7 +12,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/capella/fork/BUILD.bazel b/testing/spectest/shared/capella/fork/BUILD.bazel index 79bda2002a6..75a3d987dc8 100644 --- a/testing/spectest/shared/capella/fork/BUILD.bazel +++ b/testing/spectest/shared/capella/fork/BUILD.bazel @@ -17,7 +17,6 @@ go_library( "//config/params:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/capella/operations/BUILD.bazel b/testing/spectest/shared/capella/operations/BUILD.bazel index 95c7369130f..76233c51031 100644 --- a/testing/spectest/shared/capella/operations/BUILD.bazel +++ b/testing/spectest/shared/capella/operations/BUILD.bazel @@ -25,7 +25,6 @@ go_library( "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/spectest/shared/common/operations:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/capella/rewards/BUILD.bazel b/testing/spectest/shared/capella/rewards/BUILD.bazel index 477639709a5..dcfc0e1fce4 100644 --- a/testing/spectest/shared/capella/rewards/BUILD.bazel +++ b/testing/spectest/shared/capella/rewards/BUILD.bazel @@ -10,7 +10,6 @@ go_library( "//beacon-chain/core/altair:go_default_library", "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/state/state-native:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/capella/sanity/BUILD.bazel b/testing/spectest/shared/capella/sanity/BUILD.bazel index c0d1ecd8749..50a3eee7e30 100644 --- a/testing/spectest/shared/capella/sanity/BUILD.bazel +++ b/testing/spectest/shared/capella/sanity/BUILD.bazel @@ -16,7 +16,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/capella/ssz_static/BUILD.bazel b/testing/spectest/shared/capella/ssz_static/BUILD.bazel index 5fc7acec018..0ab4b3c5489 100644 --- a/testing/spectest/shared/capella/ssz_static/BUILD.bazel +++ b/testing/spectest/shared/capella/ssz_static/BUILD.bazel @@ -9,7 +9,6 @@ go_library( deps = [ "//beacon-chain/state/state-native:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/shared/common/ssz_static:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/testing/spectest/shared/common/forkchoice/BUILD.bazel b/testing/spectest/shared/common/forkchoice/BUILD.bazel index b1a8743217f..36109c30b35 100644 --- a/testing/spectest/shared/common/forkchoice/BUILD.bazel +++ b/testing/spectest/shared/common/forkchoice/BUILD.bazel @@ -38,7 +38,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", @@ -56,7 +55,6 @@ go_test( embed = [":go_default_library"], deps = [ "//consensus-types/blocks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", ], diff --git a/testing/spectest/shared/common/operations/BUILD.bazel b/testing/spectest/shared/common/operations/BUILD.bazel index 07b46dee0a2..f9b6a87ab27 100644 --- a/testing/spectest/shared/common/operations/BUILD.bazel +++ b/testing/spectest/shared/common/operations/BUILD.bazel @@ -32,7 +32,6 @@ go_library( "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/common/ssz_static/BUILD.bazel b/testing/spectest/shared/common/ssz_static/BUILD.bazel index f8b41eb343e..a21075a3176 100644 --- a/testing/spectest/shared/common/ssz_static/BUILD.bazel +++ b/testing/spectest/shared/common/ssz_static/BUILD.bazel @@ -25,7 +25,6 @@ go_test( deps = [ ":go_default_library", "//beacon-chain/state/state-native:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/testing/spectest/shared/deneb/epoch_processing/BUILD.bazel b/testing/spectest/shared/deneb/epoch_processing/BUILD.bazel index 6a483739c35..764c8e9ed6c 100644 --- a/testing/spectest/shared/deneb/epoch_processing/BUILD.bazel +++ b/testing/spectest/shared/deneb/epoch_processing/BUILD.bazel @@ -27,7 +27,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/deneb/finality/BUILD.bazel b/testing/spectest/shared/deneb/finality/BUILD.bazel index 0ab638534d9..06ae6c79169 100644 --- a/testing/spectest/shared/deneb/finality/BUILD.bazel +++ b/testing/spectest/shared/deneb/finality/BUILD.bazel @@ -12,7 +12,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/deneb/fork/BUILD.bazel b/testing/spectest/shared/deneb/fork/BUILD.bazel index f90f2492540..a8fe128288b 100644 --- a/testing/spectest/shared/deneb/fork/BUILD.bazel +++ b/testing/spectest/shared/deneb/fork/BUILD.bazel @@ -17,7 +17,6 @@ go_library( "//config/params:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/deneb/operations/BUILD.bazel b/testing/spectest/shared/deneb/operations/BUILD.bazel index 43971362c5c..ffa479c3aa6 100644 --- a/testing/spectest/shared/deneb/operations/BUILD.bazel +++ b/testing/spectest/shared/deneb/operations/BUILD.bazel @@ -25,7 +25,6 @@ go_library( "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/spectest/shared/common/operations:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/deneb/rewards/BUILD.bazel b/testing/spectest/shared/deneb/rewards/BUILD.bazel index 4cb11100863..23b0565ecc1 100644 --- a/testing/spectest/shared/deneb/rewards/BUILD.bazel +++ b/testing/spectest/shared/deneb/rewards/BUILD.bazel @@ -10,7 +10,6 @@ go_library( "//beacon-chain/core/altair:go_default_library", "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/state/state-native:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/deneb/sanity/BUILD.bazel b/testing/spectest/shared/deneb/sanity/BUILD.bazel index 573a3eab0ed..5b6e80ee76d 100644 --- a/testing/spectest/shared/deneb/sanity/BUILD.bazel +++ b/testing/spectest/shared/deneb/sanity/BUILD.bazel @@ -16,7 +16,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/deneb/ssz_static/BUILD.bazel b/testing/spectest/shared/deneb/ssz_static/BUILD.bazel index e09229b6833..b729c31c1bf 100644 --- a/testing/spectest/shared/deneb/ssz_static/BUILD.bazel +++ b/testing/spectest/shared/deneb/ssz_static/BUILD.bazel @@ -9,7 +9,6 @@ go_library( deps = [ "//beacon-chain/state/state-native:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/shared/common/ssz_static:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/testing/spectest/shared/electra/epoch_processing/BUILD.bazel b/testing/spectest/shared/electra/epoch_processing/BUILD.bazel index c65c52dd9f6..d356d965154 100644 --- a/testing/spectest/shared/electra/epoch_processing/BUILD.bazel +++ b/testing/spectest/shared/electra/epoch_processing/BUILD.bazel @@ -30,7 +30,6 @@ go_library( "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/electra/finality/BUILD.bazel b/testing/spectest/shared/electra/finality/BUILD.bazel index 93369784d69..2c9de58412d 100644 --- a/testing/spectest/shared/electra/finality/BUILD.bazel +++ b/testing/spectest/shared/electra/finality/BUILD.bazel @@ -12,7 +12,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/electra/fork/BUILD.bazel b/testing/spectest/shared/electra/fork/BUILD.bazel index f2101d0eace..7aef3578681 100644 --- a/testing/spectest/shared/electra/fork/BUILD.bazel +++ b/testing/spectest/shared/electra/fork/BUILD.bazel @@ -17,7 +17,6 @@ go_library( "//config/params:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/electra/operations/BUILD.bazel b/testing/spectest/shared/electra/operations/BUILD.bazel index d5d42aab639..32a3a407055 100644 --- a/testing/spectest/shared/electra/operations/BUILD.bazel +++ b/testing/spectest/shared/electra/operations/BUILD.bazel @@ -28,7 +28,6 @@ go_library( "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/spectest/shared/common/operations:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/electra/rewards/BUILD.bazel b/testing/spectest/shared/electra/rewards/BUILD.bazel index 4d6efdab287..a57c324cdae 100644 --- a/testing/spectest/shared/electra/rewards/BUILD.bazel +++ b/testing/spectest/shared/electra/rewards/BUILD.bazel @@ -10,7 +10,6 @@ go_library( "//beacon-chain/core/electra:go_default_library", "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/state/state-native:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/electra/sanity/BUILD.bazel b/testing/spectest/shared/electra/sanity/BUILD.bazel index f284008577a..4e72c901459 100644 --- a/testing/spectest/shared/electra/sanity/BUILD.bazel +++ b/testing/spectest/shared/electra/sanity/BUILD.bazel @@ -16,7 +16,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/electra/ssz_static/BUILD.bazel b/testing/spectest/shared/electra/ssz_static/BUILD.bazel index b9b04313420..8037df967f7 100644 --- a/testing/spectest/shared/electra/ssz_static/BUILD.bazel +++ b/testing/spectest/shared/electra/ssz_static/BUILD.bazel @@ -9,7 +9,6 @@ go_library( deps = [ "//beacon-chain/state/state-native:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/shared/common/ssz_static:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/testing/spectest/shared/phase0/epoch_processing/BUILD.bazel b/testing/spectest/shared/phase0/epoch_processing/BUILD.bazel index 68e6a1a9549..098b7719aad 100644 --- a/testing/spectest/shared/phase0/epoch_processing/BUILD.bazel +++ b/testing/spectest/shared/phase0/epoch_processing/BUILD.bazel @@ -25,7 +25,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/phase0/finality/BUILD.bazel b/testing/spectest/shared/phase0/finality/BUILD.bazel index 15a2673522e..9b68e598ed0 100644 --- a/testing/spectest/shared/phase0/finality/BUILD.bazel +++ b/testing/spectest/shared/phase0/finality/BUILD.bazel @@ -12,7 +12,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/phase0/operations/BUILD.bazel b/testing/spectest/shared/phase0/operations/BUILD.bazel index 8f69fb427e0..b553f4484cd 100644 --- a/testing/spectest/shared/phase0/operations/BUILD.bazel +++ b/testing/spectest/shared/phase0/operations/BUILD.bazel @@ -21,7 +21,6 @@ go_library( "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/spectest/shared/common/operations:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/phase0/rewards/BUILD.bazel b/testing/spectest/shared/phase0/rewards/BUILD.bazel index 3da95cce619..25c72102b1b 100644 --- a/testing/spectest/shared/phase0/rewards/BUILD.bazel +++ b/testing/spectest/shared/phase0/rewards/BUILD.bazel @@ -10,7 +10,6 @@ go_library( "//beacon-chain/core/epoch/precompute:go_default_library", "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/state/state-native:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/phase0/sanity/BUILD.bazel b/testing/spectest/shared/phase0/sanity/BUILD.bazel index bf7f29d7888..6cb5090396f 100644 --- a/testing/spectest/shared/phase0/sanity/BUILD.bazel +++ b/testing/spectest/shared/phase0/sanity/BUILD.bazel @@ -16,7 +16,6 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/phase0/ssz_static/BUILD.bazel b/testing/spectest/shared/phase0/ssz_static/BUILD.bazel index 50559e502f5..c33a0a9e4d5 100644 --- a/testing/spectest/shared/phase0/ssz_static/BUILD.bazel +++ b/testing/spectest/shared/phase0/ssz_static/BUILD.bazel @@ -8,7 +8,6 @@ go_library( visibility = ["//testing/spectest:__subpackages__"], deps = [ "//beacon-chain/state/state-native:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/shared/common/ssz_static:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/testing/util/BUILD.bazel b/testing/util/BUILD.bazel index 16154398cf7..e368ae4e8e1 100644 --- a/testing/util/BUILD.bazel +++ b/testing/util/BUILD.bazel @@ -58,7 +58,6 @@ go_library( "//proto/engine/v1:go_default_library", "//proto/eth/v1:go_default_library", "//proto/eth/v2:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//runtime/version:go_default_library", "//testing/assertions:go_default_library", @@ -105,7 +104,6 @@ go_test( "//encoding/ssz:go_default_library", "//proto/eth/v1:go_default_library", "//proto/eth/v2:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//time/slots:go_default_library", diff --git a/testing/validator-mock/BUILD.bazel b/testing/validator-mock/BUILD.bazel index 08bb8fa69b3..6a57d913dfc 100644 --- a/testing/validator-mock/BUILD.bazel +++ b/testing/validator-mock/BUILD.bazel @@ -17,7 +17,6 @@ go_library( "//api/client/event:go_default_library", "//consensus-types/primitives:go_default_library", "//consensus-types/validator:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//validator/client/iface:go_default_library", "@org_golang_google_protobuf//types/known/emptypb:go_default_library", "@org_uber_go_mock//gomock:go_default_library", diff --git a/tools/benchmark-files-gen/BUILD.bazel b/tools/benchmark-files-gen/BUILD.bazel index ecc6c3d0bd9..d39c8a14e0f 100644 --- a/tools/benchmark-files-gen/BUILD.bazel +++ b/tools/benchmark-files-gen/BUILD.bazel @@ -18,7 +18,6 @@ go_library( "//consensus-types/blocks:go_default_library", "//consensus-types/primitives:go_default_library", "//io/file:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//testing/benchmark:go_default_library", "//testing/util:go_default_library", diff --git a/tools/bootnode/BUILD.bazel b/tools/bootnode/BUILD.bazel index 4c20b40959d..4f8b1417281 100644 --- a/tools/bootnode/BUILD.bazel +++ b/tools/bootnode/BUILD.bazel @@ -15,7 +15,6 @@ go_library( "//encoding/bytesutil:go_default_library", "//io/logs:go_default_library", "//network:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/maxprocs:go_default_library", "//runtime/version:go_default_library", "@com_github_ethereum_go_ethereum//crypto:go_default_library", diff --git a/tools/eth1voting/BUILD.bazel b/tools/eth1voting/BUILD.bazel index bef54f1cad2..11ed13f0deb 100644 --- a/tools/eth1voting/BUILD.bazel +++ b/tools/eth1voting/BUILD.bazel @@ -15,7 +15,6 @@ go_library( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@org_golang_google_grpc//:go_default_library", "@org_golang_x_sync//errgroup:go_default_library", diff --git a/tools/exploredb/BUILD.bazel b/tools/exploredb/BUILD.bazel index 8aff1b8b58e..dc2d0b642d3 100644 --- a/tools/exploredb/BUILD.bazel +++ b/tools/exploredb/BUILD.bazel @@ -12,7 +12,6 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_dustin_go_humanize//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_status_im_keycard_go//hexutils:go_default_library", diff --git a/tools/forkchecker/BUILD.bazel b/tools/forkchecker/BUILD.bazel index db675516995..aceb8d56c6d 100644 --- a/tools/forkchecker/BUILD.bazel +++ b/tools/forkchecker/BUILD.bazel @@ -9,7 +9,6 @@ go_library( deps = [ "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_protobuf//types/known/emptypb:go_default_library", diff --git a/tools/pcli/BUILD.bazel b/tools/pcli/BUILD.bazel index a3386f17f97..d7060d08729 100644 --- a/tools/pcli/BUILD.bazel +++ b/tools/pcli/BUILD.bazel @@ -16,7 +16,6 @@ go_library( "//consensus-types/interfaces:go_default_library", "//encoding/ssz/detect:go_default_library", "//encoding/ssz/equality:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/logging/logrus-prefixed-formatter:go_default_library", "//runtime/version:go_default_library", "@com_github_kr_pretty//:go_default_library", diff --git a/validator/accounts/BUILD.bazel b/validator/accounts/BUILD.bazel index 4bb84631815..2ed28679580 100644 --- a/validator/accounts/BUILD.bazel +++ b/validator/accounts/BUILD.bazel @@ -33,7 +33,6 @@ go_library( "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", "//io/prompt:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//validator/accounts/petnames:go_default_library", "//validator/accounts/userprompt:go_default_library", "//validator/accounts/wallet:go_default_library", @@ -81,7 +80,6 @@ go_test( "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/validator-mock:go_default_library", diff --git a/validator/accounts/testing/BUILD.bazel b/validator/accounts/testing/BUILD.bazel index 628f051191c..462a9c339a4 100644 --- a/validator/accounts/testing/BUILD.bazel +++ b/validator/accounts/testing/BUILD.bazel @@ -15,7 +15,6 @@ go_library( "//config/fieldparams:go_default_library", "//config/proposer:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//validator/accounts/iface:go_default_library", "//validator/client/iface:go_default_library", "//validator/keymanager:go_default_library", diff --git a/validator/client/BUILD.bazel b/validator/client/BUILD.bazel index e873a131b3f..9abbc2f465f 100644 --- a/validator/client/BUILD.bazel +++ b/validator/client/BUILD.bazel @@ -50,7 +50,6 @@ go_library( "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//runtime/version:go_default_library", "//time:go_default_library", @@ -138,7 +137,6 @@ go_test( "//crypto/bls/common/mock:go_default_library", "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//runtime:go_default_library", "//runtime/version:go_default_library", diff --git a/validator/client/beacon-api/BUILD.bazel b/validator/client/beacon-api/BUILD.bazel index 442352b8849..d199b19dc53 100644 --- a/validator/client/beacon-api/BUILD.bazel +++ b/validator/client/beacon-api/BUILD.bazel @@ -54,7 +54,6 @@ go_library( "//network/forks:go_default_library", "//network/httputil:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "//validator/client/iface:go_default_library", @@ -126,7 +125,6 @@ go_test( "//encoding/bytesutil:go_default_library", "//network/httputil:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//time/slots:go_default_library", diff --git a/validator/client/beacon-api/mock/BUILD.bazel b/validator/client/beacon-api/mock/BUILD.bazel index e8c821ec519..c13777f5605 100644 --- a/validator/client/beacon-api/mock/BUILD.bazel +++ b/validator/client/beacon-api/mock/BUILD.bazel @@ -14,7 +14,6 @@ go_library( deps = [ "//api/server/structs:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@org_uber_go_mock//gomock:go_default_library", ], ) diff --git a/validator/client/beacon-api/test-helpers/BUILD.bazel b/validator/client/beacon-api/test-helpers/BUILD.bazel index 725b3f5907b..aa187e25607 100644 --- a/validator/client/beacon-api/test-helpers/BUILD.bazel +++ b/validator/client/beacon-api/test-helpers/BUILD.bazel @@ -17,7 +17,6 @@ go_library( "//api/server/structs:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", ], ) diff --git a/validator/client/grpc-api/BUILD.bazel b/validator/client/grpc-api/BUILD.bazel index 3dd77c8311c..a6789cf2b76 100644 --- a/validator/client/grpc-api/BUILD.bazel +++ b/validator/client/grpc-api/BUILD.bazel @@ -21,7 +21,6 @@ go_library( "//consensus-types/validator:go_default_library", "//monitoring/tracing/trace:go_default_library", "//proto/eth/v1:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//validator/client/iface:go_default_library", "@com_github_golang_protobuf//ptypes/empty", "@com_github_pkg_errors//:go_default_library", @@ -44,7 +43,6 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//consensus-types/validator:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/mock:go_default_library", "//testing/require:go_default_library", diff --git a/validator/client/iface/BUILD.bazel b/validator/client/iface/BUILD.bazel index f9492354364..73e92cfdf62 100644 --- a/validator/client/iface/BUILD.bazel +++ b/validator/client/iface/BUILD.bazel @@ -19,7 +19,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//consensus-types/validator:go_default_library", "//crypto/bls:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//validator/keymanager:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", diff --git a/validator/client/testutil/BUILD.bazel b/validator/client/testutil/BUILD.bazel index 633d7c976ba..853de48ac82 100644 --- a/validator/client/testutil/BUILD.bazel +++ b/validator/client/testutil/BUILD.bazel @@ -17,7 +17,6 @@ go_library( "//config/proposer:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//time:go_default_library", "//validator/client/iface:go_default_library", "//validator/keymanager:go_default_library", diff --git a/validator/db/BUILD.bazel b/validator/db/BUILD.bazel index 1f028478a24..ac811f18d9e 100644 --- a/validator/db/BUILD.bazel +++ b/validator/db/BUILD.bazel @@ -20,7 +20,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//io/file:go_default_library", "//io/prompt:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//validator/db/common:go_default_library", "//validator/db/filesystem:go_default_library", "//validator/db/iface:go_default_library", @@ -46,7 +45,6 @@ go_test( "//config/proposer:go_default_library", "//consensus-types/primitives:go_default_library", "//io/file:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//validator/db/common:go_default_library", diff --git a/validator/db/filesystem/BUILD.bazel b/validator/db/filesystem/BUILD.bazel index 39810f59da9..c0fd30ce643 100644 --- a/validator/db/filesystem/BUILD.bazel +++ b/validator/db/filesystem/BUILD.bazel @@ -21,7 +21,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//io/file:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//validator/db/common:go_default_library", "//validator/db/iface:go_default_library", @@ -56,7 +55,6 @@ go_test( "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", "//io/file:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/validator/db/iface/BUILD.bazel b/validator/db/iface/BUILD.bazel index cf83ebca782..c4416d28294 100644 --- a/validator/db/iface/BUILD.bazel +++ b/validator/db/iface/BUILD.bazel @@ -15,7 +15,6 @@ go_library( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//monitoring/backup:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//validator/db/common:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", ], diff --git a/validator/db/kv/BUILD.bazel b/validator/db/kv/BUILD.bazel index 38e61170b65..5fc22f7b08d 100644 --- a/validator/db/kv/BUILD.bazel +++ b/validator/db/kv/BUILD.bazel @@ -39,7 +39,6 @@ go_library( "//monitoring/progress:go_default_library", "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/slashings:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//time/slots:go_default_library", @@ -84,7 +83,6 @@ go_test( "//crypto/bls:go_default_library", "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/validator/helpers/BUILD.bazel b/validator/helpers/BUILD.bazel index 5acaa9cf650..754d61141b8 100644 --- a/validator/helpers/BUILD.bazel +++ b/validator/helpers/BUILD.bazel @@ -31,7 +31,6 @@ go_test( "//config/proposer:go_default_library", "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//validator/db/common:go_default_library", "//validator/db/iface:go_default_library", diff --git a/validator/keymanager/remote-web3signer/v1/BUILD.bazel b/validator/keymanager/remote-web3signer/v1/BUILD.bazel index ebc1a0fcae5..655eed60606 100644 --- a/validator/keymanager/remote-web3signer/v1/BUILD.bazel +++ b/validator/keymanager/remote-web3signer/v1/BUILD.bazel @@ -14,7 +14,6 @@ go_library( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//network/forks:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", @@ -32,7 +31,6 @@ go_test( ":go_default_library", "//config/fieldparams:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//testing/require:go_default_library", "//validator/keymanager/remote-web3signer/v1/mock:go_default_library", diff --git a/validator/keymanager/remote-web3signer/v1/mock/BUILD.bazel b/validator/keymanager/remote-web3signer/v1/mock/BUILD.bazel index 6c09a88be40..2ec00b670b7 100644 --- a/validator/keymanager/remote-web3signer/v1/mock/BUILD.bazel +++ b/validator/keymanager/remote-web3signer/v1/mock/BUILD.bazel @@ -8,7 +8,6 @@ go_library( visibility = ["//visibility:public"], deps = [ "//config/fieldparams:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//testing/util:go_default_library", "//validator/keymanager/remote-web3signer/v1:go_default_library", diff --git a/validator/rpc/BUILD.bazel b/validator/rpc/BUILD.bazel index 7eafb93d230..ef3f40b65ff 100644 --- a/validator/rpc/BUILD.bazel +++ b/validator/rpc/BUILD.bazel @@ -46,7 +46,6 @@ go_library( "//io/prompt:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//validator/accounts:go_default_library", "//validator/accounts/petnames:go_default_library", diff --git a/validator/slashing-protection-history/BUILD.bazel b/validator/slashing-protection-history/BUILD.bazel index a78de29f8d4..5bab7381561 100644 --- a/validator/slashing-protection-history/BUILD.bazel +++ b/validator/slashing-protection-history/BUILD.bazel @@ -32,7 +32,6 @@ go_test( deps = [ "//config/fieldparams:go_default_library", "//consensus-types/primitives:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//validator/db/common:go_default_library", diff --git a/validator/testing/BUILD.bazel b/validator/testing/BUILD.bazel index 32cf267a372..f5c46546281 100644 --- a/validator/testing/BUILD.bazel +++ b/validator/testing/BUILD.bazel @@ -20,7 +20,6 @@ go_library( "//crypto/bls:go_default_library", "//crypto/rand:go_default_library", "//encoding/bytesutil:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", "//validator/db/common:go_default_library", "//validator/slashing-protection-history/format:go_default_library", ], From df2bbc8c157ba4cfdc7ca9091eed6f13429de4ad Mon Sep 17 00:00:00 2001 From: rkapka Date: Thu, 31 Oct 2024 16:35:12 +0700 Subject: [PATCH 07/26] Revert "Auxiliary commit to revert individual files from fbe143f5635b278bdd181af0b3967b8f2b3bf021" This reverts commit decc9ed1bdeb3cda8f52a56ce74e0d56d980b9bb. --- api/client/beacon/BUILD.bazel | 2 + api/client/builder/BUILD.bazel | 2 + api/client/builder/testing/BUILD.bazel | 1 + api/server/structs/BUILD.bazel | 6 ++- beacon-chain/blockchain/BUILD.bazel | 2 + beacon-chain/blockchain/testing/BUILD.bazel | 1 + beacon-chain/builder/BUILD.bazel | 2 + beacon-chain/builder/testing/BUILD.bazel | 1 + beacon-chain/cache/BUILD.bazel | 2 + .../cache/depositsnapshot/BUILD.bazel | 2 + beacon-chain/core/altair/BUILD.bazel | 2 + beacon-chain/core/blocks/BUILD.bazel | 2 + beacon-chain/core/capella/BUILD.bazel | 2 + beacon-chain/core/deneb/BUILD.bazel | 2 + beacon-chain/core/electra/BUILD.bazel | 2 + beacon-chain/core/epoch/BUILD.bazel | 2 + .../core/epoch/precompute/BUILD.bazel | 2 + beacon-chain/core/execution/BUILD.bazel | 2 + beacon-chain/core/feed/operation/BUILD.bazel | 1 + beacon-chain/core/helpers/BUILD.bazel | 2 + beacon-chain/core/light-client/BUILD.bazel | 2 + beacon-chain/core/signing/BUILD.bazel | 2 + beacon-chain/core/time/BUILD.bazel | 1 + beacon-chain/core/transition/BUILD.bazel | 2 + .../core/transition/stateutils/BUILD.bazel | 2 + beacon-chain/core/validators/BUILD.bazel | 2 + beacon-chain/db/filesystem/BUILD.bazel | 2 + beacon-chain/db/iface/BUILD.bazel | 1 + beacon-chain/db/kv/BUILD.bazel | 2 + beacon-chain/db/slasherkv/BUILD.bazel | 2 + .../deterministic-genesis/BUILD.bazel | 1 + beacon-chain/execution/BUILD.bazel | 2 + beacon-chain/execution/testing/BUILD.bazel | 1 + .../forkchoice/doubly-linked-tree/BUILD.bazel | 2 + beacon-chain/forkchoice/types/BUILD.bazel | 1 + beacon-chain/monitor/BUILD.bazel | 2 + beacon-chain/node/BUILD.bazel | 1 + .../operations/attestations/BUILD.bazel | 2 + .../operations/attestations/kv/BUILD.bazel | 2 + .../operations/attestations/mock/BUILD.bazel | 5 +- beacon-chain/operations/blstoexec/BUILD.bazel | 2 + .../operations/blstoexec/mock/BUILD.bazel | 1 + beacon-chain/operations/slashings/BUILD.bazel | 2 + .../operations/slashings/mock/BUILD.bazel | 5 +- .../operations/synccommittee/BUILD.bazel | 6 ++- .../operations/voluntaryexits/BUILD.bazel | 2 + .../voluntaryexits/mock/BUILD.bazel | 1 + beacon-chain/p2p/BUILD.bazel | 3 ++ beacon-chain/p2p/encoder/BUILD.bazel | 1 + beacon-chain/p2p/peers/BUILD.bazel | 2 + beacon-chain/p2p/peers/peerdata/BUILD.bazel | 1 + beacon-chain/p2p/peers/scorers/BUILD.bazel | 2 + beacon-chain/p2p/testing/BUILD.bazel | 1 + beacon-chain/p2p/types/BUILD.bazel | 2 + beacon-chain/rpc/BUILD.bazel | 1 + beacon-chain/rpc/core/BUILD.bazel | 2 + beacon-chain/rpc/eth/beacon/BUILD.bazel | 2 + beacon-chain/rpc/eth/blob/BUILD.bazel | 1 + beacon-chain/rpc/eth/builder/BUILD.bazel | 1 + beacon-chain/rpc/eth/events/BUILD.bazel | 2 + beacon-chain/rpc/eth/helpers/BUILD.bazel | 1 + beacon-chain/rpc/eth/light-client/BUILD.bazel | 2 + beacon-chain/rpc/eth/node/BUILD.bazel | 2 + beacon-chain/rpc/eth/rewards/BUILD.bazel | 1 + beacon-chain/rpc/eth/validator/BUILD.bazel | 2 + beacon-chain/rpc/lookup/BUILD.bazel | 1 + beacon-chain/rpc/prysm/beacon/BUILD.bazel | 2 + beacon-chain/rpc/prysm/node/BUILD.bazel | 1 + .../rpc/prysm/v1alpha1/beacon/BUILD.bazel | 2 + .../rpc/prysm/v1alpha1/debug/BUILD.bazel | 2 + .../rpc/prysm/v1alpha1/node/BUILD.bazel | 2 + beacon-chain/rpc/prysm/validator/BUILD.bazel | 2 + beacon-chain/rpc/testutil/BUILD.bazel | 1 + beacon-chain/slasher/BUILD.bazel | 2 + beacon-chain/slasher/types/BUILD.bazel | 5 +- beacon-chain/state/BUILD.bazel | 1 + beacon-chain/state/fieldtrie/BUILD.bazel | 2 + beacon-chain/state/genesis/BUILD.bazel | 1 + beacon-chain/state/state-native/BUILD.bazel | 2 + beacon-chain/state/stategen/BUILD.bazel | 2 + beacon-chain/state/stateutil/BUILD.bazel | 2 + beacon-chain/state/testing/BUILD.bazel | 1 + beacon-chain/sync/BUILD.bazel | 5 ++ beacon-chain/sync/backfill/BUILD.bazel | 1 + beacon-chain/sync/initial-sync/BUILD.bazel | 2 + beacon-chain/verification/BUILD.bazel | 2 + cmd/prysmctl/p2p/BUILD.bazel | 1 + cmd/prysmctl/testnet/BUILD.bazel | 1 + cmd/validator/accounts/BUILD.bazel | 2 + consensus-types/blocks/BUILD.bazel | 2 + consensus-types/blocks/testing/BUILD.bazel | 1 + consensus-types/forkchoice/BUILD.bazel | 5 +- consensus-types/interfaces/BUILD.bazel | 2 + consensus-types/light-client/BUILD.bazel | 1 + consensus-types/mock/BUILD.bazel | 1 + consensus-types/wrapper/BUILD.bazel | 1 + container/trie/BUILD.bazel | 2 + contracts/deposit/BUILD.bazel | 2 + crypto/hash/BUILD.bazel | 1 + encoding/ssz/BUILD.bazel | 2 + encoding/ssz/detect/BUILD.bazel | 2 + encoding/ssz/equality/BUILD.bazel | 1 + monitoring/clientstats/BUILD.bazel | 1 + network/forks/BUILD.bazel | 2 + proto/migration/BUILD.bazel | 2 + proto/prysm/v1alpha1/BUILD.bazel | 47 ++++++++++++------- proto/prysm/v1alpha1/attestation/BUILD.bazel | 2 + .../aggregation/attestations/BUILD.bazel | 2 + .../aggregation/sync_contribution/BUILD.bazel | 2 + .../aggregation/testing/BUILD.bazel | 1 + proto/prysm/v1alpha1/metadata/BUILD.bazel | 1 + proto/prysm/v1alpha1/slashings/BUILD.bazel | 6 ++- runtime/interop/BUILD.bazel | 2 + testing/assertions/BUILD.bazel | 1 + testing/benchmark/BUILD.bazel | 1 + testing/endtoend/components/eth1/BUILD.bazel | 1 + testing/endtoend/evaluators/BUILD.bazel | 1 + .../endtoend/evaluators/beaconapi/BUILD.bazel | 1 + testing/endtoend/helpers/BUILD.bazel | 1 + testing/middleware/builder/BUILD.bazel | 1 + testing/mock/BUILD.bazel | 1 + testing/slasher/simulator/BUILD.bazel | 2 + .../spectest/general/deneb/kzg/BUILD.bazel | 1 + .../altair/epoch_processing/BUILD.bazel | 1 + .../shared/altair/finality/BUILD.bazel | 1 + .../spectest/shared/altair/fork/BUILD.bazel | 1 + .../shared/altair/operations/BUILD.bazel | 1 + .../shared/altair/rewards/BUILD.bazel | 1 + .../spectest/shared/altair/sanity/BUILD.bazel | 1 + .../shared/altair/ssz_static/BUILD.bazel | 1 + .../bellatrix/epoch_processing/BUILD.bazel | 1 + .../shared/bellatrix/finality/BUILD.bazel | 1 + .../shared/bellatrix/fork/BUILD.bazel | 1 + .../shared/bellatrix/operations/BUILD.bazel | 1 + .../shared/bellatrix/rewards/BUILD.bazel | 1 + .../shared/bellatrix/sanity/BUILD.bazel | 1 + .../shared/bellatrix/ssz_static/BUILD.bazel | 1 + .../capella/epoch_processing/BUILD.bazel | 1 + .../shared/capella/finality/BUILD.bazel | 1 + .../spectest/shared/capella/fork/BUILD.bazel | 1 + .../shared/capella/operations/BUILD.bazel | 1 + .../shared/capella/rewards/BUILD.bazel | 1 + .../shared/capella/sanity/BUILD.bazel | 1 + .../shared/capella/ssz_static/BUILD.bazel | 1 + .../shared/common/forkchoice/BUILD.bazel | 2 + .../shared/common/operations/BUILD.bazel | 1 + .../shared/common/ssz_static/BUILD.bazel | 1 + .../shared/deneb/epoch_processing/BUILD.bazel | 1 + .../shared/deneb/finality/BUILD.bazel | 1 + .../spectest/shared/deneb/fork/BUILD.bazel | 1 + .../shared/deneb/operations/BUILD.bazel | 1 + .../spectest/shared/deneb/rewards/BUILD.bazel | 1 + .../spectest/shared/deneb/sanity/BUILD.bazel | 1 + .../shared/deneb/ssz_static/BUILD.bazel | 1 + .../electra/epoch_processing/BUILD.bazel | 1 + .../shared/electra/finality/BUILD.bazel | 1 + .../spectest/shared/electra/fork/BUILD.bazel | 1 + .../shared/electra/operations/BUILD.bazel | 1 + .../shared/electra/rewards/BUILD.bazel | 1 + .../shared/electra/sanity/BUILD.bazel | 1 + .../shared/electra/ssz_static/BUILD.bazel | 1 + .../phase0/epoch_processing/BUILD.bazel | 1 + .../shared/phase0/finality/BUILD.bazel | 1 + .../shared/phase0/operations/BUILD.bazel | 1 + .../shared/phase0/rewards/BUILD.bazel | 1 + .../spectest/shared/phase0/sanity/BUILD.bazel | 1 + .../shared/phase0/ssz_static/BUILD.bazel | 1 + testing/util/BUILD.bazel | 2 + testing/validator-mock/BUILD.bazel | 1 + tools/benchmark-files-gen/BUILD.bazel | 1 + tools/bootnode/BUILD.bazel | 1 + tools/eth1voting/BUILD.bazel | 1 + tools/exploredb/BUILD.bazel | 1 + tools/forkchecker/BUILD.bazel | 1 + tools/pcli/BUILD.bazel | 1 + validator/accounts/BUILD.bazel | 2 + validator/accounts/testing/BUILD.bazel | 1 + validator/client/BUILD.bazel | 2 + validator/client/beacon-api/BUILD.bazel | 2 + validator/client/beacon-api/mock/BUILD.bazel | 1 + .../beacon-api/test-helpers/BUILD.bazel | 1 + validator/client/grpc-api/BUILD.bazel | 2 + validator/client/iface/BUILD.bazel | 1 + validator/client/testutil/BUILD.bazel | 1 + validator/db/BUILD.bazel | 2 + validator/db/filesystem/BUILD.bazel | 2 + validator/db/iface/BUILD.bazel | 1 + validator/db/kv/BUILD.bazel | 2 + validator/helpers/BUILD.bazel | 1 + .../remote-web3signer/v1/BUILD.bazel | 2 + .../remote-web3signer/v1/mock/BUILD.bazel | 1 + validator/rpc/BUILD.bazel | 1 + .../slashing-protection-history/BUILD.bazel | 1 + validator/testing/BUILD.bazel | 1 + 194 files changed, 330 insertions(+), 23 deletions(-) diff --git a/api/client/beacon/BUILD.bazel b/api/client/beacon/BUILD.bazel index a17c889d8f2..11e8ecb2e73 100644 --- a/api/client/beacon/BUILD.bazel +++ b/api/client/beacon/BUILD.bazel @@ -24,6 +24,7 @@ go_library( "//encoding/ssz/detect:go_default_library", "//io/file:go_default_library", "//network/forks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", @@ -51,6 +52,7 @@ go_test( "//consensus-types/primitives:go_default_library", "//encoding/ssz/detect:go_default_library", "//network/forks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/api/client/builder/BUILD.bazel b/api/client/builder/BUILD.bazel index b307bf2a080..b37b48b6b63 100644 --- a/api/client/builder/BUILD.bazel +++ b/api/client/builder/BUILD.bazel @@ -23,6 +23,7 @@ go_library( "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -49,6 +50,7 @@ go_test( "//encoding/bytesutil:go_default_library", "//math:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/api/client/builder/testing/BUILD.bazel b/api/client/builder/testing/BUILD.bazel index b62946618ef..6e99669d4d0 100644 --- a/api/client/builder/testing/BUILD.bazel +++ b/api/client/builder/testing/BUILD.bazel @@ -11,5 +11,6 @@ go_library( "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", ], ) diff --git a/api/server/structs/BUILD.bazel b/api/server/structs/BUILD.bazel index 6a8851caa72..54ed0b02a9e 100644 --- a/api/server/structs/BUILD.bazel +++ b/api/server/structs/BUILD.bazel @@ -36,6 +36,7 @@ go_library( "//math:go_default_library", "//proto/engine/v1:go_default_library", "//proto/eth/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", @@ -47,5 +48,8 @@ go_test( name = "go_default_test", srcs = ["conversions_test.go"], embed = [":go_default_library"], - deps = ["//testing/require:go_default_library"], + deps = [ + "//proto/prysm/v1alpha1:go_default_library", + "//testing/require:go_default_library", + ], ) diff --git a/beacon-chain/blockchain/BUILD.bazel b/beacon-chain/blockchain/BUILD.bazel index 454a0a96997..2dc6f11a87f 100644 --- a/beacon-chain/blockchain/BUILD.bazel +++ b/beacon-chain/blockchain/BUILD.bazel @@ -84,6 +84,7 @@ go_library( "//monitoring/tracing/trace:go_default_library", "//proto/engine/v1:go_default_library", "//proto/eth/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//runtime/version:go_default_library", "//time:go_default_library", @@ -170,6 +171,7 @@ go_test( "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", "//proto/eth/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/blockchain/testing/BUILD.bazel b/beacon-chain/blockchain/testing/BUILD.bazel index 47eb44db78e..600d086e34f 100644 --- a/beacon-chain/blockchain/testing/BUILD.bazel +++ b/beacon-chain/blockchain/testing/BUILD.bazel @@ -30,6 +30,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", ], diff --git a/beacon-chain/builder/BUILD.bazel b/beacon-chain/builder/BUILD.bazel index 0f118554527..f115fbeb845 100644 --- a/beacon-chain/builder/BUILD.bazel +++ b/beacon-chain/builder/BUILD.bazel @@ -21,6 +21,7 @@ go_library( "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", "@com_github_prometheus_client_golang//prometheus/promauto:go_default_library", @@ -38,6 +39,7 @@ go_test( "//beacon-chain/blockchain/testing:go_default_library", "//beacon-chain/db/testing:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", ], diff --git a/beacon-chain/builder/testing/BUILD.bazel b/beacon-chain/builder/testing/BUILD.bazel index e83c3081347..33fe5931eb6 100644 --- a/beacon-chain/builder/testing/BUILD.bazel +++ b/beacon-chain/builder/testing/BUILD.bazel @@ -15,6 +15,7 @@ go_library( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", diff --git a/beacon-chain/cache/BUILD.bazel b/beacon-chain/cache/BUILD.bazel index ef01127f8bb..3defcdfac58 100644 --- a/beacon-chain/cache/BUILD.bazel +++ b/beacon-chain/cache/BUILD.bazel @@ -47,6 +47,7 @@ go_library( "//encoding/bytesutil:go_default_library", "//math:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_hashicorp_golang_lru//:go_default_library", @@ -88,6 +89,7 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/cache/depositsnapshot/BUILD.bazel b/beacon-chain/cache/depositsnapshot/BUILD.bazel index 12a1dc603d8..de6e52e5ee9 100644 --- a/beacon-chain/cache/depositsnapshot/BUILD.bazel +++ b/beacon-chain/cache/depositsnapshot/BUILD.bazel @@ -20,6 +20,7 @@ go_library( "//encoding/bytesutil:go_default_library", "//math:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", @@ -49,6 +50,7 @@ go_test( "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/core/altair/BUILD.bazel b/beacon-chain/core/altair/BUILD.bazel index 07867344b09..e73e251e33d 100644 --- a/beacon-chain/core/altair/BUILD.bazel +++ b/beacon-chain/core/altair/BUILD.bazel @@ -35,6 +35,7 @@ go_library( "//encoding/bytesutil:go_default_library", "//math:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", @@ -76,6 +77,7 @@ go_test( "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//math:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", diff --git a/beacon-chain/core/blocks/BUILD.bazel b/beacon-chain/core/blocks/BUILD.bazel index 3d103f92fa4..64d5861acd6 100644 --- a/beacon-chain/core/blocks/BUILD.bazel +++ b/beacon-chain/core/blocks/BUILD.bazel @@ -43,6 +43,7 @@ go_library( "//monitoring/tracing/trace:go_default_library", "//network/forks:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/slashings:go_default_library", "//runtime/version:go_default_library", @@ -98,6 +99,7 @@ go_test( "//encoding/bytesutil:go_default_library", "//encoding/ssz:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/attestations:go_default_library", diff --git a/beacon-chain/core/capella/BUILD.bazel b/beacon-chain/core/capella/BUILD.bazel index f182009137c..d42f80bec08 100644 --- a/beacon-chain/core/capella/BUILD.bazel +++ b/beacon-chain/core/capella/BUILD.bazel @@ -11,6 +11,7 @@ go_library( "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", ], ) @@ -23,6 +24,7 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", ], diff --git a/beacon-chain/core/deneb/BUILD.bazel b/beacon-chain/core/deneb/BUILD.bazel index 15c6593c32a..4bfaf5f9102 100644 --- a/beacon-chain/core/deneb/BUILD.bazel +++ b/beacon-chain/core/deneb/BUILD.bazel @@ -11,6 +11,7 @@ go_library( "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", ], ) @@ -22,6 +23,7 @@ go_test( "//beacon-chain/core/time:go_default_library", "//config/params:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", ], diff --git a/beacon-chain/core/electra/BUILD.bazel b/beacon-chain/core/electra/BUILD.bazel index 8ec13ea3a0d..35ef921f3ef 100644 --- a/beacon-chain/core/electra/BUILD.bazel +++ b/beacon-chain/core/electra/BUILD.bazel @@ -37,6 +37,7 @@ go_library( "//math:go_default_library", "//monitoring/tracing/trace:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", @@ -76,6 +77,7 @@ go_test( "//crypto/bls/common:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/core/epoch/BUILD.bazel b/beacon-chain/core/epoch/BUILD.bazel index bc056c663ca..3a3ea5c5eec 100644 --- a/beacon-chain/core/epoch/BUILD.bazel +++ b/beacon-chain/core/epoch/BUILD.bazel @@ -21,6 +21,7 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//math:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "@com_github_pkg_errors//:go_default_library", ], @@ -45,6 +46,7 @@ go_test( "//config/fieldparams:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/core/epoch/precompute/BUILD.bazel b/beacon-chain/core/epoch/precompute/BUILD.bazel index 5858c0799f7..d16cd58091b 100644 --- a/beacon-chain/core/epoch/precompute/BUILD.bazel +++ b/beacon-chain/core/epoch/precompute/BUILD.bazel @@ -25,6 +25,7 @@ go_library( "//math:go_default_library", "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", @@ -54,6 +55,7 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//math:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", diff --git a/beacon-chain/core/execution/BUILD.bazel b/beacon-chain/core/execution/BUILD.bazel index 96370764040..460118b8ec6 100644 --- a/beacon-chain/core/execution/BUILD.bazel +++ b/beacon-chain/core/execution/BUILD.bazel @@ -16,6 +16,7 @@ go_library( "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", ], ) @@ -27,6 +28,7 @@ go_test( "//beacon-chain/core/time:go_default_library", "//config/params:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", ], diff --git a/beacon-chain/core/feed/operation/BUILD.bazel b/beacon-chain/core/feed/operation/BUILD.bazel index 2e8bb6abe7b..0d475e92d8c 100644 --- a/beacon-chain/core/feed/operation/BUILD.bazel +++ b/beacon-chain/core/feed/operation/BUILD.bazel @@ -11,5 +11,6 @@ go_library( deps = [ "//async/event:go_default_library", "//consensus-types/blocks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", ], ) diff --git a/beacon-chain/core/helpers/BUILD.bazel b/beacon-chain/core/helpers/BUILD.bazel index 85cda16e893..090a57458a6 100644 --- a/beacon-chain/core/helpers/BUILD.bazel +++ b/beacon-chain/core/helpers/BUILD.bazel @@ -34,6 +34,7 @@ go_library( "//encoding/bytesutil:go_default_library", "//math:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time:go_default_library", "//time/slots:go_default_library", @@ -78,6 +79,7 @@ go_test( "//container/slice:go_default_library", "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/core/light-client/BUILD.bazel b/beacon-chain/core/light-client/BUILD.bazel index 28906c18019..ecf6b8f71a7 100644 --- a/beacon-chain/core/light-client/BUILD.bazel +++ b/beacon-chain/core/light-client/BUILD.bazel @@ -17,6 +17,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//encoding/ssz:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -34,6 +35,7 @@ go_test( "//consensus-types/blocks:go_default_library", "//encoding/ssz:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", "@com_github_pkg_errors//:go_default_library", diff --git a/beacon-chain/core/signing/BUILD.bazel b/beacon-chain/core/signing/BUILD.bazel index b8d25f7eb51..58556761efd 100644 --- a/beacon-chain/core/signing/BUILD.bazel +++ b/beacon-chain/core/signing/BUILD.bazel @@ -15,6 +15,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", ], @@ -37,6 +38,7 @@ go_test( "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/core/time/BUILD.bazel b/beacon-chain/core/time/BUILD.bazel index a0692598e61..295de1e912e 100644 --- a/beacon-chain/core/time/BUILD.bazel +++ b/beacon-chain/core/time/BUILD.bazel @@ -23,6 +23,7 @@ go_test( "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/core/transition/BUILD.bazel b/beacon-chain/core/transition/BUILD.bazel index 1e06371484d..be7d42ada04 100644 --- a/beacon-chain/core/transition/BUILD.bazel +++ b/beacon-chain/core/transition/BUILD.bazel @@ -43,6 +43,7 @@ go_library( "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", @@ -89,6 +90,7 @@ go_test( "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", diff --git a/beacon-chain/core/transition/stateutils/BUILD.bazel b/beacon-chain/core/transition/stateutils/BUILD.bazel index ac4717ca529..fa0fa1dce1d 100644 --- a/beacon-chain/core/transition/stateutils/BUILD.bazel +++ b/beacon-chain/core/transition/stateutils/BUILD.bazel @@ -12,6 +12,7 @@ go_library( "//config/fieldparams:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", ], ) @@ -25,6 +26,7 @@ go_test( "//config/fieldparams:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", ], diff --git a/beacon-chain/core/validators/BUILD.bazel b/beacon-chain/core/validators/BUILD.bazel index 8a86afc7e96..8c341f4c791 100644 --- a/beacon-chain/core/validators/BUILD.bazel +++ b/beacon-chain/core/validators/BUILD.bazel @@ -19,6 +19,7 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//math:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -39,6 +40,7 @@ go_test( "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/db/filesystem/BUILD.bazel b/beacon-chain/db/filesystem/BUILD.bazel index fb615e430ba..e4008d70072 100644 --- a/beacon-chain/db/filesystem/BUILD.bazel +++ b/beacon-chain/db/filesystem/BUILD.bazel @@ -20,6 +20,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/logging:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", @@ -44,6 +45,7 @@ go_test( "//config/fieldparams: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", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/beacon-chain/db/iface/BUILD.bazel b/beacon-chain/db/iface/BUILD.bazel index fe14c8faf3b..81929a26a47 100644 --- a/beacon-chain/db/iface/BUILD.bazel +++ b/beacon-chain/db/iface/BUILD.bazel @@ -18,6 +18,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//monitoring/backup:go_default_library", "//proto/dbval:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", ], ) diff --git a/beacon-chain/db/kv/BUILD.bazel b/beacon-chain/db/kv/BUILD.bazel index 27516369d7f..714bfb1f26d 100644 --- a/beacon-chain/db/kv/BUILD.bazel +++ b/beacon-chain/db/kv/BUILD.bazel @@ -54,6 +54,7 @@ go_library( "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", "//proto/dbval:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time:go_default_library", "//time/slots:go_default_library", @@ -116,6 +117,7 @@ go_test( "//encoding/bytesutil:go_default_library", "//proto/dbval:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/testing:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", diff --git a/beacon-chain/db/slasherkv/BUILD.bazel b/beacon-chain/db/slasherkv/BUILD.bazel index c115b162015..3c9fe389817 100644 --- a/beacon-chain/db/slasherkv/BUILD.bazel +++ b/beacon-chain/db/slasherkv/BUILD.bazel @@ -21,6 +21,7 @@ go_library( "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@com_github_golang_snappy//:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -48,6 +49,7 @@ go_test( "//config/params: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", "//time/slots:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/beacon-chain/deterministic-genesis/BUILD.bazel b/beacon-chain/deterministic-genesis/BUILD.bazel index ed678b6b13b..32267dc50f3 100644 --- a/beacon-chain/deterministic-genesis/BUILD.bazel +++ b/beacon-chain/deterministic-genesis/BUILD.bazel @@ -15,6 +15,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime:go_default_library", "//runtime/interop:go_default_library", "//time/slots:go_default_library", diff --git a/beacon-chain/execution/BUILD.bazel b/beacon-chain/execution/BUILD.bazel index 7a8c67476c7..b33fb4d0d8a 100644 --- a/beacon-chain/execution/BUILD.bazel +++ b/beacon-chain/execution/BUILD.bazel @@ -55,6 +55,7 @@ go_library( "//network:go_default_library", "//network/authorization:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time:go_default_library", "//time/slots:go_default_library", @@ -123,6 +124,7 @@ go_test( "//encoding/bytesutil:go_default_library", "//monitoring/clientstats:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/execution/testing/BUILD.bazel b/beacon-chain/execution/testing/BUILD.bazel index d432c3c7595..ba5b27f98f6 100644 --- a/beacon-chain/execution/testing/BUILD.bazel +++ b/beacon-chain/execution/testing/BUILD.bazel @@ -24,6 +24,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_ethereum_go_ethereum//accounts/abi/bind/backends:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", diff --git a/beacon-chain/forkchoice/doubly-linked-tree/BUILD.bazel b/beacon-chain/forkchoice/doubly-linked-tree/BUILD.bazel index 56e4088cff0..1bf47ea02a4 100644 --- a/beacon-chain/forkchoice/doubly-linked-tree/BUILD.bazel +++ b/beacon-chain/forkchoice/doubly-linked-tree/BUILD.bazel @@ -34,6 +34,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -72,6 +73,7 @@ go_test( "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/forkchoice/types/BUILD.bazel b/beacon-chain/forkchoice/types/BUILD.bazel index 57724c2a7b4..c6c258b94ed 100644 --- a/beacon-chain/forkchoice/types/BUILD.bazel +++ b/beacon-chain/forkchoice/types/BUILD.bazel @@ -9,5 +9,6 @@ go_library( "//config/fieldparams:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", ], ) diff --git a/beacon-chain/monitor/BUILD.bazel b/beacon-chain/monitor/BUILD.bazel index b538ebcf831..2145a6c1128 100644 --- a/beacon-chain/monitor/BUILD.bazel +++ b/beacon-chain/monitor/BUILD.bazel @@ -28,6 +28,7 @@ go_library( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", @@ -59,6 +60,7 @@ 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/node/BUILD.bazel b/beacon-chain/node/BUILD.bazel index a1e10ed12eb..a310daf40b2 100644 --- a/beacon-chain/node/BUILD.bazel +++ b/beacon-chain/node/BUILD.bazel @@ -95,6 +95,7 @@ go_test( "//config/fieldparams:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime:go_default_library", "//runtime/interop:go_default_library", "//testing/assert:go_default_library", diff --git a/beacon-chain/operations/attestations/BUILD.bazel b/beacon-chain/operations/attestations/BUILD.bazel index 01729ad4d45..451b1cba93b 100644 --- a/beacon-chain/operations/attestations/BUILD.bazel +++ b/beacon-chain/operations/attestations/BUILD.bazel @@ -22,6 +22,7 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/attestations:go_default_library", "//time:go_default_library", @@ -51,6 +52,7 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/attestations:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/operations/attestations/kv/BUILD.bazel b/beacon-chain/operations/attestations/kv/BUILD.bazel index fab1f32d126..ab66a61f769 100644 --- a/beacon-chain/operations/attestations/kv/BUILD.bazel +++ b/beacon-chain/operations/attestations/kv/BUILD.bazel @@ -17,6 +17,7 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/attestations:go_default_library", "//runtime/version:go_default_library", @@ -41,6 +42,7 @@ go_test( "//config/fieldparams:go_default_library", "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/operations/attestations/mock/BUILD.bazel b/beacon-chain/operations/attestations/mock/BUILD.bazel index ddcca01940d..1976c31f5e1 100644 --- a/beacon-chain/operations/attestations/mock/BUILD.bazel +++ b/beacon-chain/operations/attestations/mock/BUILD.bazel @@ -6,5 +6,8 @@ go_library( srcs = ["mock.go"], importpath = "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/attestations/mock", visibility = ["//visibility:public"], - deps = ["//consensus-types/primitives:go_default_library"], + deps = [ + "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", + ], ) diff --git a/beacon-chain/operations/blstoexec/BUILD.bazel b/beacon-chain/operations/blstoexec/BUILD.bazel index ffea73a73dd..eb00d06ee98 100644 --- a/beacon-chain/operations/blstoexec/BUILD.bazel +++ b/beacon-chain/operations/blstoexec/BUILD.bazel @@ -16,6 +16,7 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//container/doubly-linked-list:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", "@com_github_prometheus_client_golang//prometheus/promauto:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", @@ -37,6 +38,7 @@ go_test( "//crypto/bls/common:go_default_library", "//crypto/hash:go_default_library", "//encoding/ssz:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", ], diff --git a/beacon-chain/operations/blstoexec/mock/BUILD.bazel b/beacon-chain/operations/blstoexec/mock/BUILD.bazel index f484f7a6eba..a55b32f649d 100644 --- a/beacon-chain/operations/blstoexec/mock/BUILD.bazel +++ b/beacon-chain/operations/blstoexec/mock/BUILD.bazel @@ -9,5 +9,6 @@ go_library( deps = [ "//beacon-chain/state:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", ], ) diff --git a/beacon-chain/operations/slashings/BUILD.bazel b/beacon-chain/operations/slashings/BUILD.bazel index 7ac9a429f94..f4f21b7bb4a 100644 --- a/beacon-chain/operations/slashings/BUILD.bazel +++ b/beacon-chain/operations/slashings/BUILD.bazel @@ -24,6 +24,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//container/slice:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", "@com_github_prometheus_client_golang//prometheus/promauto:go_default_library", @@ -48,6 +49,7 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/operations/slashings/mock/BUILD.bazel b/beacon-chain/operations/slashings/mock/BUILD.bazel index 8b0bad61350..27ad0173356 100644 --- a/beacon-chain/operations/slashings/mock/BUILD.bazel +++ b/beacon-chain/operations/slashings/mock/BUILD.bazel @@ -6,5 +6,8 @@ go_library( srcs = ["mock.go"], importpath = "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/slashings/mock", visibility = ["//visibility:public"], - deps = ["//beacon-chain/state:go_default_library"], + deps = [ + "//beacon-chain/state:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", + ], ) diff --git a/beacon-chain/operations/synccommittee/BUILD.bazel b/beacon-chain/operations/synccommittee/BUILD.bazel index d7a4045cd79..b2dc7ee4e0f 100644 --- a/beacon-chain/operations/synccommittee/BUILD.bazel +++ b/beacon-chain/operations/synccommittee/BUILD.bazel @@ -15,6 +15,7 @@ go_library( deps = [ "//consensus-types/primitives:go_default_library", "//container/queue:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", "@com_github_prometheus_client_golang//prometheus/promauto:go_default_library", @@ -28,5 +29,8 @@ go_test( "message_test.go", ], embed = [":go_default_library"], - deps = ["//testing/require:go_default_library"], + deps = [ + "//proto/prysm/v1alpha1:go_default_library", + "//testing/require:go_default_library", + ], ) diff --git a/beacon-chain/operations/voluntaryexits/BUILD.bazel b/beacon-chain/operations/voluntaryexits/BUILD.bazel index 0d06dce5670..b7924a805f0 100644 --- a/beacon-chain/operations/voluntaryexits/BUILD.bazel +++ b/beacon-chain/operations/voluntaryexits/BUILD.bazel @@ -16,6 +16,7 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//container/doubly-linked-list:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", ], @@ -34,6 +35,7 @@ go_test( "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", "//crypto/bls/common:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//time/slots:go_default_library", diff --git a/beacon-chain/operations/voluntaryexits/mock/BUILD.bazel b/beacon-chain/operations/voluntaryexits/mock/BUILD.bazel index 8c0a6355ea7..a2d8dbc00c7 100644 --- a/beacon-chain/operations/voluntaryexits/mock/BUILD.bazel +++ b/beacon-chain/operations/voluntaryexits/mock/BUILD.bazel @@ -9,5 +9,6 @@ go_library( deps = [ "//beacon-chain/state:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", ], ) diff --git a/beacon-chain/p2p/BUILD.bazel b/beacon-chain/p2p/BUILD.bazel index 47a03c187c5..d6897a6d5d9 100644 --- a/beacon-chain/p2p/BUILD.bazel +++ b/beacon-chain/p2p/BUILD.bazel @@ -69,6 +69,8 @@ go_library( "//monitoring/tracing/trace:go_default_library", "//network:go_default_library", "//network/forks:go_default_library", + "//proto/eth/v2:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//runtime:go_default_library", "//runtime/version:go_default_library", @@ -159,6 +161,7 @@ go_test( "//network:go_default_library", "//network/forks:go_default_library", "//proto/eth/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/testing:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", diff --git a/beacon-chain/p2p/encoder/BUILD.bazel b/beacon-chain/p2p/encoder/BUILD.bazel index 580707d154c..27c5f71bddc 100644 --- a/beacon-chain/p2p/encoder/BUILD.bazel +++ b/beacon-chain/p2p/encoder/BUILD.bazel @@ -34,6 +34,7 @@ go_test( embed = [":go_default_library"], deps = [ "//config/params:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/p2p/peers/BUILD.bazel b/beacon-chain/p2p/peers/BUILD.bazel index aab7ad24bd0..f2f8535f544 100644 --- a/beacon-chain/p2p/peers/BUILD.bazel +++ b/beacon-chain/p2p/peers/BUILD.bazel @@ -22,6 +22,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//crypto/rand:go_default_library", "//math:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//time:go_default_library", "//time/slots:go_default_library", @@ -54,6 +55,7 @@ go_test( "//consensus-types/primitives:go_default_library", "//consensus-types/wrapper:go_default_library", "//proto/eth/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enr:go_default_library", diff --git a/beacon-chain/p2p/peers/peerdata/BUILD.bazel b/beacon-chain/p2p/peers/peerdata/BUILD.bazel index a8dbe51a91e..8afc65bedf3 100644 --- a/beacon-chain/p2p/peers/peerdata/BUILD.bazel +++ b/beacon-chain/p2p/peers/peerdata/BUILD.bazel @@ -6,6 +6,7 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p/peers/peerdata", visibility = ["//beacon-chain:__subpackages__"], deps = [ + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enr:go_default_library", "@com_github_libp2p_go_libp2p//core/network:go_default_library", diff --git a/beacon-chain/p2p/peers/scorers/BUILD.bazel b/beacon-chain/p2p/peers/scorers/BUILD.bazel index 5cc95727d65..e6eb6a277c8 100644 --- a/beacon-chain/p2p/peers/scorers/BUILD.bazel +++ b/beacon-chain/p2p/peers/scorers/BUILD.bazel @@ -18,6 +18,7 @@ go_library( "//config/features:go_default_library", "//consensus-types/primitives:go_default_library", "//crypto/rand:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_libp2p_go_libp2p//core/peer:go_default_library", ], ) @@ -41,6 +42,7 @@ go_test( "//config/features:go_default_library", "//consensus-types/primitives:go_default_library", "//crypto/rand:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//time:go_default_library", diff --git a/beacon-chain/p2p/testing/BUILD.bazel b/beacon-chain/p2p/testing/BUILD.bazel index cf987dd074d..18765496b86 100644 --- a/beacon-chain/p2p/testing/BUILD.bazel +++ b/beacon-chain/p2p/testing/BUILD.bazel @@ -20,6 +20,7 @@ go_library( "//beacon-chain/p2p/encoder:go_default_library", "//beacon-chain/p2p/peers:go_default_library", "//beacon-chain/p2p/peers/scorers:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//testing/require:go_default_library", "@com_github_ethereum_go_ethereum//crypto:go_default_library", diff --git a/beacon-chain/p2p/types/BUILD.bazel b/beacon-chain/p2p/types/BUILD.bazel index fb444124183..2ecf4d8166e 100644 --- a/beacon-chain/p2p/types/BUILD.bazel +++ b/beacon-chain/p2p/types/BUILD.bazel @@ -25,6 +25,7 @@ go_library( "//consensus-types/wrapper:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", @@ -42,6 +43,7 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/rpc/BUILD.bazel b/beacon-chain/rpc/BUILD.bazel index ab4b8f9e2c3..dbb213a6559 100644 --- a/beacon-chain/rpc/BUILD.bazel +++ b/beacon-chain/rpc/BUILD.bazel @@ -54,6 +54,7 @@ go_library( "//config/params:go_default_library", "//io/logs:go_default_library", "//monitoring/tracing:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_grpc_ecosystem_go_grpc_middleware//:go_default_library", "@com_github_grpc_ecosystem_go_grpc_middleware//recovery:go_default_library", "@com_github_grpc_ecosystem_go_grpc_middleware//tracing/opentracing:go_default_library", diff --git a/beacon-chain/rpc/core/BUILD.bazel b/beacon-chain/rpc/core/BUILD.bazel index c1b5c3efee6..b59af863533 100644 --- a/beacon-chain/rpc/core/BUILD.bazel +++ b/beacon-chain/rpc/core/BUILD.bazel @@ -37,6 +37,7 @@ go_library( "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time:go_default_library", "//time/slots:go_default_library", @@ -55,6 +56,7 @@ go_test( "//beacon-chain/cache:go_default_library", "//config/params:go_default_library", "//consensus-types/validator:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", ], diff --git a/beacon-chain/rpc/eth/beacon/BUILD.bazel b/beacon-chain/rpc/eth/beacon/BUILD.bazel index d0422b43893..3b44d87bb90 100644 --- a/beacon-chain/rpc/eth/beacon/BUILD.bazel +++ b/beacon-chain/rpc/eth/beacon/BUILD.bazel @@ -54,6 +54,7 @@ go_library( "//encoding/bytesutil:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", @@ -110,6 +111,7 @@ go_test( "//encoding/bytesutil:go_default_library", "//encoding/ssz:go_default_library", "//network/httputil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/mock:go_default_library", diff --git a/beacon-chain/rpc/eth/blob/BUILD.bazel b/beacon-chain/rpc/eth/blob/BUILD.bazel index ade6012c5a7..85f48f9bbc7 100644 --- a/beacon-chain/rpc/eth/blob/BUILD.bazel +++ b/beacon-chain/rpc/eth/blob/BUILD.bazel @@ -36,6 +36,7 @@ go_test( "//config/fieldparams:go_default_library", "//config/params:go_default_library", "//network/httputil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/rpc/eth/builder/BUILD.bazel b/beacon-chain/rpc/eth/builder/BUILD.bazel index 36be4b01020..dd0663e2dda 100644 --- a/beacon-chain/rpc/eth/builder/BUILD.bazel +++ b/beacon-chain/rpc/eth/builder/BUILD.bazel @@ -37,6 +37,7 @@ go_test( "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", "//network/httputil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/rpc/eth/events/BUILD.bazel b/beacon-chain/rpc/eth/events/BUILD.bazel index dcb9ce41530..da308f79785 100644 --- a/beacon-chain/rpc/eth/events/BUILD.bazel +++ b/beacon-chain/rpc/eth/events/BUILD.bazel @@ -27,6 +27,7 @@ go_library( "//network/httputil:go_default_library", "//proto/eth/v1:go_default_library", "//proto/eth/v2:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", @@ -54,6 +55,7 @@ go_test( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//proto/eth/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", diff --git a/beacon-chain/rpc/eth/helpers/BUILD.bazel b/beacon-chain/rpc/eth/helpers/BUILD.bazel index df1d490f242..c9e1b5ff4b4 100644 --- a/beacon-chain/rpc/eth/helpers/BUILD.bazel +++ b/beacon-chain/rpc/eth/helpers/BUILD.bazel @@ -52,6 +52,7 @@ go_test( "//proto/engine/v1:go_default_library", "//proto/eth/v1:go_default_library", "//proto/migration:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/rpc/eth/light-client/BUILD.bazel b/beacon-chain/rpc/eth/light-client/BUILD.bazel index 6912951765d..f4bf65404a2 100644 --- a/beacon-chain/rpc/eth/light-client/BUILD.bazel +++ b/beacon-chain/rpc/eth/light-client/BUILD.bazel @@ -18,6 +18,7 @@ go_library( "//beacon-chain/rpc/eth/shared:go_default_library", "//beacon-chain/rpc/lookup:go_default_library", "//beacon-chain/state:go_default_library", + "//config/fieldparams:go_default_library", "//config/params:go_default_library", "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", @@ -53,6 +54,7 @@ go_test( "//consensus-types/light-client:go_default_library", "//consensus-types/primitives:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/rpc/eth/node/BUILD.bazel b/beacon-chain/rpc/eth/node/BUILD.bazel index 9d3b25185a7..5b35395a1b3 100644 --- a/beacon-chain/rpc/eth/node/BUILD.bazel +++ b/beacon-chain/rpc/eth/node/BUILD.bazel @@ -23,6 +23,7 @@ go_library( "//network/httputil:go_default_library", "//proto/eth/v1:go_default_library", "//proto/migration:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_libp2p_go_libp2p//core/peer:go_default_library", @@ -49,6 +50,7 @@ go_test( "//consensus-types/primitives:go_default_library", "//consensus-types/wrapper:go_default_library", "//network/httputil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/rpc/eth/rewards/BUILD.bazel b/beacon-chain/rpc/eth/rewards/BUILD.bazel index 3926e3c605a..7636fab75e5 100644 --- a/beacon-chain/rpc/eth/rewards/BUILD.bazel +++ b/beacon-chain/rpc/eth/rewards/BUILD.bazel @@ -62,6 +62,7 @@ go_test( "//crypto/bls/blst:go_default_library", "//encoding/bytesutil:go_default_library", "//network/httputil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/rpc/eth/validator/BUILD.bazel b/beacon-chain/rpc/eth/validator/BUILD.bazel index 8427851162c..ed434774d47 100644 --- a/beacon-chain/rpc/eth/validator/BUILD.bazel +++ b/beacon-chain/rpc/eth/validator/BUILD.bazel @@ -39,6 +39,7 @@ go_library( "//encoding/bytesutil:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", @@ -83,6 +84,7 @@ go_test( "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//network/httputil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/mock:go_default_library", diff --git a/beacon-chain/rpc/lookup/BUILD.bazel b/beacon-chain/rpc/lookup/BUILD.bazel index 9273767a76d..59ae22c64af 100644 --- a/beacon-chain/rpc/lookup/BUILD.bazel +++ b/beacon-chain/rpc/lookup/BUILD.bazel @@ -50,6 +50,7 @@ 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/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/rpc/prysm/beacon/BUILD.bazel b/beacon-chain/rpc/prysm/beacon/BUILD.bazel index 46e4d2d6f9c..d750ef3bbe2 100644 --- a/beacon-chain/rpc/prysm/beacon/BUILD.bazel +++ b/beacon-chain/rpc/prysm/beacon/BUILD.bazel @@ -30,6 +30,7 @@ go_library( "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", "//proto/eth/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -65,6 +66,7 @@ go_test( "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//network/httputil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/rpc/prysm/node/BUILD.bazel b/beacon-chain/rpc/prysm/node/BUILD.bazel index 9535ccaff04..cea92902b96 100644 --- a/beacon-chain/rpc/prysm/node/BUILD.bazel +++ b/beacon-chain/rpc/prysm/node/BUILD.bazel @@ -19,6 +19,7 @@ go_library( "//beacon-chain/sync:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_libp2p_go_libp2p//core/network:go_default_library", "@com_github_libp2p_go_libp2p//core/peer:go_default_library", "@com_github_pkg_errors//:go_default_library", diff --git a/beacon-chain/rpc/prysm/v1alpha1/beacon/BUILD.bazel b/beacon-chain/rpc/prysm/v1alpha1/beacon/BUILD.bazel index 48f27303596..81c180d28d4 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/beacon/BUILD.bazel +++ b/beacon-chain/rpc/prysm/v1alpha1/beacon/BUILD.bazel @@ -43,6 +43,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//container/slice:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", @@ -100,6 +101,7 @@ go_test( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/rpc/prysm/v1alpha1/debug/BUILD.bazel b/beacon-chain/rpc/prysm/v1alpha1/debug/BUILD.bazel index f97d60d2304..1b6c7c66803 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/debug/BUILD.bazel +++ b/beacon-chain/rpc/prysm/v1alpha1/debug/BUILD.bazel @@ -21,6 +21,7 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "@com_github_ethereum_go_ethereum//log:go_default_library", "@com_github_golang_protobuf//ptypes/empty", @@ -53,6 +54,7 @@ go_test( "//config/fieldparams:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/rpc/prysm/v1alpha1/node/BUILD.bazel b/beacon-chain/rpc/prysm/v1alpha1/node/BUILD.bazel index 106090d69b6..7331e4ddab5 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/node/BUILD.bazel +++ b/beacon-chain/rpc/prysm/v1alpha1/node/BUILD.bazel @@ -13,6 +13,7 @@ go_library( "//beacon-chain/sync:go_default_library", "//io/logs:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "@com_github_golang_protobuf//ptypes/empty", "@com_github_golang_protobuf//ptypes/timestamp", @@ -38,6 +39,7 @@ go_test( "//beacon-chain/rpc/testutil:go_default_library", "//beacon-chain/sync/initial-sync/testing:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/rpc/prysm/validator/BUILD.bazel b/beacon-chain/rpc/prysm/validator/BUILD.bazel index ec9b345dd3a..22baf6da1d2 100644 --- a/beacon-chain/rpc/prysm/validator/BUILD.bazel +++ b/beacon-chain/rpc/prysm/validator/BUILD.bazel @@ -19,6 +19,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -54,6 +55,7 @@ go_test( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/rpc/testutil/BUILD.bazel b/beacon-chain/rpc/testutil/BUILD.bazel index 3eb7eaace6b..10980a7152f 100644 --- a/beacon-chain/rpc/testutil/BUILD.bazel +++ b/beacon-chain/rpc/testutil/BUILD.bazel @@ -21,6 +21,7 @@ go_library( "//consensus-types/interfaces: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", ], diff --git a/beacon-chain/slasher/BUILD.bazel b/beacon-chain/slasher/BUILD.bazel index 22bbe0a4123..b0f0391ac11 100644 --- a/beacon-chain/slasher/BUILD.bazel +++ b/beacon-chain/slasher/BUILD.bazel @@ -40,6 +40,7 @@ go_library( "//container/slice:go_default_library", "//encoding/bytesutil:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", @@ -81,6 +82,7 @@ go_test( "//crypto/bls:go_default_library", "//crypto/bls/common:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/slasher/types/BUILD.bazel b/beacon-chain/slasher/types/BUILD.bazel index 0fdb98fcfba..1da07521179 100644 --- a/beacon-chain/slasher/types/BUILD.bazel +++ b/beacon-chain/slasher/types/BUILD.bazel @@ -9,5 +9,8 @@ go_library( "//cmd/prysmctl:__subpackages__", "//testing/slasher/simulator:__subpackages__", ], - deps = ["//consensus-types/primitives:go_default_library"], + deps = [ + "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", + ], ) diff --git a/beacon-chain/state/BUILD.bazel b/beacon-chain/state/BUILD.bazel index 0e1c299ba8a..295cfa2110d 100644 --- a/beacon-chain/state/BUILD.bazel +++ b/beacon-chain/state/BUILD.bazel @@ -15,6 +15,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", "@com_github_prometheus_client_golang//prometheus/promauto:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", diff --git a/beacon-chain/state/fieldtrie/BUILD.bazel b/beacon-chain/state/fieldtrie/BUILD.bazel index f79bc9d7bdd..d988845232e 100644 --- a/beacon-chain/state/fieldtrie/BUILD.bazel +++ b/beacon-chain/state/fieldtrie/BUILD.bazel @@ -14,6 +14,7 @@ go_library( "//beacon-chain/state/stateutil:go_default_library", "//container/multi-value-slice:go_default_library", "//math:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", ], ) @@ -35,6 +36,7 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//container/multi-value-slice:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/state/genesis/BUILD.bazel b/beacon-chain/state/genesis/BUILD.bazel index 7ad97141c4f..2c5a225e98a 100644 --- a/beacon-chain/state/genesis/BUILD.bazel +++ b/beacon-chain/state/genesis/BUILD.bazel @@ -16,6 +16,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_golang_snappy//:go_default_library", ], ) diff --git a/beacon-chain/state/state-native/BUILD.bazel b/beacon-chain/state/state-native/BUILD.bazel index 6febe70dc32..6d14d26723d 100644 --- a/beacon-chain/state/state-native/BUILD.bazel +++ b/beacon-chain/state/state-native/BUILD.bazel @@ -74,6 +74,7 @@ go_library( "//math:go_default_library", "//monitoring/tracing/trace:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -142,6 +143,7 @@ go_test( "//crypto/rand:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", diff --git a/beacon-chain/state/stategen/BUILD.bazel b/beacon-chain/state/stategen/BUILD.bazel index 6a5f8c53ee1..d6d90003346 100644 --- a/beacon-chain/state/stategen/BUILD.bazel +++ b/beacon-chain/state/stategen/BUILD.bazel @@ -36,6 +36,7 @@ go_library( "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@com_github_hashicorp_golang_lru//:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -80,6 +81,7 @@ go_test( "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/state/stateutil/BUILD.bazel b/beacon-chain/state/stateutil/BUILD.bazel index 34178756953..b9270e81c7e 100644 --- a/beacon-chain/state/stateutil/BUILD.bazel +++ b/beacon-chain/state/stateutil/BUILD.bazel @@ -37,6 +37,7 @@ go_library( "//encoding/bytesutil:go_default_library", "//encoding/ssz:go_default_library", "//math:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", ], @@ -65,6 +66,7 @@ go_test( "//encoding/bytesutil:go_default_library", "//encoding/ssz:go_default_library", "//math:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/beacon-chain/state/testing/BUILD.bazel b/beacon-chain/state/testing/BUILD.bazel index a9468fa4b19..0a053d670a2 100644 --- a/beacon-chain/state/testing/BUILD.bazel +++ b/beacon-chain/state/testing/BUILD.bazel @@ -24,6 +24,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//crypto/bls/common:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", diff --git a/beacon-chain/sync/BUILD.bazel b/beacon-chain/sync/BUILD.bazel index 13b9faa8464..a690b63ed10 100644 --- a/beacon-chain/sync/BUILD.bazel +++ b/beacon-chain/sync/BUILD.bazel @@ -75,6 +75,7 @@ go_library( "//beacon-chain/core/feed/operation:go_default_library", "//beacon-chain/core/feed/state:go_default_library", "//beacon-chain/core/helpers:go_default_library", + "//beacon-chain/core/light-client:go_default_library", "//beacon-chain/core/signing:go_default_library", "//beacon-chain/core/transition:go_default_library", "//beacon-chain/core/transition/interop:go_default_library", @@ -117,6 +118,8 @@ go_library( "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/forks:go_default_library", + "//proto/eth/v2:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//runtime:go_default_library", @@ -141,6 +144,7 @@ go_library( "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_trailofbits_go_mutexasserts//:go_default_library", + "@io_opencensus_go//trace:go_default_library", "@io_opentelemetry_go_otel_trace//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", ], @@ -243,6 +247,7 @@ go_test( "//network/forks:go_default_library", "//proto/engine/v1:go_default_library", "//proto/eth/v2:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//testing/assert:go_default_library", diff --git a/beacon-chain/sync/backfill/BUILD.bazel b/beacon-chain/sync/backfill/BUILD.bazel index 68d69dcbdcc..90e7dbbd44a 100644 --- a/beacon-chain/sync/backfill/BUILD.bazel +++ b/beacon-chain/sync/backfill/BUILD.bazel @@ -37,6 +37,7 @@ go_library( "//encoding/bytesutil:go_default_library", "//network/forks:go_default_library", "//proto/dbval:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", diff --git a/beacon-chain/sync/initial-sync/BUILD.bazel b/beacon-chain/sync/initial-sync/BUILD.bazel index 94a21d3276c..1291f2fc20f 100644 --- a/beacon-chain/sync/initial-sync/BUILD.bazel +++ b/beacon-chain/sync/initial-sync/BUILD.bazel @@ -40,6 +40,7 @@ go_library( "//crypto/rand:go_default_library", "//math:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime:go_default_library", "//runtime/version:go_default_library", "//time:go_default_library", @@ -93,6 +94,7 @@ go_test( "//container/slice:go_default_library", "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/beacon-chain/verification/BUILD.bazel b/beacon-chain/verification/BUILD.bazel index 6b863a8bb6c..fa95e5451e6 100644 --- a/beacon-chain/verification/BUILD.bazel +++ b/beacon-chain/verification/BUILD.bazel @@ -32,6 +32,7 @@ go_library( "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//network/forks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/logging:go_default_library", "//time/slots:go_default_library", "@com_github_hashicorp_golang_lru//:go_default_library", @@ -64,6 +65,7 @@ go_test( "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/cmd/prysmctl/p2p/BUILD.bazel b/cmd/prysmctl/p2p/BUILD.bazel index 415877c3d0d..712f4756a89 100644 --- a/cmd/prysmctl/p2p/BUILD.bazel +++ b/cmd/prysmctl/p2p/BUILD.bazel @@ -32,6 +32,7 @@ go_library( "//monitoring/tracing/trace:go_default_library", "//network:go_default_library", "//network/forks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", diff --git a/cmd/prysmctl/testnet/BUILD.bazel b/cmd/prysmctl/testnet/BUILD.bazel index 744c3f321cb..c0e1f07e8f4 100644 --- a/cmd/prysmctl/testnet/BUILD.bazel +++ b/cmd/prysmctl/testnet/BUILD.bazel @@ -14,6 +14,7 @@ go_library( "//config/params:go_default_library", "//container/trie:go_default_library", "//io/file:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//runtime/version:go_default_library", "@com_github_ethereum_go_ethereum//core:go_default_library", diff --git a/cmd/validator/accounts/BUILD.bazel b/cmd/validator/accounts/BUILD.bazel index 7dcfbf1861b..e9b072c623f 100644 --- a/cmd/validator/accounts/BUILD.bazel +++ b/cmd/validator/accounts/BUILD.bazel @@ -19,6 +19,7 @@ go_library( "//cmd/validator/flags:go_default_library", "//config/features:go_default_library", "//io/prompt:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/tos:go_default_library", "//validator/accounts:go_default_library", "//validator/accounts/iface:go_default_library", @@ -54,6 +55,7 @@ go_test( "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/validator-mock:go_default_library", diff --git a/consensus-types/blocks/BUILD.bazel b/consensus-types/blocks/BUILD.bazel index a92589f6df7..32ba9157fe4 100644 --- a/consensus-types/blocks/BUILD.bazel +++ b/consensus-types/blocks/BUILD.bazel @@ -30,6 +30,7 @@ go_library( "//encoding/ssz:go_default_library", "//monitoring/tracing/trace:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//runtime/version:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -60,6 +61,7 @@ go_test( "//container/trie:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", diff --git a/consensus-types/blocks/testing/BUILD.bazel b/consensus-types/blocks/testing/BUILD.bazel index f83ad46fa60..32cb182180b 100644 --- a/consensus-types/blocks/testing/BUILD.bazel +++ b/consensus-types/blocks/testing/BUILD.bazel @@ -13,6 +13,7 @@ go_library( "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", ], ) diff --git a/consensus-types/forkchoice/BUILD.bazel b/consensus-types/forkchoice/BUILD.bazel index 3ddf22c6c72..e9cd60765b6 100644 --- a/consensus-types/forkchoice/BUILD.bazel +++ b/consensus-types/forkchoice/BUILD.bazel @@ -5,5 +5,8 @@ go_library( srcs = ["types.go"], importpath = "github.com/prysmaticlabs/prysm/v5/consensus-types/forkchoice", visibility = ["//visibility:public"], - deps = ["//consensus-types/primitives:go_default_library"], + deps = [ + "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", + ], ) diff --git a/consensus-types/interfaces/BUILD.bazel b/consensus-types/interfaces/BUILD.bazel index 557ac8fbf1d..51b9c89816c 100644 --- a/consensus-types/interfaces/BUILD.bazel +++ b/consensus-types/interfaces/BUILD.bazel @@ -15,6 +15,7 @@ go_library( "//config/fieldparams:go_default_library", "//consensus-types/primitives:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//runtime/version:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -34,6 +35,7 @@ go_test( "//config/fieldparams:go_default_library", "//consensus-types/blocks:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/consensus-types/light-client/BUILD.bazel b/consensus-types/light-client/BUILD.bazel index 5f284cdedc2..78432c8eecb 100644 --- a/consensus-types/light-client/BUILD.bazel +++ b/consensus-types/light-client/BUILD.bazel @@ -20,6 +20,7 @@ go_library( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", diff --git a/consensus-types/mock/BUILD.bazel b/consensus-types/mock/BUILD.bazel index e8adf862cc6..e7ce82febd6 100644 --- a/consensus-types/mock/BUILD.bazel +++ b/consensus-types/mock/BUILD.bazel @@ -11,6 +11,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//proto/engine/v1:go_default_library", "//proto/eth/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", diff --git a/consensus-types/wrapper/BUILD.bazel b/consensus-types/wrapper/BUILD.bazel index e108effa0b6..d4e5da02244 100644 --- a/consensus-types/wrapper/BUILD.bazel +++ b/consensus-types/wrapper/BUILD.bazel @@ -6,6 +6,7 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/v5/consensus-types/wrapper", visibility = ["//visibility:public"], deps = [ + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//runtime/version:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", diff --git a/container/trie/BUILD.bazel b/container/trie/BUILD.bazel index 0183c4bf789..0cd71124692 100644 --- a/container/trie/BUILD.bazel +++ b/container/trie/BUILD.bazel @@ -11,6 +11,7 @@ go_library( deps = [ "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", ], ) @@ -30,6 +31,7 @@ go_test( "//contracts/deposit/mock:go_default_library", "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "@com_github_ethereum_go_ethereum//accounts/abi/bind:go_default_library", diff --git a/contracts/deposit/BUILD.bazel b/contracts/deposit/BUILD.bazel index 4b9ef43b4dd..0964bc0d8dd 100644 --- a/contracts/deposit/BUILD.bazel +++ b/contracts/deposit/BUILD.bazel @@ -15,6 +15,7 @@ go_library( "//config/params:go_default_library", "//crypto/bls:go_default_library", "//crypto/hash:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_ethereum_go_ethereum//:go_default_library", "@com_github_ethereum_go_ethereum//accounts/abi:go_default_library", "@com_github_ethereum_go_ethereum//accounts/abi/bind:go_default_library", @@ -40,6 +41,7 @@ go_test( "//container/trie:go_default_library", "//contracts/deposit/mock:go_default_library", "//crypto/bls:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/crypto/hash/BUILD.bazel b/crypto/hash/BUILD.bazel index 3515ad9952f..409b2fd2bc0 100644 --- a/crypto/hash/BUILD.bazel +++ b/crypto/hash/BUILD.bazel @@ -23,6 +23,7 @@ go_test( ":go_default_library", "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/testing:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/encoding/ssz/BUILD.bazel b/encoding/ssz/BUILD.bazel index 3da5699debd..90f31e0f4b2 100644 --- a/encoding/ssz/BUILD.bazel +++ b/encoding/ssz/BUILD.bazel @@ -17,6 +17,7 @@ go_library( "//crypto/hash/htr:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_minio_sha256_simd//:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", @@ -42,6 +43,7 @@ go_test( "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "@com_github_pkg_errors//:go_default_library", diff --git a/encoding/ssz/detect/BUILD.bazel b/encoding/ssz/detect/BUILD.bazel index 4ad8845419e..c409403fc96 100644 --- a/encoding/ssz/detect/BUILD.bazel +++ b/encoding/ssz/detect/BUILD.bazel @@ -18,6 +18,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//network/forks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -39,6 +40,7 @@ go_test( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/encoding/ssz/equality/BUILD.bazel b/encoding/ssz/equality/BUILD.bazel index c810c92bb2b..4c67be0035a 100644 --- a/encoding/ssz/equality/BUILD.bazel +++ b/encoding/ssz/equality/BUILD.bazel @@ -16,6 +16,7 @@ go_test( srcs = ["deep_equal_test.go"], deps = [ ":go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", ], ) diff --git a/monitoring/clientstats/BUILD.bazel b/monitoring/clientstats/BUILD.bazel index 279c986592b..abfc754bec5 100644 --- a/monitoring/clientstats/BUILD.bazel +++ b/monitoring/clientstats/BUILD.bazel @@ -11,6 +11,7 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/v5/monitoring/clientstats", visibility = ["//visibility:public"], deps = [ + "//proto/prysm/v1alpha1:go_default_library", "@com_github_prometheus_client_model//go:go_default_library", "@com_github_prometheus_prom2json//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", diff --git a/network/forks/BUILD.bazel b/network/forks/BUILD.bazel index f66fdbb90a4..3d84e93ec32 100644 --- a/network/forks/BUILD.bazel +++ b/network/forks/BUILD.bazel @@ -15,6 +15,7 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", ], @@ -31,6 +32,7 @@ go_test( "//beacon-chain/core/signing:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", ], diff --git a/proto/migration/BUILD.bazel b/proto/migration/BUILD.bazel index 2ea8405c1f1..154b51281fe 100644 --- a/proto/migration/BUILD.bazel +++ b/proto/migration/BUILD.bazel @@ -13,6 +13,7 @@ go_library( "//encoding/bytesutil:go_default_library", "//proto/eth/v1:go_default_library", "//proto/eth/v2:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_pkg_errors//:go_default_library", ], ) @@ -27,6 +28,7 @@ go_test( deps = [ "//consensus-types/primitives:go_default_library", "//proto/eth/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", ], diff --git a/proto/prysm/v1alpha1/BUILD.bazel b/proto/prysm/v1alpha1/BUILD.bazel index 6ad6ab187cf..68434877786 100644 --- a/proto/prysm/v1alpha1/BUILD.bazel +++ b/proto/prysm/v1alpha1/BUILD.bazel @@ -32,6 +32,7 @@ proto_library( deps = [ "//proto/engine/v1:proto", "//proto/eth/ext:proto", + "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_proto", "@com_google_protobuf//:any_proto", "@com_google_protobuf//:descriptor_proto", "@com_google_protobuf//:empty_proto", @@ -81,11 +82,6 @@ ssz_altair_objs = [ "BeaconBlockBodyAltair", "BeaconStateAltair", "ContributionAndProof", - "LightClientHeaderAltair", - "LightClientBootstrapAltair", - "LightClientUpdateAltair", - "LightClientFinalityUpdateAltair", - "LightClientOptimisticUpdateAltair", "SignedBeaconBlockAltair", "SignedContributionAndProof", "SyncAggregate", @@ -115,11 +111,6 @@ ssz_capella_objs = [ "BlindedBeaconBlockCapella", "BuilderBidCapella", "HistoricalSummary", - "LightClientHeaderCapella", - "LightClientBootstrapCapella", - "LightClientUpdateCapella", - "LightClientFinalityUpdateCapella", - "LightClientOptimisticUpdateCapella", "SignedBLSToExecutionChange", "SignedBeaconBlockCapella", "SignedBlindedBeaconBlockCapella", @@ -137,11 +128,6 @@ ssz_deneb_objs = [ "BlobSidecar", "BlobSidecars", "BuilderBidDeneb", - "LightClientHeaderDeneb", - "LightClientBootstrapDeneb", - "LightClientUpdateDeneb", - "LightClientFinalityUpdateDeneb", - "LightClientOptimisticUpdateDeneb", "SignedBeaconBlockContentsDeneb", "SignedBeaconBlockDeneb", "SignedBlindedBeaconBlockDeneb", @@ -287,6 +273,7 @@ go_proto_library( "//proto/engine/v1:go_default_library", "//proto/eth/ext:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@googleapis//google/api:annotations_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", @@ -300,6 +287,29 @@ go_proto_library( ], ) +go_proto_library( + name = "go_grpc_gateway_library", + compilers = [ + "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-grpc-gateway:go_gen_grpc_gateway", + ], + embed = [":go_proto"], + importpath = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1", + protos = [":proto"], + visibility = ["//visibility:private"], + deps = [ + "//proto/engine/v1:go_default_library", + "//proto/eth/ext:go_default_library", + "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", + "@com_github_prysmaticlabs_go_bitfield//:go_default_library", + "@googleapis//google/api:annotations_go_proto", + "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", + "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", + "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", + "@org_golang_google_protobuf//types/descriptorpb:go_default_library", + "@org_golang_google_protobuf//types/known/emptypb:go_default_library", + ], +) + go_library( name = "go_default_library", srcs = [ @@ -317,6 +327,9 @@ go_library( ":ssz_generated_non_core", # keep ":ssz_generated_phase0", # keep ], + embed = [ + ":go_grpc_gateway_library", + ], importpath = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1", visibility = ["//visibility:public"], deps = SSZ_DEPS + [ @@ -327,6 +340,9 @@ go_library( "//runtime/version:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", + "@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library", + "@com_github_grpc_ecosystem_grpc_gateway_v2//utilities:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", # keep "@googleapis//google/api:annotations_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", @@ -351,7 +367,6 @@ ssz_proto_files( "beacon_block.proto", "beacon_state.proto", "blobs.proto", - "light_client.proto", "sync_committee.proto", "withdrawals.proto", ], diff --git a/proto/prysm/v1alpha1/attestation/BUILD.bazel b/proto/prysm/v1alpha1/attestation/BUILD.bazel index c3ba6652ee2..c27b0bf90d3 100644 --- a/proto/prysm/v1alpha1/attestation/BUILD.bazel +++ b/proto/prysm/v1alpha1/attestation/BUILD.bazel @@ -16,6 +16,7 @@ go_library( "//crypto/bls:go_default_library", "//crypto/hash:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", @@ -33,6 +34,7 @@ go_test( "//config/fieldparams:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/proto/prysm/v1alpha1/attestation/aggregation/attestations/BUILD.bazel b/proto/prysm/v1alpha1/attestation/aggregation/attestations/BUILD.bazel index 6a8dfac77e8..1d67021b256 100644 --- a/proto/prysm/v1alpha1/attestation/aggregation/attestations/BUILD.bazel +++ b/proto/prysm/v1alpha1/attestation/aggregation/attestations/BUILD.bazel @@ -10,6 +10,7 @@ go_library( visibility = ["//visibility:public"], deps = [ "//crypto/bls:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation:go_default_library", "//runtime/version:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -29,6 +30,7 @@ go_test( "//config/params:go_default_library", "//crypto/bls:go_default_library", "//encoding/ssz/equality:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/testing:go_default_library", "//testing/assert:go_default_library", diff --git a/proto/prysm/v1alpha1/attestation/aggregation/sync_contribution/BUILD.bazel b/proto/prysm/v1alpha1/attestation/aggregation/sync_contribution/BUILD.bazel index 48ee7c73886..d644dfb4751 100644 --- a/proto/prysm/v1alpha1/attestation/aggregation/sync_contribution/BUILD.bazel +++ b/proto/prysm/v1alpha1/attestation/aggregation/sync_contribution/BUILD.bazel @@ -10,6 +10,7 @@ go_library( visibility = ["//visibility:public"], deps = [ "//crypto/bls:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", @@ -22,6 +23,7 @@ go_test( embed = [":go_default_library"], deps = [ "//crypto/bls:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/testing:go_default_library", "//testing/assert:go_default_library", diff --git a/proto/prysm/v1alpha1/attestation/aggregation/testing/BUILD.bazel b/proto/prysm/v1alpha1/attestation/aggregation/testing/BUILD.bazel index 159477e2e82..220bbe96bfb 100644 --- a/proto/prysm/v1alpha1/attestation/aggregation/testing/BUILD.bazel +++ b/proto/prysm/v1alpha1/attestation/aggregation/testing/BUILD.bazel @@ -9,6 +9,7 @@ go_library( deps = [ "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//time:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", ], diff --git a/proto/prysm/v1alpha1/metadata/BUILD.bazel b/proto/prysm/v1alpha1/metadata/BUILD.bazel index 597669e949f..8fb42dda10c 100644 --- a/proto/prysm/v1alpha1/metadata/BUILD.bazel +++ b/proto/prysm/v1alpha1/metadata/BUILD.bazel @@ -6,6 +6,7 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1/metadata", visibility = ["//visibility:public"], deps = [ + "//proto/prysm/v1alpha1:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", ], diff --git a/proto/prysm/v1alpha1/slashings/BUILD.bazel b/proto/prysm/v1alpha1/slashings/BUILD.bazel index 1b658cc77f2..06d77ece799 100644 --- a/proto/prysm/v1alpha1/slashings/BUILD.bazel +++ b/proto/prysm/v1alpha1/slashings/BUILD.bazel @@ -8,6 +8,7 @@ go_library( ], importpath = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1/slashings", visibility = ["//visibility:public"], + deps = ["//proto/prysm/v1alpha1:go_default_library"], ) go_test( @@ -17,5 +18,8 @@ go_test( "surround_votes_test.go", ], embed = [":go_default_library"], - deps = ["//consensus-types/primitives:go_default_library"], + deps = [ + "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", + ], ) diff --git a/runtime/interop/BUILD.bazel b/runtime/interop/BUILD.bazel index 35cb7fd9675..454b309e009 100644 --- a/runtime/interop/BUILD.bazel +++ b/runtime/interop/BUILD.bazel @@ -30,6 +30,7 @@ go_library( "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time:go_default_library", "//time/slots:go_default_library", @@ -60,6 +61,7 @@ go_test( "//config/params:go_default_library", "//container/trie:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/testing/assertions/BUILD.bazel b/testing/assertions/BUILD.bazel index e9aad2fe3a0..ae67367cf25 100644 --- a/testing/assertions/BUILD.bazel +++ b/testing/assertions/BUILD.bazel @@ -18,6 +18,7 @@ go_test( srcs = ["assertions_test.go"], deps = [ ":go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/testing:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/testing/benchmark/BUILD.bazel b/testing/benchmark/BUILD.bazel index b6309636bae..25fe63b06c9 100644 --- a/testing/benchmark/BUILD.bazel +++ b/testing/benchmark/BUILD.bazel @@ -10,6 +10,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@io_bazel_rules_go//go/tools/bazel:go_default_library", ], ) diff --git a/testing/endtoend/components/eth1/BUILD.bazel b/testing/endtoend/components/eth1/BUILD.bazel index 3f966e531cf..46bc9c0a7c9 100644 --- a/testing/endtoend/components/eth1/BUILD.bazel +++ b/testing/endtoend/components/eth1/BUILD.bazel @@ -21,6 +21,7 @@ go_library( "//crypto/rand:go_default_library", "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//testing/endtoend/helpers:go_default_library", "//testing/endtoend/params:go_default_library", diff --git a/testing/endtoend/evaluators/BUILD.bazel b/testing/endtoend/evaluators/BUILD.bazel index 8abb98a15ae..3b59c0095cf 100644 --- a/testing/endtoend/evaluators/BUILD.bazel +++ b/testing/endtoend/evaluators/BUILD.bazel @@ -40,6 +40,7 @@ go_library( "//encoding/ssz/detect:go_default_library", "//network/forks:go_default_library", "//network/httputil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//runtime/version:go_default_library", "//testing/endtoend/components:go_default_library", diff --git a/testing/endtoend/evaluators/beaconapi/BUILD.bazel b/testing/endtoend/evaluators/beaconapi/BUILD.bazel index c952726d514..5a8dcf275ef 100644 --- a/testing/endtoend/evaluators/beaconapi/BUILD.bazel +++ b/testing/endtoend/evaluators/beaconapi/BUILD.bazel @@ -16,6 +16,7 @@ go_library( "//api/server/structs:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/endtoend/params:go_default_library", "//testing/endtoend/policies:go_default_library", "//testing/endtoend/types:go_default_library", diff --git a/testing/endtoend/helpers/BUILD.bazel b/testing/endtoend/helpers/BUILD.bazel index 530e94450b3..db224254262 100644 --- a/testing/endtoend/helpers/BUILD.bazel +++ b/testing/endtoend/helpers/BUILD.bazel @@ -12,6 +12,7 @@ go_library( visibility = ["//testing/endtoend:__subpackages__"], deps = [ "//config/params:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/endtoend/params:go_default_library", "//testing/endtoend/types:go_default_library", "//time:go_default_library", diff --git a/testing/middleware/builder/BUILD.bazel b/testing/middleware/builder/BUILD.bazel index 3003679b9ad..90473fe94d1 100644 --- a/testing/middleware/builder/BUILD.bazel +++ b/testing/middleware/builder/BUILD.bazel @@ -22,6 +22,7 @@ go_library( "//network:go_default_library", "//network/authorization:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_ethereum_go_ethereum//beacon/engine:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", diff --git a/testing/mock/BUILD.bazel b/testing/mock/BUILD.bazel index 7046877bd47..ffbb688cae5 100644 --- a/testing/mock/BUILD.bazel +++ b/testing/mock/BUILD.bazel @@ -15,6 +15,7 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/v5/testing/mock", visibility = ["//visibility:public"], deps = [ + "//proto/prysm/v1alpha1:go_default_library", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//metadata:go_default_library", "@org_golang_google_protobuf//types/known/emptypb:go_default_library", diff --git a/testing/slasher/simulator/BUILD.bazel b/testing/slasher/simulator/BUILD.bazel index e2e7b3a954c..679ded28376 100644 --- a/testing/slasher/simulator/BUILD.bazel +++ b/testing/slasher/simulator/BUILD.bazel @@ -31,6 +31,7 @@ go_library( "//crypto/bls:go_default_library", "//crypto/rand:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", @@ -52,6 +53,7 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/slashings:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/general/deneb/kzg/BUILD.bazel b/testing/spectest/general/deneb/kzg/BUILD.bazel index 2052f54d8b6..90b3f91dde8 100644 --- a/testing/spectest/general/deneb/kzg/BUILD.bazel +++ b/testing/spectest/general/deneb/kzg/BUILD.bazel @@ -11,6 +11,7 @@ go_test( deps = [ "//beacon-chain/blockchain/kzg:go_default_library", "//consensus-types/blocks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/altair/epoch_processing/BUILD.bazel b/testing/spectest/shared/altair/epoch_processing/BUILD.bazel index 2fc9ee5a560..d566fdbd43a 100644 --- a/testing/spectest/shared/altair/epoch_processing/BUILD.bazel +++ b/testing/spectest/shared/altair/epoch_processing/BUILD.bazel @@ -27,6 +27,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/altair/finality/BUILD.bazel b/testing/spectest/shared/altair/finality/BUILD.bazel index be1629931eb..51a802755b8 100644 --- a/testing/spectest/shared/altair/finality/BUILD.bazel +++ b/testing/spectest/shared/altair/finality/BUILD.bazel @@ -12,6 +12,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/altair/fork/BUILD.bazel b/testing/spectest/shared/altair/fork/BUILD.bazel index 3d1a791bc3f..2729cd699e4 100644 --- a/testing/spectest/shared/altair/fork/BUILD.bazel +++ b/testing/spectest/shared/altair/fork/BUILD.bazel @@ -17,6 +17,7 @@ go_library( "//config/params:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/altair/operations/BUILD.bazel b/testing/spectest/shared/altair/operations/BUILD.bazel index abb25075a64..05aeecc89e8 100644 --- a/testing/spectest/shared/altair/operations/BUILD.bazel +++ b/testing/spectest/shared/altair/operations/BUILD.bazel @@ -21,6 +21,7 @@ go_library( "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/spectest/shared/common/operations:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/altair/rewards/BUILD.bazel b/testing/spectest/shared/altair/rewards/BUILD.bazel index a3c169ada03..ad8a6f73740 100644 --- a/testing/spectest/shared/altair/rewards/BUILD.bazel +++ b/testing/spectest/shared/altair/rewards/BUILD.bazel @@ -10,6 +10,7 @@ go_library( "//beacon-chain/core/altair:go_default_library", "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/state/state-native:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/altair/sanity/BUILD.bazel b/testing/spectest/shared/altair/sanity/BUILD.bazel index d64c45cfa32..af8b85ac6ca 100644 --- a/testing/spectest/shared/altair/sanity/BUILD.bazel +++ b/testing/spectest/shared/altair/sanity/BUILD.bazel @@ -16,6 +16,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/altair/ssz_static/BUILD.bazel b/testing/spectest/shared/altair/ssz_static/BUILD.bazel index 20d8b925d1e..1161580b94f 100644 --- a/testing/spectest/shared/altair/ssz_static/BUILD.bazel +++ b/testing/spectest/shared/altair/ssz_static/BUILD.bazel @@ -8,6 +8,7 @@ go_library( visibility = ["//testing/spectest:__subpackages__"], deps = [ "//beacon-chain/state/state-native:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/shared/common/ssz_static:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/testing/spectest/shared/bellatrix/epoch_processing/BUILD.bazel b/testing/spectest/shared/bellatrix/epoch_processing/BUILD.bazel index c3a3fc7b732..03ac47eaec8 100644 --- a/testing/spectest/shared/bellatrix/epoch_processing/BUILD.bazel +++ b/testing/spectest/shared/bellatrix/epoch_processing/BUILD.bazel @@ -27,6 +27,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/bellatrix/finality/BUILD.bazel b/testing/spectest/shared/bellatrix/finality/BUILD.bazel index 41078bef281..1f54e632a6a 100644 --- a/testing/spectest/shared/bellatrix/finality/BUILD.bazel +++ b/testing/spectest/shared/bellatrix/finality/BUILD.bazel @@ -12,6 +12,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/bellatrix/fork/BUILD.bazel b/testing/spectest/shared/bellatrix/fork/BUILD.bazel index 7b2705c7ff4..f501094c09a 100644 --- a/testing/spectest/shared/bellatrix/fork/BUILD.bazel +++ b/testing/spectest/shared/bellatrix/fork/BUILD.bazel @@ -17,6 +17,7 @@ go_library( "//config/params:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/bellatrix/operations/BUILD.bazel b/testing/spectest/shared/bellatrix/operations/BUILD.bazel index 417763b9af4..8ab888a3ddd 100644 --- a/testing/spectest/shared/bellatrix/operations/BUILD.bazel +++ b/testing/spectest/shared/bellatrix/operations/BUILD.bazel @@ -22,6 +22,7 @@ go_library( "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/spectest/shared/common/operations:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/bellatrix/rewards/BUILD.bazel b/testing/spectest/shared/bellatrix/rewards/BUILD.bazel index dd4d90afbbd..83004d18ff1 100644 --- a/testing/spectest/shared/bellatrix/rewards/BUILD.bazel +++ b/testing/spectest/shared/bellatrix/rewards/BUILD.bazel @@ -10,6 +10,7 @@ go_library( "//beacon-chain/core/altair:go_default_library", "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/state/state-native:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/bellatrix/sanity/BUILD.bazel b/testing/spectest/shared/bellatrix/sanity/BUILD.bazel index d6aea1968eb..db8a5d07dc0 100644 --- a/testing/spectest/shared/bellatrix/sanity/BUILD.bazel +++ b/testing/spectest/shared/bellatrix/sanity/BUILD.bazel @@ -16,6 +16,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/bellatrix/ssz_static/BUILD.bazel b/testing/spectest/shared/bellatrix/ssz_static/BUILD.bazel index 646426fea5f..fb7d21d5e01 100644 --- a/testing/spectest/shared/bellatrix/ssz_static/BUILD.bazel +++ b/testing/spectest/shared/bellatrix/ssz_static/BUILD.bazel @@ -9,6 +9,7 @@ go_library( deps = [ "//beacon-chain/state/state-native:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/shared/common/ssz_static:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/testing/spectest/shared/capella/epoch_processing/BUILD.bazel b/testing/spectest/shared/capella/epoch_processing/BUILD.bazel index c4e99e41198..9fd12223eb3 100644 --- a/testing/spectest/shared/capella/epoch_processing/BUILD.bazel +++ b/testing/spectest/shared/capella/epoch_processing/BUILD.bazel @@ -27,6 +27,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/capella/finality/BUILD.bazel b/testing/spectest/shared/capella/finality/BUILD.bazel index 89d679e5ce6..5d7f56aa8aa 100644 --- a/testing/spectest/shared/capella/finality/BUILD.bazel +++ b/testing/spectest/shared/capella/finality/BUILD.bazel @@ -12,6 +12,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/capella/fork/BUILD.bazel b/testing/spectest/shared/capella/fork/BUILD.bazel index 75a3d987dc8..79bda2002a6 100644 --- a/testing/spectest/shared/capella/fork/BUILD.bazel +++ b/testing/spectest/shared/capella/fork/BUILD.bazel @@ -17,6 +17,7 @@ go_library( "//config/params:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/capella/operations/BUILD.bazel b/testing/spectest/shared/capella/operations/BUILD.bazel index 76233c51031..95c7369130f 100644 --- a/testing/spectest/shared/capella/operations/BUILD.bazel +++ b/testing/spectest/shared/capella/operations/BUILD.bazel @@ -25,6 +25,7 @@ go_library( "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/spectest/shared/common/operations:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/capella/rewards/BUILD.bazel b/testing/spectest/shared/capella/rewards/BUILD.bazel index dcfc0e1fce4..477639709a5 100644 --- a/testing/spectest/shared/capella/rewards/BUILD.bazel +++ b/testing/spectest/shared/capella/rewards/BUILD.bazel @@ -10,6 +10,7 @@ go_library( "//beacon-chain/core/altair:go_default_library", "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/state/state-native:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/capella/sanity/BUILD.bazel b/testing/spectest/shared/capella/sanity/BUILD.bazel index 50a3eee7e30..c0d1ecd8749 100644 --- a/testing/spectest/shared/capella/sanity/BUILD.bazel +++ b/testing/spectest/shared/capella/sanity/BUILD.bazel @@ -16,6 +16,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/capella/ssz_static/BUILD.bazel b/testing/spectest/shared/capella/ssz_static/BUILD.bazel index 0ab4b3c5489..5fc7acec018 100644 --- a/testing/spectest/shared/capella/ssz_static/BUILD.bazel +++ b/testing/spectest/shared/capella/ssz_static/BUILD.bazel @@ -9,6 +9,7 @@ go_library( deps = [ "//beacon-chain/state/state-native:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/shared/common/ssz_static:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/testing/spectest/shared/common/forkchoice/BUILD.bazel b/testing/spectest/shared/common/forkchoice/BUILD.bazel index 36109c30b35..b1a8743217f 100644 --- a/testing/spectest/shared/common/forkchoice/BUILD.bazel +++ b/testing/spectest/shared/common/forkchoice/BUILD.bazel @@ -38,6 +38,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", @@ -55,6 +56,7 @@ go_test( embed = [":go_default_library"], deps = [ "//consensus-types/blocks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", ], diff --git a/testing/spectest/shared/common/operations/BUILD.bazel b/testing/spectest/shared/common/operations/BUILD.bazel index f9b6a87ab27..07b46dee0a2 100644 --- a/testing/spectest/shared/common/operations/BUILD.bazel +++ b/testing/spectest/shared/common/operations/BUILD.bazel @@ -32,6 +32,7 @@ go_library( "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/common/ssz_static/BUILD.bazel b/testing/spectest/shared/common/ssz_static/BUILD.bazel index a21075a3176..f8b41eb343e 100644 --- a/testing/spectest/shared/common/ssz_static/BUILD.bazel +++ b/testing/spectest/shared/common/ssz_static/BUILD.bazel @@ -25,6 +25,7 @@ go_test( deps = [ ":go_default_library", "//beacon-chain/state/state-native:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/testing/spectest/shared/deneb/epoch_processing/BUILD.bazel b/testing/spectest/shared/deneb/epoch_processing/BUILD.bazel index 764c8e9ed6c..6a483739c35 100644 --- a/testing/spectest/shared/deneb/epoch_processing/BUILD.bazel +++ b/testing/spectest/shared/deneb/epoch_processing/BUILD.bazel @@ -27,6 +27,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/deneb/finality/BUILD.bazel b/testing/spectest/shared/deneb/finality/BUILD.bazel index 06ae6c79169..0ab638534d9 100644 --- a/testing/spectest/shared/deneb/finality/BUILD.bazel +++ b/testing/spectest/shared/deneb/finality/BUILD.bazel @@ -12,6 +12,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/deneb/fork/BUILD.bazel b/testing/spectest/shared/deneb/fork/BUILD.bazel index a8fe128288b..f90f2492540 100644 --- a/testing/spectest/shared/deneb/fork/BUILD.bazel +++ b/testing/spectest/shared/deneb/fork/BUILD.bazel @@ -17,6 +17,7 @@ go_library( "//config/params:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/deneb/operations/BUILD.bazel b/testing/spectest/shared/deneb/operations/BUILD.bazel index ffa479c3aa6..43971362c5c 100644 --- a/testing/spectest/shared/deneb/operations/BUILD.bazel +++ b/testing/spectest/shared/deneb/operations/BUILD.bazel @@ -25,6 +25,7 @@ go_library( "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/spectest/shared/common/operations:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/deneb/rewards/BUILD.bazel b/testing/spectest/shared/deneb/rewards/BUILD.bazel index 23b0565ecc1..4cb11100863 100644 --- a/testing/spectest/shared/deneb/rewards/BUILD.bazel +++ b/testing/spectest/shared/deneb/rewards/BUILD.bazel @@ -10,6 +10,7 @@ go_library( "//beacon-chain/core/altair:go_default_library", "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/state/state-native:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/deneb/sanity/BUILD.bazel b/testing/spectest/shared/deneb/sanity/BUILD.bazel index 5b6e80ee76d..573a3eab0ed 100644 --- a/testing/spectest/shared/deneb/sanity/BUILD.bazel +++ b/testing/spectest/shared/deneb/sanity/BUILD.bazel @@ -16,6 +16,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/deneb/ssz_static/BUILD.bazel b/testing/spectest/shared/deneb/ssz_static/BUILD.bazel index b729c31c1bf..e09229b6833 100644 --- a/testing/spectest/shared/deneb/ssz_static/BUILD.bazel +++ b/testing/spectest/shared/deneb/ssz_static/BUILD.bazel @@ -9,6 +9,7 @@ go_library( deps = [ "//beacon-chain/state/state-native:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/shared/common/ssz_static:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/testing/spectest/shared/electra/epoch_processing/BUILD.bazel b/testing/spectest/shared/electra/epoch_processing/BUILD.bazel index d356d965154..c65c52dd9f6 100644 --- a/testing/spectest/shared/electra/epoch_processing/BUILD.bazel +++ b/testing/spectest/shared/electra/epoch_processing/BUILD.bazel @@ -30,6 +30,7 @@ go_library( "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/electra/finality/BUILD.bazel b/testing/spectest/shared/electra/finality/BUILD.bazel index 2c9de58412d..93369784d69 100644 --- a/testing/spectest/shared/electra/finality/BUILD.bazel +++ b/testing/spectest/shared/electra/finality/BUILD.bazel @@ -12,6 +12,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/electra/fork/BUILD.bazel b/testing/spectest/shared/electra/fork/BUILD.bazel index 7aef3578681..f2101d0eace 100644 --- a/testing/spectest/shared/electra/fork/BUILD.bazel +++ b/testing/spectest/shared/electra/fork/BUILD.bazel @@ -17,6 +17,7 @@ go_library( "//config/params:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/electra/operations/BUILD.bazel b/testing/spectest/shared/electra/operations/BUILD.bazel index 32a3a407055..d5d42aab639 100644 --- a/testing/spectest/shared/electra/operations/BUILD.bazel +++ b/testing/spectest/shared/electra/operations/BUILD.bazel @@ -28,6 +28,7 @@ go_library( "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/spectest/shared/common/operations:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/electra/rewards/BUILD.bazel b/testing/spectest/shared/electra/rewards/BUILD.bazel index a57c324cdae..4d6efdab287 100644 --- a/testing/spectest/shared/electra/rewards/BUILD.bazel +++ b/testing/spectest/shared/electra/rewards/BUILD.bazel @@ -10,6 +10,7 @@ go_library( "//beacon-chain/core/electra:go_default_library", "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/state/state-native:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/electra/sanity/BUILD.bazel b/testing/spectest/shared/electra/sanity/BUILD.bazel index 4e72c901459..f284008577a 100644 --- a/testing/spectest/shared/electra/sanity/BUILD.bazel +++ b/testing/spectest/shared/electra/sanity/BUILD.bazel @@ -16,6 +16,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/electra/ssz_static/BUILD.bazel b/testing/spectest/shared/electra/ssz_static/BUILD.bazel index 8037df967f7..b9b04313420 100644 --- a/testing/spectest/shared/electra/ssz_static/BUILD.bazel +++ b/testing/spectest/shared/electra/ssz_static/BUILD.bazel @@ -9,6 +9,7 @@ go_library( deps = [ "//beacon-chain/state/state-native:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/shared/common/ssz_static:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/testing/spectest/shared/phase0/epoch_processing/BUILD.bazel b/testing/spectest/shared/phase0/epoch_processing/BUILD.bazel index 098b7719aad..68e6a1a9549 100644 --- a/testing/spectest/shared/phase0/epoch_processing/BUILD.bazel +++ b/testing/spectest/shared/phase0/epoch_processing/BUILD.bazel @@ -25,6 +25,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//config/params:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/phase0/finality/BUILD.bazel b/testing/spectest/shared/phase0/finality/BUILD.bazel index 9b68e598ed0..15a2673522e 100644 --- a/testing/spectest/shared/phase0/finality/BUILD.bazel +++ b/testing/spectest/shared/phase0/finality/BUILD.bazel @@ -12,6 +12,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/phase0/operations/BUILD.bazel b/testing/spectest/shared/phase0/operations/BUILD.bazel index b553f4484cd..8f69fb427e0 100644 --- a/testing/spectest/shared/phase0/operations/BUILD.bazel +++ b/testing/spectest/shared/phase0/operations/BUILD.bazel @@ -21,6 +21,7 @@ go_library( "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//testing/spectest/shared/common/operations:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/phase0/rewards/BUILD.bazel b/testing/spectest/shared/phase0/rewards/BUILD.bazel index 25c72102b1b..3da95cce619 100644 --- a/testing/spectest/shared/phase0/rewards/BUILD.bazel +++ b/testing/spectest/shared/phase0/rewards/BUILD.bazel @@ -10,6 +10,7 @@ go_library( "//beacon-chain/core/epoch/precompute:go_default_library", "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/state/state-native:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/phase0/sanity/BUILD.bazel b/testing/spectest/shared/phase0/sanity/BUILD.bazel index 6cb5090396f..bf7f29d7888 100644 --- a/testing/spectest/shared/phase0/sanity/BUILD.bazel +++ b/testing/spectest/shared/phase0/sanity/BUILD.bazel @@ -16,6 +16,7 @@ go_library( "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//consensus-types/blocks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", "//testing/util:go_default_library", diff --git a/testing/spectest/shared/phase0/ssz_static/BUILD.bazel b/testing/spectest/shared/phase0/ssz_static/BUILD.bazel index c33a0a9e4d5..50559e502f5 100644 --- a/testing/spectest/shared/phase0/ssz_static/BUILD.bazel +++ b/testing/spectest/shared/phase0/ssz_static/BUILD.bazel @@ -8,6 +8,7 @@ go_library( visibility = ["//testing/spectest:__subpackages__"], deps = [ "//beacon-chain/state/state-native:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//testing/spectest/shared/common/ssz_static:go_default_library", "@com_github_prysmaticlabs_fastssz//:go_default_library", diff --git a/testing/util/BUILD.bazel b/testing/util/BUILD.bazel index e368ae4e8e1..16154398cf7 100644 --- a/testing/util/BUILD.bazel +++ b/testing/util/BUILD.bazel @@ -58,6 +58,7 @@ go_library( "//proto/engine/v1:go_default_library", "//proto/eth/v1:go_default_library", "//proto/eth/v2:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//runtime/version:go_default_library", "//testing/assertions:go_default_library", @@ -104,6 +105,7 @@ go_test( "//encoding/ssz:go_default_library", "//proto/eth/v1:go_default_library", "//proto/eth/v2:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//time/slots:go_default_library", diff --git a/testing/validator-mock/BUILD.bazel b/testing/validator-mock/BUILD.bazel index 6a57d913dfc..08bb8fa69b3 100644 --- a/testing/validator-mock/BUILD.bazel +++ b/testing/validator-mock/BUILD.bazel @@ -17,6 +17,7 @@ go_library( "//api/client/event:go_default_library", "//consensus-types/primitives:go_default_library", "//consensus-types/validator:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//validator/client/iface:go_default_library", "@org_golang_google_protobuf//types/known/emptypb:go_default_library", "@org_uber_go_mock//gomock:go_default_library", diff --git a/tools/benchmark-files-gen/BUILD.bazel b/tools/benchmark-files-gen/BUILD.bazel index d39c8a14e0f..ecc6c3d0bd9 100644 --- a/tools/benchmark-files-gen/BUILD.bazel +++ b/tools/benchmark-files-gen/BUILD.bazel @@ -18,6 +18,7 @@ go_library( "//consensus-types/blocks:go_default_library", "//consensus-types/primitives:go_default_library", "//io/file:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", "//testing/benchmark:go_default_library", "//testing/util:go_default_library", diff --git a/tools/bootnode/BUILD.bazel b/tools/bootnode/BUILD.bazel index 4f8b1417281..4c20b40959d 100644 --- a/tools/bootnode/BUILD.bazel +++ b/tools/bootnode/BUILD.bazel @@ -15,6 +15,7 @@ go_library( "//encoding/bytesutil:go_default_library", "//io/logs:go_default_library", "//network:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/maxprocs:go_default_library", "//runtime/version:go_default_library", "@com_github_ethereum_go_ethereum//crypto:go_default_library", diff --git a/tools/eth1voting/BUILD.bazel b/tools/eth1voting/BUILD.bazel index 11ed13f0deb..bef54f1cad2 100644 --- a/tools/eth1voting/BUILD.bazel +++ b/tools/eth1voting/BUILD.bazel @@ -15,6 +15,7 @@ go_library( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//time/slots:go_default_library", "@org_golang_google_grpc//:go_default_library", "@org_golang_x_sync//errgroup:go_default_library", diff --git a/tools/exploredb/BUILD.bazel b/tools/exploredb/BUILD.bazel index dc2d0b642d3..8aff1b8b58e 100644 --- a/tools/exploredb/BUILD.bazel +++ b/tools/exploredb/BUILD.bazel @@ -12,6 +12,7 @@ go_library( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_dustin_go_humanize//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_status_im_keycard_go//hexutils:go_default_library", diff --git a/tools/forkchecker/BUILD.bazel b/tools/forkchecker/BUILD.bazel index aceb8d56c6d..db675516995 100644 --- a/tools/forkchecker/BUILD.bazel +++ b/tools/forkchecker/BUILD.bazel @@ -9,6 +9,7 @@ go_library( deps = [ "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_protobuf//types/known/emptypb:go_default_library", diff --git a/tools/pcli/BUILD.bazel b/tools/pcli/BUILD.bazel index d7060d08729..a3386f17f97 100644 --- a/tools/pcli/BUILD.bazel +++ b/tools/pcli/BUILD.bazel @@ -16,6 +16,7 @@ go_library( "//consensus-types/interfaces:go_default_library", "//encoding/ssz/detect:go_default_library", "//encoding/ssz/equality:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/logging/logrus-prefixed-formatter:go_default_library", "//runtime/version:go_default_library", "@com_github_kr_pretty//:go_default_library", diff --git a/validator/accounts/BUILD.bazel b/validator/accounts/BUILD.bazel index 2ed28679580..4bb84631815 100644 --- a/validator/accounts/BUILD.bazel +++ b/validator/accounts/BUILD.bazel @@ -33,6 +33,7 @@ go_library( "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", "//io/prompt:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//validator/accounts/petnames:go_default_library", "//validator/accounts/userprompt:go_default_library", "//validator/accounts/wallet:go_default_library", @@ -80,6 +81,7 @@ go_test( "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/validator-mock:go_default_library", diff --git a/validator/accounts/testing/BUILD.bazel b/validator/accounts/testing/BUILD.bazel index 462a9c339a4..628f051191c 100644 --- a/validator/accounts/testing/BUILD.bazel +++ b/validator/accounts/testing/BUILD.bazel @@ -15,6 +15,7 @@ go_library( "//config/fieldparams:go_default_library", "//config/proposer:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//validator/accounts/iface:go_default_library", "//validator/client/iface:go_default_library", "//validator/keymanager:go_default_library", diff --git a/validator/client/BUILD.bazel b/validator/client/BUILD.bazel index 9abbc2f465f..e873a131b3f 100644 --- a/validator/client/BUILD.bazel +++ b/validator/client/BUILD.bazel @@ -50,6 +50,7 @@ go_library( "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//runtime/version:go_default_library", "//time:go_default_library", @@ -137,6 +138,7 @@ go_test( "//crypto/bls/common/mock:go_default_library", "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//runtime:go_default_library", "//runtime/version:go_default_library", diff --git a/validator/client/beacon-api/BUILD.bazel b/validator/client/beacon-api/BUILD.bazel index d199b19dc53..442352b8849 100644 --- a/validator/client/beacon-api/BUILD.bazel +++ b/validator/client/beacon-api/BUILD.bazel @@ -54,6 +54,7 @@ go_library( "//network/forks:go_default_library", "//network/httputil:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", "//validator/client/iface:go_default_library", @@ -125,6 +126,7 @@ go_test( "//encoding/bytesutil:go_default_library", "//network/httputil:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//time/slots:go_default_library", diff --git a/validator/client/beacon-api/mock/BUILD.bazel b/validator/client/beacon-api/mock/BUILD.bazel index c13777f5605..e8c821ec519 100644 --- a/validator/client/beacon-api/mock/BUILD.bazel +++ b/validator/client/beacon-api/mock/BUILD.bazel @@ -14,6 +14,7 @@ go_library( deps = [ "//api/server/structs:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@org_uber_go_mock//gomock:go_default_library", ], ) diff --git a/validator/client/beacon-api/test-helpers/BUILD.bazel b/validator/client/beacon-api/test-helpers/BUILD.bazel index aa187e25607..725b3f5907b 100644 --- a/validator/client/beacon-api/test-helpers/BUILD.bazel +++ b/validator/client/beacon-api/test-helpers/BUILD.bazel @@ -17,6 +17,7 @@ go_library( "//api/server/structs:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", ], ) diff --git a/validator/client/grpc-api/BUILD.bazel b/validator/client/grpc-api/BUILD.bazel index a6789cf2b76..3dd77c8311c 100644 --- a/validator/client/grpc-api/BUILD.bazel +++ b/validator/client/grpc-api/BUILD.bazel @@ -21,6 +21,7 @@ go_library( "//consensus-types/validator:go_default_library", "//monitoring/tracing/trace:go_default_library", "//proto/eth/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//validator/client/iface:go_default_library", "@com_github_golang_protobuf//ptypes/empty", "@com_github_pkg_errors//:go_default_library", @@ -43,6 +44,7 @@ go_test( "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", "//consensus-types/validator:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/mock:go_default_library", "//testing/require:go_default_library", diff --git a/validator/client/iface/BUILD.bazel b/validator/client/iface/BUILD.bazel index 73e92cfdf62..f9492354364 100644 --- a/validator/client/iface/BUILD.bazel +++ b/validator/client/iface/BUILD.bazel @@ -19,6 +19,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//consensus-types/validator:go_default_library", "//crypto/bls:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//validator/keymanager:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", diff --git a/validator/client/testutil/BUILD.bazel b/validator/client/testutil/BUILD.bazel index 853de48ac82..633d7c976ba 100644 --- a/validator/client/testutil/BUILD.bazel +++ b/validator/client/testutil/BUILD.bazel @@ -17,6 +17,7 @@ go_library( "//config/proposer:go_default_library", "//consensus-types/primitives:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//time:go_default_library", "//validator/client/iface:go_default_library", "//validator/keymanager:go_default_library", diff --git a/validator/db/BUILD.bazel b/validator/db/BUILD.bazel index ac811f18d9e..1f028478a24 100644 --- a/validator/db/BUILD.bazel +++ b/validator/db/BUILD.bazel @@ -20,6 +20,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//io/file:go_default_library", "//io/prompt:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//validator/db/common:go_default_library", "//validator/db/filesystem:go_default_library", "//validator/db/iface:go_default_library", @@ -45,6 +46,7 @@ go_test( "//config/proposer:go_default_library", "//consensus-types/primitives:go_default_library", "//io/file:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//validator/db/common:go_default_library", diff --git a/validator/db/filesystem/BUILD.bazel b/validator/db/filesystem/BUILD.bazel index c0fd30ce643..39810f59da9 100644 --- a/validator/db/filesystem/BUILD.bazel +++ b/validator/db/filesystem/BUILD.bazel @@ -21,6 +21,7 @@ go_library( "//consensus-types/primitives:go_default_library", "//io/file:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//validator/db/common:go_default_library", "//validator/db/iface:go_default_library", @@ -55,6 +56,7 @@ go_test( "//consensus-types/primitives:go_default_library", "//crypto/bls:go_default_library", "//io/file:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", diff --git a/validator/db/iface/BUILD.bazel b/validator/db/iface/BUILD.bazel index c4416d28294..cf83ebca782 100644 --- a/validator/db/iface/BUILD.bazel +++ b/validator/db/iface/BUILD.bazel @@ -15,6 +15,7 @@ go_library( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//monitoring/backup:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//validator/db/common:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", ], diff --git a/validator/db/kv/BUILD.bazel b/validator/db/kv/BUILD.bazel index 5fc22f7b08d..38e61170b65 100644 --- a/validator/db/kv/BUILD.bazel +++ b/validator/db/kv/BUILD.bazel @@ -39,6 +39,7 @@ go_library( "//monitoring/progress:go_default_library", "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/slashings:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//time/slots:go_default_library", @@ -83,6 +84,7 @@ go_test( "//crypto/bls:go_default_library", "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", diff --git a/validator/helpers/BUILD.bazel b/validator/helpers/BUILD.bazel index 754d61141b8..5acaa9cf650 100644 --- a/validator/helpers/BUILD.bazel +++ b/validator/helpers/BUILD.bazel @@ -31,6 +31,7 @@ go_test( "//config/proposer:go_default_library", "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/require:go_default_library", "//validator/db/common:go_default_library", "//validator/db/iface:go_default_library", diff --git a/validator/keymanager/remote-web3signer/v1/BUILD.bazel b/validator/keymanager/remote-web3signer/v1/BUILD.bazel index 655eed60606..ebc1a0fcae5 100644 --- a/validator/keymanager/remote-web3signer/v1/BUILD.bazel +++ b/validator/keymanager/remote-web3signer/v1/BUILD.bazel @@ -14,6 +14,7 @@ go_library( "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", "//network/forks:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", @@ -31,6 +32,7 @@ go_test( ":go_default_library", "//config/fieldparams:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//testing/require:go_default_library", "//validator/keymanager/remote-web3signer/v1/mock:go_default_library", diff --git a/validator/keymanager/remote-web3signer/v1/mock/BUILD.bazel b/validator/keymanager/remote-web3signer/v1/mock/BUILD.bazel index 2ec00b670b7..6c09a88be40 100644 --- a/validator/keymanager/remote-web3signer/v1/mock/BUILD.bazel +++ b/validator/keymanager/remote-web3signer/v1/mock/BUILD.bazel @@ -8,6 +8,7 @@ go_library( visibility = ["//visibility:public"], deps = [ "//config/fieldparams:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//testing/util:go_default_library", "//validator/keymanager/remote-web3signer/v1:go_default_library", diff --git a/validator/rpc/BUILD.bazel b/validator/rpc/BUILD.bazel index ef3f40b65ff..7eafb93d230 100644 --- a/validator/rpc/BUILD.bazel +++ b/validator/rpc/BUILD.bazel @@ -46,6 +46,7 @@ go_library( "//io/prompt:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//validator/accounts:go_default_library", "//validator/accounts/petnames:go_default_library", diff --git a/validator/slashing-protection-history/BUILD.bazel b/validator/slashing-protection-history/BUILD.bazel index 5bab7381561..a78de29f8d4 100644 --- a/validator/slashing-protection-history/BUILD.bazel +++ b/validator/slashing-protection-history/BUILD.bazel @@ -32,6 +32,7 @@ go_test( deps = [ "//config/fieldparams:go_default_library", "//consensus-types/primitives:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//validator/db/common:go_default_library", diff --git a/validator/testing/BUILD.bazel b/validator/testing/BUILD.bazel index f5c46546281..32cf267a372 100644 --- a/validator/testing/BUILD.bazel +++ b/validator/testing/BUILD.bazel @@ -20,6 +20,7 @@ go_library( "//crypto/bls:go_default_library", "//crypto/rand:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", "//validator/db/common:go_default_library", "//validator/slashing-protection-history/format:go_default_library", ], From 95a3bf0f037702a2dadf9effd01229c5bdf4606d Mon Sep 17 00:00:00 2001 From: rkapka Date: Thu, 31 Oct 2024 16:37:42 +0700 Subject: [PATCH 08/26] Revert "Auxiliary commit to revert individual files from 19192c68ed1d9f6ee5140173b0fc03fd0584cd9b" This reverts commit 6141570f53f1f59d64c9db85594231bd20bb425e. --- proto/prysm/v1alpha1/BUILD.bazel | 47 +++++++++++--------------------- 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/proto/prysm/v1alpha1/BUILD.bazel b/proto/prysm/v1alpha1/BUILD.bazel index 68434877786..6ad6ab187cf 100644 --- a/proto/prysm/v1alpha1/BUILD.bazel +++ b/proto/prysm/v1alpha1/BUILD.bazel @@ -32,7 +32,6 @@ proto_library( deps = [ "//proto/engine/v1:proto", "//proto/eth/ext:proto", - "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_proto", "@com_google_protobuf//:any_proto", "@com_google_protobuf//:descriptor_proto", "@com_google_protobuf//:empty_proto", @@ -82,6 +81,11 @@ ssz_altair_objs = [ "BeaconBlockBodyAltair", "BeaconStateAltair", "ContributionAndProof", + "LightClientHeaderAltair", + "LightClientBootstrapAltair", + "LightClientUpdateAltair", + "LightClientFinalityUpdateAltair", + "LightClientOptimisticUpdateAltair", "SignedBeaconBlockAltair", "SignedContributionAndProof", "SyncAggregate", @@ -111,6 +115,11 @@ ssz_capella_objs = [ "BlindedBeaconBlockCapella", "BuilderBidCapella", "HistoricalSummary", + "LightClientHeaderCapella", + "LightClientBootstrapCapella", + "LightClientUpdateCapella", + "LightClientFinalityUpdateCapella", + "LightClientOptimisticUpdateCapella", "SignedBLSToExecutionChange", "SignedBeaconBlockCapella", "SignedBlindedBeaconBlockCapella", @@ -128,6 +137,11 @@ ssz_deneb_objs = [ "BlobSidecar", "BlobSidecars", "BuilderBidDeneb", + "LightClientHeaderDeneb", + "LightClientBootstrapDeneb", + "LightClientUpdateDeneb", + "LightClientFinalityUpdateDeneb", + "LightClientOptimisticUpdateDeneb", "SignedBeaconBlockContentsDeneb", "SignedBeaconBlockDeneb", "SignedBlindedBeaconBlockDeneb", @@ -273,7 +287,6 @@ go_proto_library( "//proto/engine/v1:go_default_library", "//proto/eth/ext:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@googleapis//google/api:annotations_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", @@ -287,29 +300,6 @@ go_proto_library( ], ) -go_proto_library( - name = "go_grpc_gateway_library", - compilers = [ - "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-grpc-gateway:go_gen_grpc_gateway", - ], - embed = [":go_proto"], - importpath = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1", - protos = [":proto"], - visibility = ["//visibility:private"], - deps = [ - "//proto/engine/v1:go_default_library", - "//proto/eth/ext:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", - "@com_github_prysmaticlabs_go_bitfield//:go_default_library", - "@googleapis//google/api:annotations_go_proto", - "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", - "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", - "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", - "@org_golang_google_protobuf//types/descriptorpb:go_default_library", - "@org_golang_google_protobuf//types/known/emptypb:go_default_library", - ], -) - go_library( name = "go_default_library", srcs = [ @@ -327,9 +317,6 @@ go_library( ":ssz_generated_non_core", # keep ":ssz_generated_phase0", # keep ], - embed = [ - ":go_grpc_gateway_library", - ], importpath = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1", visibility = ["//visibility:public"], deps = SSZ_DEPS + [ @@ -340,9 +327,6 @@ go_library( "//runtime/version:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", - "@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//utilities:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", # keep "@googleapis//google/api:annotations_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", @@ -367,6 +351,7 @@ ssz_proto_files( "beacon_block.proto", "beacon_state.proto", "blobs.proto", + "light_client.proto", "sync_committee.proto", "withdrawals.proto", ], From aa82d6f4773916c6573e3e905d63573877f27cf4 Mon Sep 17 00:00:00 2001 From: rkapka Date: Thu, 31 Oct 2024 16:57:42 +0700 Subject: [PATCH 09/26] Electra version --- beacon-chain/core/light-client/lightclient.go | 4 - beacon-chain/p2p/BUILD.bazel | 1 - beacon-chain/rpc/eth/light-client/BUILD.bazel | 1 - beacon-chain/sync/BUILD.bazel | 3 - beacon-chain/sync/rpc_chunked_response.go | 48 ------- consensus-types/light-client/BUILD.bazel | 1 + proto/prysm/v1alpha1/electra.ssz.go | 117 ++++++++++++------ proto/prysm/v1alpha1/light_client.pb.go | 4 +- proto/prysm/v1alpha1/light_client.proto | 2 +- 9 files changed, 85 insertions(+), 96 deletions(-) diff --git a/beacon-chain/core/light-client/lightclient.go b/beacon-chain/core/light-client/lightclient.go index 35d2103c5b8..8c3e53f394f 100644 --- a/beacon-chain/core/light-client/lightclient.go +++ b/beacon-chain/core/light-client/lightclient.go @@ -23,10 +23,6 @@ import ( "google.golang.org/protobuf/proto" ) -const ( - FinalityBranchNumOfLeaves = 6 -) - func NewLightClientBootstrapFromBeaconState( ctx context.Context, currentSlot primitives.Slot, diff --git a/beacon-chain/p2p/BUILD.bazel b/beacon-chain/p2p/BUILD.bazel index d6897a6d5d9..7cb7e522711 100644 --- a/beacon-chain/p2p/BUILD.bazel +++ b/beacon-chain/p2p/BUILD.bazel @@ -69,7 +69,6 @@ go_library( "//monitoring/tracing/trace:go_default_library", "//network:go_default_library", "//network/forks:go_default_library", - "//proto/eth/v2:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//runtime:go_default_library", diff --git a/beacon-chain/rpc/eth/light-client/BUILD.bazel b/beacon-chain/rpc/eth/light-client/BUILD.bazel index f4bf65404a2..05112149cde 100644 --- a/beacon-chain/rpc/eth/light-client/BUILD.bazel +++ b/beacon-chain/rpc/eth/light-client/BUILD.bazel @@ -18,7 +18,6 @@ go_library( "//beacon-chain/rpc/eth/shared:go_default_library", "//beacon-chain/rpc/lookup:go_default_library", "//beacon-chain/state:go_default_library", - "//config/fieldparams:go_default_library", "//config/params:go_default_library", "//consensus-types/interfaces:go_default_library", "//consensus-types/primitives:go_default_library", diff --git a/beacon-chain/sync/BUILD.bazel b/beacon-chain/sync/BUILD.bazel index a690b63ed10..ddcd95634cd 100644 --- a/beacon-chain/sync/BUILD.bazel +++ b/beacon-chain/sync/BUILD.bazel @@ -75,7 +75,6 @@ go_library( "//beacon-chain/core/feed/operation:go_default_library", "//beacon-chain/core/feed/state:go_default_library", "//beacon-chain/core/helpers:go_default_library", - "//beacon-chain/core/light-client:go_default_library", "//beacon-chain/core/signing:go_default_library", "//beacon-chain/core/transition:go_default_library", "//beacon-chain/core/transition/interop:go_default_library", @@ -118,7 +117,6 @@ go_library( "//monitoring/tracing:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/forks:go_default_library", - "//proto/eth/v2:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", @@ -144,7 +142,6 @@ go_library( "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_trailofbits_go_mutexasserts//:go_default_library", - "@io_opencensus_go//trace:go_default_library", "@io_opentelemetry_go_otel_trace//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", ], diff --git a/beacon-chain/sync/rpc_chunked_response.go b/beacon-chain/sync/rpc_chunked_response.go index 42564f2d4d1..6c8de561b5d 100644 --- a/beacon-chain/sync/rpc_chunked_response.go +++ b/beacon-chain/sync/rpc_chunked_response.go @@ -203,51 +203,3 @@ func WriteLightClientBootstrapChunk( _, err := encoding.EncodeWithMaxLength(stream, bootstrap) return err } - -func WriteLightClientBootstrapChunk( - stream libp2pcore.Stream, - tor blockchain.TemporalOracle, - encoding encoder.NetworkEncoding, - bootstrap interfaces.LightClientBootstrap, -) error { - if _, err := stream.Write([]byte{responseCodeSuccess}); err != nil { - return err - } - - var obtainedCtx []byte - valRoot := tor.GenesisValidatorsRoot() - switch v := bootstrap.Version(); v { - case version.Altair: - digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().AltairForkEpoch, valRoot[:]) - if err != nil { - return err - } - obtainedCtx = digest[:] - case version.Capella: - digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().CapellaForkEpoch, valRoot[:]) - if err != nil { - return err - } - obtainedCtx = digest[:] - case version.Deneb: - digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().DenebForkEpoch, valRoot[:]) - if err != nil { - return err - } - obtainedCtx = digest[:] - case version.Electra: - digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().ElectraForkEpoch, valRoot[:]) - if err != nil { - return err - } - obtainedCtx = digest[:] - default: - return errors.Wrapf(ErrUnrecognizedVersion, "light client boostrap version %s is not recognized", version.String(v)) - } - - if err := writeContextToStream(obtainedCtx, stream); err != nil { - return err - } - _, err := encoding.EncodeWithMaxLength(stream, bootstrap) - return err -} diff --git a/consensus-types/light-client/BUILD.bazel b/consensus-types/light-client/BUILD.bazel index 78432c8eecb..fd01666d01b 100644 --- a/consensus-types/light-client/BUILD.bazel +++ b/consensus-types/light-client/BUILD.bazel @@ -23,6 +23,7 @@ go_library( "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", + "@com_github_pkg_errors//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", ], ) diff --git a/proto/prysm/v1alpha1/electra.ssz.go b/proto/prysm/v1alpha1/electra.ssz.go index 47298aab030..bd41d424bb0 100644 --- a/proto/prysm/v1alpha1/electra.ssz.go +++ b/proto/prysm/v1alpha1/electra.ssz.go @@ -1,5 +1,5 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: 007354908a3d6e7c735330bd4999fc70df71e307e7270a4f8935ff88d98af8c0 +// Hash: 15bba8a5ef0c1eec143044f0c54eec8535d7966f41c577bd6540197c3dd0885e package eth import ( @@ -4458,7 +4458,7 @@ func (l *LightClientFinalityUpdateElectra) MarshalSSZ() ([]byte, error) { // MarshalSSZTo ssz marshals the LightClientFinalityUpdateElectra object to a target array func (l *LightClientFinalityUpdateElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf - offset := int(400) + offset := int(180) // Offset (0) 'AttestedHeader' dst = ssz.WriteOffset(dst, offset) @@ -4474,17 +4474,11 @@ func (l *LightClientFinalityUpdateElectra) MarshalSSZTo(buf []byte) (dst []byte, } offset += l.FinalizedHeader.SizeSSZ() - // Field (2) 'FinalityBranch' - if size := len(l.FinalityBranch); size != 7 { - err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 7) - return - } - for ii := 0; ii < 7; ii++ { - if size := len(l.FinalityBranch[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32) - return - } - dst = append(dst, l.FinalityBranch[ii]...) + // Offset (2) 'FinalityBranch' + dst = ssz.WriteOffset(dst, offset) + for ii := 0; ii < len(l.FinalityBranch); ii++ { + offset += 4 + offset += len(l.FinalityBranch[ii]) } // Field (3) 'SyncAggregate' @@ -4508,6 +4502,26 @@ func (l *LightClientFinalityUpdateElectra) MarshalSSZTo(buf []byte) (dst []byte, return } + // Field (2) 'FinalityBranch' + if size := len(l.FinalityBranch); size > 7 { + err = ssz.ErrListTooBigFn("--.FinalityBranch", size, 7) + return + } + { + offset = 4 * len(l.FinalityBranch) + for ii := 0; ii < len(l.FinalityBranch); ii++ { + dst = ssz.WriteOffset(dst, offset) + offset += len(l.FinalityBranch[ii]) + } + } + for ii := 0; ii < len(l.FinalityBranch); ii++ { + if size := len(l.FinalityBranch[ii]); size > 32 { + err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32) + return + } + dst = append(dst, l.FinalityBranch[ii]...) + } + return } @@ -4515,19 +4529,19 @@ func (l *LightClientFinalityUpdateElectra) MarshalSSZTo(buf []byte) (dst []byte, func (l *LightClientFinalityUpdateElectra) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) - if size < 400 { + if size < 180 { return ssz.ErrSize } tail := buf - var o0, o1 uint64 + var o0, o1, o2 uint64 // Offset (0) 'AttestedHeader' if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { return ssz.ErrOffset } - if o0 != 400 { + if o0 != 180 { return ssz.ErrInvalidVariableOffset } @@ -4536,25 +4550,21 @@ func (l *LightClientFinalityUpdateElectra) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - // Field (2) 'FinalityBranch' - l.FinalityBranch = make([][]byte, 7) - for ii := 0; ii < 7; ii++ { - if cap(l.FinalityBranch[ii]) == 0 { - l.FinalityBranch[ii] = make([]byte, 0, len(buf[8:232][ii*32:(ii+1)*32])) - } - l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[8:232][ii*32:(ii+1)*32]...) + // Offset (2) 'FinalityBranch' + if o2 = ssz.ReadOffset(buf[8:12]); o2 > size || o1 > o2 { + return ssz.ErrOffset } // Field (3) 'SyncAggregate' if l.SyncAggregate == nil { l.SyncAggregate = new(SyncAggregate) } - if err = l.SyncAggregate.UnmarshalSSZ(buf[232:392]); err != nil { + if err = l.SyncAggregate.UnmarshalSSZ(buf[12:172]); err != nil { return err } // Field (4) 'SignatureSlot' - l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[392:400])) + l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[172:180])) // Field (0) 'AttestedHeader' { @@ -4569,7 +4579,7 @@ func (l *LightClientFinalityUpdateElectra) UnmarshalSSZ(buf []byte) error { // Field (1) 'FinalizedHeader' { - buf = tail[o1:] + buf = tail[o1:o2] if l.FinalizedHeader == nil { l.FinalizedHeader = new(LightClientHeaderDeneb) } @@ -4577,12 +4587,35 @@ func (l *LightClientFinalityUpdateElectra) UnmarshalSSZ(buf []byte) error { return err } } + + // Field (2) 'FinalityBranch' + { + buf = tail[o2:] + num, err := ssz.DecodeDynamicLength(buf, 7) + if err != nil { + return err + } + l.FinalityBranch = make([][]byte, num) + err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { + if len(buf) > 32 { + return ssz.ErrBytesLength + } + if cap(l.FinalityBranch[indx]) == 0 { + l.FinalityBranch[indx] = make([]byte, 0, len(buf)) + } + l.FinalityBranch[indx] = append(l.FinalityBranch[indx], buf...) + return nil + }) + if err != nil { + return err + } + } return err } // SizeSSZ returns the ssz encoded size in bytes for the LightClientFinalityUpdateElectra object func (l *LightClientFinalityUpdateElectra) SizeSSZ() (size int) { - size = 400 + size = 180 // Field (0) 'AttestedHeader' if l.AttestedHeader == nil { @@ -4596,6 +4629,12 @@ func (l *LightClientFinalityUpdateElectra) SizeSSZ() (size int) { } size += l.FinalizedHeader.SizeSSZ() + // Field (2) 'FinalityBranch' + for ii := 0; ii < len(l.FinalityBranch); ii++ { + size += 4 + size += len(l.FinalityBranch[ii]) + } + return } @@ -4620,19 +4659,25 @@ func (l *LightClientFinalityUpdateElectra) HashTreeRootWith(hh *ssz.Hasher) (err // Field (2) 'FinalityBranch' { - if size := len(l.FinalityBranch); size != 7 { - err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 7) + subIndx := hh.Index() + num := uint64(len(l.FinalityBranch)) + if num > 7 { + err = ssz.ErrIncorrectListSize return } - subIndx := hh.Index() - for _, i := range l.FinalityBranch { - if len(i) != 32 { - err = ssz.ErrBytesLength - return + for _, elem := range l.FinalityBranch { + { + elemIndx := hh.Index() + byteLen := uint64(len(elem)) + if byteLen > 32 { + err = ssz.ErrIncorrectListSize + return + } + hh.AppendBytes32(elem) + hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) } - hh.Append(i) } - hh.Merkleize(subIndx) + hh.MerkleizeWithMixin(subIndx, num, 7) } // Field (3) 'SyncAggregate' diff --git a/proto/prysm/v1alpha1/light_client.pb.go b/proto/prysm/v1alpha1/light_client.pb.go index 54c065d3036..28747e52776 100755 --- a/proto/prysm/v1alpha1/light_client.pb.go +++ b/proto/prysm/v1alpha1/light_client.pb.go @@ -1073,7 +1073,7 @@ type LightClientFinalityUpdateElectra struct { AttestedHeader *LightClientHeaderDeneb `protobuf:"bytes,1,opt,name=attested_header,json=attestedHeader,proto3" json:"attested_header,omitempty"` FinalizedHeader *LightClientHeaderDeneb `protobuf:"bytes,2,opt,name=finalized_header,json=finalizedHeader,proto3" json:"finalized_header,omitempty"` - FinalityBranch [][]byte `protobuf:"bytes,3,rep,name=finality_branch,json=finalityBranch,proto3" json:"finality_branch,omitempty" ssz-size:"7,32"` + FinalityBranch [][]byte `protobuf:"bytes,3,rep,name=finality_branch,json=finalityBranch,proto3" json:"finality_branch,omitempty" ssz-max:"7,32"` SyncAggregate *SyncAggregate `protobuf:"bytes,4,opt,name=sync_aggregate,json=syncAggregate,proto3" json:"sync_aggregate,omitempty"` SignatureSlot github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot `protobuf:"varint,5,opt,name=signature_slot,json=signatureSlot,proto3" json:"signature_slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"` } @@ -1703,7 +1703,7 @@ var file_proto_prysm_v1alpha1_light_client_proto_rawDesc = []byte{ 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x44, 0x65, 0x6e, 0x65, 0x62, 0x52, 0x0f, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x0f, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, - 0x68, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x08, 0x8a, 0xb5, 0x18, 0x04, 0x37, 0x2c, 0x33, + 0x68, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x08, 0x92, 0xb5, 0x18, 0x04, 0x37, 0x2c, 0x33, 0x32, 0x52, 0x0e, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x4b, 0x0a, 0x0e, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x74, 0x68, 0x65, diff --git a/proto/prysm/v1alpha1/light_client.proto b/proto/prysm/v1alpha1/light_client.proto index ee80fbe4625..57a12aa0d82 100644 --- a/proto/prysm/v1alpha1/light_client.proto +++ b/proto/prysm/v1alpha1/light_client.proto @@ -134,7 +134,7 @@ message LightClientFinalityUpdateDeneb { message LightClientFinalityUpdateElectra { LightClientHeaderDeneb attested_header = 1; LightClientHeaderDeneb finalized_header = 2; - repeated bytes finality_branch = 3 [(ethereum.eth.ext.ssz_size) = "7,32"]; + repeated bytes finality_branch = 3 [(ethereum.eth.ext.ssz_max) = "7,32"]; SyncAggregate sync_aggregate = 4; uint64 signature_slot = 5 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"]; } From 99dbf1c58e5977587f625099381bd988e371630c Mon Sep 17 00:00:00 2001 From: rkapka Date: Thu, 31 Oct 2024 21:41:40 +0700 Subject: [PATCH 10/26] fix protos --- proto/prysm/v1alpha1/BUILD.bazel | 3 + proto/prysm/v1alpha1/electra.ssz.go | 211 +++++++++++++++++++++++++++- 2 files changed, 213 insertions(+), 1 deletion(-) diff --git a/proto/prysm/v1alpha1/BUILD.bazel b/proto/prysm/v1alpha1/BUILD.bazel index 6ad6ab187cf..8d0ca5acf80 100644 --- a/proto/prysm/v1alpha1/BUILD.bazel +++ b/proto/prysm/v1alpha1/BUILD.bazel @@ -317,6 +317,7 @@ go_library( ":ssz_generated_non_core", # keep ":ssz_generated_phase0", # keep ], + embed = [":go_proto"], importpath = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1", visibility = ["//visibility:public"], deps = SSZ_DEPS + [ @@ -325,6 +326,7 @@ go_library( "//proto/engine/v1:go_default_library", "//proto/eth/ext:go_default_library", "//runtime/version:go_default_library", + "//consensus-types/primitives:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", # keep @@ -337,6 +339,7 @@ go_library( "@org_golang_google_grpc//grpclog:go_default_library", "@org_golang_google_grpc//metadata:go_default_library", "@org_golang_google_grpc//status:go_default_library", + "@org_golang_google_protobuf//proto:go_default_library", "@org_golang_google_protobuf//reflect/protoreflect:go_default_library", "@org_golang_google_protobuf//runtime/protoimpl:go_default_library", "@org_golang_google_protobuf//types/descriptorpb:go_default_library", diff --git a/proto/prysm/v1alpha1/electra.ssz.go b/proto/prysm/v1alpha1/electra.ssz.go index bd41d424bb0..a7aa9f14d62 100644 --- a/proto/prysm/v1alpha1/electra.ssz.go +++ b/proto/prysm/v1alpha1/electra.ssz.go @@ -1,5 +1,5 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: 15bba8a5ef0c1eec143044f0c54eec8535d7966f41c577bd6540197c3dd0885e +// Hash: 3fab62924eab85198e9eb6083c1f069c358eb6a246f290d56ed86fdffad76c95 package eth import ( @@ -862,6 +862,215 @@ func (s *SignedBeaconBlockContentsElectra) HashTreeRootWith(hh *ssz.Hasher) (err return } +// MarshalSSZ ssz marshals the BeaconBlockContentsElectra object +func (b *BeaconBlockContentsElectra) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconBlockContentsElectra object to a target array +func (b *BeaconBlockContentsElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(12) + + // Offset (0) 'Block' + dst = ssz.WriteOffset(dst, offset) + if b.Block == nil { + b.Block = new(BeaconBlockElectra) + } + offset += b.Block.SizeSSZ() + + // Offset (1) 'KzgProofs' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.KzgProofs) * 48 + + // Offset (2) 'Blobs' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Blobs) * 131072 + + // Field (0) 'Block' + if dst, err = b.Block.MarshalSSZTo(dst); err != nil { + return + } + + // Field (1) 'KzgProofs' + if size := len(b.KzgProofs); size > 4096 { + err = ssz.ErrListTooBigFn("--.KzgProofs", size, 4096) + return + } + for ii := 0; ii < len(b.KzgProofs); ii++ { + if size := len(b.KzgProofs[ii]); size != 48 { + err = ssz.ErrBytesLengthFn("--.KzgProofs[ii]", size, 48) + return + } + dst = append(dst, b.KzgProofs[ii]...) + } + + // Field (2) 'Blobs' + if size := len(b.Blobs); size > 4096 { + err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) + return + } + for ii := 0; ii < len(b.Blobs); ii++ { + if size := len(b.Blobs[ii]); size != 131072 { + err = ssz.ErrBytesLengthFn("--.Blobs[ii]", size, 131072) + return + } + dst = append(dst, b.Blobs[ii]...) + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconBlockContentsElectra object +func (b *BeaconBlockContentsElectra) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 12 { + return ssz.ErrSize + } + + tail := buf + var o0, o1, o2 uint64 + + // Offset (0) 'Block' + if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { + return ssz.ErrOffset + } + + if o0 != 12 { + return ssz.ErrInvalidVariableOffset + } + + // Offset (1) 'KzgProofs' + if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { + return ssz.ErrOffset + } + + // Offset (2) 'Blobs' + if o2 = ssz.ReadOffset(buf[8:12]); o2 > size || o1 > o2 { + return ssz.ErrOffset + } + + // Field (0) 'Block' + { + buf = tail[o0:o1] + if b.Block == nil { + b.Block = new(BeaconBlockElectra) + } + if err = b.Block.UnmarshalSSZ(buf); err != nil { + return err + } + } + + // Field (1) 'KzgProofs' + { + buf = tail[o1:o2] + num, err := ssz.DivideInt2(len(buf), 48, 4096) + if err != nil { + return err + } + b.KzgProofs = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(b.KzgProofs[ii]) == 0 { + b.KzgProofs[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) + } + b.KzgProofs[ii] = append(b.KzgProofs[ii], buf[ii*48:(ii+1)*48]...) + } + } + + // Field (2) 'Blobs' + { + buf = tail[o2:] + num, err := ssz.DivideInt2(len(buf), 131072, 4096) + if err != nil { + return err + } + b.Blobs = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(b.Blobs[ii]) == 0 { + b.Blobs[ii] = make([]byte, 0, len(buf[ii*131072:(ii+1)*131072])) + } + b.Blobs[ii] = append(b.Blobs[ii], buf[ii*131072:(ii+1)*131072]...) + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockContentsElectra object +func (b *BeaconBlockContentsElectra) SizeSSZ() (size int) { + size = 12 + + // Field (0) 'Block' + if b.Block == nil { + b.Block = new(BeaconBlockElectra) + } + size += b.Block.SizeSSZ() + + // Field (1) 'KzgProofs' + size += len(b.KzgProofs) * 48 + + // Field (2) 'Blobs' + size += len(b.Blobs) * 131072 + + return +} + +// HashTreeRoot ssz hashes the BeaconBlockContentsElectra object +func (b *BeaconBlockContentsElectra) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconBlockContentsElectra object with a hasher +func (b *BeaconBlockContentsElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Block' + if err = b.Block.HashTreeRootWith(hh); err != nil { + return + } + + // Field (1) 'KzgProofs' + { + if size := len(b.KzgProofs); size > 4096 { + err = ssz.ErrListTooBigFn("--.KzgProofs", size, 4096) + return + } + subIndx := hh.Index() + for _, i := range b.KzgProofs { + if len(i) != 48 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(i) + } + + numItems := uint64(len(b.KzgProofs)) + hh.MerkleizeWithMixin(subIndx, numItems, 4096) + } + + // Field (2) 'Blobs' + { + if size := len(b.Blobs); size > 4096 { + err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) + return + } + subIndx := hh.Index() + for _, i := range b.Blobs { + if len(i) != 131072 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(i) + } + + numItems := uint64(len(b.Blobs)) + hh.MerkleizeWithMixin(subIndx, numItems, 4096) + } + + hh.Merkleize(indx) + return +} + // MarshalSSZ ssz marshals the SignedBeaconBlockElectra object func (s *SignedBeaconBlockElectra) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(s) From 4d60cc3e0dbff5bbd1499dde398dd9f3802ebd82 Mon Sep 17 00:00:00 2001 From: rkapka Date: Thu, 31 Oct 2024 21:43:01 +0700 Subject: [PATCH 11/26] fix issues --- beacon-chain/sync/validate_light_client.go | 8 ++++++-- consensus-types/light-client/BUILD.bazel | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/beacon-chain/sync/validate_light_client.go b/beacon-chain/sync/validate_light_client.go index 42303c9ec0f..b68513fb6a3 100644 --- a/beacon-chain/sync/validate_light_client.go +++ b/beacon-chain/sync/validate_light_client.go @@ -43,6 +43,10 @@ func (s *Service) validateLightClientFinalityUpdate(ctx context.Context, pid pee s.lcFinalityUpdateLock.Lock() defer s.lcFinalityUpdateLock.Unlock() + maxActiveParticipants := update.SyncAggregate().SyncCommitteeBits.Len() + numActiveParticipants := update.SyncAggregate().SyncCommitteeBits.Count() + hasSupermajority := numActiveParticipants*3 >= maxActiveParticipants*2 + last := s.lastLCFinalityUpdate if last != nil { // [IGNORE] The finalized_header.beacon.slot is greater than that of all previously forwarded finality_updates, @@ -51,7 +55,7 @@ func (s *Service) validateLightClientFinalityUpdate(ctx context.Context, pid pee if update.FinalizedHeader().Beacon().Slot < last.slot { return pubsub.ValidationIgnore, nil } - if update.FinalizedHeader().Beacon().Slot == last.slot && (last.hasSupermajority || !update.HasSupermajority()) { + if update.FinalizedHeader().Beacon().Slot == last.slot && (last.hasSupermajority || !hasSupermajority) { return pubsub.ValidationIgnore, nil } } @@ -68,7 +72,7 @@ func (s *Service) validateLightClientFinalityUpdate(ctx context.Context, pid pee s.lastLCFinalityUpdate = &lcFinalityUpdateInfo{ slot: update.FinalizedHeader().Beacon().Slot, - hasSupermajority: update.HasSupermajority(), + hasSupermajority: hasSupermajority, } return pubsub.ValidationAccept, nil diff --git a/consensus-types/light-client/BUILD.bazel b/consensus-types/light-client/BUILD.bazel index fd01666d01b..78432c8eecb 100644 --- a/consensus-types/light-client/BUILD.bazel +++ b/consensus-types/light-client/BUILD.bazel @@ -23,7 +23,6 @@ go_library( "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", - "@com_github_pkg_errors//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", ], ) From ba8578eea43eb2d284be142b92724529dc73f32e Mon Sep 17 00:00:00 2001 From: rkapka Date: Sun, 3 Nov 2024 20:56:40 +0700 Subject: [PATCH 12/26] poc complete --- beacon-chain/blockchain/BUILD.bazel | 1 + beacon-chain/blockchain/options.go | 8 + beacon-chain/blockchain/process_block.go | 4 +- .../blockchain/process_block_helpers.go | 121 +++++++-------- beacon-chain/blockchain/service.go | 40 ++--- beacon-chain/light-client/BUILD.bazel | 9 ++ beacon-chain/light-client/store.go | 12 ++ beacon-chain/node/BUILD.bazel | 1 + beacon-chain/node/node.go | 5 + beacon-chain/p2p/types/types.go | 12 +- beacon-chain/rpc/eth/light-client/helpers.go | 12 +- beacon-chain/sync/BUILD.bazel | 2 + beacon-chain/sync/options.go | 9 ++ beacon-chain/sync/rpc_chunked_response.go | 143 ++++++++++++++++++ beacon-chain/sync/rpc_light_client.go | 122 ++++++++++++++- beacon-chain/sync/rpc_send_request.go | 2 + beacon-chain/sync/service.go | 6 +- beacon-chain/sync/subscriber_light_client.go | 28 ++++ beacon-chain/sync/validate_light_client.go | 30 ++-- 19 files changed, 440 insertions(+), 127 deletions(-) create mode 100644 beacon-chain/light-client/BUILD.bazel create mode 100644 beacon-chain/light-client/store.go diff --git a/beacon-chain/blockchain/BUILD.bazel b/beacon-chain/blockchain/BUILD.bazel index 2dc6f11a87f..bb7d4c728d6 100644 --- a/beacon-chain/blockchain/BUILD.bazel +++ b/beacon-chain/blockchain/BUILD.bazel @@ -59,6 +59,7 @@ go_library( "//beacon-chain/forkchoice:go_default_library", "//beacon-chain/forkchoice/doubly-linked-tree:go_default_library", "//beacon-chain/forkchoice/types:go_default_library", + "//beacon-chain/light-client:go_default_library", "//beacon-chain/operations/attestations:go_default_library", "//beacon-chain/operations/blstoexec:go_default_library", "//beacon-chain/operations/slashings:go_default_library", diff --git a/beacon-chain/blockchain/options.go b/beacon-chain/blockchain/options.go index 38492502a1f..62c6115562b 100644 --- a/beacon-chain/blockchain/options.go +++ b/beacon-chain/blockchain/options.go @@ -8,6 +8,7 @@ import ( "github.com/prysmaticlabs/prysm/v5/beacon-chain/db/filesystem" "github.com/prysmaticlabs/prysm/v5/beacon-chain/execution" "github.com/prysmaticlabs/prysm/v5/beacon-chain/forkchoice" + light_client "github.com/prysmaticlabs/prysm/v5/beacon-chain/light-client" "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/attestations" "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/blstoexec" "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/slashings" @@ -205,3 +206,10 @@ func WithSyncChecker(checker Checker) Option { return nil } } + +func WithLightClientStore(lcs *light_client.Store) Option { + return func(s *Service) error { + s.lcStore = lcs + return nil + } +} diff --git a/beacon-chain/blockchain/process_block.go b/beacon-chain/blockchain/process_block.go index 7a55c3f83fb..896472e75bd 100644 --- a/beacon-chain/blockchain/process_block.go +++ b/beacon-chain/blockchain/process_block.go @@ -69,7 +69,9 @@ func (s *Service) postBlockProcess(cfg *postBlockProcessConfig) error { if s.inRegularSync() { defer s.handleSecondFCUCall(cfg, fcuArgs) } - defer s.sendLightClientFeeds(cfg) + if features.Get().EnableLightClient && slots.ToEpoch(s.CurrentSlot()) >= params.BeaconConfig().AltairForkEpoch { + defer s.processLightClientUpdates(cfg) + } defer s.sendStateFeedOnBlock(cfg) defer reportProcessingTime(startTime) defer reportAttestationInclusion(cfg.roblock.Block()) diff --git a/beacon-chain/blockchain/process_block_helpers.go b/beacon-chain/blockchain/process_block_helpers.go index 04289145e07..7b9a104b222 100644 --- a/beacon-chain/blockchain/process_block_helpers.go +++ b/beacon-chain/blockchain/process_block_helpers.go @@ -15,7 +15,6 @@ import ( doublylinkedtree "github.com/prysmaticlabs/prysm/v5/beacon-chain/forkchoice/doubly-linked-tree" forkchoicetypes "github.com/prysmaticlabs/prysm/v5/beacon-chain/forkchoice/types" "github.com/prysmaticlabs/prysm/v5/beacon-chain/state" - "github.com/prysmaticlabs/prysm/v5/config/features" field_params "github.com/prysmaticlabs/prysm/v5/config/fieldparams" "github.com/prysmaticlabs/prysm/v5/config/params" consensus_blocks "github.com/prysmaticlabs/prysm/v5/consensus-types/blocks" @@ -114,69 +113,30 @@ func (s *Service) sendStateFeedOnBlock(cfg *postBlockProcessConfig) { }) } -// sendLightClientFeeds sends the light client feeds when feature flag is enabled. -func (s *Service) sendLightClientFeeds(cfg *postBlockProcessConfig) { - if features.Get().EnableLightClient { - if _, err := s.sendLightClientOptimisticUpdate(cfg.ctx, cfg.roblock, cfg.postState); err != nil { - log.WithError(err).Error("Failed to send light client optimistic update") - } - - // Get the finalized checkpoint - finalized := s.ForkChoicer().FinalizedCheckpoint() - - // LightClientFinalityUpdate needs super majority - s.tryPublishLightClientFinalityUpdate(cfg.ctx, cfg.roblock, finalized, cfg.postState) +func (s *Service) processLightClientUpdates(cfg *postBlockProcessConfig) { + if err := s.processLightClientOptimisticUpdate(cfg.ctx, cfg.roblock, cfg.postState); err != nil { + log.WithError(err).Error("Failed to process light client optimistic update") + } + if err := s.processLightClientFinalityUpdate(cfg.ctx, cfg.roblock, cfg.postState); err != nil { + log.WithError(err).Error("Failed to process light client finality update") } } -func (s *Service) tryPublishLightClientFinalityUpdate( +func (s *Service) processLightClientFinalityUpdate( ctx context.Context, signed interfaces.ReadOnlySignedBeaconBlock, - finalized *forkchoicetypes.Checkpoint, postState state.BeaconState, -) { - if finalized.Epoch <= s.lastPublishedLightClientEpoch { - return - } - - config := params.BeaconConfig() - if finalized.Epoch < config.AltairForkEpoch { - return - } - - syncAggregate, err := signed.Block().Body().SyncAggregate() - if err != nil || syncAggregate == nil { - return - } - - // LightClientFinalityUpdate needs super majority - if syncAggregate.SyncCommitteeBits.Count()*3 < config.SyncCommitteeSize*2 { - return - } - - _, err = s.sendLightClientFinalityUpdate(ctx, signed, postState) - if err != nil { - log.WithError(err).Error("Failed to send light client finality update") - } else { - s.lastPublishedLightClientEpoch = finalized.Epoch - } -} - -// sendLightClientFinalityUpdate sends a light client finality update notification to the state feed. -func (s *Service) sendLightClientFinalityUpdate(ctx context.Context, signed interfaces.ReadOnlySignedBeaconBlock, - postState state.BeaconState) (int, error) { - // Get attested state +) error { attestedRoot := signed.Block().ParentRoot() attestedBlock, err := s.cfg.BeaconDB.Block(ctx, attestedRoot) if err != nil { - return 0, errors.Wrap(err, "could not get attested block") + return errors.Wrap(err, "could not get attested block") } attestedState, err := s.cfg.StateGen.StateByRoot(ctx, attestedRoot) if err != nil { - return 0, errors.Wrap(err, "could not get attested state") + return errors.Wrap(err, "could not get attested state") } - // Get finalized block var finalizedBlock interfaces.ReadOnlySignedBeaconBlock finalizedCheckPoint := attestedState.FinalizedCheckpoint() if finalizedCheckPoint != nil { @@ -197,28 +157,51 @@ func (s *Service) sendLightClientFinalityUpdate(ctx context.Context, signed inte finalizedBlock, ) if err != nil { - return 0, errors.Wrap(err, "could not create light client update") + return errors.Wrap(err, "could not create light client update") } - // Send event - return s.cfg.StateNotifier.StateFeed().Send(&feed.Event{ + maxActiveParticipants := update.SyncAggregate().SyncCommitteeBits.Len() + numActiveParticipants := update.SyncAggregate().SyncCommitteeBits.Count() + hasSupermajority := numActiveParticipants*3 >= maxActiveParticipants*2 + + last := s.lcStore.LastLCFinalityUpdate + if last != nil { + // The finalized_header.beacon.slot is greater than that of all previously forwarded finality_updates, + // or it matches the highest previously forwarded slot and also has a sync_aggregate indicating supermajority (> 2/3) + // sync committee participation while the previously forwarded finality_update for that slot did not indicate supermajority + slot := last.FinalizedHeader().Beacon().Slot + lastMaxActiveParticipants := last.SyncAggregate().SyncCommitteeBits.Len() + lastNumActiveParticipants := last.SyncAggregate().SyncCommitteeBits.Count() + lastHasSupermajority := lastNumActiveParticipants*3 >= lastMaxActiveParticipants*2 + + if update.FinalizedHeader().Beacon().Slot < slot { + return nil + } + if update.FinalizedHeader().Beacon().Slot == slot && (lastHasSupermajority || !hasSupermajority) { + return nil + } + } + + s.lcStore.LastLCFinalityUpdate = update + + s.cfg.StateNotifier.StateFeed().Send(&feed.Event{ Type: statefeed.LightClientFinalityUpdate, Data: update, - }), nil + }) + + return nil } -// sendLightClientOptimisticUpdate sends a light client optimistic update notification to the state feed. -func (s *Service) sendLightClientOptimisticUpdate(ctx context.Context, signed interfaces.ReadOnlySignedBeaconBlock, - postState state.BeaconState) (int, error) { - // Get attested state +func (s *Service) processLightClientOptimisticUpdate(ctx context.Context, signed interfaces.ReadOnlySignedBeaconBlock, + postState state.BeaconState) error { attestedRoot := signed.Block().ParentRoot() attestedBlock, err := s.cfg.BeaconDB.Block(ctx, attestedRoot) if err != nil { - return 0, errors.Wrap(err, "could not get attested block") + return errors.Wrap(err, "could not get attested block") } attestedState, err := s.cfg.StateGen.StateByRoot(ctx, attestedRoot) if err != nil { - return 0, errors.Wrap(err, "could not get attested state") + return errors.Wrap(err, "could not get attested state") } update, err := lightclient.NewLightClientOptimisticUpdateFromBeaconState( @@ -230,13 +213,25 @@ func (s *Service) sendLightClientOptimisticUpdate(ctx context.Context, signed in attestedBlock, ) if err != nil { - return 0, errors.Wrap(err, "could not create light client update") + return errors.Wrap(err, "could not create light client update") } - return s.cfg.StateNotifier.StateFeed().Send(&feed.Event{ + last := s.lcStore.LastLCOptimisticUpdate + if last != nil { + // The attested_header.beacon.slot is greater than that of all previously forwarded optimistic_updates + if update.AttestedHeader().Beacon().Slot <= last.AttestedHeader().Beacon().Slot { + return nil + } + } + + s.lcStore.LastLCOptimisticUpdate = update + + s.cfg.StateNotifier.StateFeed().Send(&feed.Event{ Type: statefeed.LightClientOptimisticUpdate, Data: update, - }), nil + }) + + return nil } // updateCachesPostBlockProcessing updates the next slot cache and handles the epoch diff --git a/beacon-chain/blockchain/service.go b/beacon-chain/blockchain/service.go index c984a2f7975..6494b80a746 100644 --- a/beacon-chain/blockchain/service.go +++ b/beacon-chain/blockchain/service.go @@ -24,6 +24,7 @@ import ( "github.com/prysmaticlabs/prysm/v5/beacon-chain/execution" f "github.com/prysmaticlabs/prysm/v5/beacon-chain/forkchoice" forkchoicetypes "github.com/prysmaticlabs/prysm/v5/beacon-chain/forkchoice/types" + light_client "github.com/prysmaticlabs/prysm/v5/beacon-chain/light-client" "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/attestations" "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/blstoexec" "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/slashings" @@ -38,7 +39,6 @@ import ( "github.com/prysmaticlabs/prysm/v5/consensus-types/blocks" consensus_blocks "github.com/prysmaticlabs/prysm/v5/consensus-types/blocks" "github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces" - "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" "github.com/prysmaticlabs/prysm/v5/encoding/bytesutil" "github.com/prysmaticlabs/prysm/v5/monitoring/tracing/trace" ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" @@ -49,25 +49,25 @@ import ( // Service represents a service that handles the internal // logic of managing the full PoS beacon chain. type Service struct { - cfg *config - ctx context.Context - cancel context.CancelFunc - genesisTime time.Time - head *head - headLock sync.RWMutex - originBlockRoot [32]byte // genesis root, or weak subjectivity checkpoint root, depending on how the node is initialized - boundaryRoots [][32]byte - checkpointStateCache *cache.CheckpointStateCache - initSyncBlocks map[[32]byte]interfaces.ReadOnlySignedBeaconBlock - initSyncBlocksLock sync.RWMutex - wsVerifier *WeakSubjectivityVerifier - clockSetter startup.ClockSetter - clockWaiter startup.ClockWaiter - syncComplete chan struct{} - blobNotifiers *blobNotifierMap - blockBeingSynced *currentlySyncingBlock - blobStorage *filesystem.BlobStorage - lastPublishedLightClientEpoch primitives.Epoch + cfg *config + ctx context.Context + cancel context.CancelFunc + genesisTime time.Time + head *head + headLock sync.RWMutex + originBlockRoot [32]byte // genesis root, or weak subjectivity checkpoint root, depending on how the node is initialized + boundaryRoots [][32]byte + checkpointStateCache *cache.CheckpointStateCache + initSyncBlocks map[[32]byte]interfaces.ReadOnlySignedBeaconBlock + initSyncBlocksLock sync.RWMutex + wsVerifier *WeakSubjectivityVerifier + clockSetter startup.ClockSetter + clockWaiter startup.ClockWaiter + syncComplete chan struct{} + blobNotifiers *blobNotifierMap + blockBeingSynced *currentlySyncingBlock + blobStorage *filesystem.BlobStorage + lcStore *light_client.Store } // config options for the service. diff --git a/beacon-chain/light-client/BUILD.bazel b/beacon-chain/light-client/BUILD.bazel new file mode 100644 index 00000000000..4c36f9363a8 --- /dev/null +++ b/beacon-chain/light-client/BUILD.bazel @@ -0,0 +1,9 @@ +load("@prysm//tools/go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["store.go"], + importpath = "github.com/prysmaticlabs/prysm/v5/beacon-chain/light-client", + visibility = ["//visibility:public"], + deps = ["//consensus-types/interfaces:go_default_library"], +) diff --git a/beacon-chain/light-client/store.go b/beacon-chain/light-client/store.go new file mode 100644 index 00000000000..203758d3ebc --- /dev/null +++ b/beacon-chain/light-client/store.go @@ -0,0 +1,12 @@ +package light_client + +import ( + "github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces" +) + +type Store struct { + // lcFinalityUpdateLock sync.Mutex + LastLCFinalityUpdate interfaces.LightClientFinalityUpdate + // lcOptimisticUpdateLock sync.Mutex + LastLCOptimisticUpdate interfaces.LightClientOptimisticUpdate +} diff --git a/beacon-chain/node/BUILD.bazel b/beacon-chain/node/BUILD.bazel index a310daf40b2..e21526b857b 100644 --- a/beacon-chain/node/BUILD.bazel +++ b/beacon-chain/node/BUILD.bazel @@ -30,6 +30,7 @@ go_library( "//beacon-chain/execution:go_default_library", "//beacon-chain/forkchoice:go_default_library", "//beacon-chain/forkchoice/doubly-linked-tree:go_default_library", + "//beacon-chain/light-client:go_default_library", "//beacon-chain/monitor:go_default_library", "//beacon-chain/node/registration:go_default_library", "//beacon-chain/operations/attestations:go_default_library", diff --git a/beacon-chain/node/node.go b/beacon-chain/node/node.go index fce4a4e56af..3b08cc3105b 100644 --- a/beacon-chain/node/node.go +++ b/beacon-chain/node/node.go @@ -34,6 +34,7 @@ import ( "github.com/prysmaticlabs/prysm/v5/beacon-chain/execution" "github.com/prysmaticlabs/prysm/v5/beacon-chain/forkchoice" doublylinkedtree "github.com/prysmaticlabs/prysm/v5/beacon-chain/forkchoice/doubly-linked-tree" + light_client "github.com/prysmaticlabs/prysm/v5/beacon-chain/light-client" "github.com/prysmaticlabs/prysm/v5/beacon-chain/monitor" "github.com/prysmaticlabs/prysm/v5/beacon-chain/node/registration" "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/attestations" @@ -121,6 +122,7 @@ type BeaconNode struct { BlobStorageOptions []filesystem.BlobStorageOption verifyInitWaiter *verification.InitializerWaiter syncChecker *initialsync.SyncChecker + lcStore *light_client.Store } // New creates a new node instance, sets up configuration options, and registers @@ -157,6 +159,7 @@ func New(cliCtx *cli.Context, cancel context.CancelFunc, opts ...Option) (*Beaco serviceFlagOpts: &serviceFlagOpts{}, initialSyncComplete: make(chan struct{}), syncChecker: &initialsync.SyncChecker{}, + lcStore: &light_client.Store{}, } for _, opt := range opts { @@ -763,6 +766,7 @@ func (b *BeaconNode) registerBlockchainService(fc forkchoice.ForkChoicer, gs *st blockchain.WithTrackedValidatorsCache(b.trackedValidatorsCache), blockchain.WithPayloadIDCache(b.payloadIDCache), blockchain.WithSyncChecker(b.syncChecker), + blockchain.WithLightClientStore(b.lcStore), ) blockchainService, err := blockchain.NewService(b.ctx, opts...) @@ -846,6 +850,7 @@ func (b *BeaconNode) registerSyncService(initialSyncComplete chan struct{}, bFil regularsync.WithBlobStorage(b.BlobStorage), regularsync.WithVerifierWaiter(b.verifyInitWaiter), regularsync.WithAvailableBlocker(bFillStore), + regularsync.WithLightClientStore(b.lcStore), ) return b.services.RegisterService(rs) } diff --git a/beacon-chain/p2p/types/types.go b/beacon-chain/p2p/types/types.go index 95dd762be7d..4bf10ad5c81 100644 --- a/beacon-chain/p2p/types/types.go +++ b/beacon-chain/p2p/types/types.go @@ -250,8 +250,8 @@ func (r LightClientBootstrapReq) UnmarshalSSZ(buf []byte) error { // LightClientUpdatesByRangeReq specifies the block by roots request type. type LightClientUpdatesByRangeReq struct { - startPeriod uint64 - count uint64 + StartPeriod uint64 + Count uint64 } // MarshalSSZTo marshals the light client updates by range request with the provided byte slice. @@ -266,8 +266,8 @@ func (r *LightClientUpdatesByRangeReq) MarshalSSZTo(dst []byte) ([]byte, error) // MarshalSSZ Marshals the light client updates by range request type into the serialized object. func (r *LightClientUpdatesByRangeReq) MarshalSSZ() ([]byte, error) { buf := make([]byte, 0, r.SizeSSZ()) - binary.LittleEndian.AppendUint64(buf, r.startPeriod) - binary.LittleEndian.AppendUint64(buf, r.count) + binary.LittleEndian.AppendUint64(buf, r.StartPeriod) + binary.LittleEndian.AppendUint64(buf, r.Count) return buf, nil } @@ -283,7 +283,7 @@ func (r *LightClientUpdatesByRangeReq) UnmarshalSSZ(buf []byte) error { if bufLen != lightClientUpdatesByRangeReqLength { return errors.Errorf("expected buffer with length of %d but received length %d", lightClientUpdatesByRangeReqLength, bufLen) } - r.startPeriod = binary.LittleEndian.Uint64(buf[0:8]) - r.count = binary.LittleEndian.Uint64(buf[8:16]) + r.StartPeriod = binary.LittleEndian.Uint64(buf[0:8]) + r.Count = binary.LittleEndian.Uint64(buf[8:16]) return nil } diff --git a/beacon-chain/rpc/eth/light-client/helpers.go b/beacon-chain/rpc/eth/light-client/helpers.go index 2c43366d901..4a811248526 100644 --- a/beacon-chain/rpc/eth/light-client/helpers.go +++ b/beacon-chain/rpc/eth/light-client/helpers.go @@ -4,18 +4,12 @@ import ( "context" "reflect" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/pkg/errors" - fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams" - "github.com/prysmaticlabs/prysm/v5/config/params" - "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" - - lightclient "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/light-client" - "github.com/prysmaticlabs/prysm/v5/runtime/version" - "github.com/prysmaticlabs/prysm/v5/api/server/structs" + lightclient "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/light-client" "github.com/prysmaticlabs/prysm/v5/beacon-chain/state" "github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces" + "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" + "github.com/prysmaticlabs/prysm/v5/runtime/version" "github.com/prysmaticlabs/prysm/v5/time/slots" ) diff --git a/beacon-chain/sync/BUILD.bazel b/beacon-chain/sync/BUILD.bazel index ddcd95634cd..e7299b13ab1 100644 --- a/beacon-chain/sync/BUILD.bazel +++ b/beacon-chain/sync/BUILD.bazel @@ -82,6 +82,7 @@ go_library( "//beacon-chain/db/filesystem:go_default_library", "//beacon-chain/db/filters:go_default_library", "//beacon-chain/execution:go_default_library", + "//beacon-chain/light-client:go_default_library", "//beacon-chain/operations/attestations:go_default_library", "//beacon-chain/operations/blstoexec:go_default_library", "//beacon-chain/operations/slashings:go_default_library", @@ -126,6 +127,7 @@ go_library( "//time:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", + "@com_github_ethereum_go_ethereum//common/math:go_default_library", "@com_github_hashicorp_golang_lru//:go_default_library", "@com_github_libp2p_go_libp2p//core:go_default_library", "@com_github_libp2p_go_libp2p//core/host:go_default_library", diff --git a/beacon-chain/sync/options.go b/beacon-chain/sync/options.go index ff20b8b8121..2eaa5325a9a 100644 --- a/beacon-chain/sync/options.go +++ b/beacon-chain/sync/options.go @@ -8,6 +8,7 @@ import ( "github.com/prysmaticlabs/prysm/v5/beacon-chain/db" "github.com/prysmaticlabs/prysm/v5/beacon-chain/db/filesystem" "github.com/prysmaticlabs/prysm/v5/beacon-chain/execution" + light_client "github.com/prysmaticlabs/prysm/v5/beacon-chain/light-client" "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/attestations" "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/blstoexec" "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/slashings" @@ -180,3 +181,11 @@ func WithAvailableBlocker(avb coverage.AvailableBlocker) Option { return nil } } + +// WithLightClientStore allows the sync package to access light client data. +func WithLightClientStore(lcs *light_client.Store) Option { + return func(s *Service) error { + s.lcStore = lcs + return nil + } +} diff --git a/beacon-chain/sync/rpc_chunked_response.go b/beacon-chain/sync/rpc_chunked_response.go index 6c8de561b5d..bc452a7f62d 100644 --- a/beacon-chain/sync/rpc_chunked_response.go +++ b/beacon-chain/sync/rpc_chunked_response.go @@ -203,3 +203,146 @@ func WriteLightClientBootstrapChunk( _, err := encoding.EncodeWithMaxLength(stream, bootstrap) return err } + +func WriteLightClientUpdateChunk( + stream libp2pcore.Stream, + tor blockchain.TemporalOracle, + encoding encoder.NetworkEncoding, + update interfaces.LightClientUpdate, +) error { + if _, err := stream.Write([]byte{responseCodeSuccess}); err != nil { + return err + } + + var obtainedCtx []byte + valRoot := tor.GenesisValidatorsRoot() + switch v := update.Version(); v { + case version.Altair: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().AltairForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + case version.Capella: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().CapellaForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + case version.Deneb: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().DenebForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + case version.Electra: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().ElectraForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + default: + return errors.Wrapf(ErrUnrecognizedVersion, "light client boostrap version %s is not recognized", version.String(v)) + } + + if err := writeContextToStream(obtainedCtx, stream); err != nil { + return err + } + _, err := encoding.EncodeWithMaxLength(stream, update) + return err +} + +func WriteLightClientFinalityUpdateChunk( + stream libp2pcore.Stream, + tor blockchain.TemporalOracle, + encoding encoder.NetworkEncoding, + update interfaces.LightClientFinalityUpdate, +) error { + if _, err := stream.Write([]byte{responseCodeSuccess}); err != nil { + return err + } + + var obtainedCtx []byte + valRoot := tor.GenesisValidatorsRoot() + switch v := update.Version(); v { + case version.Altair: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().AltairForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + case version.Capella: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().CapellaForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + case version.Deneb: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().DenebForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + case version.Electra: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().ElectraForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + default: + return errors.Wrapf(ErrUnrecognizedVersion, "light client boostrap version %s is not recognized", version.String(v)) + } + + if err := writeContextToStream(obtainedCtx, stream); err != nil { + return err + } + _, err := encoding.EncodeWithMaxLength(stream, update) + return err +} +func WriteLightClientOptimisticUpdateChunk( + stream libp2pcore.Stream, + tor blockchain.TemporalOracle, + encoding encoder.NetworkEncoding, + update interfaces.LightClientOptimisticUpdate, +) error { + if _, err := stream.Write([]byte{responseCodeSuccess}); err != nil { + return err + } + + var obtainedCtx []byte + valRoot := tor.GenesisValidatorsRoot() + switch v := update.Version(); v { + case version.Altair: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().AltairForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + case version.Capella: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().CapellaForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + case version.Deneb: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().DenebForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + case version.Electra: + digest, err := forks.ForkDigestFromEpoch(params.BeaconConfig().ElectraForkEpoch, valRoot[:]) + if err != nil { + return err + } + obtainedCtx = digest[:] + default: + return errors.Wrapf(ErrUnrecognizedVersion, "light client boostrap version %s is not recognized", version.String(v)) + } + + if err := writeContextToStream(obtainedCtx, stream); err != nil { + return err + } + _, err := encoding.EncodeWithMaxLength(stream, update) + return err +} diff --git a/beacon-chain/sync/rpc_light_client.go b/beacon-chain/sync/rpc_light_client.go index 48478176c7f..cbeee59be2e 100644 --- a/beacon-chain/sync/rpc_light_client.go +++ b/beacon-chain/sync/rpc_light_client.go @@ -4,14 +4,17 @@ import ( "context" "fmt" + "github.com/ethereum/go-ethereum/common/math" libp2pcore "github.com/libp2p/go-libp2p/core" + "github.com/pkg/errors" "github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p" "github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p/types" + "github.com/prysmaticlabs/prysm/v5/config/params" + "github.com/prysmaticlabs/prysm/v5/monitoring/tracing" "github.com/prysmaticlabs/prysm/v5/monitoring/tracing/trace" ) -// blobSidecarByRootRPCHandler handles the /eth2/beacon_chain/req/blob_sidecars_by_root/1/ RPC request. -// spec: https://github.com/ethereum/consensus-specs/blob/a7e45db9ac2b60a33e144444969ad3ac0aae3d4c/specs/deneb/p2p-interface.md#blobsidecarsbyroot-v1 +// lightClientBootstrapRPCHandler handles the /eth2/beacon_chain/req/light_client_bootstrap/1/ RPC request. func (s *Service) lightClientBootstrapRPCHandler(ctx context.Context, msg interface{}, stream libp2pcore.Stream) error { ctx, span := trace.StartSpan(ctx, "sync.lightClientBootstrapRPCHandler") defer span.End() @@ -36,9 +39,14 @@ func (s *Service) lightClientBootstrapRPCHandler(ctx context.Context, msg interf bootstrap, err := s.cfg.beaconDB.LightClientBootstrap(ctx, blkRoot) if err != nil { s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) + tracing.AnnotateError(span, err) return err } + + SetStreamWriteDeadline(stream, defaultWriteDuration) if err = WriteLightClientBootstrapChunk(stream, s.cfg.clock, s.cfg.p2p.Encoding(), bootstrap); err != nil { + s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) + tracing.AnnotateError(span, err) return err } @@ -46,14 +54,120 @@ func (s *Service) lightClientBootstrapRPCHandler(ctx context.Context, msg interf return nil } +// lightClientBootstrapRPCHandler handles the /eth2/beacon_chain/req/light_client_updates_by_range/1/ RPC request. func (s *Service) lightClientUpdatesByRangeRPCHandler(ctx context.Context, msg interface{}, stream libp2pcore.Stream) error { + ctx, span := trace.StartSpan(ctx, "sync.lightClientUpdatesByRangeRPCHandler") + defer span.End() + ctx, cancel := context.WithTimeout(ctx, ttfbTimeout) + defer cancel() + + // TODO: What should we log? + log := log.WithField("handler", p2p.LightClientUpdatesByRangeName[1:]) // slice the leading slash off the name var + + SetRPCStreamDeadlines(stream) + if err := s.rateLimiter.validateRequest(stream, 1); err != nil { + return err + } + s.rateLimiter.add(stream, 1) + + rawMsg, ok := msg.(*types.LightClientUpdatesByRangeReq) + if !ok { + return fmt.Errorf("message is not type %T", &types.LightClientUpdatesByRangeReq{}) + } + r := *rawMsg + + if r.Count > params.BeaconConfig().MaxRequestLightClientUpdates { + r.Count = params.BeaconConfig().MaxRequestLightClientUpdates + } + endPeriod, ok := math.SafeAdd(r.StartPeriod, r.Count-1) + if !ok { + err := errors.Wrap(types.ErrInvalidRequest, "end period overflows") + s.writeErrorResponseToStream(responseCodeInvalidRequest, err.Error(), stream) + s.cfg.p2p.Peers().Scorers().BadResponsesScorer().Increment(stream.Conn().RemotePeer()) + tracing.AnnotateError(span, err) + return err + } + + updates, err := s.cfg.beaconDB.LightClientUpdates(ctx, r.StartPeriod, endPeriod) + if err != nil { + s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) + tracing.AnnotateError(span, err) + return err + } + for _, u := range updates { + SetStreamWriteDeadline(stream, defaultWriteDuration) + if err = WriteLightClientUpdateChunk(stream, s.cfg.clock, s.cfg.p2p.Encoding(), u); err != nil { + s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) + tracing.AnnotateError(span, err) + return err + } + s.rateLimiter.add(stream, 1) + } + + closeStream(stream, log) return nil } -func (s *Service) lightClientFinalityUpdateRPCHandler(ctx context.Context, msg interface{}, stream libp2pcore.Stream) error { +// lightClientBootstrapRPCHandler handles the /eth2/beacon_chain/req/light_client_finality_update/1/ RPC request. +func (s *Service) lightClientFinalityUpdateRPCHandler(ctx context.Context, _ interface{}, stream libp2pcore.Stream) error { + ctx, span := trace.StartSpan(ctx, "sync.lightClientFinalityUpdateRPCHandler") + defer span.End() + ctx, cancel := context.WithTimeout(ctx, ttfbTimeout) + defer cancel() + + // TODO: What should we log? + log := log.WithField("handler", p2p.LightClientFinalityUpdateName[1:]) // slice the leading slash off the name var + + SetRPCStreamDeadlines(stream) + if err := s.rateLimiter.validateRequest(stream, 1); err != nil { + return err + } + s.rateLimiter.add(stream, 1) + + if s.lcStore.LastLCFinalityUpdate == nil { + s.writeErrorResponseToStream(responseCodeResourceUnavailable, types.ErrResourceUnavailable.Error(), stream) + return nil + } + + SetStreamWriteDeadline(stream, defaultWriteDuration) + if err := WriteLightClientFinalityUpdateChunk(stream, s.cfg.clock, s.cfg.p2p.Encoding(), s.lcStore.LastLCFinalityUpdate); err != nil { + s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) + tracing.AnnotateError(span, err) + return err + } + + closeStream(stream, log) return nil } -func (s *Service) lightClientOptimisticUpdateRPCHandler(ctx context.Context, msg interface{}, stream libp2pcore.Stream) error { +// lightClientOptimisticUpdateRPCHandler handles the /eth2/beacon_chain/req/light_client_optimistic_update/1/ RPC request. +func (s *Service) lightClientOptimisticUpdateRPCHandler(ctx context.Context, _ interface{}, stream libp2pcore.Stream) error { + ctx, span := trace.StartSpan(ctx, "sync.lightClientOptimisticUpdateRPCHandler") + defer span.End() + ctx, cancel := context.WithTimeout(ctx, ttfbTimeout) + defer cancel() + + // TODO: What should we log? + log := log.WithField("handler", p2p.LightClientOptimisticUpdateName[1:]) // slice the leading slash off the name var + + SetRPCStreamDeadlines(stream) + if err := s.rateLimiter.validateRequest(stream, 1); err != nil { + return err + } + s.rateLimiter.add(stream, 1) + + if s.lcStore.LastLCOptimisticUpdate == nil { + s.writeErrorResponseToStream(responseCodeResourceUnavailable, types.ErrResourceUnavailable.Error(), stream) + return nil + } + + SetStreamWriteDeadline(stream, defaultWriteDuration) + if err := WriteLightClientOptimisticUpdateChunk(stream, s.cfg.clock, s.cfg.p2p.Encoding(), s.lcStore.LastLCOptimisticUpdate); err != nil { + s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) + tracing.AnnotateError(span, err) + return err + } + + closeStream(stream, log) return nil } diff --git a/beacon-chain/sync/rpc_send_request.go b/beacon-chain/sync/rpc_send_request.go index 30edbb09cf5..8572d94a02a 100644 --- a/beacon-chain/sync/rpc_send_request.go +++ b/beacon-chain/sync/rpc_send_request.go @@ -25,6 +25,8 @@ import ( "github.com/sirupsen/logrus" ) +// TODO + var errBlobChunkedReadFailure = errors.New("failed to read stream of chunk-encoded blobs") var errBlobUnmarshal = errors.New("Could not unmarshal chunk-encoded blob") diff --git a/beacon-chain/sync/service.go b/beacon-chain/sync/service.go index 26d610dcf54..a1d295ffaff 100644 --- a/beacon-chain/sync/service.go +++ b/beacon-chain/sync/service.go @@ -25,6 +25,7 @@ import ( "github.com/prysmaticlabs/prysm/v5/beacon-chain/db" "github.com/prysmaticlabs/prysm/v5/beacon-chain/db/filesystem" "github.com/prysmaticlabs/prysm/v5/beacon-chain/execution" + light_client "github.com/prysmaticlabs/prysm/v5/beacon-chain/light-client" "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/attestations" "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/blstoexec" "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/slashings" @@ -168,10 +169,7 @@ type Service struct { newBlobVerifier verification.NewBlobVerifier availableBlocker coverage.AvailableBlocker ctxMap ContextByteVersions - lcFinalityUpdateLock sync.Mutex - lastLCFinalityUpdate *lcFinalityUpdateInfo - lcOptimisticUpdateLock sync.Mutex - lastLCOptimisticUpdate *lcOptimisticUpdateInfo + lcStore *light_client.Store } // NewService initializes new regular sync service. diff --git a/beacon-chain/sync/subscriber_light_client.go b/beacon-chain/sync/subscriber_light_client.go index 288d941d6c8..7ea65284e89 100644 --- a/beacon-chain/sync/subscriber_light_client.go +++ b/beacon-chain/sync/subscriber_light_client.go @@ -2,16 +2,44 @@ package sync import ( "context" + "fmt" + "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/feed" + statefeed "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/feed/state" + "github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces" "google.golang.org/protobuf/proto" ) // TODO: event feed func (s *Service) lightClientFinalityUpdateSubscriber(_ context.Context, msg proto.Message) error { + update, ok := msg.(interfaces.LightClientFinalityUpdate) + if !ok { + return fmt.Errorf("message type %T is not a light client finality update", msg) + } + + s.lcStore.LastLCFinalityUpdate = update + + s.cfg.stateNotifier.StateFeed().Send(&feed.Event{ + Type: statefeed.LightClientFinalityUpdate, + Data: update, + }) + return nil } func (s *Service) lightClientOptimisticUpdateSubscriber(_ context.Context, msg proto.Message) error { + update, ok := msg.(interfaces.LightClientOptimisticUpdate) + if !ok { + return fmt.Errorf("message type %T is not a light client optimistic update", msg) + } + + s.lcStore.LastLCOptimisticUpdate = update + + s.cfg.stateNotifier.StateFeed().Send(&feed.Event{ + Type: statefeed.LightClientOptimisticUpdate, + Data: update, + }) + return nil } diff --git a/beacon-chain/sync/validate_light_client.go b/beacon-chain/sync/validate_light_client.go index b68513fb6a3..889ba28823c 100644 --- a/beacon-chain/sync/validate_light_client.go +++ b/beacon-chain/sync/validate_light_client.go @@ -40,22 +40,24 @@ func (s *Service) validateLightClientFinalityUpdate(ctx context.Context, pid pee return pubsub.ValidationReject, errWrongMessage } - s.lcFinalityUpdateLock.Lock() - defer s.lcFinalityUpdateLock.Unlock() - maxActiveParticipants := update.SyncAggregate().SyncCommitteeBits.Len() numActiveParticipants := update.SyncAggregate().SyncCommitteeBits.Count() hasSupermajority := numActiveParticipants*3 >= maxActiveParticipants*2 - last := s.lastLCFinalityUpdate + last := s.lcStore.LastLCFinalityUpdate if last != nil { // [IGNORE] The finalized_header.beacon.slot is greater than that of all previously forwarded finality_updates, // or it matches the highest previously forwarded slot and also has a sync_aggregate indicating supermajority (> 2/3) // sync committee participation while the previously forwarded finality_update for that slot did not indicate supermajority - if update.FinalizedHeader().Beacon().Slot < last.slot { + slot := last.FinalizedHeader().Beacon().Slot + lastMaxActiveParticipants := last.SyncAggregate().SyncCommitteeBits.Len() + lastNumActiveParticipants := last.SyncAggregate().SyncCommitteeBits.Count() + lastHasSupermajority := lastNumActiveParticipants*3 >= lastMaxActiveParticipants*2 + + if update.FinalizedHeader().Beacon().Slot < slot { return pubsub.ValidationIgnore, nil } - if update.FinalizedHeader().Beacon().Slot == last.slot && (last.hasSupermajority || !hasSupermajority) { + if update.FinalizedHeader().Beacon().Slot == slot && (lastHasSupermajority || !hasSupermajority) { return pubsub.ValidationIgnore, nil } } @@ -70,11 +72,6 @@ func (s *Service) validateLightClientFinalityUpdate(ctx context.Context, pid pee return pubsub.ValidationIgnore, nil } - s.lastLCFinalityUpdate = &lcFinalityUpdateInfo{ - slot: update.FinalizedHeader().Beacon().Slot, - hasSupermajority: hasSupermajority, - } - return pubsub.ValidationAccept, nil } @@ -105,13 +102,10 @@ func (s *Service) validateLightClientOptimisticUpdate(ctx context.Context, pid p return pubsub.ValidationReject, errWrongMessage } - s.lcOptimisticUpdateLock.Lock() - defer s.lcOptimisticUpdateLock.Unlock() - - last := s.lastLCOptimisticUpdate + last := s.lcStore.LastLCOptimisticUpdate if last != nil { // [IGNORE] The attested_header.beacon.slot is greater than that of all previously forwarded optimistic_updates - if update.AttestedHeader().Beacon().Slot <= last.slot { + if update.AttestedHeader().Beacon().Slot <= last.AttestedHeader().Beacon().Slot { return pubsub.ValidationIgnore, nil } } @@ -126,9 +120,5 @@ func (s *Service) validateLightClientOptimisticUpdate(ctx context.Context, pid p return pubsub.ValidationIgnore, nil } - s.lastLCOptimisticUpdate = &lcOptimisticUpdateInfo{ - slot: update.AttestedHeader().Beacon().Slot, - } - return pubsub.ValidationAccept, nil } From 37f2b4404dc58ffe173b083c70ab5c7bdfee2a1a Mon Sep 17 00:00:00 2001 From: rkapka Date: Sun, 3 Nov 2024 21:04:24 +0700 Subject: [PATCH 13/26] unused ctx --- beacon-chain/sync/rpc_light_client.go | 4 ++-- beacon-chain/sync/validate_light_client.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/beacon-chain/sync/rpc_light_client.go b/beacon-chain/sync/rpc_light_client.go index cbeee59be2e..cfba8a29342 100644 --- a/beacon-chain/sync/rpc_light_client.go +++ b/beacon-chain/sync/rpc_light_client.go @@ -112,7 +112,7 @@ func (s *Service) lightClientUpdatesByRangeRPCHandler(ctx context.Context, msg i func (s *Service) lightClientFinalityUpdateRPCHandler(ctx context.Context, _ interface{}, stream libp2pcore.Stream) error { ctx, span := trace.StartSpan(ctx, "sync.lightClientFinalityUpdateRPCHandler") defer span.End() - ctx, cancel := context.WithTimeout(ctx, ttfbTimeout) + _, cancel := context.WithTimeout(ctx, ttfbTimeout) defer cancel() // TODO: What should we log? @@ -144,7 +144,7 @@ func (s *Service) lightClientFinalityUpdateRPCHandler(ctx context.Context, _ int func (s *Service) lightClientOptimisticUpdateRPCHandler(ctx context.Context, _ interface{}, stream libp2pcore.Stream) error { ctx, span := trace.StartSpan(ctx, "sync.lightClientOptimisticUpdateRPCHandler") defer span.End() - ctx, cancel := context.WithTimeout(ctx, ttfbTimeout) + _, cancel := context.WithTimeout(ctx, ttfbTimeout) defer cancel() // TODO: What should we log? diff --git a/beacon-chain/sync/validate_light_client.go b/beacon-chain/sync/validate_light_client.go index 889ba28823c..d09db291c1e 100644 --- a/beacon-chain/sync/validate_light_client.go +++ b/beacon-chain/sync/validate_light_client.go @@ -26,7 +26,7 @@ func (s *Service) validateLightClientFinalityUpdate(ctx context.Context, pid pee return pubsub.ValidationIgnore, nil } - ctx, span := trace.StartSpan(ctx, "sync.validateLightClientFinalityUpdate") + _, span := trace.StartSpan(ctx, "sync.validateLightClientFinalityUpdate") defer span.End() m, err := s.decodePubsubMessage(msg) @@ -88,7 +88,7 @@ func (s *Service) validateLightClientOptimisticUpdate(ctx context.Context, pid p return pubsub.ValidationIgnore, nil } - ctx, span := trace.StartSpan(ctx, "sync.validateLightClientOptimisticUpdate") + _, span := trace.StartSpan(ctx, "sync.validateLightClientOptimisticUpdate") defer span.End() m, err := s.decodePubsubMessage(msg) From 0031d6413266d8c94eb15ae4648c05f04f027106 Mon Sep 17 00:00:00 2001 From: rkapka Date: Sun, 3 Nov 2024 21:24:47 +0700 Subject: [PATCH 14/26] remove unused structs --- beacon-chain/sync/service.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/beacon-chain/sync/service.go b/beacon-chain/sync/service.go index a1d295ffaff..f69f8c8b3a6 100644 --- a/beacon-chain/sync/service.go +++ b/beacon-chain/sync/service.go @@ -40,7 +40,6 @@ import ( "github.com/prysmaticlabs/prysm/v5/config/params" "github.com/prysmaticlabs/prysm/v5/consensus-types/blocks" "github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces" - "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" leakybucket "github.com/prysmaticlabs/prysm/v5/container/leaky-bucket" ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/v5/runtime" @@ -77,15 +76,6 @@ var ( // Common type for functional p2p validation options. type validationFn func(ctx context.Context) (pubsub.ValidationResult, error) -type lcFinalityUpdateInfo struct { - slot primitives.Slot - hasSupermajority bool -} - -type lcOptimisticUpdateInfo struct { - slot primitives.Slot -} - // config to hold dependencies for the sync service. type config struct { attestationNotifier operation.Notifier From ca29e37484b3b255214cc82fab322f396a9a811e Mon Sep 17 00:00:00 2001 From: rkapka Date: Sun, 3 Nov 2024 23:54:05 +0700 Subject: [PATCH 15/26] Beacon API handlers --- beacon-chain/node/node.go | 1 + beacon-chain/rpc/BUILD.bazel | 1 + beacon-chain/rpc/endpoints.go | 1 + beacon-chain/rpc/eth/light-client/BUILD.bazel | 1 + beacon-chain/rpc/eth/light-client/handlers.go | 158 ++++++++---------- beacon-chain/rpc/eth/light-client/server.go | 2 + beacon-chain/rpc/service.go | 2 + 7 files changed, 78 insertions(+), 88 deletions(-) diff --git a/beacon-chain/node/node.go b/beacon-chain/node/node.go index 3b08cc3105b..673cbdd7ada 100644 --- a/beacon-chain/node/node.go +++ b/beacon-chain/node/node.go @@ -1008,6 +1008,7 @@ func (b *BeaconNode) registerRPCService(router *http.ServeMux) error { BlobStorage: b.BlobStorage, TrackedValidatorsCache: b.trackedValidatorsCache, PayloadIDCache: b.payloadIDCache, + LCStore: b.lcStore, }) return b.services.RegisterService(rpcService) diff --git a/beacon-chain/rpc/BUILD.bazel b/beacon-chain/rpc/BUILD.bazel index dbb213a6559..19cc6384ed6 100644 --- a/beacon-chain/rpc/BUILD.bazel +++ b/beacon-chain/rpc/BUILD.bazel @@ -22,6 +22,7 @@ go_library( "//beacon-chain/db:go_default_library", "//beacon-chain/db/filesystem:go_default_library", "//beacon-chain/execution:go_default_library", + "//beacon-chain/light-client:go_default_library", "//beacon-chain/operations/attestations:go_default_library", "//beacon-chain/operations/blstoexec:go_default_library", "//beacon-chain/operations/slashings:go_default_library", diff --git a/beacon-chain/rpc/endpoints.go b/beacon-chain/rpc/endpoints.go index 9dae9c032a3..c87068e0d49 100644 --- a/beacon-chain/rpc/endpoints.go +++ b/beacon-chain/rpc/endpoints.go @@ -872,6 +872,7 @@ func (s *Service) lightClientEndpoints(blocker lookup.Blocker, stater lookup.Sta HeadFetcher: s.cfg.HeadFetcher, ChainInfoFetcher: s.cfg.ChainInfoFetcher, BeaconDB: s.cfg.BeaconDB, + LCStore: s.cfg.LCStore, } const namespace = "lightclient" diff --git a/beacon-chain/rpc/eth/light-client/BUILD.bazel b/beacon-chain/rpc/eth/light-client/BUILD.bazel index 05112149cde..7b96ef1c2c0 100644 --- a/beacon-chain/rpc/eth/light-client/BUILD.bazel +++ b/beacon-chain/rpc/eth/light-client/BUILD.bazel @@ -15,6 +15,7 @@ go_library( "//beacon-chain/blockchain:go_default_library", "//beacon-chain/core/light-client:go_default_library", "//beacon-chain/db:go_default_library", + "//beacon-chain/light-client:go_default_library", "//beacon-chain/rpc/eth/shared:go_default_library", "//beacon-chain/rpc/lookup:go_default_library", "//beacon-chain/state:go_default_library", diff --git a/beacon-chain/rpc/eth/light-client/handlers.go b/beacon-chain/rpc/eth/light-client/handlers.go index 279a51acc64..4f30d269fe8 100644 --- a/beacon-chain/rpc/eth/light-client/handlers.go +++ b/beacon-chain/rpc/eth/light-client/handlers.go @@ -3,13 +3,13 @@ package lightclient import ( "context" "fmt" - "math" "net/http" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/pkg/errors" "github.com/prysmaticlabs/prysm/v5/api" "github.com/prysmaticlabs/prysm/v5/api/server/structs" + lightclient "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/light-client" "github.com/prysmaticlabs/prysm/v5/beacon-chain/rpc/eth/shared" "github.com/prysmaticlabs/prysm/v5/config/params" "github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces" @@ -45,18 +45,33 @@ func (s *Server) GetLightClientBootstrap(w http.ResponseWriter, req *http.Reques return } - bootstrap, err := newLightClientBootstrapFromBeaconState(ctx, s.ChainInfoFetcher.CurrentSlot(), state, blk) + bootstrap, err := lightclient.NewLightClientBootstrapFromBeaconState(ctx, s.ChainInfoFetcher.CurrentSlot(), state, blk) if err != nil { httputil.HandleError(w, "could not get light client bootstrap: "+err.Error(), http.StatusInternalServerError) return } - response := &structs.LightClientBootstrapResponse{ - Version: version.String(blk.Version()), - Data: bootstrap, - } - w.Header().Set(api.VersionHeader, version.String(version.Deneb)) - httputil.WriteJson(w, response) + w.Header().Set(api.VersionHeader, version.String(bootstrap.Version())) + + if httputil.RespondWithSsz(req) { + ssz, err := bootstrap.MarshalSSZ() + if err != nil { + httputil.HandleError(w, "could not marshal bootstrap to SSZ: "+err.Error(), http.StatusInternalServerError) + return + } + httputil.WriteSsz(w, ssz, "light_client_bootstrap.ssz") + } else { + data, err := structs.LightClientBootsrapFromConsensus(bootstrap) + if err != nil { + httputil.HandleError(w, "could not marshal bootstrap to JSON: "+err.Error(), http.StatusInternalServerError) + return + } + response := &structs.LightClientBootstrapResponse{ + Version: version.String(bootstrap.Version()), + Data: data, + } + httputil.WriteJson(w, response) + } } // GetLightClientUpdatesByRange - implements https://github.com/ethereum/beacon-APIs/blob/263f4ed6c263c967f13279c7a9f5629b51c5fc55/apis/beacon/light_client/updates.yaml @@ -150,105 +165,72 @@ func (s *Server) GetLightClientUpdatesByRange(w http.ResponseWriter, req *http.R // GetLightClientFinalityUpdate - implements https://github.com/ethereum/beacon-APIs/blob/263f4ed6c263c967f13279c7a9f5629b51c5fc55/apis/beacon/light_client/finality_update.yaml func (s *Server) GetLightClientFinalityUpdate(w http.ResponseWriter, req *http.Request) { - ctx, span := trace.StartSpan(req.Context(), "beacon.GetLightClientFinalityUpdate") + _, span := trace.StartSpan(req.Context(), "beacon.GetLightClientFinalityUpdate") defer span.End() - // Finality update needs super majority of sync committee signatures - minSyncCommitteeParticipants := float64(params.BeaconConfig().MinSyncCommitteeParticipants) - minSignatures := uint64(math.Ceil(minSyncCommitteeParticipants * 2 / 3)) + update := s.LCStore.LastLCFinalityUpdate - block, err := s.suitableBlock(ctx, minSignatures) - if !shared.WriteBlockFetchError(w, block, err) { + if update == nil { + httputil.HandleError(w, "No light client finality update available", http.StatusNotFound) return } - st, err := s.Stater.StateBySlot(ctx, block.Block().Slot()) - if err != nil { - httputil.HandleError(w, "Could not get state: "+err.Error(), http.StatusInternalServerError) - return - } + w.Header().Set(api.VersionHeader, version.String(update.Version())) - attestedRoot := block.Block().ParentRoot() - attestedBlock, err := s.Blocker.Block(ctx, attestedRoot[:]) - if !shared.WriteBlockFetchError(w, block, errors.Wrap(err, "could not get attested block")) { - return - } - attestedSlot := attestedBlock.Block().Slot() - attestedState, err := s.Stater.StateBySlot(ctx, attestedSlot) - if err != nil { - httputil.HandleError(w, "Could not get attested state: "+err.Error(), http.StatusInternalServerError) - return - } - - var finalizedBlock interfaces.ReadOnlySignedBeaconBlock - finalizedCheckpoint := attestedState.FinalizedCheckpoint() - if finalizedCheckpoint == nil { - httputil.HandleError(w, "Attested state does not have a finalized checkpoint", http.StatusInternalServerError) - return - } - finalizedRoot := bytesutil.ToBytes32(finalizedCheckpoint.Root) - finalizedBlock, err = s.Blocker.Block(ctx, finalizedRoot[:]) - if !shared.WriteBlockFetchError(w, block, errors.Wrap(err, "could not get finalized block")) { - return - } - - update, err := newLightClientFinalityUpdateFromBeaconState(ctx, s.ChainInfoFetcher.CurrentSlot(), st, block, attestedState, attestedBlock, finalizedBlock) - if err != nil { - httputil.HandleError(w, "Could not get light client finality update: "+err.Error(), http.StatusInternalServerError) - return - } - - response := &structs.LightClientFinalityUpdateResponse{ - Version: version.String(attestedState.Version()), - Data: update, + if httputil.RespondWithSsz(req) { + ssz, err := update.MarshalSSZ() + if err != nil { + httputil.HandleError(w, "could not marshal update to SSZ: "+err.Error(), http.StatusInternalServerError) + return + } + httputil.WriteSsz(w, ssz, "light_client_finality_update.ssz") + } else { + data, err := structs.LightClientFinalityUpdateFromConsensus(update) + if err != nil { + httputil.HandleError(w, "could not marshal update to JSON: "+err.Error(), http.StatusInternalServerError) + return + } + response := &structs.LightClientFinalityUpdateResponse{ + Version: version.String(update.Version()), + Data: data, + } + httputil.WriteJson(w, response) } - - httputil.WriteJson(w, response) } // GetLightClientOptimisticUpdate - implements https://github.com/ethereum/beacon-APIs/blob/263f4ed6c263c967f13279c7a9f5629b51c5fc55/apis/beacon/light_client/optimistic_update.yaml func (s *Server) GetLightClientOptimisticUpdate(w http.ResponseWriter, req *http.Request) { - ctx, span := trace.StartSpan(req.Context(), "beacon.GetLightClientOptimisticUpdate") + _, span := trace.StartSpan(req.Context(), "beacon.GetLightClientOptimisticUpdate") defer span.End() - block, err := s.suitableBlock(ctx, params.BeaconConfig().MinSyncCommitteeParticipants) - if !shared.WriteBlockFetchError(w, block, err) { - return - } - st, err := s.Stater.StateBySlot(ctx, block.Block().Slot()) - if err != nil { - httputil.HandleError(w, "could not get state: "+err.Error(), http.StatusInternalServerError) - return - } - attestedRoot := block.Block().ParentRoot() - attestedBlock, err := s.Blocker.Block(ctx, attestedRoot[:]) - if err != nil { - httputil.HandleError(w, "Could not get attested block: "+err.Error(), http.StatusInternalServerError) - return - } - if attestedBlock == nil { - httputil.HandleError(w, "Attested block is nil", http.StatusInternalServerError) - return - } - attestedSlot := attestedBlock.Block().Slot() - attestedState, err := s.Stater.StateBySlot(ctx, attestedSlot) - if err != nil { - httputil.HandleError(w, "Could not get attested state: "+err.Error(), http.StatusInternalServerError) - return - } + update := s.LCStore.LastLCOptimisticUpdate - update, err := newLightClientOptimisticUpdateFromBeaconState(ctx, s.ChainInfoFetcher.CurrentSlot(), st, block, attestedState, attestedBlock) - if err != nil { - httputil.HandleError(w, "Could not get light client optimistic update: "+err.Error(), http.StatusInternalServerError) + if update == nil { + httputil.HandleError(w, "No light client optimistic update available", http.StatusNotFound) return } - response := &structs.LightClientOptimisticUpdateResponse{ - Version: version.String(attestedState.Version()), - Data: update, - } + w.Header().Set(api.VersionHeader, version.String(update.Version())) - httputil.WriteJson(w, response) + if httputil.RespondWithSsz(req) { + ssz, err := update.MarshalSSZ() + if err != nil { + httputil.HandleError(w, "could not marshal update to SSZ: "+err.Error(), http.StatusInternalServerError) + return + } + httputil.WriteSsz(w, ssz, "light_client_optimistic_update.ssz") + } else { + data, err := structs.LightClientOptimisticUpdateFromConsensus(update) + if err != nil { + httputil.HandleError(w, "could not marshal update to JSON: "+err.Error(), http.StatusInternalServerError) + return + } + response := &structs.LightClientOptimisticUpdateResponse{ + Version: version.String(update.Version()), + Data: data, + } + httputil.WriteJson(w, response) + } } // suitableBlock returns the latest block that satisfies all criteria required for creating a new update diff --git a/beacon-chain/rpc/eth/light-client/server.go b/beacon-chain/rpc/eth/light-client/server.go index 84b061379fc..2157f2d0ce4 100644 --- a/beacon-chain/rpc/eth/light-client/server.go +++ b/beacon-chain/rpc/eth/light-client/server.go @@ -3,6 +3,7 @@ package lightclient import ( "github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain" "github.com/prysmaticlabs/prysm/v5/beacon-chain/db" + light_client "github.com/prysmaticlabs/prysm/v5/beacon-chain/light-client" "github.com/prysmaticlabs/prysm/v5/beacon-chain/rpc/lookup" ) @@ -12,4 +13,5 @@ type Server struct { HeadFetcher blockchain.HeadFetcher ChainInfoFetcher blockchain.ChainInfoFetcher BeaconDB db.HeadAccessDatabase + LCStore *light_client.Store } diff --git a/beacon-chain/rpc/service.go b/beacon-chain/rpc/service.go index 4a56c0d4162..f9c86fac9bb 100644 --- a/beacon-chain/rpc/service.go +++ b/beacon-chain/rpc/service.go @@ -26,6 +26,7 @@ import ( "github.com/prysmaticlabs/prysm/v5/beacon-chain/db" "github.com/prysmaticlabs/prysm/v5/beacon-chain/db/filesystem" "github.com/prysmaticlabs/prysm/v5/beacon-chain/execution" + light_client "github.com/prysmaticlabs/prysm/v5/beacon-chain/light-client" "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/attestations" "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/blstoexec" "github.com/prysmaticlabs/prysm/v5/beacon-chain/operations/slashings" @@ -140,6 +141,7 @@ type Config struct { BlobStorage *filesystem.BlobStorage TrackedValidatorsCache *cache.TrackedValidatorsCache PayloadIDCache *cache.PayloadIDCache + LCStore *light_client.Store } // NewService instantiates a new RPC service instance that will From 9fdc36bf301db20803c50028c70bc271f944301a Mon Sep 17 00:00:00 2001 From: rkapka Date: Mon, 4 Nov 2024 14:32:07 +0700 Subject: [PATCH 16/26] final changes --- CHANGELOG.md | 2 + beacon-chain/p2p/gossip_topic_mappings.go | 3 ++ beacon-chain/p2p/types/types.go | 10 ++-- beacon-chain/rpc/eth/light-client/BUILD.bazel | 2 - beacon-chain/rpc/eth/light-client/helpers.go | 52 ------------------- .../validator/proposer_attestations.go | 1 - beacon-chain/sync/rpc.go | 3 +- beacon-chain/sync/rpc_light_client.go | 4 +- beacon-chain/sync/subscriber_light_client.go | 2 - 9 files changed, 13 insertions(+), 66 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71a23c0e4dd..4d23a7a1fda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve - Added SubmitPoolAttesterSlashingV2 endpoint. - Added SubmitAggregateAndProofsRequestV2 endpoint. - Updated the `beacon-chain/monitor` package to Electra. [PR](https://github.com/prysmaticlabs/prysm/pull/14562) +- Added ListAttestationsV2 endpoint. +- Add ability to rollback node's internal state during processing. ### Changed diff --git a/beacon-chain/p2p/gossip_topic_mappings.go b/beacon-chain/p2p/gossip_topic_mappings.go index f370b4a6526..6eb9922fe90 100644 --- a/beacon-chain/p2p/gossip_topic_mappings.go +++ b/beacon-chain/p2p/gossip_topic_mappings.go @@ -63,6 +63,9 @@ func GossipTopicMappings(topic string, epoch primitives.Epoch) proto.Message { } return gossipMessage(topic) case LightClientFinalityUpdateTopicFormat: + if epoch >= params.BeaconConfig().ElectraForkEpoch { + return ðpb.LightClientFinalityUpdateElectra{} + } if epoch >= params.BeaconConfig().DenebForkEpoch { return ðpb.LightClientFinalityUpdateDeneb{} } diff --git a/beacon-chain/p2p/types/types.go b/beacon-chain/p2p/types/types.go index 4bf10ad5c81..e73dcc28698 100644 --- a/beacon-chain/p2p/types/types.go +++ b/beacon-chain/p2p/types/types.go @@ -16,8 +16,8 @@ import ( ) const ( - maxErrorLength = 256 - lightClientUpdatesByRangeReqLength = 16 + maxErrorLength = 256 + maxLightClientUpdates = 16 ) // SSZBytes is a bytes slice that satisfies the fast-ssz interface. @@ -273,15 +273,15 @@ func (r *LightClientUpdatesByRangeReq) MarshalSSZ() ([]byte, error) { // SizeSSZ returns the size of the serialized representation. func (r *LightClientUpdatesByRangeReq) SizeSSZ() int { - return lightClientUpdatesByRangeReqLength + return maxLightClientUpdates } // UnmarshalSSZ unmarshals the provided bytes buffer into the // block by roots request object. func (r *LightClientUpdatesByRangeReq) UnmarshalSSZ(buf []byte) error { bufLen := len(buf) - if bufLen != lightClientUpdatesByRangeReqLength { - return errors.Errorf("expected buffer with length of %d but received length %d", lightClientUpdatesByRangeReqLength, bufLen) + if bufLen != maxLightClientUpdates { + return errors.Errorf("expected buffer with length of %d but received length %d", maxLightClientUpdates, bufLen) } r.StartPeriod = binary.LittleEndian.Uint64(buf[0:8]) r.Count = binary.LittleEndian.Uint64(buf[8:16]) diff --git a/beacon-chain/rpc/eth/light-client/BUILD.bazel b/beacon-chain/rpc/eth/light-client/BUILD.bazel index 7b96ef1c2c0..165ab9eb5b4 100644 --- a/beacon-chain/rpc/eth/light-client/BUILD.bazel +++ b/beacon-chain/rpc/eth/light-client/BUILD.bazel @@ -18,10 +18,8 @@ go_library( "//beacon-chain/light-client:go_default_library", "//beacon-chain/rpc/eth/shared:go_default_library", "//beacon-chain/rpc/lookup:go_default_library", - "//beacon-chain/state:go_default_library", "//config/params:go_default_library", "//consensus-types/interfaces:go_default_library", - "//consensus-types/primitives:go_default_library", "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", "//runtime/version:go_default_library", diff --git a/beacon-chain/rpc/eth/light-client/helpers.go b/beacon-chain/rpc/eth/light-client/helpers.go index 4a811248526..6799f8c9864 100644 --- a/beacon-chain/rpc/eth/light-client/helpers.go +++ b/beacon-chain/rpc/eth/light-client/helpers.go @@ -1,65 +1,13 @@ package lightclient import ( - "context" "reflect" - "github.com/prysmaticlabs/prysm/v5/api/server/structs" - lightclient "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/light-client" - "github.com/prysmaticlabs/prysm/v5/beacon-chain/state" "github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces" - "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" "github.com/prysmaticlabs/prysm/v5/runtime/version" "github.com/prysmaticlabs/prysm/v5/time/slots" ) -func newLightClientBootstrapFromBeaconState( - ctx context.Context, - currentSlot primitives.Slot, - state state.BeaconState, - block interfaces.ReadOnlySignedBeaconBlock, -) (*structs.LightClientBootstrap, error) { - bootstrap, err := lightclient.NewLightClientBootstrapFromBeaconState(ctx, currentSlot, state, block) - if err != nil { - return nil, err - } - - return structs.LightClientBootsrapFromConsensus(bootstrap) -} - -func newLightClientFinalityUpdateFromBeaconState( - ctx context.Context, - currentSlot primitives.Slot, - state state.BeaconState, - block interfaces.ReadOnlySignedBeaconBlock, - attestedState state.BeaconState, - attestedBlock interfaces.ReadOnlySignedBeaconBlock, - finalizedBlock interfaces.ReadOnlySignedBeaconBlock, -) (*structs.LightClientFinalityUpdate, error) { - result, err := lightclient.NewLightClientFinalityUpdateFromBeaconState(ctx, currentSlot, state, block, attestedState, attestedBlock, finalizedBlock) - if err != nil { - return nil, err - } - - return structs.LightClientFinalityUpdateFromConsensus(result) -} - -func newLightClientOptimisticUpdateFromBeaconState( - ctx context.Context, - currentSlot primitives.Slot, - state state.BeaconState, - block interfaces.ReadOnlySignedBeaconBlock, - attestedState state.BeaconState, - attestedBlock interfaces.ReadOnlySignedBeaconBlock, -) (*structs.LightClientOptimisticUpdate, error) { - result, err := lightclient.NewLightClientOptimisticUpdateFromBeaconState(ctx, currentSlot, state, block, attestedState, attestedBlock) - if err != nil { - return nil, err - } - - return structs.LightClientOptimisticUpdateFromConsensus(result) -} - func HasRelevantSyncCommittee(update interfaces.LightClientUpdate) (bool, error) { if update.Version() >= version.Electra { branch, err := update.NextSyncCommitteeBranchElectra() diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_attestations.go b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_attestations.go index 8c56049ca03..4446f853f2e 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_attestations.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_attestations.go @@ -128,7 +128,6 @@ func (a proposerAtts) filter(ctx context.Context, st state.BeaconState) (propose validAtts := make([]ethpb.Att, 0, len(a)) invalidAtts := make([]ethpb.Att, 0, len(a)) - primitives.Slot(0).Add(uint64(params.BeaconConfig().SlotsPerEpoch) * uint64(params.BeaconConfig().EpochsPerSyncCommitteePeriod)) for _, att := range a { if err := blocks.VerifyAttestationNoVerifySignature(ctx, st, att); err == nil { validAtts = append(validAtts, att) diff --git a/beacon-chain/sync/rpc.go b/beacon-chain/sync/rpc.go index 4ae35c73590..e08eb555c94 100644 --- a/beacon-chain/sync/rpc.go +++ b/beacon-chain/sync/rpc.go @@ -195,8 +195,7 @@ func (s *Service) registerRPC(baseTopic string, handle rpcHandler) { return } - base, ok := p2p. - RPCTopicMappings[baseTopic] + base, ok := p2p.RPCTopicMappings[baseTopic] if !ok { log.Errorf("Could not retrieve base message for topic %s", baseTopic) return diff --git a/beacon-chain/sync/rpc_light_client.go b/beacon-chain/sync/rpc_light_client.go index cfba8a29342..91ae1162608 100644 --- a/beacon-chain/sync/rpc_light_client.go +++ b/beacon-chain/sync/rpc_light_client.go @@ -54,7 +54,7 @@ func (s *Service) lightClientBootstrapRPCHandler(ctx context.Context, msg interf return nil } -// lightClientBootstrapRPCHandler handles the /eth2/beacon_chain/req/light_client_updates_by_range/1/ RPC request. +// lightClientUpdatesByRangeRPCHandler handles the /eth2/beacon_chain/req/light_client_updates_by_range/1/ RPC request. func (s *Service) lightClientUpdatesByRangeRPCHandler(ctx context.Context, msg interface{}, stream libp2pcore.Stream) error { ctx, span := trace.StartSpan(ctx, "sync.lightClientUpdatesByRangeRPCHandler") defer span.End() @@ -108,7 +108,7 @@ func (s *Service) lightClientUpdatesByRangeRPCHandler(ctx context.Context, msg i return nil } -// lightClientBootstrapRPCHandler handles the /eth2/beacon_chain/req/light_client_finality_update/1/ RPC request. +// lightClientFinalityUpdateRPCHandler handles the /eth2/beacon_chain/req/light_client_finality_update/1/ RPC request. func (s *Service) lightClientFinalityUpdateRPCHandler(ctx context.Context, _ interface{}, stream libp2pcore.Stream) error { ctx, span := trace.StartSpan(ctx, "sync.lightClientFinalityUpdateRPCHandler") defer span.End() diff --git a/beacon-chain/sync/subscriber_light_client.go b/beacon-chain/sync/subscriber_light_client.go index 7ea65284e89..154436312e8 100644 --- a/beacon-chain/sync/subscriber_light_client.go +++ b/beacon-chain/sync/subscriber_light_client.go @@ -10,8 +10,6 @@ import ( "google.golang.org/protobuf/proto" ) -// TODO: event feed - func (s *Service) lightClientFinalityUpdateSubscriber(_ context.Context, msg proto.Message) error { update, ok := msg.(interfaces.LightClientFinalityUpdate) if !ok { From 4e31417c37267b95aeb7e746b662190334aab5b7 Mon Sep 17 00:00:00 2001 From: rkapka Date: Mon, 4 Nov 2024 17:32:45 +0700 Subject: [PATCH 17/26] fix some tests --- api/server/structs/conversions_lightclient.go | 22 + beacon-chain/rpc/eth/light-client/handlers.go | 2 - .../rpc/eth/light-client/handlers_test.go | 603 ++++++------------ 3 files changed, 214 insertions(+), 413 deletions(-) diff --git a/api/server/structs/conversions_lightclient.go b/api/server/structs/conversions_lightclient.go index 9c80b92a3ff..e85ce851577 100644 --- a/api/server/structs/conversions_lightclient.go +++ b/api/server/structs/conversions_lightclient.go @@ -205,6 +205,28 @@ func lightClientHeaderToJSON(header interfaces.LightClientHeader) (json.RawMessa Execution: execution, ExecutionBranch: branchToJSON(executionBranch[:]), } + case version.Electra: + exInterface, err := header.Execution() + if err != nil { + return nil, err + } + ex, ok := exInterface.Proto().(*enginev1.ExecutionPayloadHeaderDeneb) + if !ok { + return nil, fmt.Errorf("execution data is not %T", &enginev1.ExecutionPayloadHeaderDeneb{}) + } + execution, err := ExecutionPayloadHeaderDenebFromConsensus(ex) + if err != nil { + return nil, err + } + executionBranch, err := header.ExecutionBranch() + if err != nil { + return nil, err + } + result = &LightClientHeaderDeneb{ + Beacon: BeaconBlockHeaderFromConsensus(header.Beacon()), + Execution: execution, + ExecutionBranch: branchToJSON(executionBranch[:]), + } default: return nil, fmt.Errorf("unsupported header version %s", version.String(v)) } diff --git a/beacon-chain/rpc/eth/light-client/handlers.go b/beacon-chain/rpc/eth/light-client/handlers.go index 4f30d269fe8..b61fa9cde41 100644 --- a/beacon-chain/rpc/eth/light-client/handlers.go +++ b/beacon-chain/rpc/eth/light-client/handlers.go @@ -169,7 +169,6 @@ func (s *Server) GetLightClientFinalityUpdate(w http.ResponseWriter, req *http.R defer span.End() update := s.LCStore.LastLCFinalityUpdate - if update == nil { httputil.HandleError(w, "No light client finality update available", http.StatusNotFound) return @@ -204,7 +203,6 @@ func (s *Server) GetLightClientOptimisticUpdate(w http.ResponseWriter, req *http defer span.End() update := s.LCStore.LastLCOptimisticUpdate - if update == nil { httputil.HandleError(w, "No light client optimistic update available", http.StatusNotFound) return diff --git a/beacon-chain/rpc/eth/light-client/handlers_test.go b/beacon-chain/rpc/eth/light-client/handlers_test.go index 0e91f38e403..984cd7add01 100644 --- a/beacon-chain/rpc/eth/light-client/handlers_test.go +++ b/beacon-chain/rpc/eth/light-client/handlers_test.go @@ -32,214 +32,221 @@ import ( "github.com/prysmaticlabs/prysm/v5/testing/util" ) -func TestLightClientHandler_GetLightClientBootstrap_Altair(t *testing.T) { - l := util.NewTestLightClient(t).SetupTestAltair() - - slot := l.State.Slot() - stateRoot, err := l.State.HashTreeRoot(l.Ctx) - require.NoError(t, err) - - mockBlocker := &testutil.MockBlocker{BlockToReturn: l.Block} - mockChainService := &mock.ChainService{Optimistic: true, Slot: &slot} - mockChainInfoFetcher := &mock.ChainService{Slot: &slot} - s := &Server{ - Stater: &testutil.MockStater{StatesBySlot: map[primitives.Slot]state.BeaconState{ - slot: l.State, - }}, - Blocker: mockBlocker, - HeadFetcher: mockChainService, - ChainInfoFetcher: mockChainInfoFetcher, - } - request := httptest.NewRequest("GET", "http://foo.com/", nil) - request.SetPathValue("block_root", hexutil.Encode(stateRoot[:])) - writer := httptest.NewRecorder() - writer.Body = &bytes.Buffer{} - - s.GetLightClientBootstrap(writer, request) - require.Equal(t, http.StatusOK, writer.Code) - var resp structs.LightClientBootstrapResponse - err = json.Unmarshal(writer.Body.Bytes(), &resp) - require.NoError(t, err) - var respHeader structs.LightClientHeader - err = json.Unmarshal(resp.Data.Header, &respHeader) - require.NoError(t, err) - require.Equal(t, "altair", resp.Version) - - blockHeader, err := l.Block.Header() - require.NoError(t, err) - require.Equal(t, hexutil.Encode(blockHeader.Header.BodyRoot), respHeader.Beacon.BodyRoot) - require.Equal(t, strconv.FormatUint(uint64(blockHeader.Header.Slot), 10), respHeader.Beacon.Slot) - - require.NotNil(t, resp.Data.CurrentSyncCommittee) - require.NotNil(t, resp.Data.CurrentSyncCommitteeBranch) -} +func TestLightClientHandler_GetLightClientBootstrap(t *testing.T) { + params.SetupTestConfigCleanup(t) + cfg := params.BeaconConfig() + cfg.AltairForkEpoch = 0 + cfg.BellatrixForkEpoch = 1 + cfg.CapellaForkEpoch = 2 + cfg.DenebForkEpoch = 3 + cfg.ElectraForkEpoch = 4 + params.OverrideBeaconConfig(cfg) + + t.Run("altair", func(t *testing.T) { + l := util.NewTestLightClient(t).SetupTestAltair() + + slot := primitives.Slot(params.BeaconConfig().AltairForkEpoch * primitives.Epoch(params.BeaconConfig().SlotsPerEpoch)).Add(1) + stateRoot, err := l.State.HashTreeRoot(l.Ctx) + require.NoError(t, err) -func TestLightClientHandler_GetLightClientBootstrap_Bellatrix(t *testing.T) { - l := util.NewTestLightClient(t).SetupTestBellatrix() + mockBlocker := &testutil.MockBlocker{BlockToReturn: l.Block} + mockChainService := &mock.ChainService{Optimistic: true, Slot: &slot} + mockChainInfoFetcher := &mock.ChainService{Slot: &slot} + s := &Server{ + Stater: &testutil.MockStater{StatesBySlot: map[primitives.Slot]state.BeaconState{ + slot: l.State, + }}, + Blocker: mockBlocker, + HeadFetcher: mockChainService, + ChainInfoFetcher: mockChainInfoFetcher, + } + request := httptest.NewRequest("GET", "http://foo.com/", nil) + request.SetPathValue("block_root", hexutil.Encode(stateRoot[:])) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} - slot := l.State.Slot() - stateRoot, err := l.State.HashTreeRoot(l.Ctx) - require.NoError(t, err) + s.GetLightClientBootstrap(writer, request) + require.Equal(t, http.StatusOK, writer.Code) + var resp structs.LightClientBootstrapResponse + err = json.Unmarshal(writer.Body.Bytes(), &resp) + require.NoError(t, err) + var respHeader structs.LightClientHeader + err = json.Unmarshal(resp.Data.Header, &respHeader) + require.NoError(t, err) + require.Equal(t, "altair", resp.Version) - mockBlocker := &testutil.MockBlocker{BlockToReturn: l.Block} - mockChainService := &mock.ChainService{Optimistic: true, Slot: &slot} - mockChainInfoFetcher := &mock.ChainService{Slot: &slot} - s := &Server{ - Stater: &testutil.MockStater{StatesBySlot: map[primitives.Slot]state.BeaconState{ - slot: l.State, - }}, - Blocker: mockBlocker, - HeadFetcher: mockChainService, - ChainInfoFetcher: mockChainInfoFetcher, - } - request := httptest.NewRequest("GET", "http://foo.com/", nil) - request.SetPathValue("block_root", hexutil.Encode(stateRoot[:])) - writer := httptest.NewRecorder() - writer.Body = &bytes.Buffer{} + blockHeader, err := l.Block.Header() + require.NoError(t, err) + require.Equal(t, hexutil.Encode(blockHeader.Header.BodyRoot), respHeader.Beacon.BodyRoot) + require.Equal(t, strconv.FormatUint(uint64(blockHeader.Header.Slot), 10), respHeader.Beacon.Slot) - s.GetLightClientBootstrap(writer, request) - require.Equal(t, http.StatusOK, writer.Code) - var resp structs.LightClientBootstrapResponse - err = json.Unmarshal(writer.Body.Bytes(), &resp) - require.NoError(t, err) - var respHeader structs.LightClientHeader - err = json.Unmarshal(resp.Data.Header, &respHeader) - require.NoError(t, err) - require.Equal(t, "bellatrix", resp.Version) + require.NotNil(t, resp.Data.CurrentSyncCommittee) + require.NotNil(t, resp.Data.CurrentSyncCommitteeBranch) + }) + t.Run("bellatrix", func(t *testing.T) { + l := util.NewTestLightClient(t).SetupTestBellatrix() - blockHeader, err := l.Block.Header() - require.NoError(t, err) - require.Equal(t, hexutil.Encode(blockHeader.Header.BodyRoot), respHeader.Beacon.BodyRoot) - require.Equal(t, strconv.FormatUint(uint64(blockHeader.Header.Slot), 10), respHeader.Beacon.Slot) + slot := primitives.Slot(params.BeaconConfig().BellatrixForkEpoch * primitives.Epoch(params.BeaconConfig().SlotsPerEpoch)).Add(1) + blockRoot, err := l.Block.Block().HashTreeRoot() + require.NoError(t, err) - require.NotNil(t, resp.Data.CurrentSyncCommittee) - require.NotNil(t, resp.Data.CurrentSyncCommitteeBranch) -} + mockBlocker := &testutil.MockBlocker{BlockToReturn: l.Block} + mockChainService := &mock.ChainService{Optimistic: true, Slot: &slot} + mockChainInfoFetcher := &mock.ChainService{Slot: &slot} + s := &Server{ + Stater: &testutil.MockStater{StatesBySlot: map[primitives.Slot]state.BeaconState{ + slot: l.State, + }}, + Blocker: mockBlocker, + HeadFetcher: mockChainService, + ChainInfoFetcher: mockChainInfoFetcher, + } + request := httptest.NewRequest("GET", "http://foo.com/", nil) + request.SetPathValue("block_root", hexutil.Encode(blockRoot[:])) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} -func TestLightClientHandler_GetLightClientBootstrap_Capella(t *testing.T) { - l := util.NewTestLightClient(t).SetupTestCapella(false) // result is same for true and false + s.GetLightClientBootstrap(writer, request) + require.Equal(t, http.StatusOK, writer.Code) + var resp structs.LightClientBootstrapResponse + err = json.Unmarshal(writer.Body.Bytes(), &resp) + require.NoError(t, err) + var respHeader structs.LightClientHeader + err = json.Unmarshal(resp.Data.Header, &respHeader) + require.NoError(t, err) + require.Equal(t, "altair", resp.Version) - slot := l.State.Slot() - stateRoot, err := l.State.HashTreeRoot(l.Ctx) - require.NoError(t, err) + blockHeader, err := l.Block.Header() + require.NoError(t, err) + require.Equal(t, hexutil.Encode(blockHeader.Header.BodyRoot), respHeader.Beacon.BodyRoot) + require.Equal(t, strconv.FormatUint(uint64(blockHeader.Header.Slot), 10), respHeader.Beacon.Slot) - mockBlocker := &testutil.MockBlocker{BlockToReturn: l.Block} - mockChainService := &mock.ChainService{Optimistic: true, Slot: &slot} - mockChainInfoFetcher := &mock.ChainService{Slot: &slot} - s := &Server{ - Stater: &testutil.MockStater{StatesBySlot: map[primitives.Slot]state.BeaconState{ - slot: l.State, - }}, - Blocker: mockBlocker, - HeadFetcher: mockChainService, - ChainInfoFetcher: mockChainInfoFetcher, - } - request := httptest.NewRequest("GET", "http://foo.com/", nil) - request.SetPathValue("block_root", hexutil.Encode(stateRoot[:])) - writer := httptest.NewRecorder() - writer.Body = &bytes.Buffer{} + require.NotNil(t, resp.Data.CurrentSyncCommittee) + require.NotNil(t, resp.Data.CurrentSyncCommitteeBranch) + }) + t.Run("capella", func(t *testing.T) { + l := util.NewTestLightClient(t).SetupTestCapella(false) // result is same for true and false - s.GetLightClientBootstrap(writer, request) - require.Equal(t, http.StatusOK, writer.Code) - var resp structs.LightClientBootstrapResponse - err = json.Unmarshal(writer.Body.Bytes(), &resp) - require.NoError(t, err) - var respHeader structs.LightClientHeader - err = json.Unmarshal(resp.Data.Header, &respHeader) - require.NoError(t, err) - require.Equal(t, "capella", resp.Version) + slot := primitives.Slot(params.BeaconConfig().CapellaForkEpoch * primitives.Epoch(params.BeaconConfig().SlotsPerEpoch)).Add(1) + blockRoot, err := l.Block.Block().HashTreeRoot() + require.NoError(t, err) - blockHeader, err := l.Block.Header() - require.NoError(t, err) - require.Equal(t, hexutil.Encode(blockHeader.Header.BodyRoot), respHeader.Beacon.BodyRoot) - require.Equal(t, strconv.FormatUint(uint64(blockHeader.Header.Slot), 10), respHeader.Beacon.Slot) + mockBlocker := &testutil.MockBlocker{BlockToReturn: l.Block} + mockChainService := &mock.ChainService{Optimistic: true, Slot: &slot} + mockChainInfoFetcher := &mock.ChainService{Slot: &slot} + s := &Server{ + Stater: &testutil.MockStater{StatesBySlot: map[primitives.Slot]state.BeaconState{ + slot: l.State, + }}, + Blocker: mockBlocker, + HeadFetcher: mockChainService, + ChainInfoFetcher: mockChainInfoFetcher, + } + request := httptest.NewRequest("GET", "http://foo.com/", nil) + request.SetPathValue("block_root", hexutil.Encode(blockRoot[:])) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} - require.NotNil(t, resp.Data.CurrentSyncCommittee) - require.NotNil(t, resp.Data.CurrentSyncCommitteeBranch) -} + s.GetLightClientBootstrap(writer, request) + require.Equal(t, http.StatusOK, writer.Code) + var resp structs.LightClientBootstrapResponse + err = json.Unmarshal(writer.Body.Bytes(), &resp) + require.NoError(t, err) + var respHeader structs.LightClientHeader + err = json.Unmarshal(resp.Data.Header, &respHeader) + require.NoError(t, err) + require.Equal(t, "capella", resp.Version) -func TestLightClientHandler_GetLightClientBootstrap_Deneb(t *testing.T) { - l := util.NewTestLightClient(t).SetupTestDeneb(false) // result is same for true and false + blockHeader, err := l.Block.Header() + require.NoError(t, err) + require.Equal(t, hexutil.Encode(blockHeader.Header.BodyRoot), respHeader.Beacon.BodyRoot) + require.Equal(t, strconv.FormatUint(uint64(blockHeader.Header.Slot), 10), respHeader.Beacon.Slot) - slot := l.State.Slot() - stateRoot, err := l.State.HashTreeRoot(l.Ctx) - require.NoError(t, err) + require.NotNil(t, resp.Data.CurrentSyncCommittee) + require.NotNil(t, resp.Data.CurrentSyncCommitteeBranch) + }) + t.Run("deneb", func(t *testing.T) { + l := util.NewTestLightClient(t).SetupTestDeneb(false) // result is same for true and false - mockBlocker := &testutil.MockBlocker{BlockToReturn: l.Block} - mockChainService := &mock.ChainService{Optimistic: true, Slot: &slot} - mockChainInfoFetcher := &mock.ChainService{Slot: &slot} - s := &Server{ - Stater: &testutil.MockStater{StatesBySlot: map[primitives.Slot]state.BeaconState{ - slot: l.State, - }}, - Blocker: mockBlocker, - HeadFetcher: mockChainService, - ChainInfoFetcher: mockChainInfoFetcher, - } - request := httptest.NewRequest("GET", "http://foo.com/", nil) - request.SetPathValue("block_root", hexutil.Encode(stateRoot[:])) - writer := httptest.NewRecorder() - writer.Body = &bytes.Buffer{} + slot := primitives.Slot(params.BeaconConfig().DenebForkEpoch * primitives.Epoch(params.BeaconConfig().SlotsPerEpoch)).Add(1) + blockRoot, err := l.Block.Block().HashTreeRoot() + require.NoError(t, err) - s.GetLightClientBootstrap(writer, request) - require.Equal(t, http.StatusOK, writer.Code) - var resp structs.LightClientBootstrapResponse - err = json.Unmarshal(writer.Body.Bytes(), &resp) - require.NoError(t, err) - var respHeader structs.LightClientHeader - err = json.Unmarshal(resp.Data.Header, &respHeader) - require.NoError(t, err) - require.Equal(t, "deneb", resp.Version) + mockBlocker := &testutil.MockBlocker{BlockToReturn: l.Block} + mockChainService := &mock.ChainService{Optimistic: true, Slot: &slot} + mockChainInfoFetcher := &mock.ChainService{Slot: &slot} + s := &Server{ + Stater: &testutil.MockStater{StatesBySlot: map[primitives.Slot]state.BeaconState{ + slot: l.State, + }}, + Blocker: mockBlocker, + HeadFetcher: mockChainService, + ChainInfoFetcher: mockChainInfoFetcher, + } + request := httptest.NewRequest("GET", "http://foo.com/", nil) + request.SetPathValue("block_root", hexutil.Encode(blockRoot[:])) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} - blockHeader, err := l.Block.Header() - require.NoError(t, err) - require.Equal(t, hexutil.Encode(blockHeader.Header.BodyRoot), respHeader.Beacon.BodyRoot) - require.Equal(t, strconv.FormatUint(uint64(blockHeader.Header.Slot), 10), respHeader.Beacon.Slot) + s.GetLightClientBootstrap(writer, request) + require.Equal(t, http.StatusOK, writer.Code) + var resp structs.LightClientBootstrapResponse + err = json.Unmarshal(writer.Body.Bytes(), &resp) + require.NoError(t, err) + var respHeader structs.LightClientHeader + err = json.Unmarshal(resp.Data.Header, &respHeader) + require.NoError(t, err) + require.Equal(t, "deneb", resp.Version) - require.NotNil(t, resp.Data.CurrentSyncCommittee) - require.NotNil(t, resp.Data.CurrentSyncCommitteeBranch) -} + blockHeader, err := l.Block.Header() + require.NoError(t, err) + require.Equal(t, hexutil.Encode(blockHeader.Header.BodyRoot), respHeader.Beacon.BodyRoot) + require.Equal(t, strconv.FormatUint(uint64(blockHeader.Header.Slot), 10), respHeader.Beacon.Slot) -func TestLightClientHandler_GetLightClientBootstrap_Electra(t *testing.T) { - l := util.NewTestLightClient(t).SetupTestElectra(false) // result is same for true and false + require.NotNil(t, resp.Data.CurrentSyncCommittee) + require.NotNil(t, resp.Data.CurrentSyncCommitteeBranch) + }) + t.Run("electra", func(t *testing.T) { + l := util.NewTestLightClient(t).SetupTestElectra(false) // result is same for true and false - slot := l.State.Slot() - stateRoot, err := l.State.HashTreeRoot(l.Ctx) - require.NoError(t, err) + slot := primitives.Slot(params.BeaconConfig().ElectraForkEpoch * primitives.Epoch(params.BeaconConfig().SlotsPerEpoch)).Add(1) + blockRoot, err := l.Block.Block().HashTreeRoot() + require.NoError(t, err) - mockBlocker := &testutil.MockBlocker{BlockToReturn: l.Block} - mockChainService := &mock.ChainService{Optimistic: true, Slot: &slot} - mockChainInfoFetcher := &mock.ChainService{Slot: &slot} - s := &Server{ - Stater: &testutil.MockStater{StatesBySlot: map[primitives.Slot]state.BeaconState{ - slot: l.State, - }}, - Blocker: mockBlocker, - HeadFetcher: mockChainService, - ChainInfoFetcher: mockChainInfoFetcher, - } - request := httptest.NewRequest("GET", "http://foo.com/", nil) - request.SetPathValue("block_root", hexutil.Encode(stateRoot[:])) - writer := httptest.NewRecorder() - writer.Body = &bytes.Buffer{} + mockBlocker := &testutil.MockBlocker{BlockToReturn: l.Block} + mockChainService := &mock.ChainService{Optimistic: true, Slot: &slot} + mockChainInfoFetcher := &mock.ChainService{Slot: &slot} + s := &Server{ + Stater: &testutil.MockStater{StatesBySlot: map[primitives.Slot]state.BeaconState{ + slot: l.State, + }}, + Blocker: mockBlocker, + HeadFetcher: mockChainService, + ChainInfoFetcher: mockChainInfoFetcher, + } + request := httptest.NewRequest("GET", "http://foo.com/", nil) + request.SetPathValue("block_root", hexutil.Encode(blockRoot[:])) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} - s.GetLightClientBootstrap(writer, request) - require.Equal(t, http.StatusOK, writer.Code) - var resp structs.LightClientBootstrapResponse - err = json.Unmarshal(writer.Body.Bytes(), &resp) - require.NoError(t, err) - var respHeader structs.LightClientHeader - err = json.Unmarshal(resp.Data.Header, &respHeader) - require.NoError(t, err) - require.Equal(t, "electra", resp.Version) + s.GetLightClientBootstrap(writer, request) + require.Equal(t, http.StatusOK, writer.Code) + var resp structs.LightClientBootstrapResponse + err = json.Unmarshal(writer.Body.Bytes(), &resp) + require.NoError(t, err) + var respHeader structs.LightClientHeader + err = json.Unmarshal(resp.Data.Header, &respHeader) + require.NoError(t, err) + require.Equal(t, "electra", resp.Version) - blockHeader, err := l.Block.Header() - require.NoError(t, err) - require.Equal(t, hexutil.Encode(blockHeader.Header.BodyRoot), respHeader.Beacon.BodyRoot) - require.Equal(t, strconv.FormatUint(uint64(blockHeader.Header.Slot), 10), respHeader.Beacon.Slot) + blockHeader, err := l.Block.Header() + require.NoError(t, err) + require.Equal(t, hexutil.Encode(blockHeader.Header.BodyRoot), respHeader.Beacon.BodyRoot) + require.Equal(t, strconv.FormatUint(uint64(blockHeader.Header.Slot), 10), respHeader.Beacon.Slot) - require.NotNil(t, resp.Data.CurrentSyncCommittee) - require.NotNil(t, resp.Data.CurrentSyncCommitteeBranch) + require.NotNil(t, resp.Data.CurrentSyncCommittee) + require.NotNil(t, resp.Data.CurrentSyncCommitteeBranch) + }) } // GetLightClientByRange tests @@ -988,9 +995,7 @@ func TestLightClientHandler_GetLightClientUpdatesByRangeMissingUpdates(t *testin } -// // TestLightClientHandler_GetLightClientFinalityUpdate tests - -func TestLightClientHandler_GetLightClientFinalityUpdateAltair(t *testing.T) { +func TestLightClientHandler_GetLightClientFinalityUpdate(t *testing.T) { helpers.ClearCache() ctx := context.Background() config := params.BeaconConfig() @@ -1102,230 +1107,6 @@ func TestLightClientHandler_GetLightClientFinalityUpdateAltair(t *testing.T) { require.NotNil(t, resp.Data) } -func TestLightClientHandler_GetLightClientFinalityUpdateCapella(t *testing.T) { - helpers.ClearCache() - ctx := context.Background() - config := params.BeaconConfig() - slot := primitives.Slot(config.CapellaForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1) - - attestedState, err := util.NewBeaconStateCapella() - require.NoError(t, err) - err = attestedState.SetSlot(slot.Sub(1)) - require.NoError(t, err) - - require.NoError(t, attestedState.SetFinalizedCheckpoint(&pb.Checkpoint{ - Epoch: config.AltairForkEpoch - 10, - Root: make([]byte, 32), - })) - - parent := util.NewBeaconBlockCapella() - parent.Block.Slot = slot.Sub(1) - - signedParent, err := blocks.NewSignedBeaconBlock(parent) - require.NoError(t, err) - - parentHeader, err := signedParent.Header() - require.NoError(t, err) - attestedHeader := parentHeader.Header - - err = attestedState.SetLatestBlockHeader(attestedHeader) - require.NoError(t, err) - attestedStateRoot, err := attestedState.HashTreeRoot(ctx) - require.NoError(t, err) - - // get a new signed block so the root is updated with the new state root - parent.Block.StateRoot = attestedStateRoot[:] - signedParent, err = blocks.NewSignedBeaconBlock(parent) - require.NoError(t, err) - - st, err := util.NewBeaconStateCapella() - require.NoError(t, err) - err = st.SetSlot(slot) - require.NoError(t, err) - - parentRoot, err := signedParent.Block().HashTreeRoot() - require.NoError(t, err) - - block := util.NewBeaconBlockCapella() - block.Block.Slot = slot - block.Block.ParentRoot = parentRoot[:] - - for i := uint64(0); i < config.SyncCommitteeSize; i++ { - block.Block.Body.SyncAggregate.SyncCommitteeBits.SetBitAt(i, true) - } - - signedBlock, err := blocks.NewSignedBeaconBlock(block) - require.NoError(t, err) - - h, err := signedBlock.Header() - require.NoError(t, err) - - err = st.SetLatestBlockHeader(h.Header) - require.NoError(t, err) - stateRoot, err := st.HashTreeRoot(ctx) - require.NoError(t, err) - - // get a new signed block so the root is updated with the new state root - block.Block.StateRoot = stateRoot[:] - signedBlock, err = blocks.NewSignedBeaconBlock(block) - require.NoError(t, err) - - root, err := block.Block.HashTreeRoot() - require.NoError(t, err) - - mockBlocker := &testutil.MockBlocker{ - RootBlockMap: map[[32]byte]interfaces.ReadOnlySignedBeaconBlock{ - parentRoot: signedParent, - root: signedBlock, - }, - SlotBlockMap: map[primitives.Slot]interfaces.ReadOnlySignedBeaconBlock{ - slot.Sub(1): signedParent, - slot: signedBlock, - }, - } - mockChainService := &mock.ChainService{Optimistic: true, Slot: &slot, State: st, FinalizedRoots: map[[32]byte]bool{ - root: true, - }} - mockChainInfoFetcher := &mock.ChainService{Slot: &slot} - s := &Server{ - Stater: &testutil.MockStater{StatesBySlot: map[primitives.Slot]state.BeaconState{ - slot.Sub(1): attestedState, - slot: st, - }}, - Blocker: mockBlocker, - HeadFetcher: mockChainService, - ChainInfoFetcher: mockChainInfoFetcher, - } - request := httptest.NewRequest("GET", "http://foo.com", nil) - writer := httptest.NewRecorder() - writer.Body = &bytes.Buffer{} - - s.GetLightClientFinalityUpdate(writer, request) - - require.Equal(t, http.StatusOK, writer.Code) - var resp *structs.LightClientUpdateResponse - err = json.Unmarshal(writer.Body.Bytes(), &resp) - require.NoError(t, err) - var respHeader structs.LightClientHeader - err = json.Unmarshal(resp.Data.AttestedHeader, &respHeader) - require.NoError(t, err) - require.Equal(t, "capella", resp.Version) - require.Equal(t, hexutil.Encode(attestedHeader.BodyRoot), respHeader.Beacon.BodyRoot) - require.NotNil(t, resp.Data) -} - -func TestLightClientHandler_GetLightClientFinalityUpdateDeneb(t *testing.T) { - helpers.ClearCache() - ctx := context.Background() - config := params.BeaconConfig() - slot := primitives.Slot(config.DenebForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1) - - attestedState, err := util.NewBeaconStateDeneb() - require.NoError(t, err) - err = attestedState.SetSlot(slot.Sub(1)) - require.NoError(t, err) - - require.NoError(t, attestedState.SetFinalizedCheckpoint(&pb.Checkpoint{ - Epoch: config.AltairForkEpoch - 10, - Root: make([]byte, 32), - })) - - parent := util.NewBeaconBlockDeneb() - parent.Block.Slot = slot.Sub(1) - - signedParent, err := blocks.NewSignedBeaconBlock(parent) - require.NoError(t, err) - - parentHeader, err := signedParent.Header() - require.NoError(t, err) - attestedHeader := parentHeader.Header - - err = attestedState.SetLatestBlockHeader(attestedHeader) - require.NoError(t, err) - attestedStateRoot, err := attestedState.HashTreeRoot(ctx) - require.NoError(t, err) - - // get a new signed block so the root is updated with the new state root - parent.Block.StateRoot = attestedStateRoot[:] - signedParent, err = blocks.NewSignedBeaconBlock(parent) - require.NoError(t, err) - - st, err := util.NewBeaconStateDeneb() - require.NoError(t, err) - err = st.SetSlot(slot) - require.NoError(t, err) - - parentRoot, err := signedParent.Block().HashTreeRoot() - require.NoError(t, err) - - block := util.NewBeaconBlockDeneb() - block.Block.Slot = slot - block.Block.ParentRoot = parentRoot[:] - - for i := uint64(0); i < config.SyncCommitteeSize; i++ { - block.Block.Body.SyncAggregate.SyncCommitteeBits.SetBitAt(i, true) - } - - signedBlock, err := blocks.NewSignedBeaconBlock(block) - require.NoError(t, err) - - h, err := signedBlock.Header() - require.NoError(t, err) - - err = st.SetLatestBlockHeader(h.Header) - require.NoError(t, err) - stateRoot, err := st.HashTreeRoot(ctx) - require.NoError(t, err) - - // get a new signed block so the root is updated with the new state root - block.Block.StateRoot = stateRoot[:] - signedBlock, err = blocks.NewSignedBeaconBlock(block) - require.NoError(t, err) - - root, err := block.Block.HashTreeRoot() - require.NoError(t, err) - - mockBlocker := &testutil.MockBlocker{ - RootBlockMap: map[[32]byte]interfaces.ReadOnlySignedBeaconBlock{ - parentRoot: signedParent, - root: signedBlock, - }, - SlotBlockMap: map[primitives.Slot]interfaces.ReadOnlySignedBeaconBlock{ - slot.Sub(1): signedParent, - slot: signedBlock, - }, - } - mockChainService := &mock.ChainService{Optimistic: true, Slot: &slot, State: st, FinalizedRoots: map[[32]byte]bool{ - root: true, - }} - mockChainInfoFetcher := &mock.ChainService{Slot: &slot} - s := &Server{ - Stater: &testutil.MockStater{StatesBySlot: map[primitives.Slot]state.BeaconState{ - slot.Sub(1): attestedState, - slot: st, - }}, - Blocker: mockBlocker, - HeadFetcher: mockChainService, - ChainInfoFetcher: mockChainInfoFetcher, - } - request := httptest.NewRequest("GET", "http://foo.com", nil) - writer := httptest.NewRecorder() - writer.Body = &bytes.Buffer{} - - s.GetLightClientFinalityUpdate(writer, request) - - require.Equal(t, http.StatusOK, writer.Code) - var resp *structs.LightClientUpdateResponse - err = json.Unmarshal(writer.Body.Bytes(), &resp) - require.NoError(t, err) - var respHeader structs.LightClientHeaderDeneb - err = json.Unmarshal(resp.Data.AttestedHeader, &respHeader) - require.NoError(t, err) - require.Equal(t, "deneb", resp.Version) - require.Equal(t, hexutil.Encode(attestedHeader.BodyRoot), respHeader.Beacon.BodyRoot) - require.NotNil(t, resp.Data) -} - func TestLightClientHandler_GetLightClientOptimisticUpdateAltair(t *testing.T) { helpers.ClearCache() ctx := context.Background() From 79ec52991d9ce89c422f08ce0526b7f5e6c1a5b6 Mon Sep 17 00:00:00 2001 From: Inspector-Butters Date: Mon, 4 Nov 2024 17:35:04 +0100 Subject: [PATCH 18/26] save update --- beacon-chain/blockchain/process_block.go | 1 + 1 file changed, 1 insertion(+) diff --git a/beacon-chain/blockchain/process_block.go b/beacon-chain/blockchain/process_block.go index 7a55c3f83fb..c7273e44711 100644 --- a/beacon-chain/blockchain/process_block.go +++ b/beacon-chain/blockchain/process_block.go @@ -70,6 +70,7 @@ func (s *Service) postBlockProcess(cfg *postBlockProcessConfig) error { defer s.handleSecondFCUCall(cfg, fcuArgs) } defer s.sendLightClientFeeds(cfg) + defer s.saveLightClientUpdate(cfg) defer s.sendStateFeedOnBlock(cfg) defer reportProcessingTime(startTime) defer reportAttestationInclusion(cfg.roblock.Block()) From a64a739ba3e5ea4e23f459859ebf1c2c45e667b5 Mon Sep 17 00:00:00 2001 From: Inspector-Butters Date: Mon, 4 Nov 2024 17:38:01 +0100 Subject: [PATCH 19/26] save update --- .../blockchain/process_block_helpers.go | 59 ++++++++++ beacon-chain/core/light-client/lightclient.go | 110 ++++++++++++++++++ beacon-chain/rpc/eth/light-client/helpers.go | 110 ------------------ .../rpc/eth/light-client/helpers_test.go | 32 ++--- 4 files changed, 185 insertions(+), 126 deletions(-) diff --git a/beacon-chain/blockchain/process_block_helpers.go b/beacon-chain/blockchain/process_block_helpers.go index 04289145e07..fa320882d8d 100644 --- a/beacon-chain/blockchain/process_block_helpers.go +++ b/beacon-chain/blockchain/process_block_helpers.go @@ -129,6 +129,65 @@ func (s *Service) sendLightClientFeeds(cfg *postBlockProcessConfig) { } } +// saveLightClientUpdate saves the light client update for this block +// if it's better than the already saved one, when feature flag is enabled. +func (s *Service) saveLightClientUpdate(cfg *postBlockProcessConfig) { + if !features.Get().EnableLightClient { + return + } + + attestedRoot := cfg.roblock.Block().ParentRoot() + attestedBlock, err := s.getBlock(cfg.ctx, attestedRoot) + if err != nil { + log.WithError(err).Error("Could not get attested block") + return + } + if attestedBlock == nil { + log.Error("Attested block is nil") + return + } + attestedState, err := s.cfg.StateGen.StateByRoot(cfg.ctx, attestedRoot) + + finalizedRoot := cfg.postState.FinalizedCheckpoint().Root + finalizedBlock, err := s.getBlock(cfg.ctx, [32]byte(finalizedRoot)) + + update, err := lightclient.NewLightClientUpdateFromBeaconState( + cfg.ctx, + s.CurrentSlot(), + cfg.postState, + cfg.roblock, + attestedState, + attestedBlock, + finalizedBlock, + ) + + period := uint64(attestedState.Slot()) / (uint64(params.BeaconConfig().SlotsPerEpoch) * uint64(params.BeaconConfig().EpochsPerSyncCommitteePeriod)) + + oldUpdate, err := s.cfg.BeaconDB.LightClientUpdate(cfg.ctx, period) + if err != nil { + log.WithError(err).Error("Could not get current light client update") + return + } + if oldUpdate == nil { + if err := s.cfg.BeaconDB.SaveLightClientUpdate(cfg.ctx, period, update); err != nil { + log.WithError(err).Error("Could not save light client update") + } + } else { + isNewUpdateBetter, err := lightclient.IsBetterUpdate(update, oldUpdate) + if err != nil { + log.WithError(err).Error("Could not compare light client updates") + return + } + if isNewUpdateBetter { + if err := s.cfg.BeaconDB.SaveLightClientUpdate(cfg.ctx, period, update); err != nil { + log.WithError(err).Error("Could not save light client update") + } + } + + } + +} + func (s *Service) tryPublishLightClientFinalityUpdate( ctx context.Context, signed interfaces.ReadOnlySignedBeaconBlock, diff --git a/beacon-chain/core/light-client/lightclient.go b/beacon-chain/core/light-client/lightclient.go index d07813fc7a5..2bf97ddb4d3 100644 --- a/beacon-chain/core/light-client/lightclient.go +++ b/beacon-chain/core/light-client/lightclient.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "fmt" + "reflect" "github.com/pkg/errors" "github.com/prysmaticlabs/prysm/v5/beacon-chain/execution" @@ -562,3 +563,112 @@ func emptyPayloadProof() [][]byte { } return proof } + +func HasRelevantSyncCommittee(update interfaces.LightClientUpdate) (bool, error) { + if update.Version() >= version.Electra { + branch, err := update.NextSyncCommitteeBranchElectra() + if err != nil { + return false, err + } + return !reflect.DeepEqual(branch, interfaces.LightClientSyncCommitteeBranchElectra{}), nil + } + branch, err := update.NextSyncCommitteeBranch() + if err != nil { + return false, err + } + return !reflect.DeepEqual(branch, interfaces.LightClientSyncCommitteeBranch{}), nil +} + +func HasFinality(update interfaces.LightClientUpdate) (bool, error) { + if update.Version() >= version.Electra { + b, err := update.FinalityBranchElectra() + if err != nil { + return false, err + } + return !reflect.DeepEqual(b, interfaces.LightClientFinalityBranchElectra{}), nil + } + + b, err := update.FinalityBranch() + if err != nil { + return false, err + } + return !reflect.DeepEqual(b, interfaces.LightClientFinalityBranch{}), nil +} + +func IsBetterUpdate(newUpdate, oldUpdate interfaces.LightClientUpdate) (bool, error) { + maxActiveParticipants := newUpdate.SyncAggregate().SyncCommitteeBits.Len() + newNumActiveParticipants := newUpdate.SyncAggregate().SyncCommitteeBits.Count() + oldNumActiveParticipants := oldUpdate.SyncAggregate().SyncCommitteeBits.Count() + newHasSupermajority := newNumActiveParticipants*3 >= maxActiveParticipants*2 + oldHasSupermajority := oldNumActiveParticipants*3 >= maxActiveParticipants*2 + + if newHasSupermajority != oldHasSupermajority { + return newHasSupermajority, nil + } + if !newHasSupermajority && newNumActiveParticipants != oldNumActiveParticipants { + return newNumActiveParticipants > oldNumActiveParticipants, nil + } + + newUpdateAttestedHeaderBeacon := newUpdate.AttestedHeader().Beacon() + oldUpdateAttestedHeaderBeacon := oldUpdate.AttestedHeader().Beacon() + + // Compare presence of relevant sync committee + newHasRelevantSyncCommittee, err := HasRelevantSyncCommittee(newUpdate) + if err != nil { + return false, err + } + newHasRelevantSyncCommittee = newHasRelevantSyncCommittee && + (slots.SyncCommitteePeriod(slots.ToEpoch(newUpdateAttestedHeaderBeacon.Slot)) == slots.SyncCommitteePeriod(slots.ToEpoch(newUpdate.SignatureSlot()))) + oldHasRelevantSyncCommittee, err := HasRelevantSyncCommittee(oldUpdate) + if err != nil { + return false, err + } + oldHasRelevantSyncCommittee = oldHasRelevantSyncCommittee && + (slots.SyncCommitteePeriod(slots.ToEpoch(oldUpdateAttestedHeaderBeacon.Slot)) == slots.SyncCommitteePeriod(slots.ToEpoch(oldUpdate.SignatureSlot()))) + + if newHasRelevantSyncCommittee != oldHasRelevantSyncCommittee { + return newHasRelevantSyncCommittee, nil + } + + // Compare indication of any finality + newHasFinality, err := HasFinality(newUpdate) + if err != nil { + return false, err + } + oldHasFinality, err := HasFinality(oldUpdate) + if err != nil { + return false, err + } + if newHasFinality != oldHasFinality { + return newHasFinality, nil + } + + newUpdateFinalizedHeaderBeacon := newUpdate.FinalizedHeader().Beacon() + oldUpdateFinalizedHeaderBeacon := oldUpdate.FinalizedHeader().Beacon() + + // Compare sync committee finality + if newHasFinality { + newHasSyncCommitteeFinality := + slots.SyncCommitteePeriod(slots.ToEpoch(newUpdateFinalizedHeaderBeacon.Slot)) == + slots.SyncCommitteePeriod(slots.ToEpoch(newUpdateAttestedHeaderBeacon.Slot)) + oldHasSyncCommitteeFinality := + slots.SyncCommitteePeriod(slots.ToEpoch(oldUpdateFinalizedHeaderBeacon.Slot)) == + slots.SyncCommitteePeriod(slots.ToEpoch(oldUpdateAttestedHeaderBeacon.Slot)) + + if newHasSyncCommitteeFinality != oldHasSyncCommitteeFinality { + return newHasSyncCommitteeFinality, nil + } + } + + // Tiebreaker 1: Sync committee participation beyond supermajority + if newNumActiveParticipants != oldNumActiveParticipants { + return newNumActiveParticipants > oldNumActiveParticipants, nil + } + + // Tiebreaker 2: Prefer older data (fewer changes to best) + if newUpdateAttestedHeaderBeacon.Slot != oldUpdateAttestedHeaderBeacon.Slot { + return newUpdateAttestedHeaderBeacon.Slot < oldUpdateAttestedHeaderBeacon.Slot, nil + } + + return newUpdate.SignatureSlot() < oldUpdate.SignatureSlot(), nil +} diff --git a/beacon-chain/rpc/eth/light-client/helpers.go b/beacon-chain/rpc/eth/light-client/helpers.go index 39779735bca..efaea594b4a 100644 --- a/beacon-chain/rpc/eth/light-client/helpers.go +++ b/beacon-chain/rpc/eth/light-client/helpers.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "reflect" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/pkg/errors" @@ -131,112 +130,3 @@ func newLightClientOptimisticUpdateFromBeaconState( return structs.LightClientOptimisticUpdateFromConsensus(result) } - -func HasRelevantSyncCommittee(update interfaces.LightClientUpdate) (bool, error) { - if update.Version() >= version.Electra { - branch, err := update.NextSyncCommitteeBranchElectra() - if err != nil { - return false, err - } - return !reflect.DeepEqual(branch, interfaces.LightClientSyncCommitteeBranchElectra{}), nil - } - branch, err := update.NextSyncCommitteeBranch() - if err != nil { - return false, err - } - return !reflect.DeepEqual(branch, interfaces.LightClientSyncCommitteeBranch{}), nil -} - -func HasFinality(update interfaces.LightClientUpdate) (bool, error) { - if update.Version() >= version.Electra { - b, err := update.FinalityBranchElectra() - if err != nil { - return false, err - } - return !reflect.DeepEqual(b, interfaces.LightClientFinalityBranchElectra{}), nil - } - - b, err := update.FinalityBranch() - if err != nil { - return false, err - } - return !reflect.DeepEqual(b, interfaces.LightClientFinalityBranch{}), nil -} - -func IsBetterUpdate(newUpdate, oldUpdate interfaces.LightClientUpdate) (bool, error) { - maxActiveParticipants := newUpdate.SyncAggregate().SyncCommitteeBits.Len() - newNumActiveParticipants := newUpdate.SyncAggregate().SyncCommitteeBits.Count() - oldNumActiveParticipants := oldUpdate.SyncAggregate().SyncCommitteeBits.Count() - newHasSupermajority := newNumActiveParticipants*3 >= maxActiveParticipants*2 - oldHasSupermajority := oldNumActiveParticipants*3 >= maxActiveParticipants*2 - - if newHasSupermajority != oldHasSupermajority { - return newHasSupermajority, nil - } - if !newHasSupermajority && newNumActiveParticipants != oldNumActiveParticipants { - return newNumActiveParticipants > oldNumActiveParticipants, nil - } - - newUpdateAttestedHeaderBeacon := newUpdate.AttestedHeader().Beacon() - oldUpdateAttestedHeaderBeacon := oldUpdate.AttestedHeader().Beacon() - - // Compare presence of relevant sync committee - newHasRelevantSyncCommittee, err := HasRelevantSyncCommittee(newUpdate) - if err != nil { - return false, err - } - newHasRelevantSyncCommittee = newHasRelevantSyncCommittee && - (slots.SyncCommitteePeriod(slots.ToEpoch(newUpdateAttestedHeaderBeacon.Slot)) == slots.SyncCommitteePeriod(slots.ToEpoch(newUpdate.SignatureSlot()))) - oldHasRelevantSyncCommittee, err := HasRelevantSyncCommittee(oldUpdate) - if err != nil { - return false, err - } - oldHasRelevantSyncCommittee = oldHasRelevantSyncCommittee && - (slots.SyncCommitteePeriod(slots.ToEpoch(oldUpdateAttestedHeaderBeacon.Slot)) == slots.SyncCommitteePeriod(slots.ToEpoch(oldUpdate.SignatureSlot()))) - - if newHasRelevantSyncCommittee != oldHasRelevantSyncCommittee { - return newHasRelevantSyncCommittee, nil - } - - // Compare indication of any finality - newHasFinality, err := HasFinality(newUpdate) - if err != nil { - return false, err - } - oldHasFinality, err := HasFinality(oldUpdate) - if err != nil { - return false, err - } - if newHasFinality != oldHasFinality { - return newHasFinality, nil - } - - newUpdateFinalizedHeaderBeacon := newUpdate.FinalizedHeader().Beacon() - oldUpdateFinalizedHeaderBeacon := oldUpdate.FinalizedHeader().Beacon() - - // Compare sync committee finality - if newHasFinality { - newHasSyncCommitteeFinality := - slots.SyncCommitteePeriod(slots.ToEpoch(newUpdateFinalizedHeaderBeacon.Slot)) == - slots.SyncCommitteePeriod(slots.ToEpoch(newUpdateAttestedHeaderBeacon.Slot)) - oldHasSyncCommitteeFinality := - slots.SyncCommitteePeriod(slots.ToEpoch(oldUpdateFinalizedHeaderBeacon.Slot)) == - slots.SyncCommitteePeriod(slots.ToEpoch(oldUpdateAttestedHeaderBeacon.Slot)) - - if newHasSyncCommitteeFinality != oldHasSyncCommitteeFinality { - return newHasSyncCommitteeFinality, nil - } - } - - // Tiebreaker 1: Sync committee participation beyond supermajority - if newNumActiveParticipants != oldNumActiveParticipants { - return newNumActiveParticipants > oldNumActiveParticipants, nil - } - - // Tiebreaker 2: Prefer older data (fewer changes to best) - if newUpdateAttestedHeaderBeacon.Slot != oldUpdateAttestedHeaderBeacon.Slot { - return newUpdateAttestedHeaderBeacon.Slot < oldUpdateAttestedHeaderBeacon.Slot, nil - } - - return newUpdate.SignatureSlot() < oldUpdate.SignatureSlot(), nil -} diff --git a/beacon-chain/rpc/eth/light-client/helpers_test.go b/beacon-chain/rpc/eth/light-client/helpers_test.go index e5ac6e11ce6..6d60fca8185 100644 --- a/beacon-chain/rpc/eth/light-client/helpers_test.go +++ b/beacon-chain/rpc/eth/light-client/helpers_test.go @@ -53,7 +53,7 @@ func TestIsBetterUpdate(t *testing.T) { SyncCommitteeBits: []byte{0b11111100, 0b1}, // [0,0,1,1,1,1,1,1] }) - result, err := IsBetterUpdate(newUpdate, oldUpdate) + result, err := lightclient.IsBetterUpdate(newUpdate, oldUpdate) assert.NoError(t, err) assert.Equal(t, true, result) }) @@ -71,7 +71,7 @@ func TestIsBetterUpdate(t *testing.T) { SyncCommitteeBits: []byte{0b01111100, 0b1}, // [0,0,1,1,1,1,1,0] }) - result, err := IsBetterUpdate(newUpdate, oldUpdate) + result, err := lightclient.IsBetterUpdate(newUpdate, oldUpdate) assert.NoError(t, err) assert.Equal(t, false, result) }) @@ -89,7 +89,7 @@ func TestIsBetterUpdate(t *testing.T) { SyncCommitteeBits: []byte{0b01111100, 0b1}, // [0,0,1,1,1,1,1,0] }) - result, err := IsBetterUpdate(newUpdate, oldUpdate) + result, err := lightclient.IsBetterUpdate(newUpdate, oldUpdate) assert.NoError(t, err) assert.Equal(t, true, result) }) @@ -107,7 +107,7 @@ func TestIsBetterUpdate(t *testing.T) { SyncCommitteeBits: []byte{0b00111100, 0b1}, // [0,0,1,1,1,1,0,0] }) - result, err := IsBetterUpdate(newUpdate, oldUpdate) + result, err := lightclient.IsBetterUpdate(newUpdate, oldUpdate) assert.NoError(t, err) assert.Equal(t, false, result) }) @@ -146,7 +146,7 @@ func TestIsBetterUpdate(t *testing.T) { assert.NoError(t, err) newUpdate.SetSignatureSlot(1000000) - result, err := IsBetterUpdate(newUpdate, oldUpdate) + result, err := lightclient.IsBetterUpdate(newUpdate, oldUpdate) assert.NoError(t, err) assert.Equal(t, true, result) }) @@ -185,7 +185,7 @@ func TestIsBetterUpdate(t *testing.T) { assert.NoError(t, err) newUpdate.SetSignatureSlot(9999) - result, err := IsBetterUpdate(newUpdate, oldUpdate) + result, err := lightclient.IsBetterUpdate(newUpdate, oldUpdate) assert.NoError(t, err) assert.Equal(t, false, result) }) @@ -228,7 +228,7 @@ func TestIsBetterUpdate(t *testing.T) { err = newUpdate.SetFinalityBranch(createNonEmptyFinalityBranch()) assert.NoError(t, err) - result, err := IsBetterUpdate(newUpdate, oldUpdate) + result, err := lightclient.IsBetterUpdate(newUpdate, oldUpdate) assert.NoError(t, err) assert.Equal(t, true, result) }) @@ -271,7 +271,7 @@ func TestIsBetterUpdate(t *testing.T) { assert.NoError(t, err) newUpdate.SetSignatureSlot(9999) - result, err := IsBetterUpdate(newUpdate, oldUpdate) + result, err := lightclient.IsBetterUpdate(newUpdate, oldUpdate) assert.NoError(t, err) assert.Equal(t, false, result) }) @@ -332,7 +332,7 @@ func TestIsBetterUpdate(t *testing.T) { err = newUpdate.SetFinalizedHeader(newFinalizedHeader) assert.NoError(t, err) - result, err := IsBetterUpdate(newUpdate, oldUpdate) + result, err := lightclient.IsBetterUpdate(newUpdate, oldUpdate) assert.NoError(t, err) assert.Equal(t, true, result) }) @@ -393,7 +393,7 @@ func TestIsBetterUpdate(t *testing.T) { err = newUpdate.SetFinalizedHeader(newFinalizedHeader) assert.NoError(t, err) - result, err := IsBetterUpdate(newUpdate, oldUpdate) + result, err := lightclient.IsBetterUpdate(newUpdate, oldUpdate) assert.NoError(t, err) assert.Equal(t, false, result) }) @@ -411,7 +411,7 @@ func TestIsBetterUpdate(t *testing.T) { SyncCommitteeBits: []byte{0b01111100, 0b1}, // [0,1,1,1,1,1,0,0] }) - result, err := IsBetterUpdate(newUpdate, oldUpdate) + result, err := lightclient.IsBetterUpdate(newUpdate, oldUpdate) assert.NoError(t, err) assert.Equal(t, true, result) }) @@ -429,7 +429,7 @@ func TestIsBetterUpdate(t *testing.T) { SyncCommitteeBits: []byte{0b00111100, 0b1}, // [0,0,1,1,1,1,0,0] }) - result, err := IsBetterUpdate(newUpdate, oldUpdate) + result, err := lightclient.IsBetterUpdate(newUpdate, oldUpdate) assert.NoError(t, err) assert.Equal(t, false, result) }) @@ -490,7 +490,7 @@ func TestIsBetterUpdate(t *testing.T) { err = newUpdate.SetFinalizedHeader(newFinalizedHeader) assert.NoError(t, err) - result, err := IsBetterUpdate(newUpdate, oldUpdate) + result, err := lightclient.IsBetterUpdate(newUpdate, oldUpdate) assert.NoError(t, err) assert.Equal(t, true, result) }) @@ -551,7 +551,7 @@ func TestIsBetterUpdate(t *testing.T) { err = newUpdate.SetFinalizedHeader(newFinalizedHeader) assert.NoError(t, err) - result, err := IsBetterUpdate(newUpdate, oldUpdate) + result, err := lightclient.IsBetterUpdate(newUpdate, oldUpdate) assert.NoError(t, err) assert.Equal(t, false, result) }) @@ -612,7 +612,7 @@ func TestIsBetterUpdate(t *testing.T) { err = newUpdate.SetFinalizedHeader(newFinalizedHeader) assert.NoError(t, err) - result, err := IsBetterUpdate(newUpdate, oldUpdate) + result, err := lightclient.IsBetterUpdate(newUpdate, oldUpdate) assert.NoError(t, err) assert.Equal(t, true, result) }) @@ -673,7 +673,7 @@ func TestIsBetterUpdate(t *testing.T) { err = newUpdate.SetFinalizedHeader(newFinalizedHeader) assert.NoError(t, err) - result, err := IsBetterUpdate(newUpdate, oldUpdate) + result, err := lightclient.IsBetterUpdate(newUpdate, oldUpdate) assert.NoError(t, err) assert.Equal(t, false, result) }) From 21aa9bf5663c554931a049e8d578f51700c41368 Mon Sep 17 00:00:00 2001 From: rkapka Date: Tue, 5 Nov 2024 13:00:20 +0700 Subject: [PATCH 20/26] fix events --- beacon-chain/rpc/eth/events/BUILD.bazel | 1 - beacon-chain/rpc/eth/events/events.go | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/beacon-chain/rpc/eth/events/BUILD.bazel b/beacon-chain/rpc/eth/events/BUILD.bazel index da308f79785..44f2f7116e5 100644 --- a/beacon-chain/rpc/eth/events/BUILD.bazel +++ b/beacon-chain/rpc/eth/events/BUILD.bazel @@ -26,7 +26,6 @@ go_library( "//monitoring/tracing/trace:go_default_library", "//network/httputil:go_default_library", "//proto/eth/v1:go_default_library", - "//proto/eth/v2:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", diff --git a/beacon-chain/rpc/eth/events/events.go b/beacon-chain/rpc/eth/events/events.go index 173a2017681..5d9a825fabc 100644 --- a/beacon-chain/rpc/eth/events/events.go +++ b/beacon-chain/rpc/eth/events/events.go @@ -25,7 +25,6 @@ import ( "github.com/prysmaticlabs/prysm/v5/monitoring/tracing/trace" "github.com/prysmaticlabs/prysm/v5/network/httputil" ethpb "github.com/prysmaticlabs/prysm/v5/proto/eth/v1" - ethpbv2 "github.com/prysmaticlabs/prysm/v5/proto/eth/v2" eth "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/v5/runtime/version" "github.com/prysmaticlabs/prysm/v5/time/slots" @@ -411,9 +410,9 @@ func topicForEvent(event *feed.Event) string { return HeadTopic case *ethpb.EventFinalizedCheckpoint: return FinalizedCheckpointTopic - case *ethpbv2.LightClientFinalityUpdateWithVersion: + case interfaces.LightClientFinalityUpdate: return LightClientFinalityUpdateTopic - case *ethpbv2.LightClientOptimisticUpdateWithVersion: + case interfaces.LightClientOptimisticUpdate: return LightClientOptimisticUpdateTopic case *ethpb.EventChainReorg: return ChainReorgTopic From fa6318289f37b8778c215dab852d2a83d038ca6d Mon Sep 17 00:00:00 2001 From: rkapka Date: Tue, 5 Nov 2024 17:55:44 +0700 Subject: [PATCH 21/26] debugging help --- beacon-chain/blockchain/process_block_helpers.go | 2 ++ beacon-chain/sync/rpc_light_client.go | 16 ++++++++++++++++ beacon-chain/sync/subscriber_light_client.go | 2 ++ beacon-chain/sync/validate_light_client.go | 4 ++++ 4 files changed, 24 insertions(+) diff --git a/beacon-chain/blockchain/process_block_helpers.go b/beacon-chain/blockchain/process_block_helpers.go index 7b9a104b222..838bb6bc9b3 100644 --- a/beacon-chain/blockchain/process_block_helpers.go +++ b/beacon-chain/blockchain/process_block_helpers.go @@ -182,6 +182,7 @@ func (s *Service) processLightClientFinalityUpdate( } } + log.Info("LC: storing new finality update post-block") s.lcStore.LastLCFinalityUpdate = update s.cfg.StateNotifier.StateFeed().Send(&feed.Event{ @@ -224,6 +225,7 @@ func (s *Service) processLightClientOptimisticUpdate(ctx context.Context, signed } } + log.Info("LC: storing new optimistic update post-block") s.lcStore.LastLCOptimisticUpdate = update s.cfg.StateNotifier.StateFeed().Send(&feed.Event{ diff --git a/beacon-chain/sync/rpc_light_client.go b/beacon-chain/sync/rpc_light_client.go index 91ae1162608..6f50bc9e9d8 100644 --- a/beacon-chain/sync/rpc_light_client.go +++ b/beacon-chain/sync/rpc_light_client.go @@ -24,6 +24,8 @@ func (s *Service) lightClientBootstrapRPCHandler(ctx context.Context, msg interf // TODO: What should we log? log := log.WithField("handler", p2p.LightClientBootstrapName[1:]) // slice the leading slash off the name var + log.Info("LC: lightClientBootstrapRPCHandler invoked") + SetRPCStreamDeadlines(stream) if err := s.rateLimiter.validateRequest(stream, 1); err != nil { return err @@ -50,6 +52,8 @@ func (s *Service) lightClientBootstrapRPCHandler(ctx context.Context, msg interf return err } + log.Info("LC: lightClientBootstrapRPCHandler completed") + closeStream(stream, log) return nil } @@ -64,6 +68,8 @@ func (s *Service) lightClientUpdatesByRangeRPCHandler(ctx context.Context, msg i // TODO: What should we log? log := log.WithField("handler", p2p.LightClientUpdatesByRangeName[1:]) // slice the leading slash off the name var + log.Info("LC: lightClientUpdatesByRangeRPCHandler invoked") + SetRPCStreamDeadlines(stream) if err := s.rateLimiter.validateRequest(stream, 1); err != nil { return err @@ -104,6 +110,8 @@ func (s *Service) lightClientUpdatesByRangeRPCHandler(ctx context.Context, msg i s.rateLimiter.add(stream, 1) } + log.Info("LC: lightClientUpdatesByRangeRPCHandler completed") + closeStream(stream, log) return nil } @@ -118,6 +126,8 @@ func (s *Service) lightClientFinalityUpdateRPCHandler(ctx context.Context, _ int // TODO: What should we log? log := log.WithField("handler", p2p.LightClientFinalityUpdateName[1:]) // slice the leading slash off the name var + log.Info("LC: lightClientFinalityUpdateRPCHandler invoked") + SetRPCStreamDeadlines(stream) if err := s.rateLimiter.validateRequest(stream, 1); err != nil { return err @@ -136,6 +146,8 @@ func (s *Service) lightClientFinalityUpdateRPCHandler(ctx context.Context, _ int return err } + log.Info("LC: lightClientFinalityUpdateRPCHandler completed") + closeStream(stream, log) return nil } @@ -150,6 +162,8 @@ func (s *Service) lightClientOptimisticUpdateRPCHandler(ctx context.Context, _ i // TODO: What should we log? log := log.WithField("handler", p2p.LightClientOptimisticUpdateName[1:]) // slice the leading slash off the name var + log.Info("LC: lightClientOptimisticUpdateRPCHandler invoked") + SetRPCStreamDeadlines(stream) if err := s.rateLimiter.validateRequest(stream, 1); err != nil { return err @@ -168,6 +182,8 @@ func (s *Service) lightClientOptimisticUpdateRPCHandler(ctx context.Context, _ i return err } + log.Info("LC: lightClientOptimisticUpdateRPCHandler completed") + closeStream(stream, log) return nil } diff --git a/beacon-chain/sync/subscriber_light_client.go b/beacon-chain/sync/subscriber_light_client.go index 154436312e8..8f7546c8f4b 100644 --- a/beacon-chain/sync/subscriber_light_client.go +++ b/beacon-chain/sync/subscriber_light_client.go @@ -16,6 +16,7 @@ func (s *Service) lightClientFinalityUpdateSubscriber(_ context.Context, msg pro return fmt.Errorf("message type %T is not a light client finality update", msg) } + log.Info("LC: storing new finality update in p2p subscriber") s.lcStore.LastLCFinalityUpdate = update s.cfg.stateNotifier.StateFeed().Send(&feed.Event{ @@ -32,6 +33,7 @@ func (s *Service) lightClientOptimisticUpdateSubscriber(_ context.Context, msg p return fmt.Errorf("message type %T is not a light client optimistic update", msg) } + log.Info("LC: storing new optimistic update in p2p subscriber") s.lcStore.LastLCOptimisticUpdate = update s.cfg.stateNotifier.StateFeed().Send(&feed.Event{ diff --git a/beacon-chain/sync/validate_light_client.go b/beacon-chain/sync/validate_light_client.go index d09db291c1e..5634c43b7f5 100644 --- a/beacon-chain/sync/validate_light_client.go +++ b/beacon-chain/sync/validate_light_client.go @@ -29,6 +29,8 @@ func (s *Service) validateLightClientFinalityUpdate(ctx context.Context, pid pee _, span := trace.StartSpan(ctx, "sync.validateLightClientFinalityUpdate") defer span.End() + log.Info("LC: p2p validateLightClientFinalityUpdate invoked") + m, err := s.decodePubsubMessage(msg) if err != nil { tracing.AnnotateError(span, err) @@ -91,6 +93,8 @@ func (s *Service) validateLightClientOptimisticUpdate(ctx context.Context, pid p _, span := trace.StartSpan(ctx, "sync.validateLightClientOptimisticUpdate") defer span.End() + log.Info("LC: p2p validateLightClientOptimisticUpdate invoked") + m, err := s.decodePubsubMessage(msg) if err != nil { tracing.AnnotateError(span, err) From d3936677e62555e3890553b52d1096e5a15d6364 Mon Sep 17 00:00:00 2001 From: Inspector-Butters Date: Tue, 5 Nov 2024 20:29:06 +0100 Subject: [PATCH 22/26] move create lc bootstrap to core --- api/server/structs/conversions_lightclient.go | 28 ++++ beacon-chain/core/light-client/lightclient.go | 132 ++++++++++++++++++ beacon-chain/rpc/eth/light-client/helpers.go | 80 +---------- consensus-types/interfaces/light_client.go | 3 + consensus-types/light-client/bootstrap.go | 112 +++++++++++++++ 5 files changed, 279 insertions(+), 76 deletions(-) diff --git a/api/server/structs/conversions_lightclient.go b/api/server/structs/conversions_lightclient.go index 2fc3d70e0c2..e5b525c1f80 100644 --- a/api/server/structs/conversions_lightclient.go +++ b/api/server/structs/conversions_lightclient.go @@ -177,3 +177,31 @@ func lightClientHeaderToJSON(header interfaces.LightClientHeader) (json.RawMessa return json.Marshal(result) } + +func LightClientBootstrapFromConsensus(bootstrap interfaces.LightClientBootstrap) (*LightClientBootstrap, error) { + header, err := lightClientHeaderToJSON(bootstrap.Header()) + if err != nil { + return nil, errors.Wrap(err, "could not marshal light client header") + } + + var scBranch [][32]byte + if bootstrap.Version() >= version.Electra { + b, err := bootstrap.CurrentSyncCommitteeBranchElectra() + if err != nil { + return nil, err + } + scBranch = b[:] + } else { + b, err := bootstrap.CurrentSyncCommitteeBranch() + if err != nil { + return nil, err + } + scBranch = b[:] + } + + return &LightClientBootstrap{ + Header: header, + CurrentSyncCommittee: SyncCommitteeFromConsensus(bootstrap.CurrentSyncCommittee()), + CurrentSyncCommitteeBranch: branchToJSON(scBranch), + }, nil +} diff --git a/beacon-chain/core/light-client/lightclient.go b/beacon-chain/core/light-client/lightclient.go index 2bf97ddb4d3..db6ab856f6c 100644 --- a/beacon-chain/core/light-client/lightclient.go +++ b/beacon-chain/core/light-client/lightclient.go @@ -672,3 +672,135 @@ func IsBetterUpdate(newUpdate, oldUpdate interfaces.LightClientUpdate) (bool, er return newUpdate.SignatureSlot() < oldUpdate.SignatureSlot(), nil } + +func CreateLightClientBootstrap( + ctx context.Context, + currentSlot primitives.Slot, + state state.BeaconState, + block interfaces.ReadOnlySignedBeaconBlock, +) (interfaces.LightClientBootstrap, error) { + // assert compute_epoch_at_slot(state.slot) >= ALTAIR_FORK_EPOCH + if slots.ToEpoch(state.Slot()) < params.BeaconConfig().AltairForkEpoch { + return nil, fmt.Errorf("light client bootstrap is not supported before Altair, invalid slot %d", state.Slot()) + } + + // assert state.slot == state.latest_block_header.slot + latestBlockHeader := state.LatestBlockHeader() + if state.Slot() != latestBlockHeader.Slot { + return nil, fmt.Errorf("state slot %d not equal to latest block header slot %d", state.Slot(), latestBlockHeader.Slot) + } + + // header.state_root = hash_tree_root(state) + stateRoot, err := state.HashTreeRoot(ctx) + if err != nil { + return nil, errors.Wrap(err, "could not get state root") + } + latestBlockHeader.StateRoot = stateRoot[:] + + // assert hash_tree_root(header) == hash_tree_root(block.message) + latestBlockHeaderRoot, err := latestBlockHeader.HashTreeRoot() + if err != nil { + return nil, errors.Wrap(err, "could not get latest block header root") + } + beaconBlockRoot, err := block.Block().HashTreeRoot() + if err != nil { + return nil, errors.Wrap(err, "could not get block root") + } + if latestBlockHeaderRoot != beaconBlockRoot { + return nil, fmt.Errorf("latest block header root %#x not equal to block root %#x", latestBlockHeaderRoot, beaconBlockRoot) + } + + bootstrap, err := CreateDefaultLightClientBootstrap(currentSlot) + if err != nil { + return nil, errors.Wrap(err, "could not create default light client bootstrap") + } + + lightClientHeader, err := BlockToLightClientHeader(ctx, currentSlot, block) + if err != nil { + return nil, errors.Wrap(err, "could not convert block to light client header") + } + + err = bootstrap.SetHeader(lightClientHeader) + if err != nil { + return nil, errors.Wrap(err, "could not set header") + } + + currentSyncCommittee, err := state.CurrentSyncCommittee() + if err != nil { + return nil, errors.Wrap(err, "could not get current sync committee") + } + + err = bootstrap.SetCurrentSyncCommittee(currentSyncCommittee) + if err != nil { + return nil, errors.Wrap(err, "could not set current sync committee") + } + + currentSyncCommitteeProof, err := state.CurrentSyncCommitteeProof(ctx) + if err != nil { + return nil, errors.Wrap(err, "could not get current sync committee proof") + } + + err = bootstrap.SetCurrentSyncCommitteeBranch(currentSyncCommitteeProof) + if err != nil { + return nil, errors.Wrap(err, "could not set current sync committee proof") + } + + return bootstrap, nil +} + +func CreateDefaultLightClientBootstrap(currentSlot primitives.Slot) (interfaces.LightClientBootstrap, error) { + currentEpoch := slots.ToEpoch(currentSlot) + syncCommitteeSize := params.BeaconConfig().SyncCommitteeSize + pubKeys := make([][]byte, syncCommitteeSize) + for i := uint64(0); i < syncCommitteeSize; i++ { + pubKeys[i] = make([]byte, fieldparams.BLSPubkeyLength) + } + currentSyncCommittee := &pb.SyncCommittee{ + Pubkeys: pubKeys, + AggregatePubkey: make([]byte, fieldparams.BLSPubkeyLength), + } + + var currentSyncCommitteeBranch [][]byte + if currentEpoch < params.BeaconConfig().ElectraForkEpoch { + currentSyncCommitteeBranch = make([][]byte, fieldparams.SyncCommitteeBranchDepth) + for i := 0; i < len(currentSyncCommitteeBranch); i++ { + currentSyncCommitteeBranch[i] = make([]byte, fieldparams.RootLength) + } + } else { + currentSyncCommitteeBranch = make([][]byte, fieldparams.SyncCommitteeBranchDepthElectra) + for i := 0; i < len(currentSyncCommitteeBranch); i++ { + currentSyncCommitteeBranch[i] = make([]byte, fieldparams.RootLength) + } + } + + var m proto.Message + if currentEpoch < params.BeaconConfig().CapellaForkEpoch { + m = &pb.LightClientBootstrapAltair{ + Header: &pb.LightClientHeaderAltair{}, + CurrentSyncCommittee: currentSyncCommittee, + CurrentSyncCommitteeBranch: currentSyncCommitteeBranch, + } + } else if currentEpoch < params.BeaconConfig().DenebForkEpoch { + m = &pb.LightClientBootstrapCapella{ + Header: &pb.LightClientHeaderCapella{}, + CurrentSyncCommittee: currentSyncCommittee, + CurrentSyncCommitteeBranch: currentSyncCommitteeBranch, + } + } else if currentEpoch < params.BeaconConfig().ElectraForkEpoch { + m = &pb.LightClientBootstrapDeneb{ + Header: &pb.LightClientHeaderDeneb{}, + CurrentSyncCommittee: currentSyncCommittee, + CurrentSyncCommitteeBranch: currentSyncCommitteeBranch, + } + } else { + + m = &pb.LightClientBootstrapElectra{ + Header: &pb.LightClientHeaderDeneb{}, + CurrentSyncCommittee: currentSyncCommittee, + CurrentSyncCommitteeBranch: currentSyncCommitteeBranch, + } + + } + + return light_client.NewWrappedBootstrap(m) +} diff --git a/beacon-chain/rpc/eth/light-client/helpers.go b/beacon-chain/rpc/eth/light-client/helpers.go index efaea594b4a..28809391247 100644 --- a/beacon-chain/rpc/eth/light-client/helpers.go +++ b/beacon-chain/rpc/eth/light-client/helpers.go @@ -2,22 +2,13 @@ package lightclient import ( "context" - "encoding/json" - "fmt" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/pkg/errors" - fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams" - "github.com/prysmaticlabs/prysm/v5/config/params" "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" - lightclient "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/light-client" - "github.com/prysmaticlabs/prysm/v5/runtime/version" - "github.com/prysmaticlabs/prysm/v5/api/server/structs" + lightclient "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/light-client" "github.com/prysmaticlabs/prysm/v5/beacon-chain/state" "github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces" - "github.com/prysmaticlabs/prysm/v5/time/slots" ) func createLightClientBootstrap( @@ -26,76 +17,13 @@ func createLightClientBootstrap( state state.BeaconState, block interfaces.ReadOnlySignedBeaconBlock, ) (*structs.LightClientBootstrap, error) { - // assert compute_epoch_at_slot(state.slot) >= ALTAIR_FORK_EPOCH - if slots.ToEpoch(state.Slot()) < params.BeaconConfig().AltairForkEpoch { - return nil, fmt.Errorf("light client bootstrap is not supported before Altair, invalid slot %d", state.Slot()) - } - - // assert state.slot == state.latest_block_header.slot - latestBlockHeader := state.LatestBlockHeader() - if state.Slot() != latestBlockHeader.Slot { - return nil, fmt.Errorf("state slot %d not equal to latest block header slot %d", state.Slot(), latestBlockHeader.Slot) - } - - // header.state_root = hash_tree_root(state) - stateRoot, err := state.HashTreeRoot(ctx) - if err != nil { - return nil, errors.Wrap(err, "could not get state root") - } - latestBlockHeader.StateRoot = stateRoot[:] - - // assert hash_tree_root(header) == hash_tree_root(block.message) - latestBlockHeaderRoot, err := latestBlockHeader.HashTreeRoot() - if err != nil { - return nil, errors.Wrap(err, "could not get latest block header root") - } - beaconBlockRoot, err := block.Block().HashTreeRoot() - if err != nil { - return nil, errors.Wrap(err, "could not get block root") - } - if latestBlockHeaderRoot != beaconBlockRoot { - return nil, fmt.Errorf("latest block header root %#x not equal to block root %#x", latestBlockHeaderRoot, beaconBlockRoot) - } - lightClientHeader, err := lightclient.BlockToLightClientHeader(ctx, currentSlot, block) + bootstrap, err := lightclient.CreateLightClientBootstrap(ctx, currentSlot, state, block) if err != nil { - return nil, errors.Wrap(err, "could not convert block to light client header") - } - - apiLightClientHeader := &structs.LightClientHeader{ - Beacon: structs.BeaconBlockHeaderFromConsensus(lightClientHeader.Beacon()), - } - - headerJSON, err := json.Marshal(apiLightClientHeader) - if err != nil { - return nil, errors.Wrap(err, "could not convert header to raw message") - } - currentSyncCommittee, err := state.CurrentSyncCommittee() - if err != nil { - return nil, errors.Wrap(err, "could not get current sync committee") - } - currentSyncCommitteeProof, err := state.CurrentSyncCommitteeProof(ctx) - if err != nil { - return nil, errors.Wrap(err, "could not get current sync committee proof") - } - - var branch []string - if state.Version() >= version.Electra { - branch = make([]string, fieldparams.SyncCommitteeBranchDepthElectra) - } else { - branch = make([]string, fieldparams.SyncCommitteeBranchDepth) - } - for i, proof := range currentSyncCommitteeProof { - branch[i] = hexutil.Encode(proof) - } - - result := &structs.LightClientBootstrap{ - Header: headerJSON, - CurrentSyncCommittee: structs.SyncCommitteeFromConsensus(currentSyncCommittee), - CurrentSyncCommitteeBranch: branch, + return nil, err } - return result, nil + return structs.LightClientBootstrapFromConsensus(bootstrap) } func newLightClientFinalityUpdateFromBeaconState( diff --git a/consensus-types/interfaces/light_client.go b/consensus-types/interfaces/light_client.go index b0d0dadaa2e..ccc9cbbcadc 100644 --- a/consensus-types/interfaces/light_client.go +++ b/consensus-types/interfaces/light_client.go @@ -27,8 +27,11 @@ type LightClientBootstrap interface { ssz.Marshaler Version() int Header() LightClientHeader + SetHeader(header LightClientHeader) error CurrentSyncCommittee() *pb.SyncCommittee + SetCurrentSyncCommittee(sc *pb.SyncCommittee) error CurrentSyncCommitteeBranch() (LightClientSyncCommitteeBranch, error) + SetCurrentSyncCommitteeBranch(branch [][]byte) error CurrentSyncCommitteeBranchElectra() (LightClientSyncCommitteeBranchElectra, error) } diff --git a/consensus-types/light-client/bootstrap.go b/consensus-types/light-client/bootstrap.go index 1de819266d0..b2fc3dfae06 100644 --- a/consensus-types/light-client/bootstrap.go +++ b/consensus-types/light-client/bootstrap.go @@ -81,14 +81,42 @@ func (h *bootstrapAltair) Header() interfaces.LightClientHeader { return h.header } +func (h *bootstrapAltair) SetHeader(header interfaces.LightClientHeader) error { + p, ok := (header.Proto()).(*pb.LightClientHeaderAltair) + if !ok { + return fmt.Errorf("header type %T is not %T", p, &pb.LightClientHeaderAltair{}) + } + h.p.Header = p + h.header = header + return nil +} + func (h *bootstrapAltair) CurrentSyncCommittee() *pb.SyncCommittee { return h.p.CurrentSyncCommittee } +func (h *bootstrapAltair) SetCurrentSyncCommittee(sc *pb.SyncCommittee) error { + h.p.CurrentSyncCommittee = sc + return nil +} + func (h *bootstrapAltair) CurrentSyncCommitteeBranch() (interfaces.LightClientSyncCommitteeBranch, error) { return h.currentSyncCommitteeBranch, nil } +func (h *bootstrapAltair) SetCurrentSyncCommitteeBranch(branch [][]byte) error { + if len(branch) != fieldparams.SyncCommitteeBranchDepth { + return fmt.Errorf("branch length %d is not %d", len(branch), fieldparams.SyncCommitteeBranchDepth) + } + newBranch := [fieldparams.SyncCommitteeBranchDepth][32]byte{} + for i, root := range branch { + copy(newBranch[i][:], root) + } + h.currentSyncCommitteeBranch = newBranch + h.p.CurrentSyncCommitteeBranch = branch + return nil +} + func (h *bootstrapAltair) CurrentSyncCommitteeBranchElectra() (interfaces.LightClientSyncCommitteeBranchElectra, error) { return [6][32]byte{}, consensustypes.ErrNotSupported("CurrentSyncCommitteeBranchElectra", version.Altair) } @@ -145,14 +173,42 @@ func (h *bootstrapCapella) Header() interfaces.LightClientHeader { return h.header } +func (h *bootstrapCapella) SetHeader(header interfaces.LightClientHeader) error { + p, ok := (header.Proto()).(*pb.LightClientHeaderCapella) + if !ok { + return fmt.Errorf("header type %T is not %T", p, &pb.LightClientHeaderCapella{}) + } + h.p.Header = p + h.header = header + return nil +} + func (h *bootstrapCapella) CurrentSyncCommittee() *pb.SyncCommittee { return h.p.CurrentSyncCommittee } +func (h *bootstrapCapella) SetCurrentSyncCommittee(sc *pb.SyncCommittee) error { + h.p.CurrentSyncCommittee = sc + return nil +} + func (h *bootstrapCapella) CurrentSyncCommitteeBranch() (interfaces.LightClientSyncCommitteeBranch, error) { return h.currentSyncCommitteeBranch, nil } +func (h *bootstrapCapella) SetCurrentSyncCommitteeBranch(branch [][]byte) error { + if len(branch) != fieldparams.SyncCommitteeBranchDepth { + return fmt.Errorf("branch length %d is not %d", len(branch), fieldparams.SyncCommitteeBranchDepth) + } + newBranch := [fieldparams.SyncCommitteeBranchDepth][32]byte{} + for i, root := range branch { + copy(newBranch[i][:], root) + } + h.currentSyncCommitteeBranch = newBranch + h.p.CurrentSyncCommitteeBranch = branch + return nil +} + func (h *bootstrapCapella) CurrentSyncCommitteeBranchElectra() (interfaces.LightClientSyncCommitteeBranchElectra, error) { return [6][32]byte{}, consensustypes.ErrNotSupported("CurrentSyncCommitteeBranchElectra", version.Capella) } @@ -209,14 +265,42 @@ func (h *bootstrapDeneb) Header() interfaces.LightClientHeader { return h.header } +func (h *bootstrapDeneb) SetHeader(header interfaces.LightClientHeader) error { + p, ok := (header.Proto()).(*pb.LightClientHeaderDeneb) + if !ok { + return fmt.Errorf("header type %T is not %T", p, &pb.LightClientHeaderDeneb{}) + } + h.p.Header = p + h.header = header + return nil +} + func (h *bootstrapDeneb) CurrentSyncCommittee() *pb.SyncCommittee { return h.p.CurrentSyncCommittee } +func (h *bootstrapDeneb) SetCurrentSyncCommittee(sc *pb.SyncCommittee) error { + h.p.CurrentSyncCommittee = sc + return nil +} + func (h *bootstrapDeneb) CurrentSyncCommitteeBranch() (interfaces.LightClientSyncCommitteeBranch, error) { return h.currentSyncCommitteeBranch, nil } +func (h *bootstrapDeneb) SetCurrentSyncCommitteeBranch(branch [][]byte) error { + if len(branch) != fieldparams.SyncCommitteeBranchDepth { + return fmt.Errorf("branch length %d is not %d", len(branch), fieldparams.SyncCommitteeBranchDepth) + } + newBranch := [fieldparams.SyncCommitteeBranchDepth][32]byte{} + for i, root := range branch { + copy(newBranch[i][:], root) + } + h.currentSyncCommitteeBranch = newBranch + h.p.CurrentSyncCommitteeBranch = branch + return nil +} + func (h *bootstrapDeneb) CurrentSyncCommitteeBranchElectra() (interfaces.LightClientSyncCommitteeBranchElectra, error) { return [6][32]byte{}, consensustypes.ErrNotSupported("CurrentSyncCommitteeBranchElectra", version.Deneb) } @@ -273,14 +357,42 @@ func (h *bootstrapElectra) Header() interfaces.LightClientHeader { return h.header } +func (h *bootstrapElectra) SetHeader(header interfaces.LightClientHeader) error { + p, ok := (header.Proto()).(*pb.LightClientHeaderDeneb) + if !ok { + return fmt.Errorf("header type %T is not %T", p, &pb.LightClientHeaderDeneb{}) + } + h.p.Header = p + h.header = header + return nil +} + func (h *bootstrapElectra) CurrentSyncCommittee() *pb.SyncCommittee { return h.p.CurrentSyncCommittee } +func (h *bootstrapElectra) SetCurrentSyncCommittee(sc *pb.SyncCommittee) error { + h.p.CurrentSyncCommittee = sc + return nil +} + func (h *bootstrapElectra) CurrentSyncCommitteeBranch() (interfaces.LightClientSyncCommitteeBranch, error) { return [5][32]byte{}, consensustypes.ErrNotSupported("CurrentSyncCommitteeBranch", version.Electra) } +func (h *bootstrapElectra) SetCurrentSyncCommitteeBranch(branch [][]byte) error { + if len(branch) != fieldparams.SyncCommitteeBranchDepthElectra { + return fmt.Errorf("branch length %d is not %d", len(branch), fieldparams.SyncCommitteeBranchDepthElectra) + } + newBranch := [fieldparams.SyncCommitteeBranchDepthElectra][32]byte{} + for i, root := range branch { + copy(newBranch[i][:], root) + } + h.currentSyncCommitteeBranch = newBranch + h.p.CurrentSyncCommitteeBranch = branch + return nil +} + func (h *bootstrapElectra) CurrentSyncCommitteeBranchElectra() (interfaces.LightClientSyncCommitteeBranchElectra, error) { return h.currentSyncCommitteeBranch, nil } From 97df300e666db36d2eb6a3c0d1b51a3048a867a5 Mon Sep 17 00:00:00 2001 From: Inspector-Butters Date: Tue, 5 Nov 2024 21:16:25 +0100 Subject: [PATCH 23/26] bootstrap db --- beacon-chain/db/iface/interface.go | 2 + beacon-chain/db/kv/lightclient.go | 91 +++++++++++++++++++++++++++++- beacon-chain/db/kv/schema.go | 3 +- 3 files changed, 92 insertions(+), 4 deletions(-) diff --git a/beacon-chain/db/iface/interface.go b/beacon-chain/db/iface/interface.go index fc2ef7af4fa..5e2c88f3104 100644 --- a/beacon-chain/db/iface/interface.go +++ b/beacon-chain/db/iface/interface.go @@ -59,6 +59,8 @@ type ReadOnlyDatabase interface { // light client operations LightClientUpdates(ctx context.Context, startPeriod, endPeriod uint64) (map[uint64]interfaces.LightClientUpdate, error) LightClientUpdate(ctx context.Context, period uint64) (interfaces.LightClientUpdate, error) + SaveLightClientBootstrap(ctx context.Context, blockRoot []byte, bootstrap interfaces.LightClientBootstrap) error + LightClientBootstrap(ctx context.Context, blockRoot []byte) (interfaces.LightClientBootstrap, error) // origin checkpoint sync support OriginCheckpointBlockRoot(ctx context.Context) ([32]byte, error) diff --git a/beacon-chain/db/kv/lightclient.go b/beacon-chain/db/kv/lightclient.go index f4cf94668d3..fdeaa618861 100644 --- a/beacon-chain/db/kv/lightclient.go +++ b/beacon-chain/db/kv/lightclient.go @@ -31,6 +31,91 @@ func (s *Store) SaveLightClientUpdate(ctx context.Context, period uint64, update }) } +func (s *Store) SaveLightClientBootstrap(ctx context.Context, blockRoot []byte, bootstrap interfaces.LightClientBootstrap) error { + _, span := trace.StartSpan(ctx, "BeaconDB.SaveLightClientBootstrap") + defer span.End() + + return s.db.Update(func(tx *bolt.Tx) error { + bkt := tx.Bucket(lightclientBootstrapBucket) + enc, err := encodeLightClientBootstrap(bootstrap) + if err != nil { + return err + } + return bkt.Put(blockRoot, enc) + }) +} + +func (s *Store) LightClientBootstrap(ctx context.Context, blockRoot []byte) (interfaces.LightClientBootstrap, error) { + _, span := trace.StartSpan(ctx, "BeaconDB.LightClientBootstrap") + defer span.End() + + var bootstrap interfaces.LightClientBootstrap + err := s.db.View(func(tx *bolt.Tx) error { + bkt := tx.Bucket(lightclientBootstrapBucket) + enc := bkt.Get(blockRoot) + if enc == nil { + return nil + } + var err error + bootstrap, err = decodeLightClientBootstrap(enc) + return err + }) + return bootstrap, err +} + +func encodeLightClientBootstrap(bootstrap interfaces.LightClientBootstrap) ([]byte, error) { + key, err := keyForLightClientUpdate(bootstrap.Version()) + if err != nil { + return nil, err + } + enc, err := bootstrap.MarshalSSZ() + if err != nil { + return nil, errors.Wrap(err, "could not marshal light client bootstrap") + } + fullEnc := make([]byte, len(key)+len(enc)) + copy(fullEnc, key) + copy(fullEnc[len(key):], enc) + return snappy.Encode(nil, fullEnc), nil +} + +func decodeLightClientBootstrap(enc []byte) (interfaces.LightClientBootstrap, error) { + var err error + enc, err = snappy.Decode(nil, enc) + if err != nil { + return nil, errors.Wrap(err, "could not snappy decode light client bootstrap") + } + var m proto.Message + switch { + case hasAltairKey(enc): + bootstrap := ðpb.LightClientBootstrapAltair{} + if err := bootstrap.UnmarshalSSZ(enc[len(altairKey):]); err != nil { + return nil, errors.Wrap(err, "could not unmarshal Altair light client bootstrap") + } + m = bootstrap + case hasCapellaKey(enc): + bootstrap := ðpb.LightClientBootstrapCapella{} + if err := bootstrap.UnmarshalSSZ(enc[len(capellaKey):]); err != nil { + return nil, errors.Wrap(err, "could not unmarshal Capella light client bootstrap") + } + m = bootstrap + case hasDenebKey(enc): + bootstrap := ðpb.LightClientBootstrapDeneb{} + if err := bootstrap.UnmarshalSSZ(enc[len(denebKey):]); err != nil { + return nil, errors.Wrap(err, "could not unmarshal Deneb light client bootstrap") + } + m = bootstrap + case hasElectraKey(enc): + bootstrap := ðpb.LightClientBootstrapElectra{} + if err := bootstrap.UnmarshalSSZ(enc[len(electraKey):]); err != nil { + return nil, errors.Wrap(err, "could not unmarshal Electra light client bootstrap") + } + m = bootstrap + default: + return nil, errors.New("decoding of saved light client bootstrap is unsupported") + } + return light_client.NewWrappedBootstrap(m) +} + func (s *Store) LightClientUpdates(ctx context.Context, startPeriod, endPeriod uint64) (map[uint64]interfaces.LightClientUpdate, error) { _, span := trace.StartSpan(ctx, "BeaconDB.LightClientUpdates") defer span.End() @@ -87,7 +172,7 @@ func (s *Store) LightClientUpdate(ctx context.Context, period uint64) (interface } func encodeLightClientUpdate(update interfaces.LightClientUpdate) ([]byte, error) { - key, err := keyForLightClientUpdate(update) + key, err := keyForLightClientUpdate(update.Version()) if err != nil { return nil, err } @@ -139,8 +224,8 @@ func decodeLightClientUpdate(enc []byte) (interfaces.LightClientUpdate, error) { return light_client.NewWrappedUpdate(m) } -func keyForLightClientUpdate(update interfaces.LightClientUpdate) ([]byte, error) { - switch v := update.Version(); v { +func keyForLightClientUpdate(v int) ([]byte, error) { + switch v { case version.Electra: return electraKey, nil case version.Deneb: diff --git a/beacon-chain/db/kv/schema.go b/beacon-chain/db/kv/schema.go index 30d950514ca..60f978638de 100644 --- a/beacon-chain/db/kv/schema.go +++ b/beacon-chain/db/kv/schema.go @@ -18,7 +18,8 @@ var ( registrationBucket = []byte("registration") // Light Client Updates Bucket - lightClientUpdatesBucket = []byte("light-client-updates") + lightClientUpdatesBucket = []byte("light-client-updates") + lightclientBootstrapBucket = []byte("light-client-bootstrap") // Deprecated: This bucket was migrated in PR 6461. Do not use, except for migrations. slotsHasObjectBucket = []byte("slots-has-objects") From 852b022c6e209e55e05b835d49ca41c2ea7837db Mon Sep 17 00:00:00 2001 From: Inspector-Butters Date: Tue, 5 Nov 2024 21:23:28 +0100 Subject: [PATCH 24/26] save bootstrap --- .../blockchain/process_block_helpers.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/beacon-chain/blockchain/process_block_helpers.go b/beacon-chain/blockchain/process_block_helpers.go index fa320882d8d..77c0398d215 100644 --- a/beacon-chain/blockchain/process_block_helpers.go +++ b/beacon-chain/blockchain/process_block_helpers.go @@ -188,6 +188,25 @@ func (s *Service) saveLightClientUpdate(cfg *postBlockProcessConfig) { } +// saveLightClientBootstrap saves a light client bootstrap for this block +// when feature flag is enabled. +func (s *Service) saveLightClientBootstrap(cfg *postBlockProcessConfig) { + if !features.Get().EnableLightClient { + return + } + + blockRoot := cfg.roblock.Root() + bootstrap, err := lightclient.CreateLightClientBootstrap(cfg.ctx, s.CurrentSlot(), cfg.postState, cfg.roblock) + if err != nil { + log.WithError(err).Error("Could not create light client bootstrap") + return + } + err = s.cfg.BeaconDB.SaveLightClientBootstrap(cfg.ctx, blockRoot[:], bootstrap) + if err != nil { + log.WithError(err).Error("Could not save light client bootstrap") + } +} + func (s *Service) tryPublishLightClientFinalityUpdate( ctx context.Context, signed interfaces.ReadOnlySignedBeaconBlock, From 9d70436c0b0f84e1af26a110494decbe54475cdc Mon Sep 17 00:00:00 2001 From: rkapka Date: Wed, 6 Nov 2024 15:14:50 +0700 Subject: [PATCH 25/26] debugging --- beacon-chain/blockchain/process_block_helpers.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/beacon-chain/blockchain/process_block_helpers.go b/beacon-chain/blockchain/process_block_helpers.go index 497795e27db..0f5fa0b661c 100644 --- a/beacon-chain/blockchain/process_block_helpers.go +++ b/beacon-chain/blockchain/process_block_helpers.go @@ -183,6 +183,9 @@ func (s *Service) saveLightClientUpdate(cfg *postBlockProcessConfig) error { if err = s.cfg.BeaconDB.SaveLightClientUpdate(cfg.ctx, period, update); err != nil { return errors.Wrap(err, "could not save light client update") } + log.Info("LC: saved light client update") + } else { + log.Info("LC: skipped saving light client update") } } @@ -199,6 +202,7 @@ func (s *Service) saveLightClientBootstrap(cfg *postBlockProcessConfig) error { if err = s.cfg.BeaconDB.SaveLightClientBootstrap(cfg.ctx, blockRoot[:], bootstrap); err != nil { return errors.Wrap(err, "could not save light client bootstrap") } + log.Info("LC: saved light client bootstrap") return nil } From 54f51df902c2b54e6c3d084dcaf36fa76fc22196 Mon Sep 17 00:00:00 2001 From: rkapka Date: Wed, 6 Nov 2024 20:10:58 +0700 Subject: [PATCH 26/26] bootstrp and updatesByRange working --- .../blockchain/process_block_helpers.go | 8 ++- beacon-chain/core/light-client/lightclient.go | 26 ++++------ beacon-chain/db/kv/kv.go | 1 + beacon-chain/db/kv/lightclient.go | 4 +- beacon-chain/db/kv/schema.go | 2 +- beacon-chain/p2p/rpc_topic_mappings.go | 20 +++++--- beacon-chain/p2p/types/types.go | 49 ++----------------- beacon-chain/sync/BUILD.bazel | 1 - beacon-chain/sync/rate_limiter.go | 6 +++ beacon-chain/sync/rpc_light_client.go | 33 ++++++++++--- consensus-types/light-client/bootstrap.go | 48 +++++++++++++----- 11 files changed, 103 insertions(+), 95 deletions(-) diff --git a/beacon-chain/blockchain/process_block_helpers.go b/beacon-chain/blockchain/process_block_helpers.go index 0f5fa0b661c..d2dabdcd29a 100644 --- a/beacon-chain/blockchain/process_block_helpers.go +++ b/beacon-chain/blockchain/process_block_helpers.go @@ -133,6 +133,8 @@ func (s *Service) saveLightClientUpdates(cfg *postBlockProcessConfig) { // saveLightClientUpdate saves the light client update for a block // if it's better than the already saved one. func (s *Service) saveLightClientUpdate(cfg *postBlockProcessConfig) error { + log.Info("LC: saving light client update") + attestedRoot := cfg.roblock.Block().ParentRoot() attestedBlock, err := s.getBlock(cfg.ctx, attestedRoot) if err != nil { @@ -163,6 +165,9 @@ func (s *Service) saveLightClientUpdate(cfg *postBlockProcessConfig) error { attestedBlock, finalizedBlock, ) + if err != nil { + return errors.Wrap(err, "could not create light client update") + } period := uint64(attestedState.Slot()) / (uint64(params.BeaconConfig().SlotsPerEpoch) * uint64(params.BeaconConfig().EpochsPerSyncCommitteePeriod)) @@ -194,6 +199,7 @@ func (s *Service) saveLightClientUpdate(cfg *postBlockProcessConfig) error { // saveLightClientBootstrap saves a light client bootstrap for a block. func (s *Service) saveLightClientBootstrap(cfg *postBlockProcessConfig) error { + log.Info("LC: saving light client bootstrap") blockRoot := cfg.roblock.Root() bootstrap, err := lightclient.CreateLightClientBootstrap(cfg.ctx, s.CurrentSlot(), cfg.postState, cfg.roblock) if err != nil { @@ -202,7 +208,7 @@ func (s *Service) saveLightClientBootstrap(cfg *postBlockProcessConfig) error { if err = s.cfg.BeaconDB.SaveLightClientBootstrap(cfg.ctx, blockRoot[:], bootstrap); err != nil { return errors.Wrap(err, "could not save light client bootstrap") } - log.Info("LC: saved light client bootstrap") + log.Infof("LC: saved light client bootstrap for root %#x", blockRoot) return nil } diff --git a/beacon-chain/core/light-client/lightclient.go b/beacon-chain/core/light-client/lightclient.go index c8608ea059a..e2933430ccd 100644 --- a/beacon-chain/core/light-client/lightclient.go +++ b/beacon-chain/core/light-client/lightclient.go @@ -808,7 +808,7 @@ func CreateLightClientBootstrap( return nil, fmt.Errorf("latest block header root %#x not equal to block root %#x", latestBlockHeaderRoot, beaconBlockRoot) } - bootstrap, err := CreateDefaultLightClientBootstrap(currentSlot) + bootstrap, err := createDefaultLightClientBootstrap(currentSlot) if err != nil { return nil, errors.Wrap(err, "could not create default light client bootstrap") } @@ -846,7 +846,7 @@ func CreateLightClientBootstrap( return bootstrap, nil } -func CreateDefaultLightClientBootstrap(currentSlot primitives.Slot) (interfaces.LightClientBootstrap, error) { +func createDefaultLightClientBootstrap(currentSlot primitives.Slot) (interfaces.LightClientBootstrap, error) { currentEpoch := slots.ToEpoch(currentSlot) syncCommitteeSize := params.BeaconConfig().SyncCommitteeSize pubKeys := make([][]byte, syncCommitteeSize) @@ -859,45 +859,37 @@ func CreateDefaultLightClientBootstrap(currentSlot primitives.Slot) (interfaces. } var currentSyncCommitteeBranch [][]byte - if currentEpoch < params.BeaconConfig().ElectraForkEpoch { - currentSyncCommitteeBranch = make([][]byte, fieldparams.SyncCommitteeBranchDepth) - for i := 0; i < len(currentSyncCommitteeBranch); i++ { - currentSyncCommitteeBranch[i] = make([]byte, fieldparams.RootLength) - } - } else { + if currentEpoch >= params.BeaconConfig().ElectraForkEpoch { currentSyncCommitteeBranch = make([][]byte, fieldparams.SyncCommitteeBranchDepthElectra) - for i := 0; i < len(currentSyncCommitteeBranch); i++ { - currentSyncCommitteeBranch[i] = make([]byte, fieldparams.RootLength) - } + } else { + currentSyncCommitteeBranch = make([][]byte, fieldparams.SyncCommitteeBranchDepth) + } + for i := 0; i < len(currentSyncCommitteeBranch); i++ { + currentSyncCommitteeBranch[i] = make([]byte, fieldparams.RootLength) } + // TODO: can this be based on the current epoch? var m proto.Message if currentEpoch < params.BeaconConfig().CapellaForkEpoch { m = &pb.LightClientBootstrapAltair{ - Header: &pb.LightClientHeaderAltair{}, CurrentSyncCommittee: currentSyncCommittee, CurrentSyncCommitteeBranch: currentSyncCommitteeBranch, } } else if currentEpoch < params.BeaconConfig().DenebForkEpoch { m = &pb.LightClientBootstrapCapella{ - Header: &pb.LightClientHeaderCapella{}, CurrentSyncCommittee: currentSyncCommittee, CurrentSyncCommitteeBranch: currentSyncCommitteeBranch, } } else if currentEpoch < params.BeaconConfig().ElectraForkEpoch { m = &pb.LightClientBootstrapDeneb{ - Header: &pb.LightClientHeaderDeneb{}, CurrentSyncCommittee: currentSyncCommittee, CurrentSyncCommitteeBranch: currentSyncCommitteeBranch, } } else { - m = &pb.LightClientBootstrapElectra{ - Header: &pb.LightClientHeaderDeneb{}, CurrentSyncCommittee: currentSyncCommittee, CurrentSyncCommitteeBranch: currentSyncCommitteeBranch, } - } return light_client.NewWrappedBootstrap(m) diff --git a/beacon-chain/db/kv/kv.go b/beacon-chain/db/kv/kv.go index 63e49e30485..128b17eddf2 100644 --- a/beacon-chain/db/kv/kv.go +++ b/beacon-chain/db/kv/kv.go @@ -108,6 +108,7 @@ var Buckets = [][]byte{ stateSummaryBucket, stateValidatorsBucket, lightClientUpdatesBucket, + lightClientBootstrapBucket, // Indices buckets. blockSlotIndicesBucket, stateSlotIndicesBucket, diff --git a/beacon-chain/db/kv/lightclient.go b/beacon-chain/db/kv/lightclient.go index 4fa44cb6b5c..01bd1513620 100644 --- a/beacon-chain/db/kv/lightclient.go +++ b/beacon-chain/db/kv/lightclient.go @@ -36,7 +36,7 @@ func (s *Store) SaveLightClientBootstrap(ctx context.Context, blockRoot []byte, defer span.End() return s.db.Update(func(tx *bolt.Tx) error { - bkt := tx.Bucket(lightclientBootstrapBucket) + bkt := tx.Bucket(lightClientBootstrapBucket) enc, err := encodeLightClientBootstrap(bootstrap) if err != nil { return err @@ -51,7 +51,7 @@ func (s *Store) LightClientBootstrap(ctx context.Context, blockRoot [32]byte) (i var bootstrap interfaces.LightClientBootstrap err := s.db.View(func(tx *bolt.Tx) error { - bkt := tx.Bucket(lightclientBootstrapBucket) + bkt := tx.Bucket(lightClientBootstrapBucket) enc := bkt.Get(blockRoot[:]) if enc == nil { return nil diff --git a/beacon-chain/db/kv/schema.go b/beacon-chain/db/kv/schema.go index 60f978638de..f6648a8f928 100644 --- a/beacon-chain/db/kv/schema.go +++ b/beacon-chain/db/kv/schema.go @@ -19,7 +19,7 @@ var ( // Light Client Updates Bucket lightClientUpdatesBucket = []byte("light-client-updates") - lightclientBootstrapBucket = []byte("light-client-bootstrap") + lightClientBootstrapBucket = []byte("light-client-bootstrap") // Deprecated: This bucket was migrated in PR 6461. Do not use, except for migrations. slotsHasObjectBucket = []byte("slots-has-objects") diff --git a/beacon-chain/p2p/rpc_topic_mappings.go b/beacon-chain/p2p/rpc_topic_mappings.go index aa2fbb4c376..cd1f811b647 100644 --- a/beacon-chain/p2p/rpc_topic_mappings.go +++ b/beacon-chain/p2p/rpc_topic_mappings.go @@ -140,14 +140,18 @@ var protocolMapping = map[string]bool{ // Maps all the protocol message names for the different rpc // topics. var messageMapping = map[string]bool{ - StatusMessageName: true, - GoodbyeMessageName: true, - BeaconBlocksByRangeMessageName: true, - BeaconBlocksByRootsMessageName: true, - PingMessageName: true, - MetadataMessageName: true, - BlobSidecarsByRangeName: true, - BlobSidecarsByRootName: true, + StatusMessageName: true, + GoodbyeMessageName: true, + BeaconBlocksByRangeMessageName: true, + BeaconBlocksByRootsMessageName: true, + PingMessageName: true, + MetadataMessageName: true, + BlobSidecarsByRangeName: true, + BlobSidecarsByRootName: true, + LightClientBootstrapName: true, + LightClientUpdatesByRangeName: true, + LightClientFinalityUpdateName: true, + LightClientOptimisticUpdateName: true, } // Maps all the RPC messages which are to updated in altair. diff --git a/beacon-chain/p2p/types/types.go b/beacon-chain/p2p/types/types.go index e73dcc28698..537050a7140 100644 --- a/beacon-chain/p2p/types/types.go +++ b/beacon-chain/p2p/types/types.go @@ -5,7 +5,6 @@ package types import ( "bytes" - "encoding/binary" "sort" "github.com/pkg/errors" @@ -219,7 +218,7 @@ func init() { type LightClientBootstrapReq [fieldparams.RootLength]byte // MarshalSSZTo marshals the block by roots request with the provided byte slice. -func (r LightClientBootstrapReq) MarshalSSZTo(dst []byte) ([]byte, error) { +func (r *LightClientBootstrapReq) MarshalSSZTo(dst []byte) ([]byte, error) { marshalledObj, err := r.MarshalSSZ() if err != nil { return nil, err @@ -228,18 +227,18 @@ func (r LightClientBootstrapReq) MarshalSSZTo(dst []byte) ([]byte, error) { } // MarshalSSZ Marshals the block by roots request type into the serialized object. -func (r LightClientBootstrapReq) MarshalSSZ() ([]byte, error) { +func (r *LightClientBootstrapReq) MarshalSSZ() ([]byte, error) { return r[:], nil } // SizeSSZ returns the size of the serialized representation. -func (r LightClientBootstrapReq) SizeSSZ() int { +func (r *LightClientBootstrapReq) SizeSSZ() int { return fieldparams.RootLength } // UnmarshalSSZ unmarshals the provided bytes buffer into the // block by roots request object. -func (r LightClientBootstrapReq) UnmarshalSSZ(buf []byte) error { +func (r *LightClientBootstrapReq) UnmarshalSSZ(buf []byte) error { bufLen := len(buf) if bufLen != fieldparams.RootLength { return errors.Errorf("expected buffer with length of %d but received length %d", fieldparams.RootLength, bufLen) @@ -247,43 +246,3 @@ func (r LightClientBootstrapReq) UnmarshalSSZ(buf []byte) error { copy(r[:], buf) return nil } - -// LightClientUpdatesByRangeReq specifies the block by roots request type. -type LightClientUpdatesByRangeReq struct { - StartPeriod uint64 - Count uint64 -} - -// MarshalSSZTo marshals the light client updates by range request with the provided byte slice. -func (r *LightClientUpdatesByRangeReq) MarshalSSZTo(dst []byte) ([]byte, error) { - marshalledObj, err := r.MarshalSSZ() - if err != nil { - return nil, err - } - return append(dst, marshalledObj...), nil -} - -// MarshalSSZ Marshals the light client updates by range request type into the serialized object. -func (r *LightClientUpdatesByRangeReq) MarshalSSZ() ([]byte, error) { - buf := make([]byte, 0, r.SizeSSZ()) - binary.LittleEndian.AppendUint64(buf, r.StartPeriod) - binary.LittleEndian.AppendUint64(buf, r.Count) - return buf, nil -} - -// SizeSSZ returns the size of the serialized representation. -func (r *LightClientUpdatesByRangeReq) SizeSSZ() int { - return maxLightClientUpdates -} - -// UnmarshalSSZ unmarshals the provided bytes buffer into the -// block by roots request object. -func (r *LightClientUpdatesByRangeReq) UnmarshalSSZ(buf []byte) error { - bufLen := len(buf) - if bufLen != maxLightClientUpdates { - return errors.Errorf("expected buffer with length of %d but received length %d", maxLightClientUpdates, bufLen) - } - r.StartPeriod = binary.LittleEndian.Uint64(buf[0:8]) - r.Count = binary.LittleEndian.Uint64(buf[8:16]) - return nil -} diff --git a/beacon-chain/sync/BUILD.bazel b/beacon-chain/sync/BUILD.bazel index e7299b13ab1..abcb2cd1f3b 100644 --- a/beacon-chain/sync/BUILD.bazel +++ b/beacon-chain/sync/BUILD.bazel @@ -127,7 +127,6 @@ go_library( "//time:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", - "@com_github_ethereum_go_ethereum//common/math:go_default_library", "@com_github_hashicorp_golang_lru//:go_default_library", "@com_github_libp2p_go_libp2p//core:go_default_library", "@com_github_libp2p_go_libp2p//core/host:go_default_library", diff --git a/beacon-chain/sync/rate_limiter.go b/beacon-chain/sync/rate_limiter.go index 636fe54c685..60052b01865 100644 --- a/beacon-chain/sync/rate_limiter.go +++ b/beacon-chain/sync/rate_limiter.go @@ -79,6 +79,12 @@ func newRateLimiter(p2pProvider p2p.P2P) *limiter { // BlobSidecarsByRangeV1 topicMap[addEncoding(p2p.RPCBlobSidecarsByRangeTopicV1)] = blobCollector + // Light client requests + topicMap[addEncoding(p2p.RPCLightClientBootstrapTopicV1)] = leakybucket.NewCollector(1, defaultBurstLimit, leakyBucketPeriod, false /* deleteEmptyBuckets */) + topicMap[addEncoding(p2p.RPCLightClientUpdatesByRangeTopicV1)] = leakybucket.NewCollector(1, defaultBurstLimit, leakyBucketPeriod, false /* deleteEmptyBuckets */) + topicMap[addEncoding(p2p.RPCLightClientOptimisticUpdateTopicV1)] = leakybucket.NewCollector(1, defaultBurstLimit, leakyBucketPeriod, false /* deleteEmptyBuckets */) + topicMap[addEncoding(p2p.RPCLightClientFinalityUpdateTopicV1)] = leakybucket.NewCollector(1, defaultBurstLimit, leakyBucketPeriod, false /* deleteEmptyBuckets */) + // General topic for all rpc requests. topicMap[rpcLimiterTopic] = leakybucket.NewCollector(5, defaultBurstLimit*2, leakyBucketPeriod, false /* deleteEmptyBuckets */) diff --git a/beacon-chain/sync/rpc_light_client.go b/beacon-chain/sync/rpc_light_client.go index 6f50bc9e9d8..626a8aaf036 100644 --- a/beacon-chain/sync/rpc_light_client.go +++ b/beacon-chain/sync/rpc_light_client.go @@ -4,14 +4,13 @@ import ( "context" "fmt" - "github.com/ethereum/go-ethereum/common/math" libp2pcore "github.com/libp2p/go-libp2p/core" - "github.com/pkg/errors" "github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p" "github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p/types" "github.com/prysmaticlabs/prysm/v5/config/params" "github.com/prysmaticlabs/prysm/v5/monitoring/tracing" "github.com/prysmaticlabs/prysm/v5/monitoring/tracing/trace" + eth "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" ) // lightClientBootstrapRPCHandler handles the /eth2/beacon_chain/req/light_client_bootstrap/1/ RPC request. @@ -28,12 +27,14 @@ func (s *Service) lightClientBootstrapRPCHandler(ctx context.Context, msg interf SetRPCStreamDeadlines(stream) if err := s.rateLimiter.validateRequest(stream, 1); err != nil { + log.WithError(err).Error("s.rateLimiter.validateRequest") return err } s.rateLimiter.add(stream, 1) rawMsg, ok := msg.(*types.LightClientBootstrapReq) if !ok { + log.Error("Message is not *types.LightClientBootstrapReq") return fmt.Errorf("message is not type %T", &types.LightClientBootstrapReq{}) } blkRoot := *rawMsg @@ -42,6 +43,13 @@ func (s *Service) lightClientBootstrapRPCHandler(ctx context.Context, msg interf if err != nil { s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) tracing.AnnotateError(span, err) + log.WithError(err).Error("s.cfg.beaconDB.LightClientBootstrap") + return err + } + if bootstrap == nil { + s.writeErrorResponseToStream(responseCodeResourceUnavailable, types.ErrResourceUnavailable.Error(), stream) + tracing.AnnotateError(span, err) + log.WithError(err).Error(fmt.Sprintf("nil bootstrap for root %#x", blkRoot)) return err } @@ -49,6 +57,7 @@ func (s *Service) lightClientBootstrapRPCHandler(ctx context.Context, msg interf if err = WriteLightClientBootstrapChunk(stream, s.cfg.clock, s.cfg.p2p.Encoding(), bootstrap); err != nil { s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) tracing.AnnotateError(span, err) + log.WithError(err).Error("WriteLightClientBootstrapChunk") return err } @@ -72,32 +81,39 @@ func (s *Service) lightClientUpdatesByRangeRPCHandler(ctx context.Context, msg i SetRPCStreamDeadlines(stream) if err := s.rateLimiter.validateRequest(stream, 1); err != nil { + log.WithError(err).Error("s.rateLimiter.validateRequest") return err } s.rateLimiter.add(stream, 1) - rawMsg, ok := msg.(*types.LightClientUpdatesByRangeReq) + r, ok := msg.(*eth.LightClientUpdatesByRangeReq) if !ok { - return fmt.Errorf("message is not type %T", &types.LightClientUpdatesByRangeReq{}) + log.Error("Message is not *eth.LightClientUpdatesByRangeReq") + return fmt.Errorf("message is not type %T", ð.LightClientUpdatesByRangeReq{}) } - r := *rawMsg if r.Count > params.BeaconConfig().MaxRequestLightClientUpdates { r.Count = params.BeaconConfig().MaxRequestLightClientUpdates } - endPeriod, ok := math.SafeAdd(r.StartPeriod, r.Count-1) + + // TODO: check for overflow + /*endPeriod,ok := math.SafeAdd(r.StartPeriod, r.Count-1) if !ok { err := errors.Wrap(types.ErrInvalidRequest, "end period overflows") s.writeErrorResponseToStream(responseCodeInvalidRequest, err.Error(), stream) s.cfg.p2p.Peers().Scorers().BadResponsesScorer().Increment(stream.Conn().RemotePeer()) tracing.AnnotateError(span, err) + log.WithError(err).Error("end period overflows") return err - } + }*/ + + log.Infof("LC: requesting updates by range (StartPeriod: %d, EndPeriod: %d)", r.StartPeriod, r.StartPeriod+r.Count-1) - updates, err := s.cfg.beaconDB.LightClientUpdates(ctx, r.StartPeriod, endPeriod) + updates, err := s.cfg.beaconDB.LightClientUpdates(ctx, r.StartPeriod, r.StartPeriod+r.Count-1) if err != nil { s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) tracing.AnnotateError(span, err) + log.WithError(err).Error("s.cfg.beaconDB.LightClientUpdates") return err } for _, u := range updates { @@ -105,6 +121,7 @@ func (s *Service) lightClientUpdatesByRangeRPCHandler(ctx context.Context, msg i if err = WriteLightClientUpdateChunk(stream, s.cfg.clock, s.cfg.p2p.Encoding(), u); err != nil { s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) tracing.AnnotateError(span, err) + log.WithError(err).Error("WriteLightClientUpdateChunk") return err } s.rateLimiter.add(stream, 1) diff --git a/consensus-types/light-client/bootstrap.go b/consensus-types/light-client/bootstrap.go index b2fc3dfae06..be943d4ddc1 100644 --- a/consensus-types/light-client/bootstrap.go +++ b/consensus-types/light-client/bootstrap.go @@ -41,10 +41,16 @@ func NewWrappedBootstrapAltair(p *pb.LightClientBootstrapAltair) (interfaces.Lig if p == nil { return nil, consensustypes.ErrNilObjectWrapped } - header, err := NewWrappedHeader(p.Header) - if err != nil { - return nil, err + + var header interfaces.LightClientHeader + var err error + if p.Header != nil { + header, err = NewWrappedHeader(p.Header) + if err != nil { + return nil, err + } } + branch, err := createBranch[interfaces.LightClientSyncCommitteeBranch]( "sync committee", p.CurrentSyncCommitteeBranch, @@ -133,10 +139,16 @@ func NewWrappedBootstrapCapella(p *pb.LightClientBootstrapCapella) (interfaces.L if p == nil { return nil, consensustypes.ErrNilObjectWrapped } - header, err := NewWrappedHeader(p.Header) - if err != nil { - return nil, err + + var header interfaces.LightClientHeader + var err error + if p.Header != nil { + header, err = NewWrappedHeader(p.Header) + if err != nil { + return nil, err + } } + branch, err := createBranch[interfaces.LightClientSyncCommitteeBranch]( "sync committee", p.CurrentSyncCommitteeBranch, @@ -225,10 +237,16 @@ func NewWrappedBootstrapDeneb(p *pb.LightClientBootstrapDeneb) (interfaces.Light if p == nil { return nil, consensustypes.ErrNilObjectWrapped } - header, err := NewWrappedHeader(p.Header) - if err != nil { - return nil, err + + var header interfaces.LightClientHeader + var err error + if p.Header != nil { + header, err = NewWrappedHeader(p.Header) + if err != nil { + return nil, err + } } + branch, err := createBranch[interfaces.LightClientSyncCommitteeBranch]( "sync committee", p.CurrentSyncCommitteeBranch, @@ -317,10 +335,16 @@ func NewWrappedBootstrapElectra(p *pb.LightClientBootstrapElectra) (interfaces.L if p == nil { return nil, consensustypes.ErrNilObjectWrapped } - header, err := NewWrappedHeader(p.Header) - if err != nil { - return nil, err + + var header interfaces.LightClientHeader + var err error + if p.Header != nil { + header, err = NewWrappedHeader(p.Header) + if err != nil { + return nil, err + } } + branch, err := createBranch[interfaces.LightClientSyncCommitteeBranchElectra]( "sync committee", p.CurrentSyncCommitteeBranch,