Skip to content

Commit

Permalink
Add dispute structs (#23)
Browse files Browse the repository at this point in the history
* Add dispute  structs

* Replace judgmentSignatureSize with Ed25519SignatureSize
  • Loading branch information
bamzedev authored Jul 30, 2024
1 parent c3dd4e3 commit 8d64844
Show file tree
Hide file tree
Showing 3 changed files with 39 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
}
37 changes: 37 additions & 0 deletions internal/block/dispute.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package block

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

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 [crypto.Ed25519SignatureSize]byte // E
}

type Fault struct {
ReportHash crypto.Hash // H, hash of the work report
IsValid bool // {⊺,⊥}
ValidatorEd25519PublicKey crypto.Ed25519PublicKey // He
Signature [crypto.Ed25519SignatureSize]byte // E
}

// Judgment represents a single judgment with a signature
type Judgment struct {
IsValid bool // v: {⊺,⊥}
ValidatorIndex uint16 // i: NV
Signature [crypto.Ed25519SignatureSize]byte // s: E
}
1 change: 1 addition & 0 deletions internal/crypto/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const (
BandersnatchSize = 32
Ed25519PublicSize = 32
Ed25519PrivateSize = 64
Ed25519SignatureSize = 64
BLSSize = 144
BandersnatchRingSize = 144
MetadataSize = 128
Expand Down

0 comments on commit 8d64844

Please sign in to comment.