Block Structure in Tessera
Below is the structure of a JAM block, as defined in the gray paper. A block B = (H, E), where H is block header (consensus metadata, inherited from Polkadot) and E is the block extrinsics (transactions for guarantees, assurances, disputes).
B = (H, E)
Key Components
- Header H : The Block header.
- Extrinsics E: The block extrinsic
Block Header
H ≡ (HP, HR, HX, HT, HE, HW, HO, HI, HV, HS)
| Bytes | Name | Data Type | Description |
|---|---|---|---|
| 32 | Parent Hash (HP) | [u8; 32] | The SHA256(SHA256()) hash of the previous block's header in internal byte order, ensuring immutability and chain continuity. |
| 32 | Parent state root ( HR) | [u8; 32] | The Merkle root of the state from the previous block, used to verify the starting state for this block's transitions. |
| 32 | Extrinsic Hash (HX) | [u8; 32] | The Merkle root of all extrinsics in the block, preventing modification of transactions like guarantees or disputes without header change. |
| 4 | Slot (HT) | u32 | The u64 index of the current 6-second time slot, determining BABE VRF leadership and tranche timing for auditing. |
| Epoch mark (HE) | Option[EpochMarkData] | Digest logs signaling epoch transitions (every 600 slots), updating validator sets and consensus parameters. | |
| Ticket mark (HW) | Option[TicketsMarkData] | A record of Safrole VRF tickets for slot leadership, proving the producer's right to create the block. | |
| 2 | Author Index (HO) | u16 | The u32 index of the block producer (validator) in the current epoch's set, for accountability and slashing. |
| 96 | Entropy Sources (HI) | [u8; 96] | The VRF output from the block header, providing randomness for next-slot leadership and audit assignments. |
| Offeder Marks (HV) | vec[Ed25519Public], Ed25519Public = [u8; 32] | Digest entries flagging validators for offenses (e.g., no-shows or false judgments), triggering slashing via disputes. | |
| 96 | Seal (HS) | [u8; 96] | GRANDPA finality pre-digests or seals, aggregating >682 validator votes to confirm the block's irrevocable inclusion. |
class EpochMarkData:
"""Epoch mark structure."""
entropy: Entropy
tickets_entropy: Entropy
validators: ValidatorArray
TicketsMarkData(TypedArray[TicketBody, EPOCH_LENGTH])
class TicketBody:
"""Ticket body structure."""
id: TicketId # This is the VRF output of TicketEnvelope.signature https://graypaper.fluffylabs.dev/#/5f542d7/0f84000fbd00
attempt: TicketAttempt
Block Extrinsic
E ≡ (ET, ED, EP, EA, EG)
class Extrinsic:
"""Extrinsic structure."""
tickets: TicketsExtrinsic
disputes: DisputesExtrinsic
preimages: PreimagesExtrinsic
assurances: AssurancesExtrinsic
guarantees: GuaranteesExtrinsic
The block extrinsics E is a list of transactions, each encoded as a length-prefixed byte array. Extrinsics include:
| Name | Description |
|---|---|
| Ticket Extrinsic (ET) | Tickets, used for the mechanism which manages the selection of validators for the per-missioning of block authoring. |
Ticket tuple structure (from gray paper)
ET ∈ ⟦ ( e ∈ ℕN, p ∈ V̊[ ]γ′Z(⟨XT − η′2 + e⟩) ) ⟧
where:
- e u32 Epoch Index
- p VRF proof
class TicketEnvelope:
"""Ticket entry structure."""
attempt: TicketAttempt
signature: BandersnatchRingVrfSignature
TicketsExtrinsic = TypedBoundedVector[TicketEnvelope, 0, MAX_TICKETS_PER_EXTRINSIC]
| Name | Description |
|---|---|
| Dispute Extrinsic (ED) | Information relating to disputes between validators over the validity of reports. |
Dispute tuple structure (from gray paper)
ED ≡ (EV, EC, EF)
where:
-
EV ∈ ⟦ ( H, ⌊τ∕E⌋ − ℕ2, ⟦ (⟨τ, ⊥⟩, NV, v̂) ⟧⌈2⁄3·V⌉+1 ) ⟧,
- H work report hash.
- ⌊τ∕E⌋ − ℕ2 work report age.
- ⟦ (⟨τ, ⊥⟩, NV, v̂) ⟧⌈2⁄3·V⌉+1 is a collection of tuples containing judgments information, validator indices, and validator signatures, with a minimum size of two-thirds of the total validators plus one.
-
EC ∈ ⟦ ( H, H̄, v̂ ) ⟧,
- H work report hash.
- H̄ validator Ed25519 public key.
- v̂ Valid Ed25519 signatures.
-
EF ∈ ⟦ ( H, ⟨T, ⊥⟩, H̄, v̂ ) ⟧.
- H work report hash.
- ⟨T, ⊥⟩ True/False judgments.
- H̄ validator Ed25519 public key.
- v̂ Valid Ed25519 signatures.
@structure
class Judgement:
"""Judgement structure."""
vote: Bool
index: ValidatorIndex
signature: Ed25519Signature
@structure
class Culprit:
"""Culprit structure."""
target: WorkReportHash
key: Ed25519Public
signature: Ed25519Signature
@structure
class Fault:
"""Fault structure."""
target: WorkReportHash
vote: Bool
key: Ed25519Public
signature: Ed25519Signature
JudgementVotes = TypedVector[Judgement]
@structure
class Verdict:
"""Verdict structure."""
target: WorkReportHash
age: U32
votes: JudgementVotes
WorkReportHashes = TypedVector[WorkReportHash]
Offenders = TypedVector[Ed25519Public]
@structure
class DisputesRecords:
"""Disputes records structure."""
good: WorkReportHashes
bad: WorkReportHashes
wonky: WorkReportHashes
offenders: Offenders
Verdicts = TypedVector[Verdict]
Culprits = TypedVector[Culprit]
Faults = TypedVector[Fault]
@structure
class DisputesExtrinsic:
"""Disputes extrinsic structure."""
verdicts: Verdicts
culprits: Culprits
faults: Faults
| Name | Description |
|---|---|
| Preimage Extrinsic (EP) | Static data which is presently being requested to be available for workloads to be able to fetch on demand. |
Preimage tuple structure (from gray paper)
EP ∈ ⟦ ( NS, B ) ⟧
where:
- NS service ID.
- B Blobs (octet sequences).
class Preimage:
"""Preimage structure."""
requester: ServiceId
blob: Bytes
PreimagesExtrinsic = TypedVector[Preimage]
| Name | Description |
|---|---|
| Assurance Extrinsic (EA) | The assurances extrinsic is a sequence of assurance values, at most one per validator. assurance is a sequence of binary values |
Assurance tuple structure (from gray paper)
EA ∈ ⟦ ( a ∈ H, f ∈ bC, v ∈ NV, s ∈ V̄ ) ⟧:V
where:
- a anchor
- f AvailBitField f ∈ bC = A value of 1 (or ⊺, if interpreted as a Boolean)
- v validator index v ∈ NV
- s Valid Ed25519 signature s ∈ V̄
class AvailBitField(Bits[CORE_COUNT, "lsb"]):
...
@structure
class AvailAssurance:
"""Availability assurance structure."""
anchor: OpaqueHash
bitfield: AvailBitField
validator_index: ValidatorIndex
signature: Ed25519Signature
def __repr__(self):
return (
f"Assurance(anchor={self.anchor.hex()}, bitfield={self.bitfield}, "
f"validator_index={self.validator_index}, sign={self.signature.hex()})"
)
AssurancesExtrinsic = TypedVector[AvailAssurance]
| Name | Description |
|---|---|
| Guarantee Extrinsic (EG) | Reports of newly completed workloads whose accuracy is guaranteed by specific validators. |
Guarantee tuple structure (from gray paper)
EG ∈ ⟦ ( r ∈ R, t ∈ ℕT, a ∈ ⟦ (NV, v̄) ⟧2:3 ) ⟧:C
where:
- r work report hash => r ∈ R.
- t is timeslot => t ∈ ℕT.
- a is credential is a sequence of two or three tuples of a unique validator index (NV) and a signature v̄ with sub-selection 2:3.
class ValidatorSignature:
"""Validator signature structure."""
validator_index: ValidatorIndex
signature: Ed25519Signature
ValidatorSignatures = TypedVector[ValidatorSignature]
@structure
class ReportGuarantee:
"""Report guarantee structure."""
report: WorkReport
slot: TimeSlot
signatures: ValidatorSignatures
GuaranteesExtrinsic = TypedVector[ReportGuarantee]