Skip to content

Commit

Permalink
Waste less space in the main Transaction type (#6199)
Browse files Browse the repository at this point in the history
Co-authored-by: cce <[email protected]>
  • Loading branch information
jannotti and cce authored Dec 17, 2024
1 parent fc55e26 commit 1277f9b
Show file tree
Hide file tree
Showing 18 changed files with 238 additions and 278 deletions.
11 changes: 11 additions & 0 deletions crypto/onetimesig.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ func (ots OneTimeSignature) ToHeartbeatProof() HeartbeatProof {
}
}

// BatchPrep enqueues the necessary checks into the batch. The caller must call
// batchVerifier.verify() to verify it.
func (hbp HeartbeatProof) BatchPrep(voteID OneTimeSignatureVerifier, id OneTimeSignatureIdentifier, msg Hashable, batchVerifier BatchVerifier) {
offsetID := OneTimeSignatureSubkeyOffsetID{SubKeyPK: hbp.PK, Batch: id.Batch, Offset: id.Offset}
batchID := OneTimeSignatureSubkeyBatchID{SubKeyPK: hbp.PK2, Batch: id.Batch}
batchVerifier.EnqueueSignature(PublicKey(voteID), batchID, Signature(hbp.PK2Sig))
batchVerifier.EnqueueSignature(PublicKey(batchID.SubKeyPK), offsetID, Signature(hbp.PK1Sig))
batchVerifier.EnqueueSignature(PublicKey(offsetID.SubKeyPK), msg, Signature(hbp.Sig))

Check warning on line 106 in crypto/onetimesig.go

View check run for this annotation

Codecov / codecov/patch

crypto/onetimesig.go#L101-L106

Added lines #L101 - L106 were not covered by tests

}

// A OneTimeSignatureSubkeyBatchID identifies an ephemeralSubkey of a batch
// for the purposes of signing it with the top-level master key.
type OneTimeSignatureSubkeyBatchID struct {
Expand Down
10 changes: 5 additions & 5 deletions data/transactions/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ type HeartbeatTxnFields struct {
_struct struct{} `codec:",omitempty,omitemptyarray"`

// HbAddress is the account this txn is proving onlineness for.
HbAddress basics.Address `codec:"hbad"`
HbAddress basics.Address `codec:"a"`

// HbProof is a signature using HeartbeatAddress's partkey, thereby showing it is online.
HbProof crypto.HeartbeatProof `codec:"hbprf"`
HbProof crypto.HeartbeatProof `codec:"prf"`

// The final three fields are included to allow early, concurrent check of
// the HbProof.

// HbSeed must be the block seed for the this transaction's firstValid
// block. It is the message that must be signed with HbAddress's part key.
HbSeed committee.Seed `codec:"hbsd"`
HbSeed committee.Seed `codec:"sd"`

// HbVoteID must match the HbAddress account's current VoteID.
HbVoteID crypto.OneTimeSignatureVerifier `codec:"hbvid"`
HbVoteID crypto.OneTimeSignatureVerifier `codec:"vid"`

// HbKeyDilution must match HbAddress account's current KeyDilution.
HbKeyDilution uint64 `codec:"hbkd"`
HbKeyDilution uint64 `codec:"kd"`
}
Loading

0 comments on commit 1277f9b

Please sign in to comment.