mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-28 14:57:17 +00:00
Add comments to new BeaconChainHarness
methods.
This commit is contained in:
parent
f5e4fe29d7
commit
1703508385
@ -240,6 +240,11 @@ impl BeaconChainHarness {
|
||||
debug!("Free attestations processed.");
|
||||
}
|
||||
|
||||
/// Signs a message using some validators secret key with the `Fork` info from the latest state
|
||||
/// of the `BeaconChain`.
|
||||
///
|
||||
/// Useful for producing slashable messages and other objects that `BeaconChainHarness` does
|
||||
/// not produce naturally.
|
||||
pub fn validator_sign(
|
||||
&self,
|
||||
validator_index: usize,
|
||||
@ -259,6 +264,11 @@ impl BeaconChainHarness {
|
||||
Some(Signature::new(message, domain, &validator.keypair.sk))
|
||||
}
|
||||
|
||||
/// Submit a deposit to the `BeaconChain` and, if given a keypair, create a new
|
||||
/// `ValidatorHarness` instance for this validator.
|
||||
///
|
||||
/// If a new `ValidatorHarness` was created, the validator should become fully operational as
|
||||
/// if the validator were created during `BeaconChainHarness` instantiation.
|
||||
pub fn add_deposit(&mut self, deposit: Deposit, keypair: Option<Keypair>) {
|
||||
self.beacon_chain.receive_deposit_for_inclusion(deposit);
|
||||
|
||||
@ -270,16 +280,19 @@ impl BeaconChainHarness {
|
||||
}
|
||||
}
|
||||
|
||||
/// Submit a proposer slashing to the `BeaconChain` for inclusion in some block.
|
||||
pub fn add_proposer_slashing(&mut self, proposer_slashing: ProposerSlashing) {
|
||||
self.beacon_chain
|
||||
.receive_proposer_slashing_for_inclusion(proposer_slashing);
|
||||
}
|
||||
|
||||
/// Submit an attester slashing to the `BeaconChain` for inclusion in some block.
|
||||
pub fn add_attester_slashing(&mut self, attester_slashing: AttesterSlashing) {
|
||||
self.beacon_chain
|
||||
.receive_attester_slashing_for_inclusion(attester_slashing);
|
||||
}
|
||||
|
||||
/// Executes the fork choice rule on the `BeaconChain`, selecting a new canonical head.
|
||||
pub fn run_fork_choice(&mut self) {
|
||||
self.beacon_chain.fork_choice().unwrap()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user