From 3172e070ef1bd6cb2ad4f9959405f03d3a4086ba Mon Sep 17 00:00:00 2001 From: "daniel.vladco" Date: Fri, 26 Jul 2024 15:30:21 +0300 Subject: [PATCH] fix: Hk Hv and Hs --- internal/block/header.go | 15 +++++++++++---- internal/crypto/hash.go | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/internal/block/header.go b/internal/block/header.go index ca7cea04..a2366d41 100644 --- a/internal/block/header.go +++ b/internal/block/header.go @@ -5,16 +5,23 @@ import ( "github.com/eigerco/strawberry/internal/time" ) +const NumberOfValidators uint16 = 1023 + // Header as defined in the section 5 in the paper type Header struct { ParentHash crypto.Hash // Hp PriorStateRoot crypto.Hash // Hr ExtrinsicHash crypto.Hash // Hx TimeSlotIndex time.Timeslot // Ht - EpochMarker []crypto.Hash // He + EpochMarker *Epoch // He WinningTicketsMarker [time.TimeslotsPerEpoch]*Ticket // Hw JudgementsMarkers []crypto.Hash // Hj - BlockAuthorKey []byte // Hk - VRFSignature []byte // Hv - BlockSealSignature []byte // Hs + PublicKeyIndex uint16 // Hk + VRFSignature [96]byte // Hv + BlockSealSignature [96]byte // Hs +} + +type Epoch struct { + Keys [NumberOfValidators]crypto.BandersnatchPublicKey + Entropy crypto.Hash } diff --git a/internal/crypto/hash.go b/internal/crypto/hash.go index e5196860..7be736ea 100644 --- a/internal/crypto/hash.go +++ b/internal/crypto/hash.go @@ -1,3 +1,4 @@ package crypto type Hash [HashSize]byte +type BandersnatchPublicKey [BandersnatchSize]byte