From 4b17aed56712989e8edc5419e2e3e35f10d2d005 Mon Sep 17 00:00:00 2001 From: Emanuel Pargov Date: Wed, 31 Jul 2024 14:04:52 +0300 Subject: [PATCH] Add assurance structs (#26) --- internal/block/assurance.go | 20 ++++++++++++++++++++ internal/block/block.go | 1 + 2 files changed, 21 insertions(+) create mode 100644 internal/block/assurance.go diff --git a/internal/block/assurance.go b/internal/block/assurance.go new file mode 100644 index 0000000..e61d0f9 --- /dev/null +++ b/internal/block/assurance.go @@ -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 diff --git a/internal/block/block.go b/internal/block/block.go index df83577..2ccf300 100644 --- a/internal/block/block.go +++ b/internal/block/block.go @@ -11,4 +11,5 @@ type Extrinsic struct { ET []*TicketProof EP *PreimageExtrinsic ED *DisputeExtrinsic + EA *AssurancesExtrinsic }