Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ticket structs #18

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions internal/block/block.go
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
}
20 changes: 20 additions & 0 deletions internal/block/ticket.go
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
}
Loading