github.com/unicornultrafoundation/go-u2u@v1.0.0-rc1.0.20240205080301-e74a83d3fadc/native/native_mps.go (about)

     1  package native
     2  
     3  import (
     4  	"github.com/unicornultrafoundation/go-helios/hash"
     5  	"github.com/unicornultrafoundation/go-helios/native/idx"
     6  )
     7  
     8  const (
     9  	// MinAccomplicesForProof defines how many validators must have signed the same wrong vote.
    10  	// Otherwise, wrong-signer is not liable as a protection against singular software/hardware failures
    11  	MinAccomplicesForProof = 2
    12  )
    13  
    14  type EventsDoublesign struct {
    15  	Pair [2]SignedEventLocator
    16  }
    17  
    18  type BlockVoteDoublesign struct {
    19  	Block idx.Block
    20  	Pair  [2]LlrSignedBlockVotes
    21  }
    22  
    23  func (p BlockVoteDoublesign) GetVote(i int) hash.Hash {
    24  	return p.Pair[i].Val.Votes[p.Block-p.Pair[i].Val.Start]
    25  }
    26  
    27  type WrongBlockVote struct {
    28  	Block      idx.Block
    29  	Pals       [MinAccomplicesForProof]LlrSignedBlockVotes
    30  	WrongEpoch bool
    31  }
    32  
    33  func (p WrongBlockVote) GetVote(i int) hash.Hash {
    34  	return p.Pals[i].Val.Votes[p.Block-p.Pals[i].Val.Start]
    35  }
    36  
    37  type EpochVoteDoublesign struct {
    38  	Pair [2]LlrSignedEpochVote
    39  }
    40  
    41  type WrongEpochVote struct {
    42  	Pals [MinAccomplicesForProof]LlrSignedEpochVote
    43  }
    44  
    45  type MisbehaviourProof struct {
    46  	EventsDoublesign *EventsDoublesign `rlp:"nil"`
    47  
    48  	BlockVoteDoublesign *BlockVoteDoublesign `rlp:"nil"`
    49  
    50  	WrongBlockVote *WrongBlockVote `rlp:"nil"`
    51  
    52  	EpochVoteDoublesign *EpochVoteDoublesign `rlp:"nil"`
    53  
    54  	WrongEpochVote *WrongEpochVote `rlp:"nil"`
    55  }