diff --git a/zebra-chain/src/block/header.rs b/zebra-chain/src/block/header.rs index 7f5edbdb..2e87db34 100644 --- a/zebra-chain/src/block/header.rs +++ b/zebra-chain/src/block/header.rs @@ -1,7 +1,6 @@ use super::{difficulty::CompactDifficulty, BlockHeaderHash, Error}; use crate::equihash_solution::EquihashSolution; use crate::merkle_tree::MerkleTreeRootHash; -use crate::note_commitment_tree::SaplingNoteTreeRootHash; use crate::serialization::ZcashSerialize; use chrono::{DateTime, Duration, Utc}; @@ -47,7 +46,7 @@ pub struct BlockHeader { // - replace with an unspecified HistoryRootHash type? // Note that the NetworkUpgrade list is in zebra-consensus, so we can't // parse this field into a HistoryRootHash enum in zebra-chain. - pub final_sapling_root_hash: SaplingNoteTreeRootHash, + pub history_root_hash: [u8; 32], /// The block timestamp is a Unix epoch time (UTC) when the miner /// started hashing the header (according to the miner). diff --git a/zebra-chain/src/block/serialize.rs b/zebra-chain/src/block/serialize.rs index 67df3444..2824b9e2 100644 --- a/zebra-chain/src/block/serialize.rs +++ b/zebra-chain/src/block/serialize.rs @@ -5,7 +5,6 @@ use std::io; use crate::block::difficulty::CompactDifficulty; use crate::equihash_solution::EquihashSolution; use crate::merkle_tree::MerkleTreeRootHash; -use crate::note_commitment_tree::SaplingNoteTreeRootHash; use crate::serialization::ZcashDeserializeInto; use crate::serialization::{ReadZcashExt, SerializationError, ZcashDeserialize, ZcashSerialize}; @@ -19,7 +18,7 @@ impl ZcashSerialize for BlockHeader { writer.write_u32::(self.version)?; self.previous_block_hash.zcash_serialize(&mut writer)?; writer.write_all(&self.merkle_root_hash.0[..])?; - writer.write_all(&self.final_sapling_root_hash.0[..])?; + writer.write_all(&self.history_root_hash[..])?; // this is a truncating cast, rather than a saturating cast // but u32 times are valid until 2106, and our block verification time // checks should detect any truncation. @@ -67,7 +66,7 @@ impl ZcashDeserialize for BlockHeader { version, previous_block_hash: BlockHeaderHash::zcash_deserialize(&mut reader)?, merkle_root_hash: MerkleTreeRootHash(reader.read_32_bytes()?), - final_sapling_root_hash: SaplingNoteTreeRootHash(reader.read_32_bytes()?), + history_root_hash: reader.read_32_bytes()?, // This can't panic, because all u32 values are valid `Utc.timestamp`s time: Utc.timestamp(reader.read_u32::()? as i64, 0), difficulty_threshold: CompactDifficulty(reader.read_u32::()?), diff --git a/zebra-chain/src/block/tests.rs b/zebra-chain/src/block/tests.rs index e2adfe70..e7a7eee9 100644 --- a/zebra-chain/src/block/tests.rs +++ b/zebra-chain/src/block/tests.rs @@ -3,7 +3,6 @@ use super::*; use crate::block::difficulty::CompactDifficulty; use crate::equihash_solution::EquihashSolution; use crate::merkle_tree::MerkleTreeRootHash; -use crate::note_commitment_tree::SaplingNoteTreeRootHash; use crate::serialization::{ SerializationError, ZcashDeserialize, ZcashDeserializeInto, ZcashSerialize, }; @@ -26,7 +25,7 @@ impl Arbitrary for BlockHeader { (4u32..(i32::MAX as u32)), any::(), any::(), - any::(), + any::<[u8; 32]>(), // time is interpreted as u32 in the spec, but rust timestamps are i64 (0i64..(u32::MAX as i64)), any::(), @@ -38,7 +37,7 @@ impl Arbitrary for BlockHeader { version, previous_block_hash, merkle_root_hash, - final_sapling_root_hash, + history_root_hash, timestamp, difficulty_threshold, nonce, @@ -47,7 +46,7 @@ impl Arbitrary for BlockHeader { version, previous_block_hash, merkle_root_hash, - final_sapling_root_hash, + history_root_hash, time: Utc.timestamp(timestamp, 0), difficulty_threshold, nonce,