diff --git a/types/heartbeat.go b/types/heartbeat.go index 1bd2611f..4f0ad5ff 100644 --- a/types/heartbeat.go +++ b/types/heartbeat.go @@ -10,7 +10,7 @@ type HeartbeatTxnFields struct { HbAddress Address `codec:"hbad"` // HbProof is a signature using HeartbeatAddress's partkey, thereby showing it is online. - HbProof OneTimeSignature `codec:"hbprf"` + HbProof HeartbeatProof `codec:"hbprf"` // HbSeed must be the block seed for the block before this transaction's // firstValid. It is supplied in the transaction so that Proof can be diff --git a/types/signature.go b/types/signature.go index a1f0d824..bfa64570 100644 --- a/types/signature.go +++ b/types/signature.go @@ -84,6 +84,9 @@ func (lsig LogicSig) Blank() bool { type ed25519Signature [64]byte type ed25519PublicKey [32]byte +// A HeartbeatProof is functionally equivalent to a OneTimeSignature (see below), but it has +// been cleaned up for use as a transaction field in heartbeat transactions. +// // A OneTimeSignature is a cryptographic signature that is produced a limited // number of times and provides forward integrity. // @@ -92,26 +95,17 @@ type ed25519PublicKey [32]byte // identifier, the corresponding secret is deleted. This prevents the // secret-holder from signing a contradictory message in the future in the event // of a secret-key compromise. -type OneTimeSignature struct { - // Unfortunately we forgot to mark this struct as omitempty at - // one point, and now it's hard to change if we want to preserve - // encodings. - _struct struct{} `codec:""` +type HeartbeatProof struct { + _struct struct{} `codec:",omitempty,omitemptyarray"` // Sig is a signature of msg under the key PK. Sig ed25519Signature `codec:"s"` PK ed25519PublicKey `codec:"p"` - // Old-style signature that does not use proper domain separation. - // PKSigOld is unused; however, unfortunately we forgot to mark it - // `codec:omitempty` and so it appears (with zero value) in certs. - // This means we can't delete the field without breaking catchup. - PKSigOld ed25519Signature `codec:"ps"` - - // Used to verify a new-style two-level ephemeral signature. + // PK2 is used to verify a two-level ephemeral signature. + PK2 ed25519PublicKey `codec:"p2"` // PK1Sig is a signature of OneTimeSignatureSubkeyOffsetID(PK, Batch, Offset) under the key PK2. - // PK2Sig is a signature of OneTimeSignatureSubkeyBatchID(PK2, Batch) under the master key (OneTimeSignatureVerifier). - PK2 ed25519PublicKey `codec:"p2"` PK1Sig ed25519Signature `codec:"p1s"` + // PK2Sig is a signature of OneTimeSignatureSubkeyBatchID(PK2, Batch) under the master key (OneTimeSignatureVerifier). PK2Sig ed25519Signature `codec:"p2s"` }