mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Add Capella & Deneb light client support (#4946)
* rebase and add comment * conditional test * test * optimistic chould be working now * finality should be working now * try again * try again * clippy fix * add lc bootstrap beacon api * add lc optimistic/finality update to events * fmt * That error isn't occuring on my computer but I think this should fix it * Merge branch 'unstable' into light_client_beacon_api_1 # Conflicts: # beacon_node/beacon_chain/src/events.rs # beacon_node/http_api/src/lib.rs # beacon_node/http_api/src/test_utils.rs # beacon_node/http_api/tests/main.rs # beacon_node/lighthouse_network/src/rpc/codec/ssz_snappy.rs # beacon_node/lighthouse_network/src/rpc/methods.rs # beacon_node/lighthouse_network/src/service/api_types.rs # beacon_node/network/src/beacon_processor/worker/rpc_methods.rs # beacon_node/tests/test.rs # common/eth2/src/types.rs # lighthouse/src/main.rs * Add missing test file * Update light client types to comply with Altair light client spec. * Fix test compilation * Merge branch 'unstable' into light_client_beacon_api_1 * Support deserializing light client structures for the Bellatrix fork * Move `get_light_client_bootstrap` logic to `BeaconChain`. `LightClientBootstrap` API to return `ForkVersionedResponse`. * Misc fixes. - log cleanup - move http_api config mutation to `config::get_config` for consistency - fix light client API responses * Add light client bootstrap API test and fix existing ones. * Merge branch 'unstable' into light_client_beacon_api_1 * Fix test for `light-client-server` http api config. * Appease clippy * Add Altair light client SSZ tests * Merge branch 'unstable' of https://github.com/sigp/lighthouse into light_client_beacon_api_1 * updates to light client header * light client header from signed beacon block * using options * implement helper functions * placeholder conversion from vec hash256 to exec branch * add deneb * using fixed vector * remove unwraps * by epoch * compute merkle proof * merkle proof * update comments * resolve merge conflicts * linting * Merge branch 'unstable' into light-client-ssz-tests # Conflicts: # beacon_node/beacon_chain/src/beacon_chain.rs # consensus/types/src/light_client_bootstrap.rs # consensus/types/src/light_client_header.rs * superstruct attempt * superstruct changes * lint * altair * update * update * changes to light_client_optimistic_ and finality * merge unstable * refactor * resolved merge conflicts * Merge branch 'unstable' of https://github.com/sigp/lighthouse into capella_deneb_light_client_types * block_to_light_client_header fork aware * fmt * comment fix * comment fix * include merge fork, update deserialize_by_fork, refactor * fmt * pass by ref to prevent clone * rename merkle proof fn * add FIXME * LightClientHeader TestRandom * fix comments * fork version deserialize * merge unstable * move fn arguments, fork name calc * use task executor * remove unneeded fns * remove dead code * add manual ssz decoding/encoding and add ssz_tests_by_fork macro * merge deneb types with tests * merge ssz tests, revert code deletion, cleanup * move chainspec * update ssz tests * fmt * light client ssz tests * change to superstruct * changes from feedback * linting * Merge branch 'unstable' of https://github.com/sigp/lighthouse into capella_deneb_light_client_types * test fix * cleanup * Remove unused `derive`. * Merge branch 'unstable' of https://github.com/sigp/lighthouse into capella_deneb_light_client_types * beta compiler fix * merge
This commit is contained in:
@@ -29,18 +29,8 @@ excluded_paths = [
|
||||
"tests/.*/.*/light_client",
|
||||
# LightClientStore
|
||||
"tests/.*/.*/ssz_static/LightClientStore",
|
||||
# LightClientUpdate
|
||||
"tests/.*/.*/ssz_static/LightClientUpdate",
|
||||
# LightClientSnapshot
|
||||
"tests/.*/.*/ssz_static/LightClientSnapshot",
|
||||
# LightClientBootstrap
|
||||
"tests/.*/.*/ssz_static/LightClientBootstrap",
|
||||
# LightClientOptimistic
|
||||
"tests/.*/.*/ssz_static/LightClientOptimistic",
|
||||
# LightClientFinalityUpdate
|
||||
"tests/.*/.*/ssz_static/LightClientFinalityUpdate",
|
||||
# LightClientHeader
|
||||
"tests/.*/.*/ssz_static/LightClientHeader",
|
||||
# One of the EF researchers likes to pack the tarballs on a Mac
|
||||
".*\.DS_Store.*",
|
||||
# More Mac weirdness.
|
||||
|
||||
@@ -73,6 +73,38 @@ type_name!(Fork);
|
||||
type_name!(ForkData);
|
||||
type_name_generic!(HistoricalBatch);
|
||||
type_name_generic!(IndexedAttestation);
|
||||
type_name_generic!(LightClientBootstrap);
|
||||
type_name_generic!(LightClientBootstrapAltair, "LightClientBootstrap");
|
||||
type_name_generic!(LightClientBootstrapCapella, "LightClientBootstrap");
|
||||
type_name_generic!(LightClientBootstrapDeneb, "LightClientBootstrap");
|
||||
type_name_generic!(LightClientFinalityUpdate);
|
||||
type_name_generic!(LightClientFinalityUpdateAltair, "LightClientFinalityUpdate");
|
||||
type_name_generic!(
|
||||
LightClientFinalityUpdateCapella,
|
||||
"LightClientFinalityUpdate"
|
||||
);
|
||||
type_name_generic!(LightClientFinalityUpdateDeneb, "LightClientFinalityUpdate");
|
||||
type_name_generic!(LightClientHeader);
|
||||
type_name_generic!(LightClientHeaderDeneb, "LightClientHeader");
|
||||
type_name_generic!(LightClientHeaderCapella, "LightClientHeader");
|
||||
type_name_generic!(LightClientHeaderAltair, "LightClientHeader");
|
||||
type_name_generic!(LightClientOptimisticUpdate);
|
||||
type_name_generic!(
|
||||
LightClientOptimisticUpdateAltair,
|
||||
"LightClientOptimisticUpdate"
|
||||
);
|
||||
type_name_generic!(
|
||||
LightClientOptimisticUpdateCapella,
|
||||
"LightClientOptimisticUpdate"
|
||||
);
|
||||
type_name_generic!(
|
||||
LightClientOptimisticUpdateDeneb,
|
||||
"LightClientOptimisticUpdate"
|
||||
);
|
||||
type_name_generic!(LightClientUpdate);
|
||||
type_name_generic!(LightClientUpdateAltair, "LightClientUpdate");
|
||||
type_name_generic!(LightClientUpdateCapella, "LightClientUpdate");
|
||||
type_name_generic!(LightClientUpdateDeneb, "LightClientUpdate");
|
||||
type_name_generic!(PendingAttestation);
|
||||
type_name!(ProposerSlashing);
|
||||
type_name_generic!(SignedAggregateAndProof);
|
||||
|
||||
@@ -217,7 +217,7 @@ mod ssz_static {
|
||||
use ef_tests::{Handler, SszStaticHandler, SszStaticTHCHandler, SszStaticWithSpecHandler};
|
||||
use types::blob_sidecar::BlobIdentifier;
|
||||
use types::historical_summary::HistoricalSummary;
|
||||
use types::*;
|
||||
use types::{LightClientBootstrapAltair, *};
|
||||
|
||||
ssz_static_test!(aggregate_and_proof, AggregateAndProof<_>);
|
||||
ssz_static_test!(attestation, Attestation<_>);
|
||||
@@ -236,7 +236,6 @@ mod ssz_static {
|
||||
ssz_static_test!(fork_data, ForkData);
|
||||
ssz_static_test!(historical_batch, HistoricalBatch<_>);
|
||||
ssz_static_test!(indexed_attestation, IndexedAttestation<_>);
|
||||
// NOTE: LightClient* intentionally omitted
|
||||
ssz_static_test!(pending_attestation, PendingAttestation<_>);
|
||||
ssz_static_test!(proposer_slashing, ProposerSlashing);
|
||||
ssz_static_test!(signed_aggregate_and_proof, SignedAggregateAndProof<_>);
|
||||
@@ -250,7 +249,6 @@ mod ssz_static {
|
||||
ssz_static_test!(signing_data, SigningData);
|
||||
ssz_static_test!(validator, Validator);
|
||||
ssz_static_test!(voluntary_exit, VoluntaryExit);
|
||||
|
||||
// BeaconBlockBody has no internal indicator of which fork it is for, so we test it separately.
|
||||
#[test]
|
||||
fn beacon_block_body() {
|
||||
@@ -285,6 +283,135 @@ mod ssz_static {
|
||||
.run();
|
||||
}
|
||||
|
||||
// LightClientBootstrap has no internal indicator of which fork it is for, so we test it separately.
|
||||
#[test]
|
||||
fn light_client_bootstrap() {
|
||||
SszStaticHandler::<LightClientBootstrapAltair<MinimalEthSpec>, MinimalEthSpec>::altair_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientBootstrapAltair<MainnetEthSpec>, MainnetEthSpec>::altair_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientBootstrapAltair<MinimalEthSpec>, MinimalEthSpec>::merge_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientBootstrapAltair<MainnetEthSpec>, MainnetEthSpec>::merge_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientBootstrapCapella<MinimalEthSpec>, MinimalEthSpec>::capella_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientBootstrapCapella<MainnetEthSpec>, MainnetEthSpec>::capella_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientBootstrapDeneb<MinimalEthSpec>, MinimalEthSpec>::deneb_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientBootstrapDeneb<MainnetEthSpec>, MainnetEthSpec>::deneb_only()
|
||||
.run();
|
||||
}
|
||||
|
||||
// LightClientHeader has no internal indicator of which fork it is for, so we test it separately.
|
||||
#[test]
|
||||
fn light_client_header() {
|
||||
SszStaticHandler::<LightClientHeaderAltair<MinimalEthSpec>, MinimalEthSpec>::altair_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientHeaderAltair<MainnetEthSpec>, MainnetEthSpec>::altair_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientHeaderAltair<MinimalEthSpec>, MinimalEthSpec>::merge_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientHeaderAltair<MainnetEthSpec>, MainnetEthSpec>::merge_only()
|
||||
.run();
|
||||
|
||||
SszStaticHandler::<LightClientHeaderCapella<MinimalEthSpec>, MinimalEthSpec>::capella_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientHeaderCapella<MainnetEthSpec>, MainnetEthSpec>::capella_only(
|
||||
)
|
||||
.run();
|
||||
|
||||
SszStaticHandler::<LightClientHeaderDeneb<MinimalEthSpec>, MinimalEthSpec>::deneb_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientHeaderDeneb<MainnetEthSpec>, MainnetEthSpec>::deneb_only()
|
||||
.run();
|
||||
}
|
||||
|
||||
// LightClientOptimisticUpdate has no internal indicator of which fork it is for, so we test it separately.
|
||||
#[test]
|
||||
fn light_client_optimistic_update() {
|
||||
SszStaticHandler::<LightClientOptimisticUpdateAltair<MinimalEthSpec>, MinimalEthSpec>::altair_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::altair_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateAltair<MinimalEthSpec>, MinimalEthSpec>::merge_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::merge_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateCapella<MinimalEthSpec>, MinimalEthSpec>::capella_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateCapella<MainnetEthSpec>, MainnetEthSpec>::capella_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateDeneb<MinimalEthSpec>, MinimalEthSpec>::deneb_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateDeneb<MainnetEthSpec>, MainnetEthSpec>::deneb_only(
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
// LightClientFinalityUpdate has no internal indicator of which fork it is for, so we test it separately.
|
||||
#[test]
|
||||
fn light_client_finality_update() {
|
||||
SszStaticHandler::<LightClientFinalityUpdateAltair<MinimalEthSpec>, MinimalEthSpec>::altair_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientFinalityUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::altair_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientFinalityUpdateAltair<MinimalEthSpec>, MinimalEthSpec>::merge_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientFinalityUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::merge_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientFinalityUpdateCapella<MinimalEthSpec>, MinimalEthSpec>::capella_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientFinalityUpdateCapella<MainnetEthSpec>, MainnetEthSpec>::capella_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientFinalityUpdateDeneb<MinimalEthSpec>, MinimalEthSpec>::deneb_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientFinalityUpdateDeneb<MainnetEthSpec>, MainnetEthSpec>::deneb_only(
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
// LightClientUpdate has no internal indicator of which fork it is for, so we test it separately.
|
||||
#[test]
|
||||
fn light_client_update() {
|
||||
SszStaticHandler::<LightClientUpdateAltair<MinimalEthSpec>, MinimalEthSpec>::altair_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::altair_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientUpdateAltair<MinimalEthSpec>, MinimalEthSpec>::merge_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::merge_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientUpdateCapella<MinimalEthSpec>, MinimalEthSpec>::capella_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientUpdateCapella<MainnetEthSpec>, MainnetEthSpec>::capella_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientUpdateDeneb<MinimalEthSpec>, MinimalEthSpec>::deneb_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientUpdateDeneb<MainnetEthSpec>, MainnetEthSpec>::deneb_only()
|
||||
.run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn signed_contribution_and_proof() {
|
||||
SszStaticHandler::<SignedContributionAndProof<MinimalEthSpec>, MinimalEthSpec>::altair_and_later().run();
|
||||
|
||||
Reference in New Issue
Block a user