diff --git a/crates/types/src/data.rs b/crates/types/src/data.rs index 133067ae78..da5512902b 100644 --- a/crates/types/src/data.rs +++ b/crates/types/src/data.rs @@ -960,26 +960,13 @@ impl Leaf2 { impl Committable for Leaf2 { fn commit(&self) -> committable::Commitment { - if *self.epoch == 0 { - RawCommitmentBuilder::new("leaf commitment") - .u64_field("view number", *self.view_number) - .field("parent leaf commitment", self.parent_commitment) - .field("block header", self.block_header.commit()) - .field("justify qc", self.justify_qc.commit()) - .optional("upgrade certificate", &self.upgrade_certificate) - .finalize() - } else { - RawCommitmentBuilder::new("leaf commitment") - .u64_field("view number", *self.view_number) - .u64_field("epoch number", *self.epoch) - .field("parent leaf commitment", self.parent_commitment) - .field("block header", self.block_header.commit()) - .field("justify qc", self.justify_qc.commit()) - .optional("upgrade certificate", &self.upgrade_certificate) - .fixed_size_bytes(&self.drb_seed) - .fixed_size_bytes(&self.drb_result) - .finalize() - } + RawCommitmentBuilder::new("leaf commitment") + .u64_field("view number", *self.view_number) + .field("parent leaf commitment", self.parent_commitment) + .field("block header", self.block_header.commit()) + .field("justify qc", self.justify_qc.commit()) + .optional("upgrade certificate", &self.upgrade_certificate) + .finalize() } } diff --git a/crates/types/src/simple_vote.rs b/crates/types/src/simple_vote.rs index 8a72cfeaee..9294c068f4 100644 --- a/crates/types/src/simple_vote.rs +++ b/crates/types/src/simple_vote.rs @@ -345,18 +345,14 @@ impl Committable for QuorumData { impl Committable for QuorumData2 { fn commit(&self) -> Commitment { - let QuorumData2 { leaf_commit, epoch } = self; - - if **epoch == 0 { - committable::RawCommitmentBuilder::new("Quorum data") - .var_size_bytes(leaf_commit.as_ref()) - .finalize() - } else { - committable::RawCommitmentBuilder::new("Quorum data") - .var_size_bytes(leaf_commit.as_ref()) - .u64(**epoch) - .finalize() - } + let QuorumData2 { + leaf_commit, + epoch: _, + } = self; + + committable::RawCommitmentBuilder::new("Quorum data") + .var_size_bytes(leaf_commit.as_ref()) + .finalize() } } @@ -370,18 +366,11 @@ impl Committable for TimeoutData { impl Committable for TimeoutData2 { fn commit(&self) -> Commitment { - let TimeoutData2 { view, epoch } = self; - - if **epoch == 0 { - committable::RawCommitmentBuilder::new("Timeout data") - .u64(**view) - .finalize() - } else { - committable::RawCommitmentBuilder::new("Timeout data") - .u64(**view) - .u64(**epoch) - .finalize() - } + let TimeoutData2 { view, epoch: _ } = self; + + committable::RawCommitmentBuilder::new("Timeout data") + .u64(**view) + .finalize() } } @@ -397,18 +386,12 @@ impl Committable for DaData2 { fn commit(&self) -> Commitment { let DaData2 { payload_commit, - epoch, + epoch: _, } = self; - if **epoch == 0 { - committable::RawCommitmentBuilder::new("DA data") - .var_size_bytes(payload_commit.as_ref()) - .finalize() - } else { - committable::RawCommitmentBuilder::new("DA data") - .var_size_bytes(payload_commit.as_ref()) - .u64(**epoch) - .finalize() - } + + committable::RawCommitmentBuilder::new("DA data") + .var_size_bytes(payload_commit.as_ref()) + .finalize() } } @@ -469,18 +452,10 @@ impl Committable for ViewSyncPreCommitData2 { let ViewSyncPreCommitData2 { relay, round, - epoch, + epoch: _, } = self; - if **epoch == 0 { - view_and_relay_commit::(*round, *relay, "View Sync Precommit") - } else { - committable::RawCommitmentBuilder::new("View Sync Precommit") - .u64(*relay) - .u64(**round) - .u64(**epoch) - .finalize() - } + view_and_relay_commit::(*round, *relay, "View Sync Precommit") } } @@ -495,18 +470,10 @@ impl Committable for ViewSyncFinalizeData2 { let ViewSyncFinalizeData2 { relay, round, - epoch, + epoch: _, } = self; - if **epoch == 0 { - view_and_relay_commit::(*round, *relay, "View Sync Finalize") - } else { - committable::RawCommitmentBuilder::new("View Sync Finalize") - .u64(*relay) - .u64(**round) - .u64(**epoch) - .finalize() - } + view_and_relay_commit::(*round, *relay, "View Sync Finalize") } } @@ -521,18 +488,10 @@ impl Committable for ViewSyncCommitData2 { let ViewSyncCommitData2 { relay, round, - epoch, + epoch: _, } = self; - if **epoch == 0 { - view_and_relay_commit::(*round, *relay, "View Sync Commit") - } else { - committable::RawCommitmentBuilder::new("View Sync Commit") - .u64(*relay) - .u64(**round) - .u64(**epoch) - .finalize() - } + view_and_relay_commit::(*round, *relay, "View Sync Commit") } }