diff --git a/internal/block/block.go b/internal/block/block.go index a7eb69a..ae8cea1 100644 --- a/internal/block/block.go +++ b/internal/block/block.go @@ -9,4 +9,5 @@ type Block struct { // Extrinsic represents the block extrinsic data type Extrinsic struct { ET []*TicketProof + ED *Dispute } diff --git a/internal/block/dispute.go b/internal/block/dispute.go new file mode 100644 index 0000000..f3d9410 --- /dev/null +++ b/internal/block/dispute.go @@ -0,0 +1,39 @@ +package block + +import "github.com/eigerco/strawberry/internal/crypto" + +const ( + judgmentSignatureSize = 64 // Size of Ed25519 signature +) + +type Dispute struct { + Verdicts []Verdict + Culprits []Culprit + Faults []Fault +} + +type Verdict struct { + ReportHash [32]byte // H, hash of the work report + EpochIndex uint32 // ⌊τ/E⌋ - N2, epoch index + Judgments []Judgment // ⟦{⊺,⊥},NV,E⟧⌊2/3V⌋+1 +} + +type Culprit struct { + ReportHash crypto.Hash // H, hash of the work report + ValidatorEd25519PublicKey crypto.Ed25519PublicKey // He + Signature [judgmentSignatureSize]byte // E +} + +type Fault struct { + ReportHash crypto.Hash // H, hash of the work report + IsValid bool // {⊺,⊥} + ValidatorEd25519PublicKey crypto.Ed25519PublicKey // He + Signature [judgmentSignatureSize]byte // E +} + +// Judgment represents a single judgment with a signature +type Judgment struct { + IsValid bool // v: {⊺,⊥} + ValidatorIndex uint16 // i: NV + Signature [judgmentSignatureSize]byte // s: E +}