mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Update consensus code and tests to v0.12.3 (#1655)
## Proposed Changes Update test vectors for v0.12.3, and introduced configurable `proportional_slashing_multiplier`. Also makes `YamlConfig` a bit safer by making every field access in `apply_to_chain_spec` explicit, and removing the `#[serde(default)]` attribute, which would instantiate missing fields to type defaults! Risky!
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
TESTS_TAG := v0.12.2
|
||||
TESTS_TAG := v0.12.3
|
||||
TESTS = general minimal mainnet
|
||||
TARBALLS = $(patsubst %,%-$(TESTS_TAG).tar.gz,$(TESTS))
|
||||
|
||||
|
||||
@@ -140,13 +140,20 @@ impl<E: EthSpec, O: Operation<E>> LoadCase for Operations<E, O> {
|
||||
|
||||
// Check BLS setting here before SSZ deserialization, as most types require signatures
|
||||
// to be valid.
|
||||
let operation = if metadata.bls_setting.unwrap_or_default().check().is_ok() {
|
||||
Some(ssz_decode_file(&path.join(O::filename()))?)
|
||||
let (operation, bls_error) = if metadata.bls_setting.unwrap_or_default().check().is_ok() {
|
||||
match ssz_decode_file(&path.join(O::filename())) {
|
||||
Ok(op) => (Some(op), None),
|
||||
Err(Error::InvalidBLSInput(error)) => (None, Some(error)),
|
||||
Err(e) => return Err(e),
|
||||
}
|
||||
} else {
|
||||
None
|
||||
(None, None)
|
||||
};
|
||||
let post_filename = path.join("post.ssz");
|
||||
let post = if post_filename.is_file() {
|
||||
if let Some(bls_error) = bls_error {
|
||||
panic!("input is unexpectedly invalid: {}", bls_error);
|
||||
}
|
||||
Some(ssz_decode_file(&post_filename)?)
|
||||
} else {
|
||||
None
|
||||
|
||||
@@ -21,11 +21,19 @@ pub fn ssz_decode_file<T: ssz::Decode>(path: &Path) -> Result<T, Error> {
|
||||
})
|
||||
.and_then(|s| {
|
||||
T::from_ssz_bytes(&s).map_err(|e| {
|
||||
Error::FailedToParseTest(format!(
|
||||
"Unable to parse SSZ at {}: {:?}",
|
||||
path.display(),
|
||||
e
|
||||
))
|
||||
match e {
|
||||
// NOTE: this is a bit hacky, but seemingly better than the alternatives
|
||||
ssz::DecodeError::BytesInvalid(message)
|
||||
if message.contains("Blst") || message.contains("Milagro") =>
|
||||
{
|
||||
Error::InvalidBLSInput(message)
|
||||
}
|
||||
e => Error::FailedToParseTest(format!(
|
||||
"Unable to parse SSZ at {}: {:?}",
|
||||
path.display(),
|
||||
e
|
||||
)),
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ pub enum Error {
|
||||
DidntFail(String),
|
||||
/// Failed to parse the test (internal error).
|
||||
FailedToParseTest(String),
|
||||
/// Test case contained invalid BLS data.
|
||||
InvalidBLSInput(String),
|
||||
/// Skipped the test because the BLS setting was mismatched.
|
||||
SkippedBls,
|
||||
/// Skipped the test because it's known to fail.
|
||||
@@ -18,6 +20,7 @@ impl Error {
|
||||
Error::NotEqual(_) => "NotEqual",
|
||||
Error::DidntFail(_) => "DidntFail",
|
||||
Error::FailedToParseTest(_) => "FailedToParseTest",
|
||||
Error::InvalidBLSInput(_) => "InvalidBLSInput",
|
||||
Error::SkippedBls => "SkippedBls",
|
||||
Error::SkippedKnownFailure => "SkippedKnownFailure",
|
||||
}
|
||||
@@ -28,6 +31,7 @@ impl Error {
|
||||
Error::NotEqual(m) => m.as_str(),
|
||||
Error::DidntFail(m) => m.as_str(),
|
||||
Error::FailedToParseTest(m) => m.as_str(),
|
||||
Error::InvalidBLSInput(m) => m.as_str(),
|
||||
_ => self.name(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user