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:
Michael Sproul
2020-09-26 01:58:29 +00:00
parent 3412a3ec54
commit 258b28469e
9 changed files with 264 additions and 100 deletions

View File

@@ -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