From dc2755c4ea1c7d96dacf0b361ef5685cae59dd89 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Fri, 15 Mar 2019 15:59:04 +1100 Subject: [PATCH] Update ProposerSlashing to v0.5.0 --- eth2/types/src/deposit_input.rs | 2 +- eth2/types/src/proposer_slashing.rs | 8 ++++---- .../testing_proposer_slashing_builder.rs | 18 +++++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/eth2/types/src/deposit_input.rs b/eth2/types/src/deposit_input.rs index 9da53a042..3f8a6177a 100644 --- a/eth2/types/src/deposit_input.rs +++ b/eth2/types/src/deposit_input.rs @@ -1,6 +1,6 @@ use crate::test_utils::TestRandom; use crate::*; -use bls::{Keypair, PublicKey, Signature}; +use bls::{PublicKey, Signature}; use rand::RngCore; use serde_derive::{Deserialize, Serialize}; use ssz::{SignedRoot, TreeHash}; diff --git a/eth2/types/src/proposer_slashing.rs b/eth2/types/src/proposer_slashing.rs index bc5b8665e..881f0e405 100644 --- a/eth2/types/src/proposer_slashing.rs +++ b/eth2/types/src/proposer_slashing.rs @@ -1,4 +1,4 @@ -use super::Proposal; +use super::BeaconBlockHeader; use crate::test_utils::TestRandom; use rand::RngCore; use serde_derive::{Deserialize, Serialize}; @@ -7,12 +7,12 @@ use test_random_derive::TestRandom; /// Two conflicting proposals from the same proposer (validator). /// -/// Spec v0.4.0 +/// Spec v0.5.0 #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)] pub struct ProposerSlashing { pub proposer_index: u64, - pub proposal_1: Proposal, - pub proposal_2: Proposal, + pub proposal_1: BeaconBlockHeader, + pub proposal_2: BeaconBlockHeader, } #[cfg(test)] diff --git a/eth2/types/src/test_utils/testing_proposer_slashing_builder.rs b/eth2/types/src/test_utils/testing_proposer_slashing_builder.rs index 7f16b679f..fc38c185d 100644 --- a/eth2/types/src/test_utils/testing_proposer_slashing_builder.rs +++ b/eth2/types/src/test_utils/testing_proposer_slashing_builder.rs @@ -22,20 +22,20 @@ impl TestingProposerSlashingBuilder { F: Fn(u64, &[u8], Epoch, Domain) -> Signature, { let slot = Slot::new(0); - let shard = 0; + let hash_1 = Hash256::from([1; 32]); + let hash_2 = Hash256::from([2; 32]); - let mut proposal_1 = Proposal { + let mut proposal_1 = BeaconBlockHeader { slot, - shard, - block_root: Hash256::from_low_u64_le(1), + previous_block_root: hash_1, + state_root: hash_1, + block_body_root: hash_1, signature: Signature::empty_signature(), }; - let mut proposal_2 = Proposal { - slot, - shard, - block_root: Hash256::from_low_u64_le(2), - signature: Signature::empty_signature(), + let mut proposal_2 = BeaconBlockHeader { + previous_block_root: hash_2, + ..proposal_1.clone() }; proposal_1.signature = {