mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 05:44:44 +00:00
Update to spec v1.0.0-rc.0 and BLSv4 (#1765)
## Issue Addressed Closes #1504 Closes #1505 Replaces #1703 Closes #1707 ## Proposed Changes * Update BLST and Milagro to versions compatible with BLSv4 spec * Update Lighthouse to spec v1.0.0-rc.0, and update EF test vectors * Use the v1.0.0 constants for `MainnetEthSpec`. * Rename `InteropEthSpec` -> `V012LegacyEthSpec` * Change all constants to suit the mainnet `v0.12.3` specification (i.e., Medalla). * Deprecate the `--spec` flag for the `lighthouse` binary * This value is now obtained from the `config_name` field of the `YamlConfig`. * Built in testnet YAML files have been updated. * Ignore the `--spec` value, if supplied, log a warning that it will be deprecated * `lcli` still has the spec flag, that's fine because it's dev tooling. * Remove the `E: EthSpec` from `YamlConfig` * This means we need to deser the genesis `BeaconState` on-demand, but this is fine. * Swap the old "minimal", "mainnet" strings over to the new `EthSpecId` enum. * Always require a `CONFIG_NAME` field in `YamlConfig` (it used to have a default). ## Additional Info Lots of breaking changes, do not merge! ~~We will likely need a Lighthouse v0.4.0 branch, and possibly a long-term v0.3.0 branch to keep Medalla alive~~. Co-authored-by: Kirk Baird <baird.k@outlook.com> Co-authored-by: Paul Hauner <paul@paulhauner.com>
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
use super::*;
|
||||
use crate::case_result::compare_result;
|
||||
use crate::cases::common::BlsCase;
|
||||
use bls::{AggregateSignature, PublicKey};
|
||||
use bls::{AggregateSignature, PublicKeyBytes};
|
||||
use serde_derive::Deserialize;
|
||||
use types::Hash256;
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct BlsAggregateVerifyInput {
|
||||
pub pubkeys: Vec<PublicKey>,
|
||||
pub pubkeys: Vec<PublicKeyBytes>,
|
||||
pub messages: Vec<String>,
|
||||
pub signature: String,
|
||||
}
|
||||
@@ -33,14 +33,29 @@ impl Case for BlsAggregateVerify {
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
let pubkey_refs = self.input.pubkeys.iter().collect::<Vec<_>>();
|
||||
let pubkeys_result = self
|
||||
.input
|
||||
.pubkeys
|
||||
.iter()
|
||||
.map(|pkb| pkb.decompress())
|
||||
.collect::<Result<Vec<_>, _>>();
|
||||
|
||||
let pubkeys = match pubkeys_result {
|
||||
Ok(pubkeys) => pubkeys,
|
||||
Err(bls::Error::InvalidInfinityPublicKey) if !self.output => {
|
||||
return Ok(());
|
||||
}
|
||||
Err(e) => return Err(Error::FailedToParseTest(format!("{:?}", e))),
|
||||
};
|
||||
|
||||
let pubkey_refs = pubkeys.iter().collect::<Vec<_>>();
|
||||
|
||||
let signature_bytes = hex::decode(&self.input.signature[2..])
|
||||
.map_err(|e| Error::FailedToParseTest(format!("{:?}", e)))?;
|
||||
|
||||
let signature_valid = AggregateSignature::deserialize(&signature_bytes)
|
||||
.ok()
|
||||
.map(|signature| signature.aggregate_verify(&messages, &pubkey_refs))
|
||||
.map(|signature| signature.aggregate_verify(&messages, &pubkey_refs[..]))
|
||||
.unwrap_or(false);
|
||||
|
||||
compare_result::<bool, ()>(&Ok(signature_valid), &Some(self.output))
|
||||
|
||||
Reference in New Issue
Block a user