mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Update to Spec v0.10 (#817)
* Start updating types * WIP * Signature hacking * Existing EF tests passing with fake_crypto * Updates * Delete outdated API spec * The refactor continues * It compiles * WIP test fixes * All release tests passing bar genesis state parsing * Update and test YamlConfig * Update to spec v0.10 compatible BLS * Updates to BLS EF tests * Add EF test for AggregateVerify And delete unused hash2curve tests for uncompressed points * Update EF tests to v0.10.1 * Use optional block root correctly in block proc * Use genesis fork in deposit domain. All tests pass * Cargo fmt * Fast aggregate verify test * Update REST API docs * Cargo fmt * Fix unused import * Bump spec tags to v0.10.1 * Add `seconds_per_eth1_block` to chainspec * Update to timestamp based eth1 voting scheme * Return None from `get_votes_to_consider` if block cache is empty * Handle overflows in `is_candidate_block` * Revert to failing tests * Fix eth1 data sets test * Choose default vote according to spec * Fix collect_valid_votes tests * Fix `get_votes_to_consider` to choose all eligible blocks * Uncomment winning_vote tests * Add comments; remove unused code * Reduce seconds_per_eth1_block for simulation * Addressed review comments * Add test for default vote case * Fix logs * Remove unused functions * Meter default eth1 votes * Fix comments * Address review comments; remove unused dependency * Disable/delete two outdated tests * Bump eth1 default vote warn to error * Delete outdated eth1 test Co-authored-by: Pawan Dhananjay <pawandhananjay@gmail.com>
This commit is contained in:
@@ -235,15 +235,15 @@ impl<T: SlotClock + 'static, E: EthSpec> BlockService<T, E> {
|
||||
PublishStatus::Valid => info!(
|
||||
log_1,
|
||||
"Successfully published block";
|
||||
"deposits" => block.body.deposits.len(),
|
||||
"attestations" => block.body.attestations.len(),
|
||||
"slot" => block.slot.as_u64(),
|
||||
"deposits" => block.message.body.deposits.len(),
|
||||
"attestations" => block.message.body.attestations.len(),
|
||||
"slot" => block.slot().as_u64(),
|
||||
),
|
||||
PublishStatus::Invalid(msg) => crit!(
|
||||
log_1,
|
||||
"Published block was invalid";
|
||||
"message" => msg,
|
||||
"slot" => block.slot.as_u64(),
|
||||
"slot" => block.slot().as_u64(),
|
||||
),
|
||||
PublishStatus::Unknown => {
|
||||
crit!(log_1, "Unknown condition when publishing block")
|
||||
|
||||
@@ -11,9 +11,9 @@ use std::marker::PhantomData;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use tempdir::TempDir;
|
||||
use tree_hash::TreeHash;
|
||||
use types::{
|
||||
Attestation, BeaconBlock, ChainSpec, Domain, Epoch, EthSpec, Fork, PublicKey, Signature,
|
||||
SignedBeaconBlock, SignedRoot,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -144,26 +144,25 @@ impl<T: SlotClock + 'static, E: EthSpec> ValidatorStore<T, E> {
|
||||
.get(validator_pubkey)
|
||||
.and_then(|validator_dir| {
|
||||
let voting_keypair = validator_dir.voting_keypair.as_ref()?;
|
||||
let message = epoch.tree_hash_root();
|
||||
let domain = self.spec.get_domain(epoch, Domain::Randao, &self.fork()?);
|
||||
let message = epoch.signing_root(domain);
|
||||
|
||||
Some(Signature::new(&message, domain, &voting_keypair.sk))
|
||||
Some(Signature::new(message.as_bytes(), &voting_keypair.sk))
|
||||
})
|
||||
}
|
||||
|
||||
pub fn sign_block(
|
||||
&self,
|
||||
validator_pubkey: &PublicKey,
|
||||
mut block: BeaconBlock<E>,
|
||||
) -> Option<BeaconBlock<E>> {
|
||||
block: BeaconBlock<E>,
|
||||
) -> Option<SignedBeaconBlock<E>> {
|
||||
// TODO: check for slashing.
|
||||
self.validators
|
||||
.read()
|
||||
.get(validator_pubkey)
|
||||
.and_then(|validator_dir| {
|
||||
let voting_keypair = validator_dir.voting_keypair.as_ref()?;
|
||||
block.sign(&voting_keypair.sk, &self.fork()?, &self.spec);
|
||||
Some(block)
|
||||
Some(block.sign(&voting_keypair.sk, &self.fork()?, &self.spec))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user