mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 03:31:45 +00:00
* Attestation superstruct changes for EIP 7549 (#5644)
* update
* experiment
* superstruct changes
* revert
* superstruct changes
* fix tests
* indexed attestation
* indexed attestation superstruct
* updated TODOs
* `superstruct` the `AttesterSlashing` (#5636)
* `superstruct` Attester Fork Variants
* Push a little further
* Deal with Encode / Decode of AttesterSlashing
* not so sure about this..
* Stop Encode/Decode Bounds from Propagating Out
* Tons of Changes..
* More Conversions to AttestationRef
* Add AsReference trait (#15)
* Add AsReference trait
* Fix some snafus
* Got it Compiling! :D
* Got Tests Building
* Get beacon chain tests compiling
---------
Co-authored-by: Michael Sproul <micsproul@gmail.com>
* Merge remote-tracking branch 'upstream/unstable' into electra_attestation_changes
* Make EF Tests Fork-Agnostic (#5713)
* Finish EF Test Fork Agnostic (#5714)
* Superstruct `AggregateAndProof` (#5715)
* Upgrade `superstruct` to `0.8.0`
* superstruct `AggregateAndProof`
* Merge remote-tracking branch 'sigp/unstable' into electra_attestation_changes
* cargo fmt
* Merge pull request #5726 from realbigsean/electra_attestation_changes
Merge unstable into Electra attestation changes
* EIP7549 `get_attestation_indices` (#5657)
* get attesting indices electra impl
* fmt
* get tests to pass
* fmt
* fix some beacon chain tests
* fmt
* fix slasher test
* fmt got me again
* fix more tests
* fix tests
* Some small changes (#5739)
* cargo fmt (#5740)
* Sketch op pool changes
* fix get attesting indices (#5742)
* fix get attesting indices
* better errors
* fix compile
* only get committee index once
* Ef test fixes (#5753)
* attestation related ef test fixes
* delete commented out stuff
* Fix Aggregation Pool for Electra (#5754)
* Fix Aggregation Pool for Electra
* Remove Outdated Interface
* fix ssz (#5755)
* Get `electra_op_pool` up to date (#5756)
* fix get attesting indices (#5742)
* fix get attesting indices
* better errors
* fix compile
* only get committee index once
* Ef test fixes (#5753)
* attestation related ef test fixes
* delete commented out stuff
* Fix Aggregation Pool for Electra (#5754)
* Fix Aggregation Pool for Electra
* Remove Outdated Interface
* fix ssz (#5755)
---------
Co-authored-by: realbigsean <sean@sigmaprime.io>
* Revert "Get `electra_op_pool` up to date (#5756)" (#5757)
This reverts commit ab9e58aa3d.
* Merge branch 'electra_attestation_changes' of https://github.com/sigp/lighthouse into electra_op_pool
* Compute on chain aggregate impl (#5752)
* add compute_on_chain_agg impl to op pool changes
* fmt
* get op pool tests to pass
* update the naive agg pool interface (#5760)
* Fix bugs in cross-committee aggregation
* Add comment to max cover optimisation
* Fix assert
* Merge pull request #5749 from sigp/electra_op_pool
Optimise Electra op pool aggregation
* update committee offset
* Fix Electra Fork Choice Tests (#5764)
* Subscribe to the correct subnets for electra attestations (#5782)
* subscribe to the correct att subnets for electra
* subscribe to the correct att subnets for electra
* cargo fmt
* fix slashing handling
* Merge remote-tracking branch 'upstream/unstable'
* Send unagg attestation based on fork
* Publish all aggregates
* just one more check bro plz..
* Merge pull request #5832 from ethDreamer/electra_attestation_changes_merge_unstable
Merge `unstable` into `electra_attestation_changes`
* Merge pull request #5835 from realbigsean/fix-validator-logic
Fix validator logic
* Merge pull request #5816 from realbigsean/electra-attestation-slashing-handling
Electra slashing handling
* Electra attestation changes rm decode impl (#5856)
* Remove Crappy Decode impl for Attestation
* Remove Inefficient Attestation Decode impl
* Implement Schema Upgrade / Downgrade
* Update beacon_node/beacon_chain/src/schema_change/migration_schema_v20.rs
Co-authored-by: Michael Sproul <micsproul@gmail.com>
---------
Co-authored-by: Michael Sproul <micsproul@gmail.com>
* Fix failing attestation tests and misc electra attestation cleanup (#5810)
* - get attestation related beacon chain tests to pass
- observed attestations are now keyed off of data + committee index
- rename op pool attestationref to compactattestationref
- remove unwraps in agg pool and use options instead
- cherry pick some changes from ef-tests-electra
* cargo fmt
* fix failing test
* Revert dockerfile changes
* make committee_index return option
* function args shouldnt be a ref to attestation ref
* fmt
* fix dup imports
---------
Co-authored-by: realbigsean <seananderson33@GMAIL.com>
* fix some todos (#5817)
* Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra_attestation_changes
* add consolidations to merkle calc for inclusion proof
* Remove Duplicate KZG Commitment Merkle Proof Code (#5874)
* Remove Duplicate KZG Commitment Merkle Proof Code
* s/tree_lists/fields/
* Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra_attestation_changes
* fix compile
* Fix slasher tests (#5906)
* Fix electra tests
* Add electra attestations to double vote tests
* Update superstruct to 0.8
* Merge remote-tracking branch 'origin/unstable' into electra_attestation_changes
* Small cleanup in slasher tests
* Clean up Electra observed aggregates (#5929)
* Use consistent key in observed_attestations
* Remove unwraps from observed aggregates
* Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra_attestation_changes
* De-dup attestation constructor logic
* Remove unwraps in Attestation construction
* Dedup match_attestation_data
* Remove outdated TODO
* Use ForkName Ord in fork-choice tests
* Use ForkName Ord in BeaconBlockBody
* Make to_electra not fallible
* Remove TestRandom impl for IndexedAttestation
* Remove IndexedAttestation faulty Decode impl
* Drop TestRandom impl
* Add PendingAttestationInElectra
* Indexed att on disk (#35)
* indexed att on disk
* fix lints
* Update slasher/src/migrate.rs
Co-authored-by: ethDreamer <37123614+ethDreamer@users.noreply.github.com>
---------
Co-authored-by: Lion - dapplion <35266934+dapplion@users.noreply.github.com>
Co-authored-by: ethDreamer <37123614+ethDreamer@users.noreply.github.com>
* add electra fork enabled fn to ForkName impl (#36)
* add electra fork enabled fn to ForkName impl
* remove inadvertent file
* Update common/eth2/src/types.rs
Co-authored-by: ethDreamer <37123614+ethDreamer@users.noreply.github.com>
* Dedup attestation constructor logic in attester cache
* Use if let Ok for committee_bits
* Dedup Attestation constructor code
* Diff reduction in tests
* Fix beacon_chain tests
* Diff reduction
* Use Ord for ForkName in pubsub
* Resolve into_attestation_and_indices todo
* Remove stale TODO
* Fix beacon_chain tests
* Test spec invariant
* Use electra_enabled in pubsub
* Remove get_indexed_attestation_from_signed_aggregate
* Use ok_or instead of if let else
* committees are sorted
* remove dup method `get_indexed_attestation_from_committees`
* Merge pull request #5940 from dapplion/electra_attestation_changes_lionreview
Electra attestations #5712 review
* update default persisted op pool deserialization
* ensure aggregate and proof uses serde untagged on ref
* Fork aware ssz static attestation tests
* Electra attestation changes from Lions review (#5971)
* dedup/cleanup and remove unneeded hashset use
* remove irrelevant TODOs
* Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra_attestation_changes
* Electra attestation changes sean review (#5972)
* instantiate empty bitlist in unreachable code
* clean up error conversion
* fork enabled bool cleanup
* remove a couple todos
* return bools instead of options in `aggregate` and use the result
* delete commented out code
* use map macros in simple transformations
* remove signers_disjoint_from
* get ef tests compiling
* get ef tests compiling
* update intentionally excluded files
* Avoid changing slasher schema for Electra
* Delete slasher schema v4
* Fix clippy
* Fix compilation of beacon_chain tests
* Update database.rs
* Add electra lightclient types
* Update slasher/src/database.rs
* fix imports
* Merge pull request #5980 from dapplion/electra-lightclient
Add electra lightclient types
* Merge pull request #5975 from michaelsproul/electra-slasher-no-migration
Avoid changing slasher schema for Electra
* Update beacon_node/beacon_chain/src/attestation_verification.rs
* Update beacon_node/beacon_chain/src/attestation_verification.rs
796 lines
28 KiB
Rust
796 lines
28 KiB
Rust
#![cfg(feature = "ef_tests")]
|
|
|
|
use ef_tests::*;
|
|
use types::{MainnetEthSpec, MinimalEthSpec, *};
|
|
|
|
// Check that the hand-computed multiplications on EthSpec are correctly computed.
|
|
// This test lives here because one is most likely to muck these up during a spec update.
|
|
fn check_typenum_values<E: EthSpec>() {
|
|
assert_eq!(
|
|
E::MaxPendingAttestations::to_u64(),
|
|
E::MaxAttestations::to_u64() * E::SlotsPerEpoch::to_u64()
|
|
);
|
|
assert_eq!(
|
|
E::SlotsPerEth1VotingPeriod::to_u64(),
|
|
E::EpochsPerEth1VotingPeriod::to_u64() * E::SlotsPerEpoch::to_u64()
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn derived_typenum_values() {
|
|
check_typenum_values::<MinimalEthSpec>();
|
|
check_typenum_values::<MainnetEthSpec>();
|
|
}
|
|
|
|
#[test]
|
|
fn shuffling() {
|
|
ShufflingHandler::<MinimalEthSpec>::default().run();
|
|
ShufflingHandler::<MainnetEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn operations_deposit() {
|
|
OperationsHandler::<MinimalEthSpec, Deposit>::default().run();
|
|
OperationsHandler::<MainnetEthSpec, Deposit>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn operations_exit() {
|
|
OperationsHandler::<MinimalEthSpec, SignedVoluntaryExit>::default().run();
|
|
OperationsHandler::<MainnetEthSpec, SignedVoluntaryExit>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn operations_proposer_slashing() {
|
|
OperationsHandler::<MinimalEthSpec, ProposerSlashing>::default().run();
|
|
OperationsHandler::<MainnetEthSpec, ProposerSlashing>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn operations_attester_slashing() {
|
|
OperationsHandler::<MinimalEthSpec, AttesterSlashing<_>>::default().run();
|
|
OperationsHandler::<MainnetEthSpec, AttesterSlashing<_>>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn operations_attestation() {
|
|
OperationsHandler::<MinimalEthSpec, Attestation<_>>::default().run();
|
|
OperationsHandler::<MainnetEthSpec, Attestation<_>>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn operations_block_header() {
|
|
OperationsHandler::<MinimalEthSpec, BeaconBlock<_>>::default().run();
|
|
OperationsHandler::<MainnetEthSpec, BeaconBlock<_>>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn operations_sync_aggregate() {
|
|
OperationsHandler::<MinimalEthSpec, SyncAggregate<_>>::default().run();
|
|
OperationsHandler::<MainnetEthSpec, SyncAggregate<_>>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn operations_execution_payload_full() {
|
|
OperationsHandler::<MinimalEthSpec, BeaconBlockBody<_, FullPayload<_>>>::default().run();
|
|
OperationsHandler::<MainnetEthSpec, BeaconBlockBody<_, FullPayload<_>>>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn operations_execution_payload_blinded() {
|
|
OperationsHandler::<MinimalEthSpec, BeaconBlockBody<_, BlindedPayload<_>>>::default().run();
|
|
OperationsHandler::<MainnetEthSpec, BeaconBlockBody<_, BlindedPayload<_>>>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn operations_withdrawals() {
|
|
OperationsHandler::<MinimalEthSpec, WithdrawalsPayload<_>>::default().run();
|
|
OperationsHandler::<MainnetEthSpec, WithdrawalsPayload<_>>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn operations_bls_to_execution_change() {
|
|
OperationsHandler::<MinimalEthSpec, SignedBlsToExecutionChange>::default().run();
|
|
OperationsHandler::<MainnetEthSpec, SignedBlsToExecutionChange>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn sanity_blocks() {
|
|
SanityBlocksHandler::<MinimalEthSpec>::default().run();
|
|
SanityBlocksHandler::<MainnetEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn sanity_slots() {
|
|
SanitySlotsHandler::<MinimalEthSpec>::default().run();
|
|
SanitySlotsHandler::<MainnetEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn random() {
|
|
RandomHandler::<MinimalEthSpec>::default().run();
|
|
RandomHandler::<MainnetEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
#[cfg(not(feature = "fake_crypto"))]
|
|
fn bls_aggregate() {
|
|
BlsAggregateSigsHandler::default().run();
|
|
}
|
|
|
|
#[test]
|
|
#[cfg(not(feature = "fake_crypto"))]
|
|
fn bls_sign() {
|
|
BlsSignMsgHandler::default().run();
|
|
}
|
|
|
|
#[test]
|
|
#[cfg(not(feature = "fake_crypto"))]
|
|
fn bls_verify() {
|
|
BlsVerifyMsgHandler::default().run();
|
|
}
|
|
|
|
#[test]
|
|
#[cfg(not(feature = "fake_crypto"))]
|
|
fn bls_batch_verify() {
|
|
BlsBatchVerifyHandler::default().run();
|
|
}
|
|
|
|
#[test]
|
|
#[cfg(not(feature = "fake_crypto"))]
|
|
fn bls_aggregate_verify() {
|
|
BlsAggregateVerifyHandler::default().run();
|
|
}
|
|
|
|
#[test]
|
|
#[cfg(not(feature = "fake_crypto"))]
|
|
fn bls_fast_aggregate_verify() {
|
|
BlsFastAggregateVerifyHandler::default().run();
|
|
}
|
|
|
|
#[test]
|
|
#[cfg(not(feature = "fake_crypto"))]
|
|
fn bls_eth_aggregate_pubkeys() {
|
|
BlsEthAggregatePubkeysHandler::default().run();
|
|
}
|
|
|
|
#[test]
|
|
#[cfg(not(feature = "fake_crypto"))]
|
|
fn bls_eth_fast_aggregate_verify() {
|
|
BlsEthFastAggregateVerifyHandler::default().run();
|
|
}
|
|
|
|
/// As for `ssz_static_test_no_run` (below), but also executes the function as a test.
|
|
#[cfg(feature = "fake_crypto")]
|
|
macro_rules! ssz_static_test {
|
|
($($args:tt)*) => {
|
|
ssz_static_test_no_run!(#[test] $($args)*);
|
|
};
|
|
}
|
|
|
|
/// Generate a function to run the SSZ static tests for a type.
|
|
///
|
|
/// Quite complex in order to support an optional #[test] attrib, generics, and the two EthSpecs.
|
|
#[cfg(feature = "fake_crypto")]
|
|
macro_rules! ssz_static_test_no_run {
|
|
// Top-level
|
|
($(#[$test:meta])? $test_name:ident, $typ:ident$(<$generics:tt>)?) => {
|
|
ssz_static_test_no_run!($(#[$test])? $test_name, SszStaticHandler, $typ$(<$generics>)?);
|
|
};
|
|
// Generic
|
|
($(#[$test:meta])? $test_name:ident, $handler:ident, $typ:ident<_>) => {
|
|
ssz_static_test_no_run!(
|
|
$(#[$test])?
|
|
$test_name,
|
|
$handler,
|
|
{
|
|
($typ<MinimalEthSpec>, MinimalEthSpec),
|
|
($typ<MainnetEthSpec>, MainnetEthSpec)
|
|
}
|
|
);
|
|
};
|
|
// Non-generic
|
|
($(#[$test:meta])? $test_name:ident, $handler:ident, $typ:ident) => {
|
|
ssz_static_test_no_run!(
|
|
$(#[$test])?
|
|
$test_name,
|
|
$handler,
|
|
{
|
|
($typ, MinimalEthSpec),
|
|
($typ, MainnetEthSpec)
|
|
}
|
|
);
|
|
};
|
|
// Base case
|
|
($(#[$test:meta])? $test_name:ident, $handler:ident, { $(($($typ:ty),+)),+ }) => {
|
|
$(#[$test])?
|
|
fn $test_name() {
|
|
$(
|
|
$handler::<$($typ),+>::default().run();
|
|
)+
|
|
}
|
|
};
|
|
}
|
|
|
|
#[cfg(feature = "fake_crypto")]
|
|
mod ssz_static {
|
|
use ef_tests::{Handler, SszStaticHandler, SszStaticTHCHandler, SszStaticWithSpecHandler};
|
|
use types::blob_sidecar::BlobIdentifier;
|
|
use types::historical_summary::HistoricalSummary;
|
|
use types::{AttesterSlashingBase, AttesterSlashingElectra, LightClientBootstrapAltair, *};
|
|
|
|
ssz_static_test!(attestation_data, AttestationData);
|
|
ssz_static_test!(beacon_block, SszStaticWithSpecHandler, BeaconBlock<_>);
|
|
ssz_static_test!(beacon_block_header, BeaconBlockHeader);
|
|
ssz_static_test!(beacon_state, SszStaticTHCHandler, BeaconState<_>);
|
|
ssz_static_test!(checkpoint, Checkpoint);
|
|
ssz_static_test!(deposit, Deposit);
|
|
ssz_static_test!(deposit_data, DepositData);
|
|
ssz_static_test!(deposit_message, DepositMessage);
|
|
// NOTE: Eth1Block intentionally omitted, see: https://github.com/sigp/lighthouse/issues/1835
|
|
ssz_static_test!(eth1_data, Eth1Data);
|
|
ssz_static_test!(fork, Fork);
|
|
ssz_static_test!(fork_data, ForkData);
|
|
ssz_static_test!(historical_batch, HistoricalBatch<_>);
|
|
ssz_static_test!(pending_attestation, PendingAttestation<_>);
|
|
ssz_static_test!(proposer_slashing, ProposerSlashing);
|
|
ssz_static_test!(
|
|
signed_beacon_block,
|
|
SszStaticWithSpecHandler,
|
|
SignedBeaconBlock<_>
|
|
);
|
|
ssz_static_test!(signed_beacon_block_header, SignedBeaconBlockHeader);
|
|
ssz_static_test!(signed_voluntary_exit, SignedVoluntaryExit);
|
|
ssz_static_test!(signing_data, SigningData);
|
|
ssz_static_test!(validator, Validator);
|
|
ssz_static_test!(voluntary_exit, VoluntaryExit);
|
|
|
|
#[test]
|
|
fn attestation() {
|
|
SszStaticHandler::<AttestationBase<MinimalEthSpec>, MinimalEthSpec>::pre_electra().run();
|
|
SszStaticHandler::<AttestationBase<MainnetEthSpec>, MainnetEthSpec>::pre_electra().run();
|
|
SszStaticHandler::<AttestationElectra<MinimalEthSpec>, MinimalEthSpec>::electra_only()
|
|
.run();
|
|
SszStaticHandler::<AttestationElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only()
|
|
.run();
|
|
}
|
|
|
|
#[test]
|
|
fn attester_slashing() {
|
|
SszStaticHandler::<AttesterSlashingBase<MinimalEthSpec>, MinimalEthSpec>::pre_electra()
|
|
.run();
|
|
SszStaticHandler::<AttesterSlashingBase<MainnetEthSpec>, MainnetEthSpec>::pre_electra()
|
|
.run();
|
|
SszStaticHandler::<AttesterSlashingElectra<MinimalEthSpec>, MinimalEthSpec>::electra_only()
|
|
.run();
|
|
SszStaticHandler::<AttesterSlashingElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only()
|
|
.run();
|
|
}
|
|
|
|
#[test]
|
|
fn signed_aggregate_and_proof() {
|
|
SszStaticHandler::<SignedAggregateAndProofBase<MinimalEthSpec>, MinimalEthSpec>::pre_electra(
|
|
)
|
|
.run();
|
|
SszStaticHandler::<SignedAggregateAndProofBase<MainnetEthSpec>, MainnetEthSpec>::pre_electra(
|
|
)
|
|
.run();
|
|
SszStaticHandler::<SignedAggregateAndProofElectra<MinimalEthSpec>, MinimalEthSpec>::electra_only(
|
|
)
|
|
.run();
|
|
SszStaticHandler::<SignedAggregateAndProofElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only(
|
|
)
|
|
.run();
|
|
}
|
|
|
|
#[test]
|
|
fn aggregate_and_proof() {
|
|
SszStaticHandler::<AggregateAndProofBase<MinimalEthSpec>, MinimalEthSpec>::pre_electra()
|
|
.run();
|
|
SszStaticHandler::<AggregateAndProofBase<MainnetEthSpec>, MainnetEthSpec>::pre_electra()
|
|
.run();
|
|
SszStaticHandler::<AggregateAndProofElectra<MinimalEthSpec>, MinimalEthSpec>::electra_only(
|
|
)
|
|
.run();
|
|
SszStaticHandler::<AggregateAndProofElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only(
|
|
)
|
|
.run();
|
|
}
|
|
|
|
// BeaconBlockBody has no internal indicator of which fork it is for, so we test it separately.
|
|
#[test]
|
|
fn beacon_block_body() {
|
|
SszStaticHandler::<BeaconBlockBodyBase<MinimalEthSpec>, MinimalEthSpec>::base_only().run();
|
|
SszStaticHandler::<BeaconBlockBodyBase<MainnetEthSpec>, MainnetEthSpec>::base_only().run();
|
|
SszStaticHandler::<BeaconBlockBodyAltair<MinimalEthSpec>, MinimalEthSpec>::altair_only()
|
|
.run();
|
|
SszStaticHandler::<BeaconBlockBodyAltair<MainnetEthSpec>, MainnetEthSpec>::altair_only()
|
|
.run();
|
|
SszStaticHandler::<BeaconBlockBodyBellatrix<MinimalEthSpec>, MinimalEthSpec>::bellatrix_only()
|
|
.run();
|
|
SszStaticHandler::<BeaconBlockBodyBellatrix<MainnetEthSpec>, MainnetEthSpec>::bellatrix_only()
|
|
.run();
|
|
SszStaticHandler::<BeaconBlockBodyCapella<MinimalEthSpec>, MinimalEthSpec>::capella_only()
|
|
.run();
|
|
SszStaticHandler::<BeaconBlockBodyCapella<MainnetEthSpec>, MainnetEthSpec>::capella_only()
|
|
.run();
|
|
SszStaticHandler::<BeaconBlockBodyDeneb<MinimalEthSpec>, MinimalEthSpec>::deneb_only()
|
|
.run();
|
|
SszStaticHandler::<BeaconBlockBodyDeneb<MainnetEthSpec>, MainnetEthSpec>::deneb_only()
|
|
.run();
|
|
}
|
|
|
|
// Altair and later
|
|
#[test]
|
|
fn contribution_and_proof() {
|
|
SszStaticHandler::<ContributionAndProof<MinimalEthSpec>, MinimalEthSpec>::altair_and_later(
|
|
)
|
|
.run();
|
|
SszStaticHandler::<ContributionAndProof<MainnetEthSpec>, MainnetEthSpec>::altair_and_later(
|
|
)
|
|
.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>::bellatrix_only(
|
|
)
|
|
.run();
|
|
SszStaticHandler::<LightClientBootstrapAltair<MainnetEthSpec>, MainnetEthSpec>::bellatrix_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>::bellatrix_only()
|
|
.run();
|
|
SszStaticHandler::<LightClientHeaderAltair<MainnetEthSpec>, MainnetEthSpec>::bellatrix_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>::bellatrix_only(
|
|
)
|
|
.run();
|
|
SszStaticHandler::<LightClientOptimisticUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::bellatrix_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>::bellatrix_only(
|
|
)
|
|
.run();
|
|
SszStaticHandler::<LightClientFinalityUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::bellatrix_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>::bellatrix_only()
|
|
.run();
|
|
SszStaticHandler::<LightClientUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::bellatrix_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();
|
|
SszStaticHandler::<SignedContributionAndProof<MainnetEthSpec>, MainnetEthSpec>::altair_and_later().run();
|
|
}
|
|
|
|
#[test]
|
|
fn sync_aggregate() {
|
|
SszStaticHandler::<SyncAggregate<MinimalEthSpec>, MinimalEthSpec>::altair_and_later().run();
|
|
SszStaticHandler::<SyncAggregate<MainnetEthSpec>, MainnetEthSpec>::altair_and_later().run();
|
|
}
|
|
|
|
#[test]
|
|
fn sync_committee() {
|
|
SszStaticHandler::<SyncCommittee<MinimalEthSpec>, MinimalEthSpec>::altair_and_later().run();
|
|
SszStaticHandler::<SyncCommittee<MainnetEthSpec>, MainnetEthSpec>::altair_and_later().run();
|
|
}
|
|
|
|
#[test]
|
|
fn sync_committee_contribution() {
|
|
SszStaticHandler::<SyncCommitteeContribution<MinimalEthSpec>, MinimalEthSpec>::altair_and_later().run();
|
|
SszStaticHandler::<SyncCommitteeContribution<MainnetEthSpec>, MainnetEthSpec>::altair_and_later().run();
|
|
}
|
|
|
|
#[test]
|
|
fn sync_committee_message() {
|
|
SszStaticHandler::<SyncCommitteeMessage, MinimalEthSpec>::altair_and_later().run();
|
|
SszStaticHandler::<SyncCommitteeMessage, MainnetEthSpec>::altair_and_later().run();
|
|
}
|
|
|
|
#[test]
|
|
fn sync_aggregator_selection_data() {
|
|
SszStaticHandler::<SyncAggregatorSelectionData, MinimalEthSpec>::altair_and_later().run();
|
|
SszStaticHandler::<SyncAggregatorSelectionData, MainnetEthSpec>::altair_and_later().run();
|
|
}
|
|
|
|
// Bellatrix and later
|
|
#[test]
|
|
fn execution_payload() {
|
|
SszStaticHandler::<ExecutionPayloadBellatrix<MinimalEthSpec>, MinimalEthSpec>::bellatrix_only()
|
|
.run();
|
|
SszStaticHandler::<ExecutionPayloadBellatrix<MainnetEthSpec>, MainnetEthSpec>::bellatrix_only()
|
|
.run();
|
|
SszStaticHandler::<ExecutionPayloadCapella<MinimalEthSpec>, MinimalEthSpec>::capella_only()
|
|
.run();
|
|
SszStaticHandler::<ExecutionPayloadCapella<MainnetEthSpec>, MainnetEthSpec>::capella_only()
|
|
.run();
|
|
SszStaticHandler::<ExecutionPayloadDeneb<MinimalEthSpec>, MinimalEthSpec>::deneb_only()
|
|
.run();
|
|
SszStaticHandler::<ExecutionPayloadDeneb<MainnetEthSpec>, MainnetEthSpec>::deneb_only()
|
|
.run();
|
|
}
|
|
|
|
#[test]
|
|
fn execution_payload_header() {
|
|
SszStaticHandler::<ExecutionPayloadHeaderBellatrix<MinimalEthSpec>, MinimalEthSpec>::bellatrix_only()
|
|
.run();
|
|
SszStaticHandler::<ExecutionPayloadHeaderBellatrix<MainnetEthSpec>, MainnetEthSpec>::bellatrix_only()
|
|
.run();
|
|
SszStaticHandler::<ExecutionPayloadHeaderCapella<MinimalEthSpec>, MinimalEthSpec>
|
|
::capella_only().run();
|
|
SszStaticHandler::<ExecutionPayloadHeaderCapella<MainnetEthSpec>, MainnetEthSpec>
|
|
::capella_only().run();
|
|
SszStaticHandler::<ExecutionPayloadHeaderDeneb<MinimalEthSpec>, MinimalEthSpec>
|
|
::deneb_only().run();
|
|
SszStaticHandler::<ExecutionPayloadHeaderDeneb<MainnetEthSpec>, MainnetEthSpec>
|
|
::deneb_only().run();
|
|
}
|
|
|
|
#[test]
|
|
fn withdrawal() {
|
|
SszStaticHandler::<Withdrawal, MinimalEthSpec>::capella_and_later().run();
|
|
SszStaticHandler::<Withdrawal, MainnetEthSpec>::capella_and_later().run();
|
|
}
|
|
|
|
#[test]
|
|
fn bls_to_execution_change() {
|
|
SszStaticHandler::<BlsToExecutionChange, MinimalEthSpec>::capella_and_later().run();
|
|
SszStaticHandler::<BlsToExecutionChange, MainnetEthSpec>::capella_and_later().run();
|
|
}
|
|
|
|
#[test]
|
|
fn signed_bls_to_execution_change() {
|
|
SszStaticHandler::<SignedBlsToExecutionChange, MinimalEthSpec>::capella_and_later().run();
|
|
SszStaticHandler::<SignedBlsToExecutionChange, MainnetEthSpec>::capella_and_later().run();
|
|
}
|
|
|
|
#[test]
|
|
fn blob_sidecar() {
|
|
SszStaticHandler::<BlobSidecar<MinimalEthSpec>, MinimalEthSpec>::deneb_only().run();
|
|
SszStaticHandler::<BlobSidecar<MainnetEthSpec>, MainnetEthSpec>::deneb_only().run();
|
|
}
|
|
|
|
#[test]
|
|
fn blob_identifier() {
|
|
SszStaticHandler::<BlobIdentifier, MinimalEthSpec>::deneb_only().run();
|
|
SszStaticHandler::<BlobIdentifier, MainnetEthSpec>::deneb_only().run();
|
|
}
|
|
|
|
#[test]
|
|
fn historical_summary() {
|
|
SszStaticHandler::<HistoricalSummary, MinimalEthSpec>::capella_and_later().run();
|
|
SszStaticHandler::<HistoricalSummary, MainnetEthSpec>::capella_and_later().run();
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn ssz_generic() {
|
|
SszGenericHandler::<BasicVector>::default().run();
|
|
SszGenericHandler::<Bitlist>::default().run();
|
|
SszGenericHandler::<Bitvector>::default().run();
|
|
SszGenericHandler::<Boolean>::default().run();
|
|
SszGenericHandler::<Uints>::default().run();
|
|
SszGenericHandler::<Containers>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn epoch_processing_justification_and_finalization() {
|
|
EpochProcessingHandler::<MinimalEthSpec, JustificationAndFinalization>::default().run();
|
|
EpochProcessingHandler::<MainnetEthSpec, JustificationAndFinalization>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn epoch_processing_rewards_and_penalties() {
|
|
EpochProcessingHandler::<MinimalEthSpec, RewardsAndPenalties>::default().run();
|
|
EpochProcessingHandler::<MainnetEthSpec, RewardsAndPenalties>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn epoch_processing_registry_updates() {
|
|
EpochProcessingHandler::<MinimalEthSpec, RegistryUpdates>::default().run();
|
|
EpochProcessingHandler::<MainnetEthSpec, RegistryUpdates>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn epoch_processing_slashings() {
|
|
EpochProcessingHandler::<MinimalEthSpec, Slashings>::default().run();
|
|
EpochProcessingHandler::<MainnetEthSpec, Slashings>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn epoch_processing_eth1_data_reset() {
|
|
EpochProcessingHandler::<MinimalEthSpec, Eth1DataReset>::default().run();
|
|
EpochProcessingHandler::<MainnetEthSpec, Eth1DataReset>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn epoch_processing_effective_balance_updates() {
|
|
EpochProcessingHandler::<MinimalEthSpec, EffectiveBalanceUpdates>::default().run();
|
|
EpochProcessingHandler::<MainnetEthSpec, EffectiveBalanceUpdates>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn epoch_processing_slashings_reset() {
|
|
EpochProcessingHandler::<MinimalEthSpec, SlashingsReset>::default().run();
|
|
EpochProcessingHandler::<MainnetEthSpec, SlashingsReset>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn epoch_processing_randao_mixes_reset() {
|
|
EpochProcessingHandler::<MinimalEthSpec, RandaoMixesReset>::default().run();
|
|
EpochProcessingHandler::<MainnetEthSpec, RandaoMixesReset>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn epoch_processing_historical_roots_update() {
|
|
EpochProcessingHandler::<MinimalEthSpec, HistoricalRootsUpdate>::default().run();
|
|
EpochProcessingHandler::<MainnetEthSpec, HistoricalRootsUpdate>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn epoch_processing_historical_summaries_update() {
|
|
EpochProcessingHandler::<MinimalEthSpec, HistoricalSummariesUpdate>::default().run();
|
|
EpochProcessingHandler::<MainnetEthSpec, HistoricalSummariesUpdate>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn epoch_processing_participation_record_updates() {
|
|
EpochProcessingHandler::<MinimalEthSpec, ParticipationRecordUpdates>::default().run();
|
|
EpochProcessingHandler::<MainnetEthSpec, ParticipationRecordUpdates>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn epoch_processing_sync_committee_updates() {
|
|
// There are presently no mainnet tests, see:
|
|
// https://github.com/ethereum/consensus-spec-tests/issues/29
|
|
EpochProcessingHandler::<MinimalEthSpec, SyncCommitteeUpdates>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn epoch_processing_inactivity_updates() {
|
|
EpochProcessingHandler::<MinimalEthSpec, InactivityUpdates>::default().run();
|
|
EpochProcessingHandler::<MainnetEthSpec, InactivityUpdates>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn epoch_processing_participation_flag_updates() {
|
|
EpochProcessingHandler::<MinimalEthSpec, ParticipationFlagUpdates>::default().run();
|
|
EpochProcessingHandler::<MainnetEthSpec, ParticipationFlagUpdates>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn fork_upgrade() {
|
|
ForkHandler::<MinimalEthSpec>::default().run();
|
|
ForkHandler::<MainnetEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn transition() {
|
|
TransitionHandler::<MinimalEthSpec>::default().run();
|
|
TransitionHandler::<MainnetEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn finality() {
|
|
FinalityHandler::<MinimalEthSpec>::default().run();
|
|
FinalityHandler::<MainnetEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn fork_choice_get_head() {
|
|
ForkChoiceHandler::<MinimalEthSpec>::new("get_head").run();
|
|
ForkChoiceHandler::<MainnetEthSpec>::new("get_head").run();
|
|
}
|
|
|
|
#[test]
|
|
fn fork_choice_on_block() {
|
|
ForkChoiceHandler::<MinimalEthSpec>::new("on_block").run();
|
|
ForkChoiceHandler::<MainnetEthSpec>::new("on_block").run();
|
|
}
|
|
|
|
#[test]
|
|
fn fork_choice_on_merge_block() {
|
|
ForkChoiceHandler::<MinimalEthSpec>::new("on_merge_block").run();
|
|
ForkChoiceHandler::<MainnetEthSpec>::new("on_merge_block").run();
|
|
}
|
|
|
|
#[test]
|
|
fn fork_choice_ex_ante() {
|
|
ForkChoiceHandler::<MinimalEthSpec>::new("ex_ante").run();
|
|
ForkChoiceHandler::<MainnetEthSpec>::new("ex_ante").run();
|
|
}
|
|
|
|
#[test]
|
|
fn fork_choice_reorg() {
|
|
ForkChoiceHandler::<MinimalEthSpec>::new("reorg").run();
|
|
// There is no mainnet variant for this test.
|
|
}
|
|
|
|
#[test]
|
|
fn fork_choice_withholding() {
|
|
ForkChoiceHandler::<MinimalEthSpec>::new("withholding").run();
|
|
// There is no mainnet variant for this test.
|
|
}
|
|
|
|
#[test]
|
|
fn fork_choice_should_override_forkchoice_update() {
|
|
ForkChoiceHandler::<MinimalEthSpec>::new("should_override_forkchoice_update").run();
|
|
ForkChoiceHandler::<MainnetEthSpec>::new("should_override_forkchoice_update").run();
|
|
}
|
|
|
|
#[test]
|
|
fn fork_choice_get_proposer_head() {
|
|
ForkChoiceHandler::<MinimalEthSpec>::new("get_proposer_head").run();
|
|
ForkChoiceHandler::<MainnetEthSpec>::new("get_proposer_head").run();
|
|
}
|
|
|
|
#[test]
|
|
fn optimistic_sync() {
|
|
OptimisticSyncHandler::<MinimalEthSpec>::default().run();
|
|
OptimisticSyncHandler::<MainnetEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn genesis_initialization() {
|
|
GenesisInitializationHandler::<MinimalEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn genesis_validity() {
|
|
GenesisValidityHandler::<MinimalEthSpec>::default().run();
|
|
// Note: there are no genesis validity tests for mainnet
|
|
}
|
|
|
|
#[test]
|
|
fn kzg_blob_to_kzg_commitment() {
|
|
KZGBlobToKZGCommitmentHandler::<MainnetEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn kzg_compute_blob_kzg_proof() {
|
|
KZGComputeBlobKZGProofHandler::<MainnetEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn kzg_compute_kzg_proof() {
|
|
KZGComputeKZGProofHandler::<MainnetEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn kzg_verify_blob_kzg_proof() {
|
|
KZGVerifyBlobKZGProofHandler::<MainnetEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn kzg_verify_blob_kzg_proof_batch() {
|
|
KZGVerifyBlobKZGProofBatchHandler::<MainnetEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn kzg_verify_kzg_proof() {
|
|
KZGVerifyKZGProofHandler::<MainnetEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn merkle_proof_validity() {
|
|
MerkleProofValidityHandler::<MainnetEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
#[cfg(feature = "fake_crypto")]
|
|
fn kzg_inclusion_merkle_proof_validity() {
|
|
KzgInclusionMerkleProofValidityHandler::<MainnetEthSpec>::default().run();
|
|
KzgInclusionMerkleProofValidityHandler::<MinimalEthSpec>::default().run();
|
|
}
|
|
|
|
#[test]
|
|
fn rewards() {
|
|
for handler in &["basic", "leak", "random"] {
|
|
RewardsHandler::<MinimalEthSpec>::new(handler).run();
|
|
RewardsHandler::<MainnetEthSpec>::new(handler).run();
|
|
}
|
|
}
|