Fixed some BeaconChain Tests

This commit is contained in:
Mark Mackey
2022-11-28 16:56:54 -06:00
parent e0ea26c228
commit 36170ec428
3 changed files with 65 additions and 32 deletions

View File

@@ -12,9 +12,9 @@ use beacon_chain::{
INVALID_JUSTIFIED_PAYLOAD_SHUTDOWN_REASON,
};
use execution_layer::{
json_structures::{JsonForkchoiceStateV1, JsonPayloadAttributesV1},
json_structures::{JsonForkchoiceStateV1, JsonPayloadAttributes, JsonPayloadAttributesV1},
test_utils::ExecutionBlockGenerator,
ExecutionLayer, ForkchoiceState, PayloadAttributes,
ExecutionLayer, ForkchoiceState, PayloadAttributes, PayloadAttributesV1,
};
use fork_choice::{
CountUnrealized, Error as ForkChoiceError, InvalidationOperation, PayloadVerificationStatus,
@@ -133,7 +133,10 @@ impl InvalidPayloadRig {
let attributes: JsonPayloadAttributesV1 =
serde_json::from_value(payload_param_json.clone()).unwrap();
(fork_choice_state.into(), attributes.into())
(
fork_choice_state.into(),
JsonPayloadAttributes::V1(attributes).into(),
)
}
fn previous_payload_attributes(&self) -> PayloadAttributes {
@@ -982,7 +985,7 @@ async fn payload_preparation() {
.await
.unwrap();
let payload_attributes = PayloadAttributes {
let payload_attributes = PayloadAttributes::V1(PayloadAttributesV1 {
timestamp: rig
.harness
.chain
@@ -995,7 +998,7 @@ async fn payload_preparation() {
.get_randao_mix(head.beacon_state.current_epoch())
.unwrap(),
suggested_fee_recipient: fee_recipient,
};
});
assert_eq!(rig.previous_payload_attributes(), payload_attributes);
}
@@ -1125,7 +1128,7 @@ async fn payload_preparation_before_transition_block() {
let (fork_choice_state, payload_attributes) = rig.previous_forkchoice_update_params();
let latest_block_hash = rig.latest_execution_block_hash();
assert_eq!(payload_attributes.suggested_fee_recipient, fee_recipient);
assert_eq!(payload_attributes.suggested_fee_recipient(), fee_recipient);
assert_eq!(fork_choice_state.head_block_hash, latest_block_hash);
}
@@ -1367,18 +1370,16 @@ async fn build_optimistic_chain(
.body()
.execution_payload()
.unwrap()
.execution_payload
== <_>::default(),
.is_default_with_empty_roots(),
"the block *has not* undergone the merge transition"
);
assert!(
post_transition_block
!post_transition_block
.message()
.body()
.execution_payload()
.unwrap()
.execution_payload
!= <_>::default(),
.is_default_with_empty_roots(),
"the block *has* undergone the merge transition"
);