blame

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: MIT Imports: 13 Imported by: 10

Documentation

Index

Constants

View Source
const (
	HashCheckFail = "hash check failed"
	TssTimeout    = "Tss timeout"
	TssSyncFail   = "signers fail to sync before keygen/keysign"
	TssBrokenMsg  = "tss share verification failed"
	InternalError = "fail to start the join party "
)

Variables

View Source
var (
	ErrHashFromOwner     = errors.New(" hash sent from data owner")
	ErrNotEnoughPeer     = errors.New("not enough nodes to evaluate hash")
	ErrNotMajority       = errors.New("message we received does not match the majority")
	ErrTssTimeOut        = errors.New("error Tss Timeout")
	ErrHashCheck         = errors.New("error in processing hash check")
	ErrHashInconsistency = errors.New("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_broadcast"`
	Round      string `json:"round"`
	BlameNodes []Node `json:"blame_peers,omitempty"`
	// contains filtered or unexported fields
}

Blame is used to store the blame nodes and the fail reason *** Blame struct had been referenced and registered in thornode , so please don't change this structure, otherwise it will have consensus failure when trying to update thornode ***

func NewBlame

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

NewBlame create a new instance of Blame

func (*Blame) AddBlameNodes

func (b *Blame) AddBlameNodes(newBlameNodes ...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, round string)

SetBlame update the field values of Blame

func (Blame) String

func (b Blame) String() string

String implement fmt.Stringer

type Manager

type Manager struct {
	PartyIDtoP2PID map[string]peer.ID
	// contains filtered or unexported fields
}

func NewBlameManager

func NewBlameManager() *Manager

func (*Manager) CheckMsgDuplication added in v1.3.0

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

func (*Manager) GetBlame

func (m *Manager) GetBlame() *Blame

func (*Manager) GetBlamePubKeysLists

func (m *Manager) GetBlamePubKeysLists(peer []string) ([]string, []string, error)

GetBlamePubKeysNotInList returns the nodes public key who are not in the peer list

func (*Manager) GetBroadcastBlame

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

this blame blames the node who cause the timeout in broadcast message

func (*Manager) GetLastMsg

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

func (*Manager) GetRoundMgr

func (m *Manager) GetRoundMgr() *RoundMgr

func (*Manager) GetShareMgr

func (m *Manager) GetShareMgr() *ShareMgr

func (*Manager) GetUnicastBlame

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

this blame blames the node who cause the timeout in unicast message

func (*Manager) NodeSyncBlame

func (m *Manager) NodeSyncBlame(keys []string, onlinePeers []peer.ID) (Blame, error)

this blame blames the node who cause the timeout in node sync

func (*Manager) SetLastMsg

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

func (*Manager) SetLastUnicastPeer

func (m *Manager) SetLastUnicastPeer(peerID peer.ID, roundInfo string)

func (*Manager) SetPartyInfo

func (m *Manager) SetPartyInfo(partyMap *sync.Map, partyIDMap map[string]*btss.PartyID)

func (*Manager) TssMissingShareBlame

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

this blame 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 *messages.WireMessage) (string, error)

this blame blames the node who provide the wrong share

func (*Manager) UpdateAcceptShare added in v1.3.0

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

type Node

type Node struct {
	Pubkey         string `json:"pubkey"`
	BlameData      []byte `json:"data"`
	BlameSignature []byte `json:"signature,omitempty"`
}

func NewNode

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

func (*Node) Equal

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

type PartyInfo

type PartyInfo struct {
	PartyMap   *sync.Map
	PartyIDMap map[string]*btss.PartyID
}

PartyInfo the information used by tss key gen and key sign

type RoundInfo

type RoundInfo struct {
	Index         int
	RoundMsg      string
	MsgIdentifier string
}

type RoundMgr

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

func NewTssRoundMgr

func NewTssRoundMgr() *RoundMgr

func (*RoundMgr) Get

func (tr *RoundMgr) Get(key string) *messages.WireMessage

func (*RoundMgr) GetByRound

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

func (*RoundMgr) Set

func (tr *RoundMgr) Set(key string, msg *messages.WireMessage)

type ShareMgr

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

func NewTssShareMgr

func NewTssShareMgr() *ShareMgr

func (*ShareMgr) QueryAndDelete

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

func (*ShareMgr) Set

func (sm *ShareMgr) Set(key string)

Jump to

Keyboard shortcuts

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