From cbb84c0d6963dac3d4b03a45b009f33c5570a614 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Tue, 5 Feb 2019 12:40:03 +1100 Subject: [PATCH] Move all attestation_data fns into same file --- .../mod.rs => attestation_data.rs} | 13 +++++++++---- eth2/types/src/attestation_data/signing.rs | 12 ------------ 2 files changed, 9 insertions(+), 16 deletions(-) rename eth2/types/src/{attestation_data/mod.rs => attestation_data.rs} (93%) delete mode 100644 eth2/types/src/attestation_data/signing.rs diff --git a/eth2/types/src/attestation_data/mod.rs b/eth2/types/src/attestation_data.rs similarity index 93% rename from eth2/types/src/attestation_data/mod.rs rename to eth2/types/src/attestation_data.rs index 28504127e..d509f6b3d 100644 --- a/eth2/types/src/attestation_data/mod.rs +++ b/eth2/types/src/attestation_data.rs @@ -1,11 +1,8 @@ -use super::Hash256; +use super::{AttestationDataAndCustodyBit, Hash256}; use crate::test_utils::TestRandom; use rand::RngCore; use serde_derive::Serialize; use ssz::{hash, Decodable, DecodeError, Encodable, SszStream, TreeHash}; -use std::hash::Hash; - -mod signing; pub const SSZ_ATTESTION_DATA_LENGTH: usize = { 8 + // slot @@ -51,6 +48,14 @@ impl AttestationData { pub fn canonical_root(&self) -> Hash256 { Hash256::zero() } + + pub fn signable_message(&self, custody_bit: bool) -> Vec { + let attestation_data_and_custody_bit = AttestationDataAndCustodyBit { + data: self.clone(), + custody_bit, + }; + attestation_data_and_custody_bit.hash_tree_root() + } } impl Encodable for AttestationData { diff --git a/eth2/types/src/attestation_data/signing.rs b/eth2/types/src/attestation_data/signing.rs deleted file mode 100644 index f14cc0ef4..000000000 --- a/eth2/types/src/attestation_data/signing.rs +++ /dev/null @@ -1,12 +0,0 @@ -use crate::{AttestationData, AttestationDataAndCustodyBit}; -use ssz::TreeHash; - -impl AttestationData { - pub fn signable_message(&self, custody_bit: bool) -> Vec { - let attestation_data_and_custody_bit = AttestationDataAndCustodyBit { - data: self.clone(), - custody_bit, - }; - attestation_data_and_custody_bit.hash_tree_root() - } -}