fix compilation errors (#25)

This commit is contained in:
Jimmy Chen 2022-12-08 02:07:55 +11:00 committed by GitHub
parent 2cd971c7d3
commit ae054d2663
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2122,7 +2122,7 @@ impl ApiTester {
self self
} }
pub async fn test_blinded_block_production<Payload: ExecPayload<E>>(&self) { pub async fn test_blinded_block_production<Payload: AbstractExecPayload<E>>(&self) {
let fork = self.chain.canonical_head.cached_head().head_fork(); let fork = self.chain.canonical_head.cached_head().head_fork();
let genesis_validators_root = self.chain.genesis_validators_root; let genesis_validators_root = self.chain.genesis_validators_root;
@ -2182,7 +2182,7 @@ impl ApiTester {
} }
} }
pub async fn test_blinded_block_production_no_verify_randao<Payload: ExecPayload<E>>( pub async fn test_blinded_block_production_no_verify_randao<Payload: AbstractExecPayload<E>>(
self, self,
) -> Self { ) -> Self {
for _ in 0..E::slots_per_epoch() { for _ in 0..E::slots_per_epoch() {
@ -2206,7 +2206,7 @@ impl ApiTester {
self self
} }
pub async fn test_blinded_block_production_verify_randao_invalid<Payload: ExecPayload<E>>( pub async fn test_blinded_block_production_verify_randao_invalid<Payload: AbstractExecPayload<E>>(
self, self,
) -> Self { ) -> Self {
let fork = self.chain.canonical_head.cached_head().head_fork(); let fork = self.chain.canonical_head.cached_head().head_fork();
@ -2664,11 +2664,13 @@ impl ApiTester {
let (proposer_index, randao_reveal) = self.get_test_randao(slot, epoch).await; let (proposer_index, randao_reveal) = self.get_test_randao(slot, epoch).await;
let payload = self let beacon_block_response = self
.client .client
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None) .get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
.await .await
.unwrap() .unwrap();
let payload = beacon_block_response
.data .data
.body() .body()
.execution_payload() .execution_payload()
@ -2677,10 +2679,10 @@ impl ApiTester {
let expected_fee_recipient = Address::from_low_u64_be(proposer_index as u64); let expected_fee_recipient = Address::from_low_u64_be(proposer_index as u64);
assert_eq!( assert_eq!(
payload.execution_payload_header.fee_recipient, payload.to_execution_payload_header().fee_recipient(),
expected_fee_recipient expected_fee_recipient
); );
assert_eq!(payload.execution_payload_header.gas_limit, 11_111_111); assert_eq!(payload.to_execution_payload_header().gas_limit(), 11_111_111);
// If this cache is empty, it indicates fallback was not used, so the payload came from the // If this cache is empty, it indicates fallback was not used, so the payload came from the
// mock builder. // mock builder.
@ -2707,11 +2709,13 @@ impl ApiTester {
let (proposer_index, randao_reveal) = self.get_test_randao(slot, epoch).await; let (proposer_index, randao_reveal) = self.get_test_randao(slot, epoch).await;
let payload = self let beacon_block_response = self
.client .client
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None) .get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
.await .await
.unwrap() .unwrap();
let payload = beacon_block_response
.data .data
.body() .body()
.execution_payload() .execution_payload()
@ -2720,10 +2724,10 @@ impl ApiTester {
let expected_fee_recipient = Address::from_low_u64_be(proposer_index as u64); let expected_fee_recipient = Address::from_low_u64_be(proposer_index as u64);
assert_eq!( assert_eq!(
payload.execution_payload_header.fee_recipient, payload.to_execution_payload_header().fee_recipient(),
expected_fee_recipient expected_fee_recipient
); );
assert_eq!(payload.execution_payload_header.gas_limit, 30_000_000); assert_eq!(payload.to_execution_payload_header().gas_limit(), 30_000_000);
// This cache should not be populated because fallback should not have been used. // This cache should not be populated because fallback should not have been used.
assert!(self assert!(self
@ -2753,11 +2757,13 @@ impl ApiTester {
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await; let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
let payload = self let beacon_block_response = self
.client .client
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None) .get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
.await .await
.unwrap() .unwrap();
let payload = beacon_block_response
.data .data
.body() .body()
.execution_payload() .execution_payload()
@ -2765,7 +2771,7 @@ impl ApiTester {
.clone(); .clone();
assert_eq!( assert_eq!(
payload.execution_payload_header.fee_recipient, payload.to_execution_payload_header().fee_recipient(),
test_fee_recipient test_fee_recipient
); );
@ -2801,15 +2807,17 @@ impl ApiTester {
.beacon_state .beacon_state
.latest_execution_payload_header() .latest_execution_payload_header()
.unwrap() .unwrap()
.block_hash; .block_hash();
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await; let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
let payload = self let beacon_block_response = self
.client .client
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None) .get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
.await .await
.unwrap() .unwrap();
let payload = beacon_block_response
.data .data
.body() .body()
.execution_payload() .execution_payload()
@ -2817,7 +2825,7 @@ impl ApiTester {
.clone(); .clone();
assert_eq!( assert_eq!(
payload.execution_payload_header.parent_hash, payload.to_execution_payload_header().parent_hash(),
expected_parent_hash expected_parent_hash
); );
@ -2856,11 +2864,13 @@ impl ApiTester {
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await; let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
let payload = self let beacon_block_response = self
.client .client
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None) .get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
.await .await
.unwrap() .unwrap();
let payload = beacon_block_response
.data .data
.body() .body()
.execution_payload() .execution_payload()
@ -2868,7 +2878,7 @@ impl ApiTester {
.clone(); .clone();
assert_eq!( assert_eq!(
payload.execution_payload_header.prev_randao, payload.to_execution_payload_header().prev_randao(),
expected_prev_randao expected_prev_randao
); );
@ -2901,16 +2911,18 @@ impl ApiTester {
.beacon_state .beacon_state
.latest_execution_payload_header() .latest_execution_payload_header()
.unwrap() .unwrap()
.block_number .block_number()
+ 1; + 1;
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await; let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
let payload = self let beacon_block_response = self
.client .client
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None) .get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
.await .await
.unwrap() .unwrap();
let payload = beacon_block_response
.data .data
.body() .body()
.execution_payload() .execution_payload()
@ -2918,7 +2930,7 @@ impl ApiTester {
.clone(); .clone();
assert_eq!( assert_eq!(
payload.execution_payload_header.block_number, payload.to_execution_payload_header().block_number(),
expected_block_number expected_block_number
); );
@ -2951,22 +2963,24 @@ impl ApiTester {
.beacon_state .beacon_state
.latest_execution_payload_header() .latest_execution_payload_header()
.unwrap() .unwrap()
.timestamp; .timestamp();
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await; let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
let payload = self let beacon_block_response = self
.client .client
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None) .get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
.await .await
.unwrap() .unwrap();
let payload = beacon_block_response
.data .data
.body() .body()
.execution_payload() .execution_payload()
.unwrap() .unwrap()
.clone(); .clone();
assert!(payload.execution_payload_header.timestamp > min_expected_timestamp); assert!(payload.to_execution_payload_header().timestamp() > min_expected_timestamp);
// If this cache is populated, it indicates fallback to the local EE was correctly used. // If this cache is populated, it indicates fallback to the local EE was correctly used.
assert!(self assert!(self
@ -2991,11 +3005,13 @@ impl ApiTester {
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await; let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
let payload = self let beacon_block_response = self
.client .client
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None) .get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
.await .await
.unwrap() .unwrap();
let payload = beacon_block_response
.data .data
.body() .body()
.execution_payload() .execution_payload()
@ -3028,11 +3044,13 @@ impl ApiTester {
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await; let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
let payload = self let beacon_block_response = self
.client .client
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None) .get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
.await .await
.unwrap() .unwrap();
let payload = beacon_block_response
.data .data
.body() .body()
.execution_payload() .execution_payload()
@ -3071,11 +3089,13 @@ impl ApiTester {
.get_test_randao(next_slot, next_slot.epoch(E::slots_per_epoch())) .get_test_randao(next_slot, next_slot.epoch(E::slots_per_epoch()))
.await; .await;
let payload = self let beacon_block_response = self
.client .client
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(next_slot, &randao_reveal, None) .get_validator_blinded_blocks::<E, BlindedPayload<E>>(next_slot, &randao_reveal, None)
.await .await
.unwrap() .unwrap();
let payload = beacon_block_response
.data .data
.body() .body()
.execution_payload() .execution_payload()
@ -3100,11 +3120,13 @@ impl ApiTester {
.get_test_randao(next_slot, next_slot.epoch(E::slots_per_epoch())) .get_test_randao(next_slot, next_slot.epoch(E::slots_per_epoch()))
.await; .await;
let payload = self let beacon_block_response = self
.client .client
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(next_slot, &randao_reveal, None) .get_validator_blinded_blocks::<E, BlindedPayload<E>>(next_slot, &randao_reveal, None)
.await .await
.unwrap() .unwrap();
let payload = beacon_block_response
.data .data
.body() .body()
.execution_payload() .execution_payload()
@ -3149,11 +3171,13 @@ impl ApiTester {
.get_test_randao(next_slot, next_slot.epoch(E::slots_per_epoch())) .get_test_randao(next_slot, next_slot.epoch(E::slots_per_epoch()))
.await; .await;
let payload = self let beacon_block_response = self
.client .client
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(next_slot, &randao_reveal, None) .get_validator_blinded_blocks::<E, BlindedPayload<E>>(next_slot, &randao_reveal, None)
.await .await
.unwrap() .unwrap();
let payload = beacon_block_response
.data .data
.body() .body()
.execution_payload() .execution_payload()
@ -3187,12 +3211,14 @@ impl ApiTester {
let (_, randao_reveal) = self let (_, randao_reveal) = self
.get_test_randao(next_slot, next_slot.epoch(E::slots_per_epoch())) .get_test_randao(next_slot, next_slot.epoch(E::slots_per_epoch()))
.await; .await;
let payload = self let beacon_block_response = self
.client .client
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(next_slot, &randao_reveal, None) .get_validator_blinded_blocks::<E, BlindedPayload<E>>(next_slot, &randao_reveal, None)
.await .await
.unwrap() .unwrap();
let payload = beacon_block_response
.data .data
.body() .body()
.execution_payload() .execution_payload()
@ -3231,11 +3257,13 @@ impl ApiTester {
let (proposer_index, randao_reveal) = self.get_test_randao(slot, epoch).await; let (proposer_index, randao_reveal) = self.get_test_randao(slot, epoch).await;
let payload = self let beacon_block_response = self
.client .client
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None) .get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
.await .await
.unwrap() .unwrap();
let payload = beacon_block_response
.data .data
.body() .body()
.execution_payload() .execution_payload()
@ -3244,7 +3272,7 @@ impl ApiTester {
let expected_fee_recipient = Address::from_low_u64_be(proposer_index as u64); let expected_fee_recipient = Address::from_low_u64_be(proposer_index as u64);
assert_eq!( assert_eq!(
payload.execution_payload_header.fee_recipient, payload.to_execution_payload_header().fee_recipient(),
expected_fee_recipient expected_fee_recipient
); );
@ -3275,11 +3303,13 @@ impl ApiTester {
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await; let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
let payload = self let beacon_block_response = self
.client .client
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None) .get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
.await .await
.unwrap() .unwrap();
let payload = beacon_block_response
.data .data
.body() .body()
.execution_payload() .execution_payload()