Skip to content

Commit

Permalink
Sync HeartbeatProof type in SDK with that in go-algorand.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmalouf committed Nov 27, 2024
1 parent c6f0307 commit 625a18d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion types/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 8 additions & 14 deletions types/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand All @@ -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"`
}

0 comments on commit 625a18d

Please sign in to comment.