Update to signature-scheme 0.5.2

This commit is contained in:
Kirk Baird
2019-02-18 10:50:40 +11:00
parent 977f3edfb6
commit 9c4a1f1d1f
12 changed files with 67 additions and 38 deletions

View File

@@ -27,8 +27,11 @@ impl Attestation {
custody_bit: bool,
domain: u64,
) -> bool {
self.aggregate_signature
.verify(&self.signable_message(custody_bit), domain, group_public_key)
self.aggregate_signature.verify(
&self.signable_message(custody_bit),
domain,
group_public_key,
)
}
}

View File

@@ -1,8 +1,8 @@
use crate::test_utils::TestRandom;
use crate::{
validator::StatusFlags, validator_registry::get_active_validator_indices, AttestationData,
Bitfield, ChainSpec, Crosslink, Deposit, DepositInput, Epoch, Eth1Data, Eth1DataVote, Fork, Hash256,
PendingAttestation, PublicKey, Signature, Slot, Validator,
Bitfield, ChainSpec, Crosslink, Deposit, DepositInput, Epoch, Eth1Data, Eth1DataVote, Fork,
Hash256, PendingAttestation, PublicKey, Signature, Slot, Validator,
};
use honey_badger_split::SplitExt;
use rand::RngCore;
@@ -593,7 +593,7 @@ impl BeaconState {
pubkey: PublicKey,
proof_of_possession: Signature,
withdrawal_credentials: Hash256,
spec: &ChainSpec
spec: &ChainSpec,
) -> bool {
let proof_of_possession_data = DepositInput {
pubkey: pubkey.clone(),
@@ -603,15 +603,12 @@ impl BeaconState {
proof_of_possession.verify(
&proof_of_possession_data.hash_tree_root(),
self.fork.get_domain(
self.slot.epoch(spec.epoch_length),
spec.domain_deposit,
),
self.fork
.get_domain(self.slot.epoch(spec.epoch_length), spec.domain_deposit),
&pubkey,
)
}
/// Process a validator deposit, returning the validator index if the deposit is valid.
///
/// Spec v0.2.0
@@ -623,7 +620,12 @@ impl BeaconState {
withdrawal_credentials: Hash256,
spec: &ChainSpec,
) -> Result<usize, ()> {
if !self.validate_proof_of_possession(pubkey.clone(), proof_of_possession, withdrawal_credentials, &spec) {
if !self.validate_proof_of_possession(
pubkey.clone(),
proof_of_possession,
withdrawal_credentials,
&spec,
) {
return Err(());
}

View File

@@ -22,7 +22,7 @@ impl Fork {
/// Get the domain number that represents the fork meta and signature domain.
pub fn get_domain(&self, epoch: Epoch, domain_type: u64) -> u64 {
let fork_version = self.get_fork_version(epoch);
fork_version * u64::pow(2,32) + domain_type
fork_version * u64::pow(2, 32) + domain_type
}
}