mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 05:44:44 +00:00
Optimistic sync spec tests (v1.2.0) (#3564)
## Issue Addressed Implements new optimistic sync test format from https://github.com/ethereum/consensus-specs/pull/2982. ## Proposed Changes - Add parsing and runner support for the new test format. - Extend the mock EL with a set of canned responses keyed by block hash. Although this doubles up on some of the existing functionality I think it's really nice to use compared to the `preloaded_responses` or static responses. I think we could write novel new opt sync tests using these primtives much more easily than the previous ones. Forks are natively supported, and different responses to `forkchoiceUpdated` and `newPayload` are also straight-forward. ## Additional Info Blocked on merge of the spec PR and release of new test vectors.
This commit is contained in:
@@ -7,7 +7,7 @@ use serde_derive::Deserialize;
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct BlsAggregateSigs {
|
||||
pub input: Vec<String>,
|
||||
pub output: String,
|
||||
pub output: Option<String>,
|
||||
}
|
||||
|
||||
impl_bls_load_case!(BlsAggregateSigs);
|
||||
@@ -25,14 +25,13 @@ impl Case for BlsAggregateSigs {
|
||||
aggregate_signature.add_assign(&sig);
|
||||
}
|
||||
|
||||
// Check for YAML null value, indicating invalid input. This is a bit of a hack,
|
||||
// as our mutating `aggregate_signature.add` API doesn't play nicely with aggregating 0
|
||||
// inputs.
|
||||
let output_bytes = if self.output == "~" {
|
||||
AggregateSignature::infinity().serialize().to_vec()
|
||||
} else {
|
||||
hex::decode(&self.output[2..])
|
||||
.map_err(|e| Error::FailedToParseTest(format!("{:?}", e)))?
|
||||
let output_bytes = match self.output.as_deref() {
|
||||
// Check for YAML null value, indicating invalid input. This is a bit of a hack,
|
||||
// as our mutating `aggregate_signature.add` API doesn't play nicely with aggregating 0
|
||||
// inputs.
|
||||
Some("~") | None => AggregateSignature::infinity().serialize().to_vec(),
|
||||
Some(output) => hex::decode(&output[2..])
|
||||
.map_err(|e| Error::FailedToParseTest(format!("{:?}", e)))?,
|
||||
};
|
||||
let aggregate_signature = Ok(aggregate_signature.serialize().to_vec());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user