-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/jamtime
- Loading branch information
Showing
4 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
package block | ||
|
||
// Block represents the main block structure | ||
type Block struct { | ||
Header *Header | ||
Extrinsic *Extrinsic | ||
} | ||
|
||
// Extrinsic represents the block extrinsic data | ||
type Extrinsic struct { | ||
ET []*TicketProof | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,29 @@ | ||
package block | ||
|
||
import ( | ||
"github.com/eigerco/strawberry/internal/crypto" | ||
"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 *EpochMarker // He | ||
WinningTicketsMarker [time.TimeslotsPerEpoch]*Ticket // Hw | ||
JudgementsMarkers []crypto.Hash // Hj | ||
PublicKeyIndex uint16 // Hk | ||
VRFSignature crypto.BandersnatchSignature // Hv | ||
BlockSealSignature crypto.BandersnatchSignature // Hs | ||
} | ||
|
||
// EpochMarker consists of epoch randomness and a sequence of | ||
// Bandersnatch keys defining the Bandersnatch validator keys (kb) beginning in the next epoch. | ||
type EpochMarker struct { | ||
Keys [NumberOfValidators]crypto.BandersnatchPublicKey | ||
Entropy crypto.Hash | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package block | ||
|
||
import "github.com/eigerco/strawberry/internal/crypto" | ||
|
||
const ( | ||
maxTicketsPerBlock = 16 // `K` in the paper. The maximum number of tickets which may be submitted in a single extrinsic. | ||
ticketProofSize = 784 // Size of F̄[]γz⟨XT ⌢ η′2 r⟩ | ||
) | ||
|
||
// Ticket represents a single ticket (C in equation 50) | ||
type Ticket struct { | ||
Identifier crypto.Hash // y ∈ H 32bytes hash | ||
EntryIndex uint8 // r ∈ Nn (0, 1) | ||
} | ||
|
||
// TicketProof represents a proof of a valid ticket | ||
type TicketProof struct { | ||
EntryIndex uint8 // r ∈ Nn (0, 1) | ||
Proof [ticketProofSize]byte // RingVRF proof | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package crypto | ||
|
||
type BandersnatchPublicKey [BandersnatchSize]byte | ||
type BandersnatchSignature [96]byte |