JAR: Join-Accumulate Refine

15.2. Header Validation (§5)🔗

🔗def
Jar.validateHeader [Jar.JarVariant] (s : Jar.State) (h : Jar.Header) : Bool
Jar.validateHeader [Jar.JarVariant] (s : Jar.State) (h : Jar.Header) : Bool

Validate block header against the current state. GP §5. Checks:

  1. Parent hash matches last known block

  2. Timeslot strictly increasing

  3. Timeslot not too far in the future

  4. Author index is valid

  5. Extrinsic size bounds

  6. Seal signature (via crypto opaque)

  7. VRF output (via crypto opaque)

🔗def
Jar.validateHeaderNoSeal [Jar.JarVariant] (s : Jar.State) (h : Jar.Header) : Bool
Jar.validateHeaderNoSeal [Jar.JarVariant] (s : Jar.State) (h : Jar.Header) : Bool

Header validation without seal/VRF checks (for block-level testing while seal verification context is being fixed).

🔗def
Jar.validateAuthor [Jar.JarVariant] (h : Jar.Header) (eta' : Jar.Entropy) (sealKeys : Jar.SealKeySeries) (validators : Array Jar.ValidatorKey) : Bool
Jar.validateAuthor [Jar.JarVariant] (h : Jar.Header) (eta' : Jar.Entropy) (sealKeys : Jar.SealKeySeries) (validators : Array Jar.ValidatorKey) : Bool

Validate the block seal signature and author identity. In ticket mode: the author's bandersnatch key must match the ticket's key for the slot. In fallback mode: the author's bandersnatch key must match the fallback key for the slot. eta' is the POST-transition entropy (needed because seal uses η'_3). sealKeys is the POST-epoch seal key series (may differ from pre-state on epoch boundaries). validators is the POST-epoch active validator set (κ'). Returns true if the author is expected for this timeslot.

🔗def
Jar.validateEpochMarkerContents [Jar.JarVariant] (s : Jar.State) (h : Jar.Header) (eta' : Jar.Entropy) (kappa' : Array Jar.ValidatorKey) : Bool
Jar.validateEpochMarkerContents [Jar.JarVariant] (s : Jar.State) (h : Jar.Header) (eta' : Jar.Entropy) (kappa' : Array Jar.ValidatorKey) : Bool

Validate the epoch marker contents. When present, the epoch marker must contain the correct entropy values and the correct validator key set. GP eq (6.13-6.16).

🔗def
Jar.validateExtrinsic [Jar.JarVariant] (e : Jar.Extrinsic) : Bool
Jar.validateExtrinsic [Jar.JarVariant] (e : Jar.Extrinsic) : Bool

Validate extrinsic data bounds. GP §5, §11.

🔗def
Jar.validatePreimages [Jar.JarVariant] (delta : Dict Jar.ServiceId Jar.ServiceAccount) (preimages : Jar.PreimagesExtrinsic) (opaqueData : Array (ByteArray × ByteArray)) : Bool
Jar.validatePreimages [Jar.JarVariant] (delta : Dict Jar.ServiceId Jar.ServiceAccount) (preimages : Jar.PreimagesExtrinsic) (opaqueData : Array (ByteArray × ByteArray)) : Bool

Validate that preimages are required (solicited by the service). Returns true if all preimages are solicited.

🔗def
Jar.validateAssuranceOrder [Jar.JarVariant] (assurances : Jar.AssurancesExtrinsic) : Bool
Jar.validateAssuranceOrder [Jar.JarVariant] (assurances : Jar.AssurancesExtrinsic) : Bool

Validate assurance ordering: validator indices must be sorted and unique.

🔗def
Jar.validateAssuranceIndices [Jar.JarVariant] (assurances : Jar.AssurancesExtrinsic) (validatorCount : Nat := Jar.V) : Bool
Jar.validateAssuranceIndices [Jar.JarVariant] (assurances : Jar.AssurancesExtrinsic) (validatorCount : Nat := Jar.V) : Bool

Validate assurance validator indices are in range. GP#514: bounded by actual active set size when variableValidators.

🔗def
Jar.validateAssuranceAnchors [Jar.JarVariant] (assurances : Jar.AssurancesExtrinsic) (s : Jar.State) : Bool
Jar.validateAssuranceAnchors [Jar.JarVariant] (assurances : Jar.AssurancesExtrinsic) (s : Jar.State) : Bool

Validate assurance anchors: all must equal parent block hash. GP eq (11.11).

🔗def
Jar.validateAssuranceSignatures [Jar.JarVariant] (assurances : Jar.AssurancesExtrinsic) (validators : Array Jar.ValidatorKey) : Bool
Jar.validateAssuranceSignatures [Jar.JarVariant] (assurances : Jar.AssurancesExtrinsic) (validators : Array Jar.ValidatorKey) : Bool

Validate assurance signatures. Each assurance must be signed by the validator at the given index. Message: "jam_available" ++ H(parent_hash ++ bitfield). GP eq (11.13).

🔗def
Jar.validateGuaranteeIndices [Jar.JarVariant] (guarantees : Jar.GuaranteesExtrinsic) (validatorCount : Nat := Jar.V) : Bool
Jar.validateGuaranteeIndices [Jar.JarVariant] (guarantees : Jar.GuaranteesExtrinsic) (validatorCount : Nat := Jar.V) : Bool

Validate guarantee credential validator indices are in range. GP#514: bounded by actual active set size when variableValidators.

🔗def
Jar.validateGuaranteeTimeslots [Jar.JarVariant] (guarantees : Jar.GuaranteesExtrinsic) (t' : Jar.Timeslot) : Bool
Jar.validateGuaranteeTimeslots [Jar.JarVariant] (guarantees : Jar.GuaranteesExtrinsic) (t' : Jar.Timeslot) : Bool

Validate guarantee timeslots: the guarantee timeslot must not be in the future relative to the block timeslot. GP eq (11.24): g_t <= H_t. Also: the report context anchor must be in recent history.

🔗def
Jar.validateGuaranteeSignatures [Jar.JarVariant] (guarantees : Jar.GuaranteesExtrinsic) (validators : Array Jar.ValidatorKey) : Bool
Jar.validateGuaranteeSignatures [Jar.JarVariant] (guarantees : Jar.GuaranteesExtrinsic) (validators : Array Jar.ValidatorKey) : Bool

Validate guarantee credential signatures. Each credential (vi, sig) must be a valid Ed25519 signature of the work report by the validator at index vi. GP eq (11.28): H̄_κ'[vi] ∈ V̄_sig⟨𝓔(report)⟩.