mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 12:47:05 +00:00
resolve merge conflict and migrate il service to new pardigmn
This commit is contained in:
@@ -115,10 +115,10 @@ async fn state_by_root_pruned_from_fork_choice() {
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
|
||||
assert!(response.metadata.finalized.unwrap());
|
||||
assert!(!response.metadata.execution_optimistic.unwrap());
|
||||
assert!(response.metadata().finalized.unwrap());
|
||||
assert!(!response.metadata().execution_optimistic.unwrap());
|
||||
|
||||
let mut state = response.data;
|
||||
let mut state = response.into_data();
|
||||
assert_eq!(state.update_tree_hash_cache().unwrap(), state_root);
|
||||
}
|
||||
}
|
||||
@@ -846,7 +846,7 @@ pub async fn fork_choice_before_proposal() {
|
||||
.get_validator_blocks::<E>(slot_d, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.deconstruct()
|
||||
.0;
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ use http_api::{
|
||||
};
|
||||
use lighthouse_network::{types::SyncState, Enr, EnrExt, PeerId};
|
||||
use network::NetworkReceivers;
|
||||
use operation_pool::attestation_storage::CheckpointKey;
|
||||
use proto_array::ExecutionStatus;
|
||||
use sensitive_url::SensitiveUrl;
|
||||
use slot_clock::SlotClock;
|
||||
@@ -681,7 +682,7 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.metadata
|
||||
.metadata()
|
||||
.finalized
|
||||
.unwrap();
|
||||
|
||||
@@ -718,7 +719,7 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.metadata
|
||||
.metadata()
|
||||
.finalized
|
||||
.unwrap();
|
||||
|
||||
@@ -756,7 +757,7 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.metadata
|
||||
.metadata()
|
||||
.finalized
|
||||
.unwrap();
|
||||
|
||||
@@ -926,18 +927,32 @@ impl ApiTester {
|
||||
.map(|res| res.data);
|
||||
|
||||
let expected = state_opt.map(|(state, _execution_optimistic, _finalized)| {
|
||||
let mut validators = Vec::with_capacity(validator_indices.len());
|
||||
// If validator_indices is empty, return balances for all validators
|
||||
if validator_indices.is_empty() {
|
||||
state
|
||||
.balances()
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(index, balance)| ValidatorBalanceData {
|
||||
index: index as u64,
|
||||
balance: *balance,
|
||||
})
|
||||
.collect()
|
||||
} else {
|
||||
// Same behaviour as before for the else branch
|
||||
let mut validators = Vec::with_capacity(validator_indices.len());
|
||||
|
||||
for i in validator_indices {
|
||||
if i < state.balances().len() as u64 {
|
||||
validators.push(ValidatorBalanceData {
|
||||
index: i,
|
||||
balance: *state.balances().get(i as usize).unwrap(),
|
||||
});
|
||||
for i in validator_indices {
|
||||
if i < state.balances().len() as u64 {
|
||||
validators.push(ValidatorBalanceData {
|
||||
index: i,
|
||||
balance: *state.balances().get(i as usize).unwrap(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
validators
|
||||
validators
|
||||
}
|
||||
});
|
||||
|
||||
assert_eq!(result_index_ids, expected, "{:?}", state_id);
|
||||
@@ -1241,6 +1256,33 @@ impl ApiTester {
|
||||
self
|
||||
}
|
||||
|
||||
pub async fn test_beacon_states_pending_consolidations(self) -> Self {
|
||||
for state_id in self.interesting_state_ids() {
|
||||
let mut state_opt = state_id
|
||||
.state(&self.chain)
|
||||
.ok()
|
||||
.map(|(state, _execution_optimistic, _finalized)| state);
|
||||
|
||||
let result = self
|
||||
.client
|
||||
.get_beacon_states_pending_consolidations(state_id.0)
|
||||
.await
|
||||
.unwrap()
|
||||
.map(|res| res.data);
|
||||
|
||||
if result.is_none() && state_opt.is_none() {
|
||||
continue;
|
||||
}
|
||||
|
||||
let state = state_opt.as_mut().expect("result should be none");
|
||||
let expected = state.pending_consolidations().unwrap();
|
||||
|
||||
assert_eq!(result.unwrap(), expected.to_vec());
|
||||
}
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
pub async fn test_beacon_headers_all_slots(self) -> Self {
|
||||
for slot in 0..CHAIN_LENGTH {
|
||||
let slot = Slot::from(slot);
|
||||
@@ -1569,9 +1611,9 @@ impl ApiTester {
|
||||
let json_result = self.client.get_beacon_blocks(block_id.0).await.unwrap();
|
||||
|
||||
if let (Some(json), Some(expected)) = (&json_result, &expected) {
|
||||
assert_eq!(&json.data, expected.as_ref(), "{:?}", block_id);
|
||||
assert_eq!(json.data(), expected.as_ref(), "{:?}", block_id);
|
||||
assert_eq!(
|
||||
json.version,
|
||||
json.version(),
|
||||
Some(expected.fork_name(&self.chain.spec).unwrap())
|
||||
);
|
||||
} else {
|
||||
@@ -1595,8 +1637,8 @@ impl ApiTester {
|
||||
// Check that the legacy v1 API still works but doesn't return a version field.
|
||||
let v1_result = self.client.get_beacon_blocks_v1(block_id.0).await.unwrap();
|
||||
if let (Some(v1_result), Some(expected)) = (&v1_result, &expected) {
|
||||
assert_eq!(v1_result.version, None);
|
||||
assert_eq!(&v1_result.data, expected.as_ref());
|
||||
assert_eq!(v1_result.version(), None);
|
||||
assert_eq!(v1_result.data(), expected.as_ref());
|
||||
} else {
|
||||
assert_eq!(v1_result, None);
|
||||
assert_eq!(expected, None);
|
||||
@@ -1657,9 +1699,9 @@ impl ApiTester {
|
||||
.unwrap();
|
||||
|
||||
if let (Some(json), Some(expected)) = (&json_result, &expected) {
|
||||
assert_eq!(&json.data, expected, "{:?}", block_id);
|
||||
assert_eq!(json.data(), expected, "{:?}", block_id);
|
||||
assert_eq!(
|
||||
json.version,
|
||||
json.version(),
|
||||
Some(expected.fork_name(&self.chain.spec).unwrap())
|
||||
);
|
||||
} else {
|
||||
@@ -1722,10 +1764,14 @@ impl ApiTester {
|
||||
};
|
||||
let result = match self
|
||||
.client
|
||||
.get_blobs::<E>(CoreBlockId::Root(block_root), blob_indices.as_deref())
|
||||
.get_blobs::<E>(
|
||||
CoreBlockId::Root(block_root),
|
||||
blob_indices.as_deref(),
|
||||
&self.chain.spec,
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(result) => result.unwrap().data,
|
||||
Ok(result) => result.unwrap().into_data(),
|
||||
Err(e) => panic!("query failed incorrectly: {e:?}"),
|
||||
};
|
||||
|
||||
@@ -1778,13 +1824,13 @@ impl ApiTester {
|
||||
|
||||
match self
|
||||
.client
|
||||
.get_blobs::<E>(CoreBlockId::Slot(test_slot), None)
|
||||
.get_blobs::<E>(CoreBlockId::Slot(test_slot), None, &self.chain.spec)
|
||||
.await
|
||||
{
|
||||
Ok(result) => {
|
||||
if zero_blobs {
|
||||
assert_eq!(
|
||||
&result.unwrap().data[..],
|
||||
&result.unwrap().into_data()[..],
|
||||
&[],
|
||||
"empty blobs are always available"
|
||||
);
|
||||
@@ -1816,7 +1862,7 @@ impl ApiTester {
|
||||
|
||||
match self
|
||||
.client
|
||||
.get_blobs::<E>(CoreBlockId::Slot(test_slot), None)
|
||||
.get_blobs::<E>(CoreBlockId::Slot(test_slot), None, &self.chain.spec)
|
||||
.await
|
||||
{
|
||||
Ok(result) => panic!("queries for pre-Deneb slots should fail. got: {result:?}"),
|
||||
@@ -1833,7 +1879,7 @@ impl ApiTester {
|
||||
.get_beacon_blocks_attestations_v2(block_id.0)
|
||||
.await
|
||||
.unwrap()
|
||||
.map(|res| res.data);
|
||||
.map(|res| res.into_data());
|
||||
|
||||
let expected = block_id.full_block(&self.chain).await.ok().map(
|
||||
|(block, _execution_optimistic, _finalized)| {
|
||||
@@ -2043,7 +2089,7 @@ impl ApiTester {
|
||||
.get_light_client_bootstrap(&self.chain.store, &block_root, 1u64, &self.chain.spec);
|
||||
|
||||
assert!(expected.is_ok());
|
||||
assert_eq!(result.unwrap().data, expected.unwrap().unwrap().0);
|
||||
assert_eq!(result.unwrap().data(), &expected.unwrap().unwrap().0);
|
||||
|
||||
self
|
||||
}
|
||||
@@ -2055,7 +2101,7 @@ impl ApiTester {
|
||||
.get_beacon_light_client_optimistic_update::<E>()
|
||||
.await
|
||||
{
|
||||
Ok(result) => result.map(|res| res.data),
|
||||
Ok(result) => result.map(|res| res.into_data()),
|
||||
Err(e) => panic!("query failed incorrectly: {e:?}"),
|
||||
};
|
||||
|
||||
@@ -2074,7 +2120,7 @@ impl ApiTester {
|
||||
.get_beacon_light_client_finality_update::<E>()
|
||||
.await
|
||||
{
|
||||
Ok(result) => result.map(|res| res.data),
|
||||
Ok(result) => result.map(|res| res.into_data()),
|
||||
Err(e) => panic!("query failed incorrectly: {e:?}"),
|
||||
};
|
||||
|
||||
@@ -2087,7 +2133,7 @@ impl ApiTester {
|
||||
self
|
||||
}
|
||||
|
||||
pub async fn test_get_beacon_pool_attestations(self) -> Self {
|
||||
pub async fn test_get_beacon_pool_attestations(self) {
|
||||
let result = self
|
||||
.client
|
||||
.get_beacon_pool_attestations_v1(None, None)
|
||||
@@ -2105,10 +2151,81 @@ impl ApiTester {
|
||||
.get_beacon_pool_attestations_v2(None, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data;
|
||||
.into_data();
|
||||
|
||||
assert_eq!(result, expected);
|
||||
|
||||
self
|
||||
let result_committee_index_filtered = self
|
||||
.client
|
||||
.get_beacon_pool_attestations_v1(None, Some(0))
|
||||
.await
|
||||
.unwrap()
|
||||
.data;
|
||||
|
||||
let expected_committee_index_filtered = expected
|
||||
.clone()
|
||||
.into_iter()
|
||||
.filter(|att| att.get_committee_indices_map().contains(&0))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
assert_eq!(
|
||||
result_committee_index_filtered,
|
||||
expected_committee_index_filtered
|
||||
);
|
||||
|
||||
let result_committee_index_filtered = self
|
||||
.client
|
||||
.get_beacon_pool_attestations_v1(None, Some(1))
|
||||
.await
|
||||
.unwrap()
|
||||
.data;
|
||||
|
||||
let expected_committee_index_filtered = expected
|
||||
.clone()
|
||||
.into_iter()
|
||||
.filter(|att| att.get_committee_indices_map().contains(&1))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
assert_eq!(
|
||||
result_committee_index_filtered,
|
||||
expected_committee_index_filtered
|
||||
);
|
||||
|
||||
let fork_name = self
|
||||
.harness
|
||||
.chain
|
||||
.spec
|
||||
.fork_name_at_slot::<E>(self.harness.chain.slot().unwrap());
|
||||
|
||||
// aggregate electra attestations
|
||||
if fork_name.electra_enabled() {
|
||||
// Take and drop the lock in a block to avoid clippy complaining
|
||||
// about taking locks across await points
|
||||
{
|
||||
let mut all_attestations = self.chain.op_pool.attestations.write();
|
||||
let (prev_epoch_key, curr_epoch_key) =
|
||||
CheckpointKey::keys_for_state(&self.harness.get_current_state());
|
||||
all_attestations.aggregate_across_committees(prev_epoch_key);
|
||||
all_attestations.aggregate_across_committees(curr_epoch_key);
|
||||
}
|
||||
let result_committee_index_filtered = self
|
||||
.client
|
||||
.get_beacon_pool_attestations_v2(None, Some(0))
|
||||
.await
|
||||
.unwrap()
|
||||
.into_data();
|
||||
let mut expected = self.chain.op_pool.get_all_attestations();
|
||||
expected.extend(self.chain.naive_aggregation_pool.read().iter().cloned());
|
||||
let expected_committee_index_filtered = expected
|
||||
.clone()
|
||||
.into_iter()
|
||||
.filter(|att| att.get_committee_indices_map().contains(&0))
|
||||
.collect::<Vec<_>>();
|
||||
assert_eq!(
|
||||
result_committee_index_filtered,
|
||||
expected_committee_index_filtered
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn test_post_beacon_pool_attester_slashings_valid_v1(mut self) -> Self {
|
||||
@@ -2212,7 +2329,7 @@ impl ApiTester {
|
||||
.get_beacon_pool_attester_slashings_v2()
|
||||
.await
|
||||
.unwrap()
|
||||
.data;
|
||||
.into_data();
|
||||
assert_eq!(result, expected);
|
||||
|
||||
self
|
||||
@@ -2376,7 +2493,7 @@ impl ApiTester {
|
||||
is_syncing: false,
|
||||
is_optimistic: false,
|
||||
// these tests run without the Bellatrix fork enabled
|
||||
el_offline: true,
|
||||
el_offline: false,
|
||||
head_slot,
|
||||
sync_distance,
|
||||
};
|
||||
@@ -2440,11 +2557,11 @@ impl ApiTester {
|
||||
pub async fn test_get_node_health(self) -> Self {
|
||||
let status = self.client.get_node_health().await;
|
||||
match status {
|
||||
Ok(_) => {
|
||||
panic!("should return 503 error status code");
|
||||
Ok(status) => {
|
||||
assert_eq!(status, 200);
|
||||
}
|
||||
Err(e) => {
|
||||
assert_eq!(e.status().unwrap(), 503);
|
||||
Err(_) => {
|
||||
panic!("should return valid status");
|
||||
}
|
||||
}
|
||||
self
|
||||
@@ -2550,9 +2667,9 @@ impl ApiTester {
|
||||
expected.as_mut().map(|state| state.drop_all_caches());
|
||||
|
||||
if let (Some(json), Some(expected)) = (&result_json, &expected) {
|
||||
assert_eq!(json.data, *expected, "{:?}", state_id);
|
||||
assert_eq!(json.data(), expected, "{:?}", state_id);
|
||||
assert_eq!(
|
||||
json.version,
|
||||
json.version(),
|
||||
Some(expected.fork_name(&self.chain.spec).unwrap())
|
||||
);
|
||||
} else {
|
||||
@@ -3073,7 +3190,7 @@ impl ApiTester {
|
||||
.get_validator_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.deconstruct()
|
||||
.0;
|
||||
|
||||
@@ -3170,7 +3287,7 @@ impl ApiTester {
|
||||
) {
|
||||
// Compare fork name to ForkVersionedResponse rather than metadata consensus_version, which
|
||||
// is deserialized to a dummy value.
|
||||
assert_eq!(Some(metadata.consensus_version), response.version);
|
||||
assert_eq!(metadata.consensus_version, response.version);
|
||||
assert_eq!(ForkName::Base, response.metadata.consensus_version);
|
||||
assert_eq!(
|
||||
metadata.execution_payload_blinded,
|
||||
@@ -3296,7 +3413,7 @@ impl ApiTester {
|
||||
)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.deconstruct()
|
||||
.0;
|
||||
assert_eq!(block.slot(), slot);
|
||||
@@ -3410,7 +3527,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data;
|
||||
.into_data();
|
||||
|
||||
let signed_block = block.sign(&sk, &fork, genesis_validators_root, &self.chain.spec);
|
||||
|
||||
@@ -3425,7 +3542,7 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.data;
|
||||
.into_data();
|
||||
|
||||
assert_eq!(head_block.clone_as_blinded(), signed_block);
|
||||
|
||||
@@ -3498,7 +3615,7 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.data;
|
||||
.into_data();
|
||||
|
||||
let signed_block = signed_block_contents.signed_block();
|
||||
assert_eq!(head_block, **signed_block);
|
||||
@@ -3521,7 +3638,7 @@ impl ApiTester {
|
||||
)
|
||||
.await
|
||||
.unwrap()
|
||||
.data;
|
||||
.into_data();
|
||||
assert_eq!(blinded_block.slot(), slot);
|
||||
self.chain.slot_clock.set_slot(slot.as_u64() + 1);
|
||||
}
|
||||
@@ -3665,7 +3782,7 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.data;
|
||||
.into_data();
|
||||
let expected = attestation;
|
||||
|
||||
assert_eq!(result, expected);
|
||||
@@ -4239,7 +4356,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4285,7 +4402,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4329,7 +4446,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4403,7 +4520,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4489,7 +4606,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4581,7 +4698,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4671,7 +4788,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4760,7 +4877,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4835,7 +4952,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4898,7 +5015,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4974,7 +5091,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(next_slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -5005,7 +5122,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(next_slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -5113,7 +5230,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(next_slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -5154,7 +5271,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(next_slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -5270,7 +5387,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -5351,7 +5468,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -5419,7 +5536,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -5487,7 +5604,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -5554,7 +5671,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -5625,7 +5742,7 @@ impl ApiTester {
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.into_data()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -6294,6 +6411,34 @@ impl ApiTester {
|
||||
|
||||
assert_eq!(result.execution_optimistic, Some(true));
|
||||
}
|
||||
|
||||
async fn test_get_beacon_rewards_blocks_at_head(&self) -> StandardBlockReward {
|
||||
self.client
|
||||
.get_beacon_rewards_blocks(CoreBlockId::Head)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
}
|
||||
|
||||
async fn test_beacon_block_rewards_electra(self) -> Self {
|
||||
for _ in 0..E::slots_per_epoch() {
|
||||
let state = self.harness.get_current_state();
|
||||
let slot = state.slot() + Slot::new(1);
|
||||
// calculate beacon block rewards / penalties
|
||||
let ((signed_block, _maybe_blob_sidecars), mut state) =
|
||||
self.harness.make_block_return_pre_state(state, slot).await;
|
||||
|
||||
let beacon_block_reward = self
|
||||
.harness
|
||||
.chain
|
||||
.compute_beacon_block_reward(signed_block.message(), &mut state)
|
||||
.unwrap();
|
||||
self.harness.extend_slots(1).await;
|
||||
let api_beacon_block_reward = self.test_get_beacon_rewards_blocks_at_head().await;
|
||||
assert_eq!(beacon_block_reward, api_beacon_block_reward);
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
async fn poll_events<S: Stream<Item = Result<EventKind<E>, eth2::Error>> + Unpin, E: EthSpec>(
|
||||
@@ -6416,6 +6561,8 @@ async fn beacon_get_state_info_electra() {
|
||||
.test_beacon_states_pending_deposits()
|
||||
.await
|
||||
.test_beacon_states_pending_partial_withdrawals()
|
||||
.await
|
||||
.test_beacon_states_pending_consolidations()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -6446,10 +6593,30 @@ async fn beacon_get_blocks() {
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn beacon_get_pools() {
|
||||
async fn test_beacon_pool_attestations_electra() {
|
||||
let mut config = ApiTesterConfig::default();
|
||||
config.spec.altair_fork_epoch = Some(Epoch::new(0));
|
||||
config.spec.bellatrix_fork_epoch = Some(Epoch::new(0));
|
||||
config.spec.capella_fork_epoch = Some(Epoch::new(0));
|
||||
config.spec.deneb_fork_epoch = Some(Epoch::new(0));
|
||||
config.spec.electra_fork_epoch = Some(Epoch::new(0));
|
||||
ApiTester::new_from_config(config)
|
||||
.await
|
||||
.test_get_beacon_pool_attestations()
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn test_beacon_pool_attestations_base() {
|
||||
ApiTester::new()
|
||||
.await
|
||||
.test_get_beacon_pool_attestations()
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn beacon_get_pools() {
|
||||
ApiTester::new()
|
||||
.await
|
||||
.test_get_beacon_pool_attester_slashings()
|
||||
.await
|
||||
@@ -7412,6 +7579,20 @@ async fn expected_withdrawals_valid_capella() {
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn get_beacon_rewards_blocks_electra() {
|
||||
let mut config = ApiTesterConfig::default();
|
||||
config.spec.altair_fork_epoch = Some(Epoch::new(0));
|
||||
config.spec.bellatrix_fork_epoch = Some(Epoch::new(0));
|
||||
config.spec.capella_fork_epoch = Some(Epoch::new(0));
|
||||
config.spec.deneb_fork_epoch = Some(Epoch::new(0));
|
||||
config.spec.electra_fork_epoch = Some(Epoch::new(0));
|
||||
ApiTester::new_from_config(config)
|
||||
.await
|
||||
.test_beacon_block_rewards_electra()
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn create_signed_inclusion_lists() {
|
||||
let mut config = ApiTesterConfig::default();
|
||||
|
||||
Reference in New Issue
Block a user