From 9a0874c2d770582d6806d784c6be11629e7cf157 Mon Sep 17 00:00:00 2001 From: Jeb Bearer Date: Tue, 14 Nov 2023 13:01:40 -0500 Subject: [PATCH] Change AssembledSignature variant from Genesis() to Genesis serde_json appears not to handle empty tuple variants correctly, but it does handle unit variants: https://github.com/serde-rs/json/issues/1084 --- crates/hotshot/src/demos/sdemo.rs | 2 +- crates/hotshot/src/traits/storage/memory_storage.rs | 2 +- crates/types/src/certificate.rs | 4 ++-- crates/types/src/data.rs | 2 +- crates/types/src/traits/election.rs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/hotshot/src/demos/sdemo.rs b/crates/hotshot/src/demos/sdemo.rs index 97117347a9..3669fcf109 100644 --- a/crates/hotshot/src/demos/sdemo.rs +++ b/crates/hotshot/src/demos/sdemo.rs @@ -357,7 +357,7 @@ pub fn random_quorum_certificate::Time::genesis(), leaf_commitment: dummy_leaf_commit, - signatures: AssembledSignature::Genesis(), + signatures: AssembledSignature::Genesis, view_number, }, DummyBlock::random(rng), diff --git a/crates/types/src/certificate.rs b/crates/types/src/certificate.rs index 47720eba75..6ee49ec8ac 100644 --- a/crates/types/src/certificate.rs +++ b/crates/types/src/certificate.rs @@ -122,7 +122,7 @@ pub enum AssembledSignature { /// These signatures are for a 'DA' certificate DA(::QCType), /// These signatures are for genesis certificate - Genesis(), + Genesis, /// These signatures are for ViewSyncPreCommit ViewSyncPreCommit(::QCType), /// These signatures are for ViewSyncCommit @@ -194,7 +194,7 @@ impl> Self { leaf_commitment: fake_commitment::(), view_number: ::genesis(), - signatures: AssembledSignature::Genesis(), + signatures: AssembledSignature::Genesis, is_genesis: true, } } diff --git a/crates/types/src/data.rs b/crates/types/src/data.rs index 68fc0ec064..e8944751a4 100644 --- a/crates/types/src/data.rs +++ b/crates/types/src/data.rs @@ -844,7 +844,7 @@ pub fn serialize_signature(signature: &AssembledSignature None, + AssembledSignature::Genesis => None, }; if let Some(sig) = signatures { let (sig, proof) = TYPES::SignatureKey::get_sig_proof(&sig); diff --git a/crates/types/src/traits/election.rs b/crates/types/src/traits/election.rs index fdc435163b..37a9140563 100644 --- a/crates/types/src/traits/election.rs +++ b/crates/types/src/traits/election.rs @@ -374,7 +374,7 @@ pub trait ConsensusExchange: Send + Sync { ); ::check(&real_qc_pp, real_commit.as_ref(), &qc) } - AssembledSignature::Genesis() => true, + AssembledSignature::Genesis => true, AssembledSignature::ViewSyncPreCommit(_) | AssembledSignature::ViewSyncCommit(_) | AssembledSignature::ViewSyncFinalize(_) => {