mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-22 22:34:45 +00:00
Merged Age's changes and ripped out heaps of now obsolete stuff in the validator client.
- Replaced most instances of PublicKey with KeyPair, since they need to be passed into each validator thread now. - Pulled out a bunch of FreeAttestations, and replaced with regular Attestations (as per Paul's suggestion) - Started generalising pubkeys to 'signers' (though they are still just Keypairs) - Added validator_index into a few structs where relevant - Removed the SlotClock and DutiesReader from the BlockProducer and Attester services, since this logic is now abstracted to the higher level process. - Added a Hash trait to the Keypair (rather than just pubkey) which assumes the Pubkey uniquely defines it.
This commit is contained in:
@@ -6,4 +6,5 @@ pub struct AttestationDuty {
|
||||
pub slot: Slot,
|
||||
pub shard: Shard,
|
||||
pub committee_index: usize,
|
||||
pub validator_index: usize,
|
||||
}
|
||||
|
||||
@@ -37,6 +37,19 @@ impl BeaconBlockHeader {
|
||||
pub fn canonical_root(&self) -> Hash256 {
|
||||
Hash256::from_slice(&self.hash_tree_root()[..])
|
||||
}
|
||||
|
||||
/// Given a `body`, consumes `self` and returns a complete `BeaconBlock`.
|
||||
///
|
||||
/// Spec v0.5.0
|
||||
pub fn into_block(self, body: BeaconBlockBody) -> BeaconBlock {
|
||||
BeaconBlock {
|
||||
slot: self.slot,
|
||||
previous_block_root: self.previous_block_root,
|
||||
state_root: self.state_root,
|
||||
body,
|
||||
signature: self.signature,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -92,6 +92,7 @@ impl EpochCache {
|
||||
slot,
|
||||
shard,
|
||||
committee_index: k,
|
||||
validator_index: *validator_index,
|
||||
};
|
||||
attestation_duties[*validator_index] = Some(attestation_duty)
|
||||
}
|
||||
|
||||
@@ -85,6 +85,6 @@ pub type AttesterMap = HashMap<(u64, u64), Vec<usize>>;
|
||||
pub type ProposerMap = HashMap<u64, usize>;
|
||||
|
||||
pub use bls::{AggregatePublicKey, AggregateSignature, Keypair, PublicKey, SecretKey, Signature};
|
||||
pub use libp2p::floodsub::{Topic, TopicBuilder};
|
||||
pub use libp2p::floodsub::{Topic, TopicBuilder, TopicHash};
|
||||
pub use libp2p::multiaddr;
|
||||
pub use libp2p::Multiaddr;
|
||||
|
||||
@@ -23,6 +23,7 @@ pub fn keypairs_path() -> PathBuf {
|
||||
/// Builds a beacon state to be used for testing purposes.
|
||||
///
|
||||
/// This struct should **never be used for production purposes.**
|
||||
#[derive(Clone)]
|
||||
pub struct TestingBeaconStateBuilder {
|
||||
state: BeaconState,
|
||||
keypairs: Vec<Keypair>,
|
||||
|
||||
Reference in New Issue
Block a user