mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-20 22:38:34 +00:00
Merge branch 'unstable' of https://github.com/sigp/lighthouse into gloas-fc-proto
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use super::*;
|
||||
use crate::case_result::compare_result;
|
||||
use kzg::{Bytes48, Error as KzgError};
|
||||
use kzg::Error as KzgError;
|
||||
use serde::Deserialize;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
@@ -47,8 +47,8 @@ impl<E: EthSpec> Case for KZGVerifyCellKZGProofBatch<E> {
|
||||
|
||||
let result =
|
||||
parse_input(&self.input).and_then(|(cells, proofs, cell_indices, commitments)| {
|
||||
let proofs: Vec<Bytes48> = proofs.iter().map(|&proof| proof.into()).collect();
|
||||
let commitments: Vec<Bytes48> = commitments.iter().map(|&c| c.into()).collect();
|
||||
let proofs = proofs.iter().map(|&proof| proof.0).collect::<Vec<_>>();
|
||||
let commitments = commitments.iter().map(|&c| c.0).collect::<Vec<_>>();
|
||||
let cells = cells.iter().map(|c| c.as_ref()).collect::<Vec<_>>();
|
||||
let kzg = get_kzg();
|
||||
match kzg.verify_cell_proof_batch(&cells, &proofs, cell_indices, &commitments) {
|
||||
|
||||
@@ -25,6 +25,7 @@ mod tests {
|
||||
use eth2_keystore::KeystoreBuilder;
|
||||
use eth2_network_config::Eth2NetworkConfig;
|
||||
use fixed_bytes::FixedBytesExtended;
|
||||
use futures::StreamExt;
|
||||
use initialized_validators::{
|
||||
InitializedValidators, load_pem_certificate, load_pkcs12_identity,
|
||||
};
|
||||
@@ -50,7 +51,7 @@ mod tests {
|
||||
use types::{attestation::AttestationBase, *};
|
||||
use url::Url;
|
||||
use validator_store::{
|
||||
Error as ValidatorStoreError, SignedBlock, UnsignedBlock, ValidatorStore,
|
||||
AttestationToSign, Error as ValidatorStoreError, SignedBlock, UnsignedBlock, ValidatorStore,
|
||||
};
|
||||
|
||||
/// If the we are unable to reach the Web3Signer HTTP API within this time out then we will
|
||||
@@ -654,13 +655,14 @@ mod tests {
|
||||
.await
|
||||
.assert_signatures_match("attestation", |pubkey, validator_store| async move {
|
||||
let attestation = get_attestation();
|
||||
validator_store
|
||||
.sign_attestations(vec![(0, pubkey, 0, attestation)])
|
||||
.await
|
||||
.unwrap()
|
||||
.pop()
|
||||
.unwrap()
|
||||
.1
|
||||
let stream = validator_store.sign_attestations(vec![AttestationToSign {
|
||||
validator_index: 0,
|
||||
pubkey,
|
||||
validator_committee_index: 0,
|
||||
attestation,
|
||||
}]);
|
||||
tokio::pin!(stream);
|
||||
stream.next().await.unwrap().unwrap().pop().unwrap().1
|
||||
})
|
||||
.await
|
||||
.assert_signatures_match("signed_aggregate", |pubkey, validator_store| async move {
|
||||
@@ -879,22 +881,28 @@ mod tests {
|
||||
.await
|
||||
.assert_signatures_match("first_attestation", |pubkey, validator_store| async move {
|
||||
let attestation = first_attestation();
|
||||
validator_store
|
||||
.sign_attestations(vec![(0, pubkey, 0, attestation)])
|
||||
.await
|
||||
.unwrap()
|
||||
.pop()
|
||||
.unwrap()
|
||||
.1
|
||||
let stream = validator_store.sign_attestations(vec![AttestationToSign {
|
||||
validator_index: 0,
|
||||
pubkey,
|
||||
validator_committee_index: 0,
|
||||
attestation,
|
||||
}]);
|
||||
tokio::pin!(stream);
|
||||
stream.next().await.unwrap().unwrap().pop().unwrap().1
|
||||
})
|
||||
.await
|
||||
.assert_slashable_attestation_should_sign(
|
||||
"double_vote_attestation",
|
||||
move |pubkey, validator_store| async move {
|
||||
let attestation = double_vote_attestation();
|
||||
validator_store
|
||||
.sign_attestations(vec![(0, pubkey, 0, attestation)])
|
||||
.await
|
||||
let stream = validator_store.sign_attestations(vec![AttestationToSign {
|
||||
validator_index: 0,
|
||||
pubkey,
|
||||
validator_committee_index: 0,
|
||||
attestation,
|
||||
}]);
|
||||
tokio::pin!(stream);
|
||||
stream.next().await.unwrap()
|
||||
},
|
||||
slashable_message_should_sign,
|
||||
)
|
||||
@@ -903,9 +911,14 @@ mod tests {
|
||||
"surrounding_attestation",
|
||||
move |pubkey, validator_store| async move {
|
||||
let attestation = surrounding_attestation();
|
||||
validator_store
|
||||
.sign_attestations(vec![(0, pubkey, 0, attestation)])
|
||||
.await
|
||||
let stream = validator_store.sign_attestations(vec![AttestationToSign {
|
||||
validator_index: 0,
|
||||
pubkey,
|
||||
validator_committee_index: 0,
|
||||
attestation,
|
||||
}]);
|
||||
tokio::pin!(stream);
|
||||
stream.next().await.unwrap()
|
||||
},
|
||||
slashable_message_should_sign,
|
||||
)
|
||||
@@ -914,9 +927,14 @@ mod tests {
|
||||
"surrounded_attestation",
|
||||
move |pubkey, validator_store| async move {
|
||||
let attestation = surrounded_attestation();
|
||||
validator_store
|
||||
.sign_attestations(vec![(0, pubkey, 0, attestation)])
|
||||
.await
|
||||
let stream = validator_store.sign_attestations(vec![AttestationToSign {
|
||||
validator_index: 0,
|
||||
pubkey,
|
||||
validator_committee_index: 0,
|
||||
attestation,
|
||||
}]);
|
||||
tokio::pin!(stream);
|
||||
stream.next().await.unwrap()
|
||||
},
|
||||
slashable_message_should_sign,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user