diff --git a/internal/block/header.go b/internal/block/header.go index ca7cea04..15b49f0a 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 crypto.BandersnatchSignature // Hv + BlockSealSignature crypto.BandersnatchSignature // Hs +} + +type Epoch struct { + Keys [NumberOfValidators]crypto.BandersnatchPublicKey + Entropy crypto.Hash } diff --git a/internal/crypto/bandersnatch.go b/internal/crypto/bandersnatch.go new file mode 100644 index 00000000..b70e5dbf --- /dev/null +++ b/internal/crypto/bandersnatch.go @@ -0,0 +1,4 @@ +package crypto + +type BandersnatchPublicKey [BandersnatchSize]byte +type BandersnatchSignature [96]byte