mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-16 18:28:42 +00:00
Merge branch 'unstable' of https://github.com/sigp/lighthouse into glamsterdam-devnet-5
This commit is contained in:
@@ -4970,6 +4970,10 @@ impl ApiTester {
|
||||
"payload attestation should report payload_present=true after publishing \
|
||||
the envelope via the HTTP API (slot {slot})"
|
||||
);
|
||||
assert!(
|
||||
pa_data.blob_data_available,
|
||||
"blob_data_available should be true once the envelope is imported (slot {slot})"
|
||||
);
|
||||
|
||||
self.chain.slot_clock.set_slot(slot.as_u64() + 1);
|
||||
}
|
||||
@@ -4977,6 +4981,71 @@ impl ApiTester {
|
||||
self
|
||||
}
|
||||
|
||||
/// When a payload hasn't been seen, the payload attestation data
|
||||
/// must report `payload_present = false` and `blob_data_available = false`.
|
||||
pub async fn test_payload_attestation_unavailable_without_envelope(self) -> Self {
|
||||
if !self.chain.spec.is_gloas_scheduled() {
|
||||
return self;
|
||||
}
|
||||
|
||||
let fork = self.chain.canonical_head.cached_head().head_fork();
|
||||
let genesis_validators_root = self.chain.genesis_validators_root;
|
||||
|
||||
for _ in 0..E::slots_per_epoch() * 3 {
|
||||
let slot = self.chain.slot().unwrap();
|
||||
let epoch = self.chain.epoch().unwrap();
|
||||
let fork_name = self.chain.spec.fork_name_at_slot::<E>(slot);
|
||||
|
||||
if !fork_name.gloas_enabled() {
|
||||
self.chain.slot_clock.set_slot(slot.as_u64() + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
let (sk, randao_reveal) = self
|
||||
.proposer_setup(slot, epoch, &fork, genesis_validators_root)
|
||||
.await;
|
||||
|
||||
// Produce and publish a block, but withhold its envelope.
|
||||
let (response, _metadata) = self
|
||||
.client
|
||||
.get_validator_blocks_v4::<E>(slot, &randao_reveal, None, None, None, None)
|
||||
.await
|
||||
.unwrap();
|
||||
let block = response.data;
|
||||
let block_root = block.tree_hash_root();
|
||||
|
||||
let signed_block = block.sign(&sk, &fork, genesis_validators_root, &self.chain.spec);
|
||||
let signed_block_request =
|
||||
PublishBlockRequest::try_from(Arc::new(signed_block)).unwrap();
|
||||
self.client
|
||||
.post_beacon_blocks_v2(&signed_block_request, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let pa_data = self
|
||||
.client
|
||||
.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);
|
||||
assert!(
|
||||
!pa_data.payload_present,
|
||||
"payload_present should be false when the envelope is withheld (slot {slot})"
|
||||
);
|
||||
assert!(
|
||||
!pa_data.blob_data_available,
|
||||
"blob_data_available should be false when the envelope is not imported (slot {slot})"
|
||||
);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
pub async fn test_get_validator_payload_attestation_data_pre_gloas(self) -> Self {
|
||||
let slot = self.chain.slot().unwrap();
|
||||
|
||||
@@ -8703,6 +8772,14 @@ async fn payload_attestation_present_after_envelope_publish() {
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn payload_attestation_unavailable_without_envelope() {
|
||||
ApiTester::new_with_hard_forks()
|
||||
.await
|
||||
.test_payload_attestation_unavailable_without_envelope()
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn post_beacon_pool_payload_attestations_valid() {
|
||||
if !fork_name_from_env().is_some_and(|f| f.gloas_enabled()) {
|
||||
|
||||
Reference in New Issue
Block a user