From d7184345b89e073b99fd92f65e48ea3ce8fe9cf0 Mon Sep 17 00:00:00 2001 From: mjkeating Date: Mon, 25 Feb 2019 09:17:17 -0800 Subject: [PATCH] renamed the macro Hashtree to TreeHash --- eth2/types/src/attestation.rs | 4 ++-- eth2/types/src/attestation_data.rs | 4 ++-- eth2/types/src/attestation_data_and_custody_bit.rs | 4 ++-- eth2/types/src/attester_slashing.rs | 4 ++-- eth2/types/src/beacon_block.rs | 4 ++-- eth2/types/src/beacon_block_body.rs | 4 ++-- eth2/types/src/casper_slashing.rs | 4 ++-- eth2/types/src/crosslink.rs | 4 ++-- eth2/types/src/deposit.rs | 4 ++-- eth2/types/src/deposit_data.rs | 4 ++-- eth2/types/src/deposit_input.rs | 4 ++-- eth2/types/src/eth1_data.rs | 4 ++-- eth2/types/src/eth1_data_vote.rs | 4 ++-- eth2/types/src/exit.rs | 4 ++-- eth2/types/src/fork.rs | 4 ++-- eth2/types/src/pending_attestation.rs | 4 ++-- eth2/types/src/proposal_signed_data.rs | 4 ++-- eth2/types/src/proposer_slashing.rs | 4 ++-- eth2/types/src/shard_reassignment_record.rs | 4 ++-- eth2/types/src/slashable_attestation.rs | 4 ++-- eth2/types/src/slashable_vote_data.rs | 4 ++-- eth2/types/src/validator_registry_delta_block.rs | 4 ++-- eth2/utils/ssz_derive/src/lib.rs | 6 +++--- 23 files changed, 47 insertions(+), 47 deletions(-) diff --git a/eth2/types/src/attestation.rs b/eth2/types/src/attestation.rs index a8523dfe8..66140decb 100644 --- a/eth2/types/src/attestation.rs +++ b/eth2/types/src/attestation.rs @@ -3,9 +3,9 @@ use crate::test_utils::TestRandom; use rand::RngCore; use serde_derive::Serialize; use ssz::TreeHash; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, Clone, PartialEq, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, Clone, PartialEq, Serialize, Encode, Decode, TreeHash)] pub struct Attestation { pub aggregation_bitfield: Bitfield, pub data: AttestationData, diff --git a/eth2/types/src/attestation_data.rs b/eth2/types/src/attestation_data.rs index d2da31102..868f9743a 100644 --- a/eth2/types/src/attestation_data.rs +++ b/eth2/types/src/attestation_data.rs @@ -3,7 +3,7 @@ use crate::{AttestationDataAndCustodyBit, Crosslink, Epoch, Hash256, Slot}; use rand::RngCore; use serde_derive::Serialize; use ssz::TreeHash; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; pub const SSZ_ATTESTION_DATA_LENGTH: usize = { 8 + // slot @@ -16,7 +16,7 @@ pub const SSZ_ATTESTION_DATA_LENGTH: usize = { 32 // justified_block_root }; -#[derive(Debug, Clone, PartialEq, Default, Serialize, Hash, Encode, Decode, Hashtree)] +#[derive(Debug, Clone, PartialEq, Default, Serialize, Hash, Encode, Decode, TreeHash)] pub struct AttestationData { pub slot: Slot, pub shard: u64, diff --git a/eth2/types/src/attestation_data_and_custody_bit.rs b/eth2/types/src/attestation_data_and_custody_bit.rs index 33b7f3715..9175863ae 100644 --- a/eth2/types/src/attestation_data_and_custody_bit.rs +++ b/eth2/types/src/attestation_data_and_custody_bit.rs @@ -2,9 +2,9 @@ use super::AttestationData; use crate::test_utils::TestRandom; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, Clone, PartialEq, Default, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, Clone, PartialEq, Default, Serialize, Encode, Decode, TreeHash)] pub struct AttestationDataAndCustodyBit { pub data: AttestationData, pub custody_bit: bool, diff --git a/eth2/types/src/attester_slashing.rs b/eth2/types/src/attester_slashing.rs index 76c0c2b2c..96204edc5 100644 --- a/eth2/types/src/attester_slashing.rs +++ b/eth2/types/src/attester_slashing.rs @@ -1,9 +1,9 @@ use crate::{test_utils::TestRandom, SlashableAttestation}; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, TreeHash)] pub struct AttesterSlashing { pub slashable_attestation_1: SlashableAttestation, pub slashable_attestation_2: SlashableAttestation, diff --git a/eth2/types/src/beacon_block.rs b/eth2/types/src/beacon_block.rs index d1dcd58df..9d769cbed 100644 --- a/eth2/types/src/beacon_block.rs +++ b/eth2/types/src/beacon_block.rs @@ -4,9 +4,9 @@ use bls::Signature; use rand::RngCore; use serde_derive::Serialize; use ssz::TreeHash; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, TreeHash)] pub struct BeaconBlock { pub slot: Slot, pub parent_root: Hash256, diff --git a/eth2/types/src/beacon_block_body.rs b/eth2/types/src/beacon_block_body.rs index 62e8e1e90..915e6435c 100644 --- a/eth2/types/src/beacon_block_body.rs +++ b/eth2/types/src/beacon_block_body.rs @@ -2,9 +2,9 @@ use super::{Attestation, AttesterSlashing, Deposit, Exit, ProposerSlashing}; use crate::test_utils::TestRandom; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, PartialEq, Clone, Default, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, PartialEq, Clone, Default, Serialize, Encode, Decode, TreeHash)] pub struct BeaconBlockBody { pub proposer_slashings: Vec, pub attester_slashings: Vec, diff --git a/eth2/types/src/casper_slashing.rs b/eth2/types/src/casper_slashing.rs index 5532a8b57..76a6515a2 100644 --- a/eth2/types/src/casper_slashing.rs +++ b/eth2/types/src/casper_slashing.rs @@ -2,9 +2,9 @@ use super::SlashableVoteData; use crate::test_utils::TestRandom; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, TreeHash)] pub struct CasperSlashing { pub slashable_vote_data_1: SlashableVoteData, pub slashable_vote_data_2: SlashableVoteData, diff --git a/eth2/types/src/crosslink.rs b/eth2/types/src/crosslink.rs index 45a92d787..9c7b8eeed 100644 --- a/eth2/types/src/crosslink.rs +++ b/eth2/types/src/crosslink.rs @@ -2,9 +2,9 @@ use crate::test_utils::TestRandom; use crate::{Epoch, Hash256}; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, Clone, PartialEq, Default, Serialize, Hash, Encode, Decode, Hashtree)] +#[derive(Debug, Clone, PartialEq, Default, Serialize, Hash, Encode, Decode, TreeHash)] pub struct Crosslink { pub epoch: Epoch, pub shard_block_root: Hash256, diff --git a/eth2/types/src/deposit.rs b/eth2/types/src/deposit.rs index 5a738d4c5..de485cd2b 100644 --- a/eth2/types/src/deposit.rs +++ b/eth2/types/src/deposit.rs @@ -2,9 +2,9 @@ use super::{DepositData, Hash256}; use crate::test_utils::TestRandom; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, TreeHash)] pub struct Deposit { pub branch: Vec, pub index: u64, diff --git a/eth2/types/src/deposit_data.rs b/eth2/types/src/deposit_data.rs index fa0bd78b6..6ac40c0f8 100644 --- a/eth2/types/src/deposit_data.rs +++ b/eth2/types/src/deposit_data.rs @@ -2,9 +2,9 @@ use super::DepositInput; use crate::test_utils::TestRandom; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, TreeHash)] pub struct DepositData { pub amount: u64, pub timestamp: u64, diff --git a/eth2/types/src/deposit_input.rs b/eth2/types/src/deposit_input.rs index 24146ad44..5baa2226d 100644 --- a/eth2/types/src/deposit_input.rs +++ b/eth2/types/src/deposit_input.rs @@ -3,9 +3,9 @@ use crate::test_utils::TestRandom; use bls::{PublicKey, Signature}; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, TreeHash)] pub struct DepositInput { pub pubkey: PublicKey, pub withdrawal_credentials: Hash256, diff --git a/eth2/types/src/eth1_data.rs b/eth2/types/src/eth1_data.rs index cdf746fae..2cbfad770 100644 --- a/eth2/types/src/eth1_data.rs +++ b/eth2/types/src/eth1_data.rs @@ -2,10 +2,10 @@ use super::Hash256; use crate::test_utils::TestRandom; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; // Note: this is refer to as DepositRootVote in specs -#[derive(Debug, PartialEq, Clone, Default, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, PartialEq, Clone, Default, Serialize, Encode, Decode, TreeHash)] pub struct Eth1Data { pub deposit_root: Hash256, pub block_hash: Hash256, diff --git a/eth2/types/src/eth1_data_vote.rs b/eth2/types/src/eth1_data_vote.rs index acf77ffac..e2a98df3c 100644 --- a/eth2/types/src/eth1_data_vote.rs +++ b/eth2/types/src/eth1_data_vote.rs @@ -2,10 +2,10 @@ use super::Eth1Data; use crate::test_utils::TestRandom; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; // Note: this is refer to as DepositRootVote in specs -#[derive(Debug, PartialEq, Clone, Default, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, PartialEq, Clone, Default, Serialize, Encode, Decode, TreeHash)] pub struct Eth1DataVote { pub eth1_data: Eth1Data, pub vote_count: u64, diff --git a/eth2/types/src/exit.rs b/eth2/types/src/exit.rs index c0af761fd..f564c8bb5 100644 --- a/eth2/types/src/exit.rs +++ b/eth2/types/src/exit.rs @@ -2,9 +2,9 @@ use crate::{test_utils::TestRandom, Epoch}; use bls::Signature; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, TreeHash)] pub struct Exit { pub epoch: Epoch, pub validator_index: u64, diff --git a/eth2/types/src/fork.rs b/eth2/types/src/fork.rs index c6c2b27ff..35285d6ed 100644 --- a/eth2/types/src/fork.rs +++ b/eth2/types/src/fork.rs @@ -1,9 +1,9 @@ use crate::{test_utils::TestRandom, Epoch}; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, Clone, PartialEq, Default, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, Clone, PartialEq, Default, Serialize, Encode, Decode, TreeHash)] pub struct Fork { pub previous_version: u64, pub current_version: u64, diff --git a/eth2/types/src/pending_attestation.rs b/eth2/types/src/pending_attestation.rs index b6f152321..53f1868d6 100644 --- a/eth2/types/src/pending_attestation.rs +++ b/eth2/types/src/pending_attestation.rs @@ -2,9 +2,9 @@ use crate::test_utils::TestRandom; use crate::{AttestationData, Bitfield, Slot}; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, Clone, PartialEq, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, Clone, PartialEq, Serialize, Encode, Decode, TreeHash)] pub struct PendingAttestation { pub aggregation_bitfield: Bitfield, pub data: AttestationData, diff --git a/eth2/types/src/proposal_signed_data.rs b/eth2/types/src/proposal_signed_data.rs index 53f04956b..164192cc9 100644 --- a/eth2/types/src/proposal_signed_data.rs +++ b/eth2/types/src/proposal_signed_data.rs @@ -2,9 +2,9 @@ use crate::test_utils::TestRandom; use crate::{Hash256, Slot}; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, PartialEq, Clone, Default, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, PartialEq, Clone, Default, Serialize, Encode, Decode, TreeHash)] pub struct ProposalSignedData { pub slot: Slot, pub shard: u64, diff --git a/eth2/types/src/proposer_slashing.rs b/eth2/types/src/proposer_slashing.rs index 739c5f84d..fc5276dfe 100644 --- a/eth2/types/src/proposer_slashing.rs +++ b/eth2/types/src/proposer_slashing.rs @@ -3,9 +3,9 @@ use crate::test_utils::TestRandom; use bls::Signature; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, TreeHash)] pub struct ProposerSlashing { pub proposer_index: u64, pub proposal_data_1: ProposalSignedData, diff --git a/eth2/types/src/shard_reassignment_record.rs b/eth2/types/src/shard_reassignment_record.rs index 4fa685d26..e7a22e1fa 100644 --- a/eth2/types/src/shard_reassignment_record.rs +++ b/eth2/types/src/shard_reassignment_record.rs @@ -1,9 +1,9 @@ use crate::{test_utils::TestRandom, Slot}; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, TreeHash)] pub struct ShardReassignmentRecord { pub validator_index: u64, pub shard: u64, diff --git a/eth2/types/src/slashable_attestation.rs b/eth2/types/src/slashable_attestation.rs index 64507994b..3315f1d35 100644 --- a/eth2/types/src/slashable_attestation.rs +++ b/eth2/types/src/slashable_attestation.rs @@ -1,9 +1,9 @@ use crate::{test_utils::TestRandom, AggregateSignature, AttestationData, Bitfield}; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, TreeHash)] pub struct SlashableAttestation { pub validator_indices: Vec, pub data: AttestationData, diff --git a/eth2/types/src/slashable_vote_data.rs b/eth2/types/src/slashable_vote_data.rs index 53742372c..e8ac61dbe 100644 --- a/eth2/types/src/slashable_vote_data.rs +++ b/eth2/types/src/slashable_vote_data.rs @@ -4,9 +4,9 @@ use crate::test_utils::TestRandom; use bls::AggregateSignature; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; -#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, PartialEq, Clone, Serialize, Encode, Decode, TreeHash)] pub struct SlashableVoteData { pub custody_bit_0_indices: Vec, pub custody_bit_1_indices: Vec, diff --git a/eth2/types/src/validator_registry_delta_block.rs b/eth2/types/src/validator_registry_delta_block.rs index c42300cb4..86f5718d6 100644 --- a/eth2/types/src/validator_registry_delta_block.rs +++ b/eth2/types/src/validator_registry_delta_block.rs @@ -2,10 +2,10 @@ use crate::{test_utils::TestRandom, Hash256, Slot}; use bls::PublicKey; use rand::RngCore; use serde_derive::Serialize; -use ssz_derive::{Decode, Encode, Hashtree}; +use ssz_derive::{Decode, Encode, TreeHash}; // The information gathered from the PoW chain validator registration function. -#[derive(Debug, Clone, PartialEq, Serialize, Encode, Decode, Hashtree)] +#[derive(Debug, Clone, PartialEq, Serialize, Encode, Decode, TreeHash)] pub struct ValidatorRegistryDeltaBlock { pub latest_registry_delta_root: Hash256, pub validator_index: u32, diff --git a/eth2/utils/ssz_derive/src/lib.rs b/eth2/utils/ssz_derive/src/lib.rs index 09e1b2dc7..ac66526fe 100644 --- a/eth2/utils/ssz_derive/src/lib.rs +++ b/eth2/utils/ssz_derive/src/lib.rs @@ -2,7 +2,7 @@ //! //! - `#[derive(Encode)]` //! - `#[derive(Decode)]` -//! - `#[derive(Hashtree)]` +//! - `#[derive(TreeHash)]` //! //! These macros provide SSZ encoding/decoding for a `struct`. Fields are encoded/decoded in the //! order they are defined. @@ -131,8 +131,8 @@ pub fn ssz_decode_derive(input: TokenStream) -> TokenStream { /// Implements `ssz::TreeHash` for some `struct`. /// /// Fields are processed in the order they are defined. -#[proc_macro_derive(Hashtree)] -pub fn ssz_hashtree_derive(input: TokenStream) -> TokenStream { +#[proc_macro_derive(TreeHash)] +pub fn ssz_tree_hash_derive(input: TokenStream) -> TokenStream { let item = parse_macro_input!(input as DeriveInput); let name = &item.ident;