blame

package
v0.0.0-...-de91b87 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HashCheckFail = "hash check failed"
	TssTimeout    = "Tss timeout"
	TssBrokenMsg  = "tss share verification failed"
	InternalError = "fail to start the join party "
)

Variables

View Source
var (
	ErrHashFromOwner     = fmt.Errorf(" hash sent from data owner")
	ErrNotEnoughPeer     = fmt.Errorf("not enough nodes to evaluate hash")
	ErrNotMajority       = fmt.Errorf("message we received does not match the majority")
	ErrTssTimeOut        = fmt.Errorf("error Tss Timeout")
	ErrHashCheck         = fmt.Errorf("error in processing hash check")
	ErrHashInconsistency = fmt.Errorf("fail to agree on the hash value")
)

Functions

This section is empty.

Types

type Blame

type Blame struct {
	FailReason string `json:"fail_reason"`
	IsUnicast  bool   `json:"is_unicast"`
	BlameNodes []Node `json:"blame_peers,omitempty"`
	// contains filtered or unexported fields
}

Blame is used to store the blame Peers and the fail reason

func NewBlame

func NewBlame(reason string, blameNodes []Node) Blame

NewBlame create a new instance of Blame

func (*Blame) AddBlameNodes

func (b *Blame) AddBlameNodes(newBlamePeers ...Node)

AddBlameNodes add Nodes to the blame list

func (*Blame) AlreadyBlame

func (b *Blame) AlreadyBlame() bool

func (*Blame) SetBlame

func (b *Blame) SetBlame(reason string, nodes []Node, isUnicast bool)

SetBlame update the field values of Blame

func (Blame) String

func (b Blame) String() string

String implement fmt.Stringer

type Manager

type Manager struct {
	Blame    *Blame
	ShareMgr *ShareMgr
	RoundMgr *RoundMgr
	// contains filtered or unexported fields
}

func NewBlameManager

func NewBlameManager(logger logrus.FieldLogger) *Manager

func (*Manager) CheckMsgDuplication

func (m *Manager) CheckMsgDuplication(round conversion.RoundInfo, id string) bool

CheckMsgDuplication checks whether a participant is already in the acceptedShares list for the specified round

func (*Manager) GetBlamePartyIDsLists

func (m *Manager) GetBlamePartyIDsLists(partiesID []string) ([]string, []string, error)

GetBlamePartyIDsLists returns the nodes partyID.id who are in and not in the partiesID list

func (*Manager) GetBroadcastBlame

func (m *Manager) GetBroadcastBlame(lastMessageType string) ([]Node, error)

GetBroadcastBlame blames the node who cause the timeout in broadcast message

func (*Manager) GetLastMsg

func (m *Manager) GetLastMsg() btss.Message

func (*Manager) GetUnicastBlame

func (m *Manager) GetUnicastBlame(lastMsgType string) ([]Node, error)

GetUnicastBlame blames the node who cause the timeout in unicast message

func (*Manager) SetLastMsg

func (m *Manager) SetLastMsg(lastMsg btss.Message)

func (*Manager) SetLastUnicastParty

func (m *Manager) SetLastUnicastParty(partyID string, roundInfo string)

func (*Manager) SetPartyInfo

func (m *Manager) SetPartyInfo(partyInfo *conversion.PartyInfo)

func (*Manager) TssMissingShareBlame

func (m *Manager) TssMissingShareBlame(rounds int) ([]Node, bool, error)

TssMissingShareBlame blames the node fail to send the shares to the node with batch signing, we need to put the accepted shares into different message group then search the missing share for each keysign message

func (*Manager) TssWrongShareBlame

func (m *Manager) TssWrongShareBlame(wiredMsg *message.TaskMessage) (string, error)

TssWrongShareBlame blames the node who provide the wrong share

func (*Manager) UpdateAcceptShare

func (m *Manager) UpdateAcceptShare(round conversion.RoundInfo, id string)

UpdateAcceptShare adds a participant who have accepted all shared information for the specified round

type Node

type Node struct {
	PartyID        string `json:"party_id"`
	BlameData      []byte `json:"blame_data"`
	BlameSignature []byte `json:"blame_signature"`
}

func NewNode

func NewNode(partyID string, blameData, blameSig []byte) Node

func (*Node) Equal

func (bn *Node) Equal(node Node) bool

type RoundMgr

type RoundMgr struct {
	// contains filtered or unexported fields
}

RoundMgr is used to record the confirmation of broadcast messages of each round. In the round of keygen and keysign, a participant needs to broadcast the hash of a broadcast message after receiving it

to ensure that the broadcast message received by the participant is consistent with that received by other participants.

func NewTssRoundMgr

func NewTssRoundMgr() *RoundMgr

func (*RoundMgr) Get

func (tr *RoundMgr) Get(key string) *message.TaskMessage

func (*RoundMgr) GetByRound

func (tr *RoundMgr) GetByRound(roundInfo string) []string

GetByRound queries all senders of messages in the specified round. That is, query participants that normally send messages in the specified round.

func (*RoundMgr) Set

func (tr *RoundMgr) Set(key string, msg *message.TaskMessage)

type ShareMgr

type ShareMgr struct {
	// contains filtered or unexported fields
}

ShareMgr is used to manage the share request. When the current participant does not receive a broadcast message (or when the received broadcast message

is inconsistent with the majority of participants), the current participant requests the share of the broadcast
message from the majority of participants in agreement.

func NewTssShareMgr

func NewTssShareMgr() *ShareMgr

func (*ShareMgr) QueryAndDelete

func (sm *ShareMgr) QueryAndDelete(key string) bool

QueryAndDelete determines whether the share result is needed according to the 「requested」 when receiving the result from other participants, and it deletes the 「requested」at the same time.

func (*ShareMgr) Set

func (sm *ShareMgr) Set(key string)

Set Sets the 「requested」 to true when making requests to other participants

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL