Fixed Some Tests
This commit is contained in:
parent
96da8b9383
commit
c922566fbc
@ -5,7 +5,7 @@ use beacon_chain::{
|
|||||||
test_utils::{AttestationStrategy, BlockStrategy},
|
test_utils::{AttestationStrategy, BlockStrategy},
|
||||||
};
|
};
|
||||||
use eth2::types::DepositContractData;
|
use eth2::types::DepositContractData;
|
||||||
use execution_layer::{ForkChoiceState, PayloadAttributes};
|
use execution_layer::{ForkchoiceState, PayloadAttributes};
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use slot_clock::SlotClock;
|
use slot_clock::SlotClock;
|
||||||
use state_processing::state_advance::complete_state_advance;
|
use state_processing::state_advance::complete_state_advance;
|
||||||
@ -55,7 +55,7 @@ struct ForkChoiceUpdates {
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
struct ForkChoiceUpdateMetadata {
|
struct ForkChoiceUpdateMetadata {
|
||||||
received_at: Duration,
|
received_at: Duration,
|
||||||
state: ForkChoiceState,
|
state: ForkchoiceState,
|
||||||
payload_attributes: Option<PayloadAttributes>,
|
payload_attributes: Option<PayloadAttributes>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ impl ForkChoiceUpdates {
|
|||||||
.payload_attributes
|
.payload_attributes
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map_or(false, |payload_attributes| {
|
.map_or(false, |payload_attributes| {
|
||||||
payload_attributes.timestamp == proposal_timestamp
|
payload_attributes.timestamp() == proposal_timestamp
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.cloned()
|
.cloned()
|
||||||
@ -342,7 +342,7 @@ pub async fn proposer_boost_re_org_test(
|
|||||||
.lock()
|
.lock()
|
||||||
.set_forkchoice_updated_hook(Box::new(move |state, payload_attributes| {
|
.set_forkchoice_updated_hook(Box::new(move |state, payload_attributes| {
|
||||||
let received_at = chain_inner.slot_clock.now_duration().unwrap();
|
let received_at = chain_inner.slot_clock.now_duration().unwrap();
|
||||||
let state = ForkChoiceState::from(state);
|
let state = ForkchoiceState::from(state);
|
||||||
let payload_attributes = payload_attributes.map(Into::into);
|
let payload_attributes = payload_attributes.map(Into::into);
|
||||||
let update = ForkChoiceUpdateMetadata {
|
let update = ForkChoiceUpdateMetadata {
|
||||||
received_at,
|
received_at,
|
||||||
@ -521,16 +521,20 @@ pub async fn proposer_boost_re_org_test(
|
|||||||
|
|
||||||
if !misprediction {
|
if !misprediction {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
lookahead, payload_lookahead,
|
lookahead,
|
||||||
|
payload_lookahead,
|
||||||
"lookahead={lookahead:?}, timestamp={}, prev_randao={:?}",
|
"lookahead={lookahead:?}, timestamp={}, prev_randao={:?}",
|
||||||
payload_attribs.timestamp, payload_attribs.prev_randao,
|
payload_attribs.timestamp(),
|
||||||
|
payload_attribs.prev_randao(),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// On a misprediction we issue the first fcU 500ms before creating a block!
|
// On a misprediction we issue the first fcU 500ms before creating a block!
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
lookahead, fork_choice_lookahead,
|
lookahead,
|
||||||
|
fork_choice_lookahead,
|
||||||
"timestamp={}, prev_randao={:?}",
|
"timestamp={}, prev_randao={:?}",
|
||||||
payload_attribs.timestamp, payload_attribs.prev_randao,
|
payload_attribs.timestamp(),
|
||||||
|
payload_attribs.prev_randao(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1372,9 +1372,9 @@ impl ApiTester {
|
|||||||
pub async fn test_get_config_spec(self) -> Self {
|
pub async fn test_get_config_spec(self) -> Self {
|
||||||
let result = self
|
let result = self
|
||||||
.client
|
.client
|
||||||
.get_config_spec::<ConfigAndPresetBellatrix>()
|
.get_config_spec::<ConfigAndPresetCapella>()
|
||||||
.await
|
.await
|
||||||
.map(|res| ConfigAndPreset::Bellatrix(res.data))
|
.map(|res| ConfigAndPreset::Capella(res.data))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let expected = ConfigAndPreset::from_chain_spec::<E>(&self.chain.spec, None);
|
let expected = ConfigAndPreset::from_chain_spec::<E>(&self.chain.spec, None);
|
||||||
|
|
||||||
|
@ -212,9 +212,9 @@ impl ApiTester {
|
|||||||
pub async fn test_get_lighthouse_spec(self) -> Self {
|
pub async fn test_get_lighthouse_spec(self) -> Self {
|
||||||
let result = self
|
let result = self
|
||||||
.client
|
.client
|
||||||
.get_lighthouse_spec::<ConfigAndPresetBellatrix>()
|
.get_lighthouse_spec::<ConfigAndPresetCapella>()
|
||||||
.await
|
.await
|
||||||
.map(|res| ConfigAndPreset::Bellatrix(res.data))
|
.map(|res| ConfigAndPreset::Capella(res.data))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let expected = ConfigAndPreset::from_chain_spec::<E>(&E::default_spec(), None);
|
let expected = ConfigAndPreset::from_chain_spec::<E>(&E::default_spec(), None);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user