Skip to content

Commit

Permalink
Add dispute structs
Browse files Browse the repository at this point in the history
  • Loading branch information
bamzedev committed Jul 30, 2024
1 parent c3dd4e3 commit 5aca0f6
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/block/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ type Block struct {
// Extrinsic represents the block extrinsic data
type Extrinsic struct {
ET []*TicketProof
ED *DisputeExtrinsic
}
39 changes: 39 additions & 0 deletions internal/block/dispute.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package block

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

const (
judgmentSignatureSize = 64 // Size of Ed25519 signature
)

type DisputeExtrinsic struct {
Verdicts []Verdict
Culprits []Culprit
Faults []Fault
}

type Verdict struct {
ReportHash crypto.Hash // 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
}

0 comments on commit 5aca0f6

Please sign in to comment.