mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-02 04:14:33 +00:00
Merge remote-tracking branch 'origin/unstable' into tree-states
This commit is contained in:
@@ -699,8 +699,8 @@ async fn aggregated_gossip_verification() {
|
||||
|tester, err| {
|
||||
assert!(matches!(
|
||||
err,
|
||||
AttnError::AttestationAlreadyKnown(hash)
|
||||
if hash == tester.valid_aggregate.message.aggregate.tree_hash_root()
|
||||
AttnError::AttestationSupersetKnown(hash)
|
||||
if hash == tester.valid_aggregate.message.aggregate.data.tree_hash_root()
|
||||
))
|
||||
},
|
||||
)
|
||||
|
||||
@@ -351,6 +351,7 @@ async fn assert_invalid_signature(
|
||||
snapshots[block_index].beacon_block.canonical_root(),
|
||||
snapshots[block_index].beacon_block.clone(),
|
||||
NotifyExecutionLayer::Yes,
|
||||
|| Ok(()),
|
||||
)
|
||||
.await;
|
||||
assert!(
|
||||
@@ -415,6 +416,7 @@ async fn invalid_signature_gossip_block() {
|
||||
signed_block.canonical_root(),
|
||||
Arc::new(signed_block),
|
||||
NotifyExecutionLayer::Yes,
|
||||
|| Ok(()),
|
||||
)
|
||||
.await,
|
||||
Err(BlockError::InvalidSignature)
|
||||
@@ -727,6 +729,7 @@ async fn block_gossip_verification() {
|
||||
gossip_verified.block_root,
|
||||
gossip_verified,
|
||||
NotifyExecutionLayer::Yes,
|
||||
|| Ok(()),
|
||||
)
|
||||
.await
|
||||
.expect("should import valid gossip verified block");
|
||||
@@ -923,11 +926,7 @@ async fn block_gossip_verification() {
|
||||
assert!(
|
||||
matches!(
|
||||
unwrap_err(harness.chain.verify_block_for_gossip(Arc::new(block.clone())).await),
|
||||
BlockError::RepeatProposal {
|
||||
proposer,
|
||||
slot,
|
||||
}
|
||||
if proposer == other_proposer && slot == block.message().slot()
|
||||
BlockError::BlockIsAlreadyKnown,
|
||||
),
|
||||
"should register any valid signature against the proposer, even if the block failed later verification"
|
||||
);
|
||||
@@ -956,11 +955,7 @@ async fn block_gossip_verification() {
|
||||
.await
|
||||
.err()
|
||||
.expect("should error when processing known block"),
|
||||
BlockError::RepeatProposal {
|
||||
proposer,
|
||||
slot,
|
||||
}
|
||||
if proposer == block.message().proposer_index() && slot == block.message().slot()
|
||||
BlockError::BlockIsAlreadyKnown
|
||||
),
|
||||
"the second proposal by this validator should be rejected"
|
||||
);
|
||||
@@ -998,6 +993,7 @@ async fn verify_block_for_gossip_slashing_detection() {
|
||||
verified_block.block_root,
|
||||
verified_block,
|
||||
NotifyExecutionLayer::Yes,
|
||||
|| Ok(()),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
@@ -1037,6 +1033,7 @@ async fn verify_block_for_gossip_doppelganger_detection() {
|
||||
verified_block.block_root,
|
||||
verified_block,
|
||||
NotifyExecutionLayer::Yes,
|
||||
|| Ok(()),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
@@ -1184,6 +1181,7 @@ async fn add_base_block_to_altair_chain() {
|
||||
base_block.canonical_root(),
|
||||
Arc::new(base_block.clone()),
|
||||
NotifyExecutionLayer::Yes,
|
||||
|| Ok(()),
|
||||
)
|
||||
.await
|
||||
.err()
|
||||
@@ -1318,6 +1316,7 @@ async fn add_altair_block_to_base_chain() {
|
||||
altair_block.canonical_root(),
|
||||
Arc::new(altair_block.clone()),
|
||||
NotifyExecutionLayer::Yes,
|
||||
|| Ok(()),
|
||||
)
|
||||
.await
|
||||
.err()
|
||||
|
||||
@@ -133,13 +133,8 @@ async fn base_altair_merge_capella() {
|
||||
for _ in (merge_fork_slot.as_u64() + 3)..capella_fork_slot.as_u64() {
|
||||
harness.extend_slots(1).await;
|
||||
let block = &harness.chain.head_snapshot().beacon_block;
|
||||
let full_payload: FullPayload<E> = block
|
||||
.message()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
.clone()
|
||||
.into();
|
||||
let full_payload: FullPayload<E> =
|
||||
block.message().body().execution_payload().unwrap().into();
|
||||
// pre-capella shouldn't have withdrawals
|
||||
assert!(full_payload.withdrawals_root().is_err());
|
||||
execution_payloads.push(full_payload);
|
||||
@@ -151,13 +146,8 @@ async fn base_altair_merge_capella() {
|
||||
for _ in 0..16 {
|
||||
harness.extend_slots(1).await;
|
||||
let block = &harness.chain.head_snapshot().beacon_block;
|
||||
let full_payload: FullPayload<E> = block
|
||||
.message()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
.clone()
|
||||
.into();
|
||||
let full_payload: FullPayload<E> =
|
||||
block.message().body().execution_payload().unwrap().into();
|
||||
// post-capella should have withdrawals
|
||||
assert!(full_payload.withdrawals_root().is_ok());
|
||||
execution_payloads.push(full_payload);
|
||||
|
||||
@@ -697,6 +697,7 @@ async fn invalidates_all_descendants() {
|
||||
fork_block.canonical_root(),
|
||||
Arc::new(fork_block),
|
||||
NotifyExecutionLayer::Yes,
|
||||
|| Ok(()),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
@@ -793,6 +794,7 @@ async fn switches_heads() {
|
||||
fork_block.canonical_root(),
|
||||
Arc::new(fork_block),
|
||||
NotifyExecutionLayer::Yes,
|
||||
|| Ok(()),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
@@ -1046,7 +1048,9 @@ async fn invalid_parent() {
|
||||
|
||||
// Ensure the block built atop an invalid payload is invalid for import.
|
||||
assert!(matches!(
|
||||
rig.harness.chain.process_block(block.canonical_root(), block.clone(), NotifyExecutionLayer::Yes).await,
|
||||
rig.harness.chain.process_block(block.canonical_root(), block.clone(), NotifyExecutionLayer::Yes,
|
||||
|| Ok(()),
|
||||
).await,
|
||||
Err(BlockError::ParentExecutionPayloadInvalid { parent_root: invalid_root })
|
||||
if invalid_root == parent_root
|
||||
));
|
||||
@@ -1060,8 +1064,9 @@ async fn invalid_parent() {
|
||||
Duration::from_secs(0),
|
||||
&state,
|
||||
PayloadVerificationStatus::Optimistic,
|
||||
rig.harness.chain.config.progressive_balances_mode,
|
||||
&rig.harness.chain.spec,
|
||||
|
||||
rig.harness.logger()
|
||||
),
|
||||
Err(ForkChoiceError::ProtoArrayStringError(message))
|
||||
if message.contains(&format!(
|
||||
@@ -1332,7 +1337,12 @@ async fn build_optimistic_chain(
|
||||
for block in blocks {
|
||||
rig.harness
|
||||
.chain
|
||||
.process_block(block.canonical_root(), block, NotifyExecutionLayer::Yes)
|
||||
.process_block(
|
||||
block.canonical_root(),
|
||||
block,
|
||||
NotifyExecutionLayer::Yes,
|
||||
|| Ok(()),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
@@ -1892,6 +1902,7 @@ async fn recover_from_invalid_head_by_importing_blocks() {
|
||||
fork_block.canonical_root(),
|
||||
fork_block.clone(),
|
||||
NotifyExecutionLayer::Yes,
|
||||
|| Ok(()),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -2107,6 +2107,7 @@ async fn weak_subjectivity_sync() {
|
||||
full_block.canonical_root(),
|
||||
Arc::new(full_block),
|
||||
NotifyExecutionLayer::Yes,
|
||||
|| Ok(()),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#![cfg(not(debug_assertions))]
|
||||
|
||||
use beacon_chain::sync_committee_verification::Error as SyncCommitteeError;
|
||||
use beacon_chain::sync_committee_verification::{Error as SyncCommitteeError, SyncCommitteeData};
|
||||
use beacon_chain::test_utils::{BeaconChainHarness, EphemeralHarnessType, RelativeSyncCommittee};
|
||||
use int_to_bytes::int_to_bytes32;
|
||||
use lazy_static::lazy_static;
|
||||
@@ -444,11 +444,17 @@ async fn aggregated_gossip_verification() {
|
||||
* subcommittee index contribution.subcommittee_index.
|
||||
*/
|
||||
|
||||
let contribution = &valid_aggregate.message.contribution;
|
||||
let sync_committee_data = SyncCommitteeData {
|
||||
slot: contribution.slot,
|
||||
root: contribution.beacon_block_root,
|
||||
subcommittee_index: contribution.subcommittee_index,
|
||||
};
|
||||
assert_invalid!(
|
||||
"aggregate that has already been seen",
|
||||
valid_aggregate.clone(),
|
||||
SyncCommitteeError::SyncContributionAlreadyKnown(hash)
|
||||
if hash == valid_aggregate.message.contribution.tree_hash_root()
|
||||
SyncCommitteeError::SyncContributionSupersetKnown(hash)
|
||||
if hash == sync_committee_data.tree_hash_root()
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
@@ -683,6 +683,7 @@ async fn run_skip_slot_test(skip_slots: u64) {
|
||||
harness_a.chain.head_snapshot().beacon_block_root,
|
||||
harness_a.chain.head_snapshot().beacon_block.clone(),
|
||||
NotifyExecutionLayer::Yes,
|
||||
|| Ok(())
|
||||
)
|
||||
.await
|
||||
.unwrap(),
|
||||
|
||||
Reference in New Issue
Block a user