mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-15 09:48:20 +00:00
Update
This commit is contained in:
@@ -57,14 +57,9 @@ async fn sync_committee_duties_across_fork() {
|
||||
// If there's a skip slot at the fork slot, the endpoint should return duties, even
|
||||
// though the head state hasn't transitioned yet.
|
||||
let fork_slot = fork_epoch.start_slot(E::slots_per_epoch());
|
||||
let (genesis_state, genesis_state_root) = harness.get_current_state_and_root();
|
||||
let (_, mut state) = harness
|
||||
.add_attested_block_at_slot(
|
||||
fork_slot - 1,
|
||||
genesis_state,
|
||||
genesis_state_root,
|
||||
&all_validators,
|
||||
)
|
||||
let genesis_state = harness.get_current_state();
|
||||
let (_, state) = harness
|
||||
.add_attested_block_at_slot(fork_slot - 1, genesis_state, &all_validators)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -79,9 +74,8 @@ async fn sync_committee_duties_across_fork() {
|
||||
assert_eq!(sync_duties.len(), E::sync_committee_size());
|
||||
|
||||
// After applying a block at the fork slot the duties should remain unchanged.
|
||||
let state_root = state.canonical_root().unwrap();
|
||||
harness
|
||||
.add_attested_block_at_slot(fork_slot, state, state_root, &all_validators)
|
||||
.add_attested_block_at_slot(fork_slot, state, &all_validators)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -295,14 +289,9 @@ async fn sync_committee_indices_across_fork() {
|
||||
// If there's a skip slot at the fork slot, the endpoint will return a 400 until a block is
|
||||
// applied.
|
||||
let fork_slot = fork_epoch.start_slot(E::slots_per_epoch());
|
||||
let (genesis_state, genesis_state_root) = harness.get_current_state_and_root();
|
||||
let (_, mut state) = harness
|
||||
.add_attested_block_at_slot(
|
||||
fork_slot - 1,
|
||||
genesis_state,
|
||||
genesis_state_root,
|
||||
&all_validators,
|
||||
)
|
||||
let genesis_state = harness.get_current_state();
|
||||
let (_, state) = harness
|
||||
.add_attested_block_at_slot(fork_slot - 1, genesis_state, &all_validators)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -334,9 +323,8 @@ async fn sync_committee_indices_across_fork() {
|
||||
|
||||
// Once the head is updated it should be useable for requests, including in the next sync
|
||||
// committee period.
|
||||
let state_root = state.canonical_root().unwrap();
|
||||
harness
|
||||
.add_attested_block_at_slot(fork_slot + 1, state, state_root, &all_validators)
|
||||
.add_attested_block_at_slot(fork_slot + 1, state, &all_validators)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
||||
@@ -4288,6 +4288,7 @@ impl ApiTester {
|
||||
);
|
||||
// TODO(gloas): check why consensus block value is 0
|
||||
// assert!(!metadata.consensus_block_value.is_zero());
|
||||
assert!(!metadata.execution_payload_included);
|
||||
|
||||
let block_root = block.tree_hash_root();
|
||||
let envelope = self
|
||||
@@ -4360,7 +4361,7 @@ impl ApiTester {
|
||||
|
||||
let (response, metadata) = self
|
||||
.client
|
||||
.get_validator_blocks_v4::<E>(slot, &randao_reveal, None, None, None)
|
||||
.get_validator_blocks_v4::<E>(slot, &randao_reveal, None, None, None, None)
|
||||
.await
|
||||
.unwrap();
|
||||
let block = response.data;
|
||||
@@ -4369,7 +4370,7 @@ impl ApiTester {
|
||||
|
||||
let envelope = self
|
||||
.client
|
||||
.get_validator_execution_payload_envelope::<E>(slot, BUILDER_INDEX_SELF_BUILD)
|
||||
.get_validator_execution_payload_envelope::<E>(slot)
|
||||
.await
|
||||
.unwrap()
|
||||
.data;
|
||||
@@ -4423,7 +4424,7 @@ impl ApiTester {
|
||||
|
||||
let (block, metadata) = self
|
||||
.client
|
||||
.get_validator_blocks_v4_ssz::<E>(slot, &randao_reveal, None, None, None)
|
||||
.get_validator_blocks_v4_ssz::<E>(slot, &randao_reveal, None, None, None, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -4431,7 +4432,7 @@ impl ApiTester {
|
||||
|
||||
let envelope = self
|
||||
.client
|
||||
.get_validator_execution_payload_envelope_ssz::<E>(slot, BUILDER_INDEX_SELF_BUILD)
|
||||
.get_validator_execution_payload_envelope_ssz::<E>(slot)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -4807,7 +4808,8 @@ impl ApiTester {
|
||||
.client
|
||||
.get_validator_payload_attestation_data(slot)
|
||||
.await
|
||||
.unwrap();
|
||||
.unwrap()
|
||||
.expect("expected payload attestation data for slot with block");
|
||||
|
||||
assert_eq!(response.version(), Some(fork_name));
|
||||
|
||||
@@ -4823,7 +4825,8 @@ impl ApiTester {
|
||||
.client
|
||||
.get_validator_payload_attestation_data_ssz(slot)
|
||||
.await
|
||||
.unwrap();
|
||||
.unwrap()
|
||||
.expect("expected SSZ payload attestation data for slot with block");
|
||||
|
||||
assert_eq!(ssz_result, expected);
|
||||
|
||||
@@ -4859,7 +4862,7 @@ impl ApiTester {
|
||||
// Produce and publish a block.
|
||||
let (response, _metadata) = self
|
||||
.client
|
||||
.get_validator_blocks_v4::<E>(slot, &randao_reveal, None, None, None)
|
||||
.get_validator_blocks_v4::<E>(slot, &randao_reveal, None, None, None, None)
|
||||
.await
|
||||
.unwrap();
|
||||
let block = response.data;
|
||||
@@ -4876,7 +4879,7 @@ impl ApiTester {
|
||||
// Retrieve and publish the envelope.
|
||||
let envelope = self
|
||||
.client
|
||||
.get_validator_execution_payload_envelope::<E>(slot, BUILDER_INDEX_SELF_BUILD)
|
||||
.get_validator_execution_payload_envelope::<E>(slot)
|
||||
.await
|
||||
.unwrap()
|
||||
.data;
|
||||
@@ -4894,6 +4897,7 @@ impl ApiTester {
|
||||
.get_validator_payload_attestation_data(slot)
|
||||
.await
|
||||
.unwrap()
|
||||
.expect("expected payload attestation data for slot with block")
|
||||
.into_data();
|
||||
|
||||
assert_eq!(pa_data.beacon_block_root, block_root);
|
||||
@@ -4926,6 +4930,26 @@ impl ApiTester {
|
||||
self
|
||||
}
|
||||
|
||||
pub async fn test_get_validator_payload_attestation_data_no_block(self) -> Self {
|
||||
// Advance the slot clock without producing a block
|
||||
self.harness.advance_slot();
|
||||
let slot = self.chain.slot().unwrap();
|
||||
|
||||
// Should return None when no block exists for the slot
|
||||
let result = self
|
||||
.client
|
||||
.get_validator_payload_attestation_data(slot)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert!(
|
||||
result.is_none(),
|
||||
"expected None for empty slot, got: {result:?}"
|
||||
);
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
#[allow(clippy::await_holding_lock)] // This is a test, so it should be fine.
|
||||
pub async fn test_get_validator_aggregate_attestation_v1(self) -> Self {
|
||||
let attestation = self
|
||||
@@ -8597,6 +8621,17 @@ async fn get_validator_payload_attestation_data_pre_gloas() {
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn get_validator_payload_attestation_data_no_block() {
|
||||
if !fork_name_from_env().is_some_and(|f| f.gloas_enabled()) {
|
||||
return;
|
||||
}
|
||||
ApiTester::new_with_hard_forks()
|
||||
.await
|
||||
.test_get_validator_payload_attestation_data_no_block()
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn payload_attestation_present_after_envelope_publish() {
|
||||
ApiTester::new_with_hard_forks()
|
||||
|
||||
Reference in New Issue
Block a user