mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-17 21:08:32 +00:00
Fix all compile errors from v0.4.0 update
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use super::ValidatorHarness;
|
||||
use beacon_chain::{BeaconChain, BlockProcessingOutcome};
|
||||
pub use beacon_chain::{CheckPoint, Error as BeaconChainError};
|
||||
pub use beacon_chain::{BeaconChainError, CheckPoint};
|
||||
use bls::create_proof_of_possession;
|
||||
use db::{
|
||||
stores::{BeaconBlockStore, BeaconStateStore},
|
||||
@@ -250,16 +250,13 @@ impl BeaconChainHarness {
|
||||
validator_index: usize,
|
||||
message: &[u8],
|
||||
epoch: Epoch,
|
||||
domain_type: u64,
|
||||
domain_type: Domain,
|
||||
) -> Option<Signature> {
|
||||
let validator = self.validators.get(validator_index)?;
|
||||
|
||||
let domain = self
|
||||
.beacon_chain
|
||||
.state
|
||||
.read()
|
||||
.fork
|
||||
.get_domain(epoch, domain_type);
|
||||
.spec
|
||||
.get_domain(epoch, domain_type, &self.beacon_chain.state.read().fork);
|
||||
|
||||
Some(Signature::new(message, domain, &validator.keypair.sk))
|
||||
}
|
||||
@@ -285,7 +282,7 @@ impl BeaconChainHarness {
|
||||
/// Note: the `ValidatorHarness` for this validator continues to exist. Once it is exited it
|
||||
/// will stop receiving duties from the beacon chain and just do nothing when prompted to
|
||||
/// produce/attest.
|
||||
pub fn add_exit(&mut self, exit: Exit) {
|
||||
pub fn add_exit(&mut self, exit: VoluntaryExit) {
|
||||
self.beacon_chain.receive_exit_for_inclusion(exit);
|
||||
}
|
||||
|
||||
|
||||
@@ -200,14 +200,14 @@ impl TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
fn build_exit(harness: &BeaconChainHarness, validator_index: u64) -> Exit {
|
||||
fn build_exit(harness: &BeaconChainHarness, validator_index: u64) -> VoluntaryExit {
|
||||
let epoch = harness
|
||||
.beacon_chain
|
||||
.state
|
||||
.read()
|
||||
.current_epoch(&harness.spec);
|
||||
|
||||
let mut exit = Exit {
|
||||
let mut exit = VoluntaryExit {
|
||||
epoch,
|
||||
validator_index,
|
||||
signature: Signature::empty_signature(),
|
||||
@@ -216,13 +216,8 @@ fn build_exit(harness: &BeaconChainHarness, validator_index: u64) -> Exit {
|
||||
let message = exit.hash_tree_root();
|
||||
|
||||
exit.signature = harness
|
||||
.validator_sign(
|
||||
validator_index as usize,
|
||||
&message[..],
|
||||
epoch,
|
||||
harness.spec.domain_exit,
|
||||
)
|
||||
.expect("Unable to sign Exit");
|
||||
.validator_sign(validator_index as usize, &message[..], epoch, Domain::Exit)
|
||||
.expect("Unable to sign VoluntaryExit");
|
||||
|
||||
exit
|
||||
}
|
||||
@@ -234,20 +229,20 @@ fn build_double_vote_attester_slashing(
|
||||
harness: &BeaconChainHarness,
|
||||
validator_indices: &[u64],
|
||||
) -> AttesterSlashing {
|
||||
let signer = |validator_index: u64, message: &[u8], epoch: Epoch, domain: u64| {
|
||||
let signer = |validator_index: u64, message: &[u8], epoch: Epoch, domain: Domain| {
|
||||
harness
|
||||
.validator_sign(validator_index as usize, message, epoch, domain)
|
||||
.expect("Unable to sign AttesterSlashing")
|
||||
};
|
||||
|
||||
AttesterSlashingBuilder::double_vote(validator_indices, signer, &harness.spec)
|
||||
AttesterSlashingBuilder::double_vote(validator_indices, signer)
|
||||
}
|
||||
|
||||
/// Builds an `ProposerSlashing` for some `validator_index`.
|
||||
///
|
||||
/// Signs the message using a `BeaconChainHarness`.
|
||||
fn build_proposer_slashing(harness: &BeaconChainHarness, validator_index: u64) -> ProposerSlashing {
|
||||
let signer = |validator_index: u64, message: &[u8], epoch: Epoch, domain: u64| {
|
||||
let signer = |validator_index: u64, message: &[u8], epoch: Epoch, domain: Domain| {
|
||||
harness
|
||||
.validator_sign(validator_index as usize, message, epoch, domain)
|
||||
.expect("Unable to sign AttesterSlashing")
|
||||
|
||||
@@ -66,7 +66,7 @@ impl StateCheck {
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter_map(|(i, validator)| {
|
||||
if validator.is_penalized_at(state_epoch) {
|
||||
if validator.slashed {
|
||||
Some(i as u64)
|
||||
} else {
|
||||
None
|
||||
@@ -108,7 +108,7 @@ impl StateCheck {
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter_map(|(i, validator)| {
|
||||
if validator.has_initiated_exit() {
|
||||
if validator.initiated_exit {
|
||||
Some(i as u64)
|
||||
} else {
|
||||
None
|
||||
|
||||
@@ -80,8 +80,8 @@ impl<T: ClientDB, U: SlotClock, F: ForkChoice> BeaconBlockNode for DirectBeaconN
|
||||
let (block, _state) = self
|
||||
.beacon_chain
|
||||
.produce_block(randao_reveal.clone())
|
||||
.ok_or_else(|| {
|
||||
BeaconBlockNodeError::RemoteFailure("Did not produce block.".to_string())
|
||||
.map_err(|e| {
|
||||
BeaconBlockNodeError::RemoteFailure(format!("Did not produce block: {:?}", e))
|
||||
})?;
|
||||
|
||||
if block.slot == slot {
|
||||
|
||||
Reference in New Issue
Block a user