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 assurance structs #26

Merged
merged 1 commit into from
Jul 31, 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
20 changes: 20 additions & 0 deletions internal/block/assurance.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package block

import "github.com/eigerco/strawberry/internal/crypto"

// Assurance represents a single validator's attestation of data availability
// for work reports on specific cores. It is part of the Assurances Extrinsic (E_A).
// Each Assurance contains:
// - An anchor to the parent block
// - A bitstring flag indicating availability for each core
// - The index of the attesting validator (0 to 1023)
// - A signature validating the assurance
// Assurances must be ordered by validator index in the extrinsic.
type Assurance struct {
Anchor crypto.Hash // Parent block hash (a ∈ H)
Flag bool // Bitstring of assurances, one bit per core (f ∈ B_C)
ValidatorIndex uint16 // Index of the attesting validator (v ∈ N_V)
Signature [crypto.Ed25519SignatureSize]byte // Ed25519 signature (s ∈ E)
}

type AssurancesExtrinsic []Assurance
1 change: 1 addition & 0 deletions internal/block/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ type Extrinsic struct {
ET []*TicketProof
EP *PreimageExtrinsic
ED *DisputeExtrinsic
EA *AssurancesExtrinsic
}