Update ProposerSlashing to v0.5.0

This commit is contained in:
Paul Hauner 2019-03-15 15:59:04 +11:00
parent 15c3e5eab5
commit dc2755c4ea
No known key found for this signature in database
GPG Key ID: D362883A9218FCC6
3 changed files with 14 additions and 14 deletions

View File

@ -1,6 +1,6 @@
use crate::test_utils::TestRandom; use crate::test_utils::TestRandom;
use crate::*; use crate::*;
use bls::{Keypair, PublicKey, Signature}; use bls::{PublicKey, Signature};
use rand::RngCore; use rand::RngCore;
use serde_derive::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
use ssz::{SignedRoot, TreeHash}; use ssz::{SignedRoot, TreeHash};

View File

@ -1,4 +1,4 @@
use super::Proposal; use super::BeaconBlockHeader;
use crate::test_utils::TestRandom; use crate::test_utils::TestRandom;
use rand::RngCore; use rand::RngCore;
use serde_derive::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
@ -7,12 +7,12 @@ use test_random_derive::TestRandom;
/// Two conflicting proposals from the same proposer (validator). /// 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)] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
pub struct ProposerSlashing { pub struct ProposerSlashing {
pub proposer_index: u64, pub proposer_index: u64,
pub proposal_1: Proposal, pub proposal_1: BeaconBlockHeader,
pub proposal_2: Proposal, pub proposal_2: BeaconBlockHeader,
} }
#[cfg(test)] #[cfg(test)]

View File

@ -22,20 +22,20 @@ impl TestingProposerSlashingBuilder {
F: Fn(u64, &[u8], Epoch, Domain) -> Signature, F: Fn(u64, &[u8], Epoch, Domain) -> Signature,
{ {
let slot = Slot::new(0); 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, slot,
shard, previous_block_root: hash_1,
block_root: Hash256::from_low_u64_le(1), state_root: hash_1,
block_body_root: hash_1,
signature: Signature::empty_signature(), signature: Signature::empty_signature(),
}; };
let mut proposal_2 = Proposal { let mut proposal_2 = BeaconBlockHeader {
slot, previous_block_root: hash_2,
shard, ..proposal_1.clone()
block_root: Hash256::from_low_u64_le(2),
signature: Signature::empty_signature(),
}; };
proposal_1.signature = { proposal_1.signature = {