Documentation
¶
Overview ¶
Membercheckers are responsible for tracking who can participate in consensus by having a list of their public keys. Membership can change on each iteration of consenus depding on the implementation of the application and memberchecker.
Index ¶
- func InitBinRotateMemberChecker(myPriv sig.Priv, gc *generalconfig.GeneralConfig) consinterface.MemberChecker
- func InitCurrentTrueMemberChecker(localRand *rand.Rand, rotateCord bool, rndMemberCount int, ...) consinterface.MemberChecker
- func InitLaterMemberChecker(localRand *rand.Rand, rotateCord bool, rndMemberCount int, ...) consinterface.MemberChecker
- func InitTrueMemberChecker(rotateCord bool, myPriv sig.Priv, gc *generalconfig.GeneralConfig) consinterface.MemberChecker
- type AbsRandLocalKnownMemberChecker
- type BinRotateMemberChecker
- func (mc *BinRotateMemberChecker) AbsGotDecision(newFixedCoord sig.Pub, newMemberPubs, newOtherPubs sig.PubList, prevDec []byte, ...) (retMemberPubs, retAllPubs []sig.Pub, changedMembers bool)
- func (mc *BinRotateMemberChecker) AddPubKeys(fixedCoord sig.Pub, memberPubKeys, otherPubs sig.PubList, ...)
- func (mc *BinRotateMemberChecker) AllowsChange() bool
- func (mc *BinRotateMemberChecker) CheckEstimatedRoundCoordNextIndex(checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
- func (mc *BinRotateMemberChecker) CheckFixedCoord(pub sig.Pub) (coordPub sig.Pub, err error)
- func (mc *BinRotateMemberChecker) CheckIndex(idx types.ConsensusIndex) bool
- func (mc *BinRotateMemberChecker) CheckMemberBytes(idx types.ConsensusIndex, pubBytes sig.PubKeyID) sig.Pub
- func (mc *BinRotateMemberChecker) CheckRandMember(pub sig.Pub, hdr messages.InternalSignedMsgHeader, msgID messages.MsgID, ...) error
- func (mc *BinRotateMemberChecker) CheckRandRoundCoord(msgID messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (randValue uint64, coordPub sig.Pub, err error)
- func (mc *BinRotateMemberChecker) CheckRoundCoord(msgID messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
- func (mc *BinRotateMemberChecker) DoneNextUpdateState() error
- func (mc *BinRotateMemberChecker) FinishUpdateState()
- func (mc *BinRotateMemberChecker) GetAllPubs() sig.PubList
- func (mc *BinRotateMemberChecker) GetFaultCount() int
- func (mc *BinRotateMemberChecker) GetIndex() types.ConsensusIndex
- func (mc *BinRotateMemberChecker) GetMemberCount() int
- func (mc *BinRotateMemberChecker) GetMyPriv() sig.Priv
- func (mc *BinRotateMemberChecker) GetMyVRF(isProposal bool, id messages.MsgID) sig.VRFProof
- func (mc *BinRotateMemberChecker) GetNewPub() sig.Pub
- func (mc *BinRotateMemberChecker) GetParticipantCount() int
- func (mc *BinRotateMemberChecker) GetParticipants() sig.PubList
- func (mc *BinRotateMemberChecker) GetRnd() (ret [32]byte)
- func (mc *BinRotateMemberChecker) GetStats() stats.StatsInterface
- func (mc *BinRotateMemberChecker) Invalidated() error
- func (mc *BinRotateMemberChecker) IsReady() bool
- func (mc *BinRotateMemberChecker) New(newIndex types.ConsensusIndex) consinterface.MemberChecker
- func (mc *BinRotateMemberChecker) RandMemberType() types.RndMemberType
- func (mc *BinRotateMemberChecker) SetMainChannel(mainChannel channelinterface.MainChannel)
- func (mc *BinRotateMemberChecker) UpdateState(fixedCoord sig.Pub, prevDec []byte, randBytes [32]byte, ...) (newMemberPubs, newAllPubs []sig.Pub, changedMembers bool)
- func (mc *BinRotateMemberChecker) Validated(signType types.SignType)
- type CurrentTrueMemberChecker
- func (mc *CurrentTrueMemberChecker) AbsGotDecision(newFixedCoord sig.Pub, newMemberPubs, newOtherPubs sig.PubList, prevDec []byte, ...) (retMemberPubs, retAllPubs []sig.Pub, changedMembers bool)
- func (mc *CurrentTrueMemberChecker) AddPubKeys(fixedCoord sig.Pub, memberPubKeys, otherPubs sig.PubList, ...)
- func (mc *CurrentTrueMemberChecker) AllowsChange() bool
- func (mc *CurrentTrueMemberChecker) CheckEstimatedRoundCoordNextIndex(checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
- func (mc *CurrentTrueMemberChecker) CheckFixedCoord(pub sig.Pub) (coordPub sig.Pub, err error)
- func (mc *CurrentTrueMemberChecker) CheckIndex(idx types.ConsensusIndex) bool
- func (mc *CurrentTrueMemberChecker) CheckMemberBytes(idx types.ConsensusIndex, pubBytes sig.PubKeyID) sig.Pub
- func (mc *CurrentTrueMemberChecker) CheckRandMember(pub sig.Pub, hdr messages.InternalSignedMsgHeader, msgID messages.MsgID, ...) error
- func (mc *CurrentTrueMemberChecker) CheckRandRoundCoord(msgID messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (randValue uint64, coordPub sig.Pub, err error)
- func (mc *CurrentTrueMemberChecker) CheckRoundCoord(_ messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
- func (mc *CurrentTrueMemberChecker) DoneNextUpdateState() error
- func (mc *CurrentTrueMemberChecker) FinishUpdateState()
- func (mc *CurrentTrueMemberChecker) GetAllPubs() sig.PubList
- func (mc *CurrentTrueMemberChecker) GetFaultCount() int
- func (mc *CurrentTrueMemberChecker) GetIndex() types.ConsensusIndex
- func (mc *CurrentTrueMemberChecker) GetMemberCount() int
- func (mc *CurrentTrueMemberChecker) GetMyPriv() sig.Priv
- func (mc *CurrentTrueMemberChecker) GetMyVRF(isProposal bool, id messages.MsgID) sig.VRFProof
- func (mc *CurrentTrueMemberChecker) GetNewPub() sig.Pub
- func (mc *CurrentTrueMemberChecker) GetParticipantCount() int
- func (mc *CurrentTrueMemberChecker) GetParticipants() sig.PubList
- func (mc *CurrentTrueMemberChecker) GetRnd() (ret [32]byte)
- func (mc *CurrentTrueMemberChecker) GetStats() stats.StatsInterface
- func (mc *CurrentTrueMemberChecker) Invalidated() error
- func (mc *CurrentTrueMemberChecker) IsReady() bool
- func (mc *CurrentTrueMemberChecker) New(newIndex types.ConsensusIndex) consinterface.MemberChecker
- func (mc *CurrentTrueMemberChecker) RandMemberType() types.RndMemberType
- func (mc *CurrentTrueMemberChecker) SetMainChannel(mainChannel channelinterface.MainChannel)
- func (mc *CurrentTrueMemberChecker) UpdateState(fixedCoord sig.Pub, prevDec []byte, randBytes [32]byte, ...) (newMemberPubs, newAllPubs []sig.Pub, changedMembers bool)
- func (mc *CurrentTrueMemberChecker) Validated(signType types.SignType)
- type CustomMemberChecker
- func (mc *CustomMemberChecker) AbsGotDecision(newFixedCoord sig.Pub, newMemberPubs, newOtherPubs sig.PubList, prevDec []byte, ...) (retMemberPubs, retAllPubs []sig.Pub, changedMembers bool)
- func (mc *CustomMemberChecker) AddPubKeys(fixedCoord sig.Pub, memberPubKeys, otherPubs sig.PubList, ...)
- func (mc *CustomMemberChecker) CheckEstimatedRoundCoordNextIndex(checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
- func (mc *CustomMemberChecker) CheckFixedCoord(pub sig.Pub) (coordPub sig.Pub, err error)
- func (mc *CustomMemberChecker) CheckIndex(idx types.ConsensusIndex) bool
- func (mc *CustomMemberChecker) CheckMemberBytes(idx types.ConsensusIndex, pubBytes sig.PubKeyID) sig.Pub
- func (mc *CustomMemberChecker) CheckRandMember(pub sig.Pub, hdr messages.InternalSignedMsgHeader, msgID messages.MsgID, ...) error
- func (mc *CustomMemberChecker) CheckRandRoundCoord(msgID messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (randValue uint64, coordPub sig.Pub, err error)
- func (mc *CustomMemberChecker) CheckRoundCoord(_ messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
- func (mc *CustomMemberChecker) DoneNextUpdateState() error
- func (mc *CustomMemberChecker) FinishUpdateState()
- func (mc *CustomMemberChecker) GetAllPubs() sig.PubList
- func (mc *CustomMemberChecker) GetFaultCount() int
- func (mc *CustomMemberChecker) GetIndex() types.ConsensusIndex
- func (mc *CustomMemberChecker) GetMemberCount() int
- func (mc *CustomMemberChecker) GetMyPriv() sig.Priv
- func (mc *CustomMemberChecker) GetMyVRF(isProposal bool, id messages.MsgID) sig.VRFProof
- func (mc *CustomMemberChecker) GetNewPub() sig.Pub
- func (mc *CustomMemberChecker) GetParticipantCount() int
- func (mc *CustomMemberChecker) GetParticipants() sig.PubList
- func (mc *CustomMemberChecker) GetRnd() (ret [32]byte)
- func (mc *CustomMemberChecker) GetStats() stats.StatsInterface
- func (mc *CustomMemberChecker) Invalidated() error
- func (mc *CustomMemberChecker) IsReady() bool
- func (mc *CustomMemberChecker) New(newIndex types.ConsensusIndex) *CustomMemberChecker
- func (mc *CustomMemberChecker) RandMemberType() types.RndMemberType
- func (mc *CustomMemberChecker) SetMainChannel(mainChannel channelinterface.MainChannel)
- func (mc *CustomMemberChecker) UpdateState(fixedCoord sig.Pub, prevDec []byte, randBytes [32]byte, ...) (sig.PubList, sig.PubList, bool)
- func (mc *CustomMemberChecker) Validated(signType types.SignType)
- type LaterMemberChecker
- func (mc *LaterMemberChecker) AbsGotDecision(newFixedCoord sig.Pub, newMemberPubs, newOtherPubs sig.PubList, prevDec []byte, ...) (retMemberPubs, retAllPubs []sig.Pub, changedMembers bool)
- func (mc *LaterMemberChecker) AddPubKeys(fixedCoord sig.Pub, memberPubKeys, otherPubs sig.PubList, ...)
- func (mc *LaterMemberChecker) AllowsChange() bool
- func (mc *LaterMemberChecker) CheckEstimatedRoundCoordNextIndex(checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
- func (mc *LaterMemberChecker) CheckFixedCoord(pub sig.Pub) (coordPub sig.Pub, err error)
- func (mc *LaterMemberChecker) CheckIndex(idx types.ConsensusIndex) bool
- func (mc *LaterMemberChecker) CheckMemberBytes(idx types.ConsensusIndex, pubBytes sig.PubKeyID) sig.Pub
- func (mc *LaterMemberChecker) CheckRandMember(pub sig.Pub, hdr messages.InternalSignedMsgHeader, msgID messages.MsgID, ...) error
- func (mc *LaterMemberChecker) CheckRandRoundCoord(msgID messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (randValue uint64, coordPub sig.Pub, err error)
- func (mc *LaterMemberChecker) CheckRoundCoord(_ messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
- func (mc *LaterMemberChecker) DoneNextUpdateState() error
- func (mc *LaterMemberChecker) FinishUpdateState()
- func (mc *LaterMemberChecker) GetAllPubs() sig.PubList
- func (mc *LaterMemberChecker) GetFaultCount() int
- func (mc *LaterMemberChecker) GetIndex() types.ConsensusIndex
- func (mc *LaterMemberChecker) GetMemberCount() int
- func (mc *LaterMemberChecker) GetMyPriv() sig.Priv
- func (mc *LaterMemberChecker) GetMyVRF(isProposal bool, id messages.MsgID) sig.VRFProof
- func (mc *LaterMemberChecker) GetNewPub() sig.Pub
- func (mc *LaterMemberChecker) GetParticipantCount() int
- func (mc *LaterMemberChecker) GetParticipants() sig.PubList
- func (mc *LaterMemberChecker) GetRnd() (ret [32]byte)
- func (mc *LaterMemberChecker) GetStats() stats.StatsInterface
- func (mc *LaterMemberChecker) Invalidated() error
- func (mc *LaterMemberChecker) IsReady() bool
- func (mc *LaterMemberChecker) New(newIndex types.ConsensusIndex) consinterface.MemberChecker
- func (mc *LaterMemberChecker) RandMemberType() types.RndMemberType
- func (mc *LaterMemberChecker) SetMainChannel(mainChannel channelinterface.MainChannel)
- func (mc *LaterMemberChecker) UpdateState(fixedCoord sig.Pub, prevDec []byte, randBytes [32]byte, ...) (newMemberPubs, newAllPubs []sig.Pub, changedMembers bool)
- func (mc *LaterMemberChecker) Validated(signType types.SignType)
- type MultiSigMemChecker
- func (msm *MultiSigMemChecker) CheckMember(idx types.ConsensusIndex, pub sig.Pub, mc consinterface.MemberChecker, ...) (sig.Pub, error)
- func (msm *MultiSigMemChecker) New(idx types.ConsensusIndex) consinterface.SpecialPubMemberChecker
- func (msm *MultiSigMemChecker) UpdateState(newKeys sig.PubList, randBytes [32]byte, ...)
- type NoSpecialMembers
- func (tsm *NoSpecialMembers) CheckMember(idx types.ConsensusIndex, pub sig.Pub, mc consinterface.MemberChecker, ...) (sig.Pub, error)
- func (tsm *NoSpecialMembers) New(types.ConsensusIndex) consinterface.SpecialPubMemberChecker
- func (tsm *NoSpecialMembers) UpdateState(newKeys sig.PubList, randBytes [32]byte, ...)
- type ThrshSigMemChecker
- func (tsm *ThrshSigMemChecker) CheckMember(idx types.ConsensusIndex, pub sig.Pub, mc consinterface.MemberChecker, ...) (sig.Pub, error)
- func (tsm *ThrshSigMemChecker) New(idx types.ConsensusIndex) consinterface.SpecialPubMemberChecker
- func (tsm *ThrshSigMemChecker) UpdateState(newKeys sig.PubList, randBytes [32]byte, ...)
- type TrueMemberChecker
- func (mc *TrueMemberChecker) AbsGotDecision(newFixedCoord sig.Pub, newMemberPubs, newOtherPubs sig.PubList, prevDec []byte, ...) (retMemberPubs, retAllPubs []sig.Pub, changedMembers bool)
- func (mc *TrueMemberChecker) AddPubKeys(fixedCoord sig.Pub, memberPubKeys, otherPubs sig.PubList, ...)
- func (mc *TrueMemberChecker) AllowsChange() bool
- func (mc *TrueMemberChecker) CheckEstimatedRoundCoordNextIndex(checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
- func (mc *TrueMemberChecker) CheckFixedCoord(pub sig.Pub) (coordPub sig.Pub, err error)
- func (mc *TrueMemberChecker) CheckIndex(idx types.ConsensusIndex) bool
- func (mc *TrueMemberChecker) CheckMemberBytes(idx types.ConsensusIndex, pubBytes sig.PubKeyID) sig.Pub
- func (mc *TrueMemberChecker) CheckRandMember(pub sig.Pub, hdr messages.InternalSignedMsgHeader, msgID messages.MsgID, ...) error
- func (mc *TrueMemberChecker) CheckRandRoundCoord(msgID messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (randValue uint64, coordPub sig.Pub, err error)
- func (mc *TrueMemberChecker) CheckRoundCoord(_ messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
- func (mc *TrueMemberChecker) DoneNextUpdateState() error
- func (mc *TrueMemberChecker) FinishUpdateState()
- func (mc *TrueMemberChecker) GetAllPubs() sig.PubList
- func (mc *TrueMemberChecker) GetFaultCount() int
- func (mc *TrueMemberChecker) GetIndex() types.ConsensusIndex
- func (mc *TrueMemberChecker) GetMemberCount() int
- func (mc *TrueMemberChecker) GetMyPriv() sig.Priv
- func (mc *TrueMemberChecker) GetMyVRF(isProposal bool, id messages.MsgID) sig.VRFProof
- func (mc *TrueMemberChecker) GetNewPub() sig.Pub
- func (mc *TrueMemberChecker) GetParticipantCount() int
- func (mc *TrueMemberChecker) GetParticipants() sig.PubList
- func (mc *TrueMemberChecker) GetRnd() (ret [32]byte)
- func (mc *TrueMemberChecker) GetStats() stats.StatsInterface
- func (mc *TrueMemberChecker) Invalidated() error
- func (mc *TrueMemberChecker) IsReady() bool
- func (mc *TrueMemberChecker) New(idx types.ConsensusIndex) consinterface.MemberChecker
- func (mc *TrueMemberChecker) RandMemberType() types.RndMemberType
- func (mc *TrueMemberChecker) SetMainChannel(mainChannel channelinterface.MainChannel)
- func (mc *TrueMemberChecker) UpdateState(fixedCoord sig.Pub, prevDec []byte, randBytes [32]byte, ...) (newMemberPubs, newAllPubs []sig.Pub, changedMembers bool)
- func (mc *TrueMemberChecker) Validated(signType types.SignType)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitBinRotateMemberChecker ¶
func InitBinRotateMemberChecker(myPriv sig.Priv, gc *generalconfig.GeneralConfig) consinterface.MemberChecker
func InitCurrentTrueMemberChecker ¶
func InitCurrentTrueMemberChecker(localRand *rand.Rand, rotateCord bool, rndMemberCount int, rndMemberType types.RndMemberType, localRandChangeFrequency types.ConsensusInt, priv sig.Priv, gc *generalconfig.GeneralConfig) consinterface.MemberChecker
func InitLaterMemberChecker ¶
func InitLaterMemberChecker(localRand *rand.Rand, rotateCord bool, rndMemberCount int, rndMemberType types.RndMemberType, localRandChangeFrequency types.ConsensusInt, priv sig.Priv, gc *generalconfig.GeneralConfig) consinterface.MemberChecker
func InitTrueMemberChecker ¶
func InitTrueMemberChecker(rotateCord bool, myPriv sig.Priv, gc *generalconfig.GeneralConfig) consinterface.MemberChecker
Types ¶
type AbsRandLocalKnownMemberChecker ¶
type AbsRandLocalKnownMemberChecker struct {
// contains filtered or unexported fields
}
AbsRandLocalKnownMemberChecker uses a set of locally chosen member for the consensus.
func (*AbsRandLocalKnownMemberChecker) GetRnd ¶
func (arm *AbsRandLocalKnownMemberChecker) GetRnd() (ret [32]byte)
type BinRotateMemberChecker ¶
type BinRotateMemberChecker struct {
// contains filtered or unexported fields
}
BinRotateMemberChecker rotates consensus members based on the decided value. If absMemberChecker.AddPubKeys was called with len(keys) > membercount, then this member checker has the list of cons members for the next consensus instance rotate by one position (of the list of all participants) each time 0 is decided by consensus. Any other decided value keeps the members the same.
func (*BinRotateMemberChecker) AbsGotDecision ¶
func (mc *BinRotateMemberChecker) AbsGotDecision(newFixedCoord sig.Pub, newMemberPubs, newOtherPubs sig.PubList, prevDec []byte, randBytes [32]byte, prevMember *absMemberChecker) (retMemberPubs, retAllPubs []sig.Pub, changedMembers bool)
AbsGotDecision should be called at the end of UpdateState from the MemberChecker. The newAllPubs is a list of all new pubs in the system (note this list does not need to be sorted as it will be sorted here). If it is nil then the set of pubs must have not changed since the last consensus instance. These pubs will be sorted and returned to insure that their new ids are computed correctly. newMemberPubs pubs are the public keys that will now participate in consensus. newMemberPubs must be a equal to or a subset of newAllPubs. newMemberPubs should also be nil if they have not changed since the previous consensus index. myPubIndex is the index of the local nodes public key in the list, if it is negative then this nodes public key should not be in the list (i.e. is not a member). ChangedMembers must be true if either of the other return values are non-nil. Even if they are nil, but the membership could have changed in a different way (i.e. by random membership) it must return true
func (*BinRotateMemberChecker) AddPubKeys ¶
func (mc *BinRotateMemberChecker) AddPubKeys(fixedCoord sig.Pub, memberPubKeys, otherPubs sig.PubList, initRandBytes [32]byte, shared *consinterface.Shared)
AddPubKeys is used for adding the public keys to the very inital member checker, and should not be called on later member checkers, as they should change pub keys through the call to UpdateState. allPubs are the list of all pubs in the system. memberPubs pubs are the public keys that will now participate in consensus. memberPubs must be equal to or a subset of newAllPubs. If shared is non-nil then the local nodes on the machine will share the same initial member objects (to save memory for experiments that run many nodes on the same machine).
func (*BinRotateMemberChecker) AllowsChange ¶
func (mc *BinRotateMemberChecker) AllowsChange() bool
func (*BinRotateMemberChecker) CheckEstimatedRoundCoordNextIndex ¶
func (mc *BinRotateMemberChecker) CheckEstimatedRoundCoordNextIndex(checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
CheckEstimatedRoundCoordNextIndex returns the estimated public key of the coordinator for round round for the following consensus index. It might not return the correct coordinator for the next index because the decision might change the membership for the next index. This function should not be used if it needs to know the next coordinator for certain. It returns an error if there is a fixed cordinator or random membership is enabled as it is unsupported in these cases.
func (*BinRotateMemberChecker) CheckFixedCoord ¶
CheckFixedCoord checks if checkPub the/a coordinator for round. If it is, err is returned as nil, otherwise an error is returned. If checkPub is nil, then it will return the fixed coordinator in coordPub. If there is no fixedCoordinator, then an error types.ErrNoFixedCoord is returned. Note this should only be called after the pub is verified to be a member with CheckMemberBytes
func (*BinRotateMemberChecker) CheckIndex ¶
func (mc *BinRotateMemberChecker) CheckIndex(idx types.ConsensusIndex) bool
CheckIndex should return true if the index is the same as the one used in New, it is for testing.
func (*BinRotateMemberChecker) CheckMemberBytes ¶
func (mc *BinRotateMemberChecker) CheckMemberBytes(idx types.ConsensusIndex, pubBytes sig.PubKeyID) sig.Pub
CheckMemberBytes checks the the pub key is a member and returns corresponding pub key object
func (*BinRotateMemberChecker) CheckRandMember ¶
func (mc *BinRotateMemberChecker) CheckRandMember(pub sig.Pub, hdr messages.InternalSignedMsgHeader, msgID messages.MsgID, isLocal bool) error
CheckRandMember can be called after CheckMemberBytes is successful when ChooseRandomMember is enabled. If ChooseRandomMember is false it return nil, otherwise it uses the random bytes and the VRF to decide if this pud is a random member.
func (*BinRotateMemberChecker) CheckRandRoundCoord ¶
func (mc *BinRotateMemberChecker) CheckRandRoundCoord(msgID messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (randValue uint64, coordPub sig.Pub, err error)
CheckRandRoundCoord is unsupported.
func (*BinRotateMemberChecker) CheckRoundCoord ¶
func (mc *BinRotateMemberChecker) CheckRoundCoord(msgID messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
GetRoundCoord returns the public key of the coordinator for round round. It is just the mod of the round in the sorted list of public keys.
func (*BinRotateMemberChecker) DoneNextUpdateState ¶
func (mc *BinRotateMemberChecker) DoneNextUpdateState() error
func (*BinRotateMemberChecker) FinishUpdateState ¶
func (mc *BinRotateMemberChecker) FinishUpdateState()
FinishUpdateState sets the member checker to ready.
func (*BinRotateMemberChecker) GetAllPubs ¶
GetAllPub returns all pubs in the system
func (*BinRotateMemberChecker) GetFaultCount ¶
func (mc *BinRotateMemberChecker) GetFaultCount() int
GetFaultCount returns the number of possilbe faultly nodes that the consensus can handle.
func (*BinRotateMemberChecker) GetIndex ¶
func (mc *BinRotateMemberChecker) GetIndex() types.ConsensusIndex
func (*BinRotateMemberChecker) GetMemberCount ¶
func (mc *BinRotateMemberChecker) GetMemberCount() int
GetMemberCount returns the number of consensus members.
func (*BinRotateMemberChecker) GetParticipantCount ¶
func (mc *BinRotateMemberChecker) GetParticipantCount() int
GetParticipantCount returns the total number of nodes in the system
func (*BinRotateMemberChecker) GetParticipants ¶
GetParticipant return the pub key of the participants.
func (*BinRotateMemberChecker) GetStats ¶
func (mc *BinRotateMemberChecker) GetStats() stats.StatsInterface
func (*BinRotateMemberChecker) Invalidated ¶
func (mc *BinRotateMemberChecker) Invalidated() error
Invalidated is called if the member checker has been made invalid. This happens if a different set of members was chosen then was initial proposed.
func (*BinRotateMemberChecker) IsReady ¶
func (mc *BinRotateMemberChecker) IsReady() bool
IsReady returns false until FinishUpdateState is called.
func (*BinRotateMemberChecker) New ¶
func (mc *BinRotateMemberChecker) New(newIndex types.ConsensusIndex) consinterface.MemberChecker
New generates a new member checker for the index, this is called on the inital member checker each time.
func (*BinRotateMemberChecker) RandMemberType ¶
func (mc *BinRotateMemberChecker) RandMemberType() types.RndMemberType
SelectRandMembers returns true if the member checker is selecting random members.
func (*BinRotateMemberChecker) SetMainChannel ¶
func (mc *BinRotateMemberChecker) SetMainChannel(mainChannel channelinterface.MainChannel)
SetMainChannel is called on the initial member checker to inform it of the network channel object
func (*BinRotateMemberChecker) UpdateState ¶
func (mc *BinRotateMemberChecker) UpdateState(fixedCoord sig.Pub, prevDec []byte, randBytes [32]byte, prevMember consinterface.MemberChecker, prevSM consinterface.GeneralStateMachineInterface, futureFixed types.ConsensusID) (newMemberPubs, newAllPubs []sig.Pub, changedMembers bool)
Update state computes the new members, in case 0 was decided, then they rotate by one from the list of all public keys (see BinRotateMemberChecker struct description). func (mc *BinRotateMemberChecker) UpdateState(prevDec []byte, prevSM consinterface.StateMachineInterface, prevMember MemberChecker) []sig.Pub {
type CurrentTrueMemberChecker ¶
type CurrentTrueMemberChecker struct {
// contains filtered or unexported fields
}
CurrentTrueMemberChecker is the same as TrueMemberChecker, except IsReady returns true only once FinishUpdateState has been called. It is just for testing
func (*CurrentTrueMemberChecker) AbsGotDecision ¶
func (mc *CurrentTrueMemberChecker) AbsGotDecision(newFixedCoord sig.Pub, newMemberPubs, newOtherPubs sig.PubList, prevDec []byte, randBytes [32]byte, prevMember *absMemberChecker) (retMemberPubs, retAllPubs []sig.Pub, changedMembers bool)
AbsGotDecision should be called at the end of UpdateState from the MemberChecker. The newAllPubs is a list of all new pubs in the system (note this list does not need to be sorted as it will be sorted here). If it is nil then the set of pubs must have not changed since the last consensus instance. These pubs will be sorted and returned to insure that their new ids are computed correctly. newMemberPubs pubs are the public keys that will now participate in consensus. newMemberPubs must be a equal to or a subset of newAllPubs. newMemberPubs should also be nil if they have not changed since the previous consensus index. myPubIndex is the index of the local nodes public key in the list, if it is negative then this nodes public key should not be in the list (i.e. is not a member). ChangedMembers must be true if either of the other return values are non-nil. Even if they are nil, but the membership could have changed in a different way (i.e. by random membership) it must return true
func (*CurrentTrueMemberChecker) AddPubKeys ¶
func (mc *CurrentTrueMemberChecker) AddPubKeys(fixedCoord sig.Pub, memberPubKeys, otherPubs sig.PubList, initRandBytes [32]byte, shared *consinterface.Shared)
AddPubKeys is used for adding the public keys to the very inital member checker, and should not be called on later member checkers, as they should change pub keys through the call to UpdateState. allPubs are the list of all pubs in the system. memberPubs pubs are the public keys that will now participate in consensus. memberPubs must be equal to or a subset of newAllPubs. If shared is non-nil then the local nodes on the machine will share the same initial member objects (to save memory for experiments that run many nodes on the same machine).
func (*CurrentTrueMemberChecker) AllowsChange ¶
func (mc *CurrentTrueMemberChecker) AllowsChange() bool
AllowsChange returns true if the member checker allows changing members, used as a sanity check.
func (*CurrentTrueMemberChecker) CheckEstimatedRoundCoordNextIndex ¶
func (mc *CurrentTrueMemberChecker) CheckEstimatedRoundCoordNextIndex(checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
CheckEstimatedRoundCoordNextIndex returns the estimated public key of the coordinator for round round for the following consensus index. It might not return the correct coordinator for the next index because the decision might change the membership for the next index. This function should not be used if it needs to know the next coordinator for certain. It returns an error if there is a fixed cordinator or random membership is enabled as it is unsupported in these cases.
func (*CurrentTrueMemberChecker) CheckFixedCoord ¶
CheckFixedCoord checks if checkPub the/a coordinator for round. If it is, err is returned as nil, otherwise an error is returned. If checkPub is nil, then it will return the fixed coordinator in coordPub. If there is no fixedCoordinator, then an error types.ErrNoFixedCoord is returned. Note this should only be called after the pub is verified to be a member with CheckMemberBytes
func (*CurrentTrueMemberChecker) CheckIndex ¶
func (mc *CurrentTrueMemberChecker) CheckIndex(idx types.ConsensusIndex) bool
CheckIndex should return true if the index is the same as the one used in New, it is for testing.
func (*CurrentTrueMemberChecker) CheckMemberBytes ¶
func (mc *CurrentTrueMemberChecker) CheckMemberBytes(idx types.ConsensusIndex, pubBytes sig.PubKeyID) sig.Pub
CheckMemberBytes checks the the pub key is a member and returns corresponding pub key object
func (*CurrentTrueMemberChecker) CheckRandMember ¶
func (mc *CurrentTrueMemberChecker) CheckRandMember(pub sig.Pub, hdr messages.InternalSignedMsgHeader, msgID messages.MsgID, isLocal bool) error
CheckRandMember can be called after CheckMemberBytes is successful when ChooseRandomMember is enabled. If ChooseRandomMember is false it return nil, otherwise it uses the random bytes and the VRF to decide if this pud is a random member.
func (*CurrentTrueMemberChecker) CheckRandRoundCoord ¶
func (mc *CurrentTrueMemberChecker) CheckRandRoundCoord(msgID messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (randValue uint64, coordPub sig.Pub, err error)
CheckRandRoundCoord should be called instead of CheckRoundCoord if random membership selection is enabled. If using VRFs then checkPub must not be nil. If checkPub is nil, then it will return the known coordinator in coordPub. If VRF is enabled randValue is the VRF random value for the inputs. Note this should be called after CheckRandMember for the same pub.
func (*CurrentTrueMemberChecker) CheckRoundCoord ¶
func (mc *CurrentTrueMemberChecker) CheckRoundCoord(_ messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
CheckRoundCoord returns the public key of the coordinator for round round. It is just the mod of the round in the sorted list of public keys.
func (*CurrentTrueMemberChecker) DoneNextUpdateState ¶
func (mc *CurrentTrueMemberChecker) DoneNextUpdateState() error
func (*CurrentTrueMemberChecker) FinishUpdateState ¶
func (mc *CurrentTrueMemberChecker) FinishUpdateState()
FinishUpdateState sets the member checker to ready.
func (*CurrentTrueMemberChecker) GetAllPubs ¶
GetAllPub returns all pubs in the system
func (*CurrentTrueMemberChecker) GetFaultCount ¶
func (mc *CurrentTrueMemberChecker) GetFaultCount() int
GetFaultCount returns the number of possilbe faultly nodes that the consensus can handle.
func (*CurrentTrueMemberChecker) GetIndex ¶
func (mc *CurrentTrueMemberChecker) GetIndex() types.ConsensusIndex
func (*CurrentTrueMemberChecker) GetMemberCount ¶
func (mc *CurrentTrueMemberChecker) GetMemberCount() int
GetMemberCount returns the number of consensus members.
func (*CurrentTrueMemberChecker) GetParticipantCount ¶
func (mc *CurrentTrueMemberChecker) GetParticipantCount() int
GetParticipantCount returns the total number of nodes in the system
func (*CurrentTrueMemberChecker) GetParticipants ¶
GetParticipant return the pub key of the participants.
func (*CurrentTrueMemberChecker) GetRnd ¶
func (mc *CurrentTrueMemberChecker) GetRnd() (ret [32]byte)
func (*CurrentTrueMemberChecker) GetStats ¶
func (mc *CurrentTrueMemberChecker) GetStats() stats.StatsInterface
func (*CurrentTrueMemberChecker) Invalidated ¶
func (mc *CurrentTrueMemberChecker) Invalidated() error
Invalidated is called if the member checker has been made invalid. This happens if a different set of members was chosen then was initial proposed.
func (*CurrentTrueMemberChecker) IsReady ¶
func (mc *CurrentTrueMemberChecker) IsReady() bool
IsReady returns false until FinishUpdateState is called.
func (*CurrentTrueMemberChecker) New ¶
func (mc *CurrentTrueMemberChecker) New(newIndex types.ConsensusIndex) consinterface.MemberChecker
New generates a new member checker for the index, this is called on the inital member checker each time.
func (*CurrentTrueMemberChecker) RandMemberType ¶
func (mc *CurrentTrueMemberChecker) RandMemberType() types.RndMemberType
SelectRandMembers returns true if the member checker is selecting random members.
func (*CurrentTrueMemberChecker) SetMainChannel ¶
func (mc *CurrentTrueMemberChecker) SetMainChannel(mainChannel channelinterface.MainChannel)
SetMainChannel is called on the initial member checker to inform it of the network channel object
func (*CurrentTrueMemberChecker) UpdateState ¶
func (mc *CurrentTrueMemberChecker) UpdateState(fixedCoord sig.Pub, prevDec []byte, randBytes [32]byte, prevMember consinterface.MemberChecker, prevSM consinterface.GeneralStateMachineInterface, futureFixed types.ConsensusID) (newMemberPubs, newAllPubs []sig.Pub, changedMembers bool)
UpdateState does nothing since the members do not change. func (mc *CurrentTrueMemberChecker) UpdateState(prevDec []byte, prevSM consinterface.StateMachineInterface, prevMember MemberChecker) []sig.Pub {
type CustomMemberChecker ¶
type CustomMemberChecker struct {
// contains filtered or unexported fields
}
CustomMemberChecker is intended to extended to be used as a custom member checker associated with a state machine.
func InitCustomMemberChecker ¶
func InitCustomMemberChecker(localRand *rand.Rand, rotateCord bool, rndMemberCount int, rndMemberType types.RndMemberType, localRandChangeFrequency types.ConsensusInt, priv sig.Priv, gc *generalconfig.GeneralConfig) *CustomMemberChecker
InitCustomMemberChecker initiates a CustomMemberChecker object.
func (*CustomMemberChecker) AbsGotDecision ¶
func (mc *CustomMemberChecker) AbsGotDecision(newFixedCoord sig.Pub, newMemberPubs, newOtherPubs sig.PubList, prevDec []byte, randBytes [32]byte, prevMember *absMemberChecker) (retMemberPubs, retAllPubs []sig.Pub, changedMembers bool)
AbsGotDecision should be called at the end of UpdateState from the MemberChecker. The newAllPubs is a list of all new pubs in the system (note this list does not need to be sorted as it will be sorted here). If it is nil then the set of pubs must have not changed since the last consensus instance. These pubs will be sorted and returned to insure that their new ids are computed correctly. newMemberPubs pubs are the public keys that will now participate in consensus. newMemberPubs must be a equal to or a subset of newAllPubs. newMemberPubs should also be nil if they have not changed since the previous consensus index. myPubIndex is the index of the local nodes public key in the list, if it is negative then this nodes public key should not be in the list (i.e. is not a member). ChangedMembers must be true if either of the other return values are non-nil. Even if they are nil, but the membership could have changed in a different way (i.e. by random membership) it must return true
func (*CustomMemberChecker) AddPubKeys ¶
func (mc *CustomMemberChecker) AddPubKeys(fixedCoord sig.Pub, memberPubKeys, otherPubs sig.PubList, initRandBytes [32]byte, shared *consinterface.Shared)
AddPubKeys is used for adding the public keys to the very inital member checker, and should not be called on later member checkers, as they should change pub keys through the call to UpdateState. allPubs are the list of all pubs in the system. memberPubs pubs are the public keys that will now participate in consensus. memberPubs must be equal to or a subset of newAllPubs. If shared is non-nil then the local nodes on the machine will share the same initial member objects (to save memory for experiments that run many nodes on the same machine).
func (*CustomMemberChecker) CheckEstimatedRoundCoordNextIndex ¶
func (mc *CustomMemberChecker) CheckEstimatedRoundCoordNextIndex(checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
CheckEstimatedRoundCoordNextIndex returns the estimated public key of the coordinator for round round for the following consensus index. It might not return the correct coordinator for the next index because the decision might change the membership for the next index. This function should not be used if it needs to know the next coordinator for certain. It returns an error if there is a fixed cordinator or random membership is enabled as it is unsupported in these cases.
func (*CustomMemberChecker) CheckFixedCoord ¶
CheckFixedCoord checks if checkPub the/a coordinator for round. If it is, err is returned as nil, otherwise an error is returned. If checkPub is nil, then it will return the fixed coordinator in coordPub. If there is no fixedCoordinator, then an error types.ErrNoFixedCoord is returned. Note this should only be called after the pub is verified to be a member with CheckMemberBytes
func (*CustomMemberChecker) CheckIndex ¶
func (mc *CustomMemberChecker) CheckIndex(idx types.ConsensusIndex) bool
CheckIndex should return true if the index is the same as the one used in New, it is for testing.
func (*CustomMemberChecker) CheckMemberBytes ¶
func (mc *CustomMemberChecker) CheckMemberBytes(idx types.ConsensusIndex, pubBytes sig.PubKeyID) sig.Pub
CheckMemberBytes checks the the pub key is a member and returns corresponding pub key object
func (*CustomMemberChecker) CheckRandMember ¶
func (mc *CustomMemberChecker) CheckRandMember(pub sig.Pub, hdr messages.InternalSignedMsgHeader, msgID messages.MsgID, isLocal bool) error
CheckRandMember can be called after CheckMemberBytes is successful when ChooseRandomMember is enabled. If ChooseRandomMember is false it return nil, otherwise it uses the random bytes and the VRF to decide if this pud is a random member.
func (*CustomMemberChecker) CheckRandRoundCoord ¶
func (mc *CustomMemberChecker) CheckRandRoundCoord(msgID messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (randValue uint64, coordPub sig.Pub, err error)
CheckRandRoundCoord should be called instead of CheckRoundCoord if random membership selection is enabled. If using VRFs then checkPub must not be nil. If checkPub is nil, then it will return the known coordinator in coordPub. If VRF is enabled randValue is the VRF random value for the inputs. Note this should be called after CheckRandMember for the same pub.
func (*CustomMemberChecker) CheckRoundCoord ¶
func (mc *CustomMemberChecker) CheckRoundCoord(_ messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
CheckRoundCoord returns the public key of the coordinator for round round. It is just the mod of the round in the sorted list of public keys.
func (*CustomMemberChecker) DoneNextUpdateState ¶
func (mc *CustomMemberChecker) DoneNextUpdateState() error
func (*CustomMemberChecker) FinishUpdateState ¶
func (mc *CustomMemberChecker) FinishUpdateState()
FinishUpdateState sets the member checker to ready.
func (*CustomMemberChecker) GetAllPubs ¶
GetAllPub returns all pubs in the system
func (*CustomMemberChecker) GetFaultCount ¶
func (mc *CustomMemberChecker) GetFaultCount() int
GetFaultCount returns the number of possilbe faultly nodes that the consensus can handle.
func (*CustomMemberChecker) GetIndex ¶
func (mc *CustomMemberChecker) GetIndex() types.ConsensusIndex
func (*CustomMemberChecker) GetMemberCount ¶
func (mc *CustomMemberChecker) GetMemberCount() int
GetMemberCount returns the number of consensus members.
func (*CustomMemberChecker) GetParticipantCount ¶
func (mc *CustomMemberChecker) GetParticipantCount() int
GetParticipantCount returns the total number of nodes in the system
func (*CustomMemberChecker) GetParticipants ¶
GetParticipant return the pub key of the participants.
func (*CustomMemberChecker) GetStats ¶
func (mc *CustomMemberChecker) GetStats() stats.StatsInterface
func (*CustomMemberChecker) Invalidated ¶
func (mc *CustomMemberChecker) Invalidated() error
Invalidated is called if the member checker has been made invalid. This happens if a different set of members was chosen then was initial proposed.
func (*CustomMemberChecker) IsReady ¶
func (mc *CustomMemberChecker) IsReady() bool
IsReady returns false until FinishUpdateState is called.
func (*CustomMemberChecker) New ¶
func (mc *CustomMemberChecker) New(newIndex types.ConsensusIndex) *CustomMemberChecker
New generates a new member checker for the index, this is called on the inital member checker each time.
func (*CustomMemberChecker) RandMemberType ¶
func (mc *CustomMemberChecker) RandMemberType() types.RndMemberType
SelectRandMembers returns true if the member checker is selecting random members.
func (*CustomMemberChecker) SetMainChannel ¶
func (mc *CustomMemberChecker) SetMainChannel(mainChannel channelinterface.MainChannel)
SetMainChannel is called on the initial member checker to inform it of the network channel object
func (*CustomMemberChecker) UpdateState ¶
func (mc *CustomMemberChecker) UpdateState(fixedCoord sig.Pub, prevDec []byte, randBytes [32]byte, prevMember *CustomMemberChecker, newMemberPubs, newAllPubs []sig.Pub) (sig.PubList, sig.PubList, bool)
UpdateState does nothing since the members do not change. func (mc *CustomMemberChecker) UpdateState(prevDec []byte, prevSM consinterface.StateMachineInterface, prevMember MemberChecker) []sig.Pub {
type LaterMemberChecker ¶
type LaterMemberChecker struct {
// contains filtered or unexported fields
}
LaterMemberChecker is used for consensus algorithms that piggyback consensus messages on later consensus instances, so that when a decision happens the members are changed not on the index that was decided, but on a future one. As returned by GetDecision() from the consinterface.ConsItem interface. The consensus instance starts with IsReady=true. When UpdateState is called, the previous consensus index member checker that received a non nil decision is input.
func (*LaterMemberChecker) AbsGotDecision ¶
func (mc *LaterMemberChecker) AbsGotDecision(newFixedCoord sig.Pub, newMemberPubs, newOtherPubs sig.PubList, prevDec []byte, randBytes [32]byte, prevMember *absMemberChecker) (retMemberPubs, retAllPubs []sig.Pub, changedMembers bool)
AbsGotDecision should be called at the end of UpdateState from the MemberChecker. The newAllPubs is a list of all new pubs in the system (note this list does not need to be sorted as it will be sorted here). If it is nil then the set of pubs must have not changed since the last consensus instance. These pubs will be sorted and returned to insure that their new ids are computed correctly. newMemberPubs pubs are the public keys that will now participate in consensus. newMemberPubs must be a equal to or a subset of newAllPubs. newMemberPubs should also be nil if they have not changed since the previous consensus index. myPubIndex is the index of the local nodes public key in the list, if it is negative then this nodes public key should not be in the list (i.e. is not a member). ChangedMembers must be true if either of the other return values are non-nil. Even if they are nil, but the membership could have changed in a different way (i.e. by random membership) it must return true
func (*LaterMemberChecker) AddPubKeys ¶
func (mc *LaterMemberChecker) AddPubKeys(fixedCoord sig.Pub, memberPubKeys, otherPubs sig.PubList, initRandBytes [32]byte, shared *consinterface.Shared)
AddPubKeys is used for adding the public keys to the very inital member checker, and should not be called on later member checkers, as they should change pub keys through the call to UpdateState. allPubs are the list of all pubs in the system. memberPubs pubs are the public keys that will now participate in consensus. memberPubs must be equal to or a subset of newAllPubs. If shared is non-nil then the local nodes on the machine will share the same initial member objects (to save memory for experiments that run many nodes on the same machine).
func (*LaterMemberChecker) AllowsChange ¶
func (mc *LaterMemberChecker) AllowsChange() bool
AllowsChange returns true if the member checker allows changing members, used as a sanity check.
func (*LaterMemberChecker) CheckEstimatedRoundCoordNextIndex ¶
func (mc *LaterMemberChecker) CheckEstimatedRoundCoordNextIndex(checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
CheckEstimatedRoundCoordNextIndex returns the estimated public key of the coordinator for round round for the following consensus index. It might not return the correct coordinator for the next index because the decision might change the membership for the next index. This function should not be used if it needs to know the next coordinator for certain. It returns an error if there is a fixed cordinator or random membership is enabled as it is unsupported in these cases.
func (*LaterMemberChecker) CheckFixedCoord ¶
CheckFixedCoord checks if checkPub the/a coordinator for round. If it is, err is returned as nil, otherwise an error is returned. If checkPub is nil, then it will return the fixed coordinator in coordPub. If there is no fixedCoordinator, then an error types.ErrNoFixedCoord is returned. Note this should only be called after the pub is verified to be a member with CheckMemberBytes
func (*LaterMemberChecker) CheckIndex ¶
func (mc *LaterMemberChecker) CheckIndex(idx types.ConsensusIndex) bool
CheckIndex should return true if the index is the same as the one used in New, it is for testing.
func (*LaterMemberChecker) CheckMemberBytes ¶
func (mc *LaterMemberChecker) CheckMemberBytes(idx types.ConsensusIndex, pubBytes sig.PubKeyID) sig.Pub
CheckMemberBytes checks the the pub key is a member and returns corresponding pub key object
func (*LaterMemberChecker) CheckRandMember ¶
func (mc *LaterMemberChecker) CheckRandMember(pub sig.Pub, hdr messages.InternalSignedMsgHeader, msgID messages.MsgID, isLocal bool) error
CheckRandMember can be called after CheckMemberBytes is successful when ChooseRandomMember is enabled. If ChooseRandomMember is false it return nil, otherwise it uses the random bytes and the VRF to decide if this pud is a random member.
func (*LaterMemberChecker) CheckRandRoundCoord ¶
func (mc *LaterMemberChecker) CheckRandRoundCoord(msgID messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (randValue uint64, coordPub sig.Pub, err error)
CheckRandRoundCoord should be called instead of CheckRoundCoord if random membership selection is enabled. If using VRFs then checkPub must not be nil. If checkPub is nil, then it will return the known coordinator in coordPub. If VRF is enabled randValue is the VRF random value for the inputs. Note this should be called after CheckRandMember for the same pub.
func (*LaterMemberChecker) CheckRoundCoord ¶
func (mc *LaterMemberChecker) CheckRoundCoord(_ messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
CheckRoundCoord returns the public key of the coordinator for round round. It is just the mod of the round in the sorted list of public keys.
func (*LaterMemberChecker) DoneNextUpdateState ¶
func (mc *LaterMemberChecker) DoneNextUpdateState() error
func (*LaterMemberChecker) FinishUpdateState ¶
func (mc *LaterMemberChecker) FinishUpdateState()
FinishUpdateState does nothing.
func (*LaterMemberChecker) GetAllPubs ¶
GetAllPub returns all pubs in the system
func (*LaterMemberChecker) GetFaultCount ¶
func (mc *LaterMemberChecker) GetFaultCount() int
GetFaultCount returns the number of possilbe faultly nodes that the consensus can handle.
func (*LaterMemberChecker) GetIndex ¶
func (mc *LaterMemberChecker) GetIndex() types.ConsensusIndex
func (*LaterMemberChecker) GetMemberCount ¶
func (mc *LaterMemberChecker) GetMemberCount() int
GetMemberCount returns the number of consensus members.
func (*LaterMemberChecker) GetParticipantCount ¶
func (mc *LaterMemberChecker) GetParticipantCount() int
GetParticipantCount returns the total number of nodes in the system
func (*LaterMemberChecker) GetParticipants ¶
GetParticipant return the pub key of the participants.
func (*LaterMemberChecker) GetStats ¶
func (mc *LaterMemberChecker) GetStats() stats.StatsInterface
func (*LaterMemberChecker) Invalidated ¶
func (mc *LaterMemberChecker) Invalidated() error
Invalidated is called if the member checker has been made invalid. This happens if a different set of members was chosen then was initial proposed.
func (*LaterMemberChecker) IsReady ¶
func (mc *LaterMemberChecker) IsReady() bool
IsReady returns true
func (*LaterMemberChecker) New ¶
func (mc *LaterMemberChecker) New(newIndex types.ConsensusIndex) consinterface.MemberChecker
New generates a new member checker for the index, this is called on the inital member checker each time.
func (*LaterMemberChecker) RandMemberType ¶
func (mc *LaterMemberChecker) RandMemberType() types.RndMemberType
SelectRandMembers returns true if the member checker is selecting random members.
func (*LaterMemberChecker) SetMainChannel ¶
func (mc *LaterMemberChecker) SetMainChannel(mainChannel channelinterface.MainChannel)
SetMainChannel is called on the initial member checker to inform it of the network channel object
func (*LaterMemberChecker) UpdateState ¶
func (mc *LaterMemberChecker) UpdateState(fixedCoord sig.Pub, prevDec []byte, randBytes [32]byte, prevMember consinterface.MemberChecker, prevSM consinterface.GeneralStateMachineInterface, futureFixed types.ConsensusID) (newMemberPubs, newAllPubs []sig.Pub, changedMembers bool)
UpdateState updates the random member checker state.
type MultiSigMemChecker ¶
type MultiSigMemChecker struct {
// contains filtered or unexported fields
}
NoSpecialMembers implements SpecialPubMemberChecker, it allows for multi-signature public keys using BLS signatures. Keys will be generated using the BitID of the merged public key being requested in CheckMemberLocalMsg by merging the normal public key, using their indecies.
func NewMultiSigMemChecker ¶
func NewMultiSigMemChecker(pubs sig.PubList, allowsChange bool) *MultiSigMemChecker
NewMultSigMemChecker generates a new MultiSigMemChecker object.
func (*MultiSigMemChecker) CheckMember ¶
func (msm *MultiSigMemChecker) CheckMember(idx types.ConsensusIndex, pub sig.Pub, mc consinterface.MemberChecker, hdr messages.InternalSignedMsgHeader, msgID messages.MsgID) (sig.Pub, error)
CheckMemberLocalMsg checks if pub is a special member and returns new pub that has all the values filled. If pub has a valid BitID then CheckMemberLocalMsg will always return a merged public key by merging the indices from teh BitID using the normal public keys.
func (*MultiSigMemChecker) New ¶
func (msm *MultiSigMemChecker) New(idx types.ConsensusIndex) consinterface.SpecialPubMemberChecker
New generates a new member checker for the index, this is called on the inital special member checker each time.
func (*MultiSigMemChecker) UpdateState ¶
func (msm *MultiSigMemChecker) UpdateState(newKeys sig.PubList, randBytes [32]byte, prevMember consinterface.SpecialPubMemberChecker)
UpdateState is called after MemberCheck.Update state. If there are new keys, they will be used to generate the multi-signature public keys.
type NoSpecialMembers ¶
type NoSpecialMembers struct { }
NoSpecialMembers implements SpecialPubMemberChecker, but contains no special public keys.
func NewNoSpecialMembers ¶
func NewNoSpecialMembers() *NoSpecialMembers
NewNoSpecialMembers generates an empty NoSpecialMembers object.
func (*NoSpecialMembers) CheckMember ¶
func (tsm *NoSpecialMembers) CheckMember(idx types.ConsensusIndex, pub sig.Pub, mc consinterface.MemberChecker, hdr messages.InternalSignedMsgHeader, msgID messages.MsgID) (sig.Pub, error)
CheckMemberLocalMsg checks if pub is a special member, here is always returns an error since there are no speical pubs.
func (*NoSpecialMembers) New ¶
func (tsm *NoSpecialMembers) New(types.ConsensusIndex) consinterface.SpecialPubMemberChecker
New generates a new member checker for the index, this is called on the inital special member checker each time.
func (*NoSpecialMembers) UpdateState ¶
func (tsm *NoSpecialMembers) UpdateState(newKeys sig.PubList, randBytes [32]byte, prevMember consinterface.SpecialPubMemberChecker)
UpdateState is called after MemberCheck.Update state. Here it does nothing.
type ThrshSigMemChecker ¶
type ThrshSigMemChecker struct {
// contains filtered or unexported fields
}
ThrshSigMemChecker implements SpecialPubMemberChecker, it allows for using a threshold public key. It does not allow the public keys to change over consensus instances as that would require computing a new threshold key, something that is not currently supported.
func NewThrshSigMemChecker ¶
func NewThrshSigMemChecker(pubs []sig.Pub) *ThrshSigMemChecker
NewThrshSigMemberChecker generates a new ThrshSigMemChecker object
func (*ThrshSigMemChecker) CheckMember ¶
func (tsm *ThrshSigMemChecker) CheckMember(idx types.ConsensusIndex, pub sig.Pub, mc consinterface.MemberChecker, hdr messages.InternalSignedMsgHeader, msgID messages.MsgID) (sig.Pub, error)
CheckMemberLocalMsg checks if pub is the threshold key and returns new pub that has all the values filled.
func (*ThrshSigMemChecker) New ¶
func (tsm *ThrshSigMemChecker) New(idx types.ConsensusIndex) consinterface.SpecialPubMemberChecker
New generates a new member checker for the index, this is called on the inital special member checker each time.
func (*ThrshSigMemChecker) UpdateState ¶
func (tsm *ThrshSigMemChecker) UpdateState(newKeys sig.PubList, randBytes [32]byte, prevMember consinterface.SpecialPubMemberChecker)
UpdateState is called after MemberCheck.Update state. It panics if newKeys != nil, as changing keys is not supported.
type TrueMemberChecker ¶
type TrueMemberChecker struct {
// contains filtered or unexported fields
}
TrueMemberChecker has a fixed list of member from the beginning.
func (*TrueMemberChecker) AbsGotDecision ¶
func (mc *TrueMemberChecker) AbsGotDecision(newFixedCoord sig.Pub, newMemberPubs, newOtherPubs sig.PubList, prevDec []byte, randBytes [32]byte, prevMember *absMemberChecker) (retMemberPubs, retAllPubs []sig.Pub, changedMembers bool)
AbsGotDecision should be called at the end of UpdateState from the MemberChecker. The newAllPubs is a list of all new pubs in the system (note this list does not need to be sorted as it will be sorted here). If it is nil then the set of pubs must have not changed since the last consensus instance. These pubs will be sorted and returned to insure that their new ids are computed correctly. newMemberPubs pubs are the public keys that will now participate in consensus. newMemberPubs must be a equal to or a subset of newAllPubs. newMemberPubs should also be nil if they have not changed since the previous consensus index. myPubIndex is the index of the local nodes public key in the list, if it is negative then this nodes public key should not be in the list (i.e. is not a member). ChangedMembers must be true if either of the other return values are non-nil. Even if they are nil, but the membership could have changed in a different way (i.e. by random membership) it must return true
func (*TrueMemberChecker) AddPubKeys ¶
func (mc *TrueMemberChecker) AddPubKeys(fixedCoord sig.Pub, memberPubKeys, otherPubs sig.PubList, initRandBytes [32]byte, shared *consinterface.Shared)
AddPubKeys is used for adding the public keys to the very inital member checker, and should not be called on later member checkers, as they should change pub keys through the call to UpdateState. allPubs are the list of all pubs in the system. memberPubs pubs are the public keys that will now participate in consensus. memberPubs must be equal to or a subset of newAllPubs. If shared is non-nil then the local nodes on the machine will share the same initial member objects (to save memory for experiments that run many nodes on the same machine).
func (*TrueMemberChecker) AllowsChange ¶
func (mc *TrueMemberChecker) AllowsChange() bool
AllowsChange returns true if the member checker allows changing members, used as a sanity check.
func (*TrueMemberChecker) CheckEstimatedRoundCoordNextIndex ¶
func (mc *TrueMemberChecker) CheckEstimatedRoundCoordNextIndex(checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
CheckEstimatedRoundCoordNextIndex returns the estimated public key of the coordinator for round round for the following consensus index. It might not return the correct coordinator for the next index because the decision might change the membership for the next index. This function should not be used if it needs to know the next coordinator for certain. It returns an error if there is a fixed cordinator or random membership is enabled as it is unsupported in these cases.
func (*TrueMemberChecker) CheckFixedCoord ¶
CheckFixedCoord checks if checkPub the/a coordinator for round. If it is, err is returned as nil, otherwise an error is returned. If checkPub is nil, then it will return the fixed coordinator in coordPub. If there is no fixedCoordinator, then an error types.ErrNoFixedCoord is returned. Note this should only be called after the pub is verified to be a member with CheckMemberBytes
func (*TrueMemberChecker) CheckIndex ¶
func (mc *TrueMemberChecker) CheckIndex(idx types.ConsensusIndex) bool
CheckIndex should return true if the index is the same as the one used in New, it is for testing.
func (*TrueMemberChecker) CheckMemberBytes ¶
func (mc *TrueMemberChecker) CheckMemberBytes(idx types.ConsensusIndex, pubBytes sig.PubKeyID) sig.Pub
CheckMemberBytes checks the the pub key is a member and returns corresponding pub key object
func (*TrueMemberChecker) CheckRandMember ¶
func (mc *TrueMemberChecker) CheckRandMember(pub sig.Pub, hdr messages.InternalSignedMsgHeader, msgID messages.MsgID, isLocal bool) error
CheckRandMember can be called after CheckMemberBytes is successful when ChooseRandomMember is enabled. If ChooseRandomMember is false it return nil, otherwise it uses the random bytes and the VRF to decide if this pud is a random member.
func (*TrueMemberChecker) CheckRandRoundCoord ¶
func (mc *TrueMemberChecker) CheckRandRoundCoord(msgID messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (randValue uint64, coordPub sig.Pub, err error)
CheckRandRoundCoord is unsupported.
func (*TrueMemberChecker) CheckRoundCoord ¶
func (mc *TrueMemberChecker) CheckRoundCoord(_ messages.MsgID, checkPub sig.Pub, round types.ConsensusRound) (coordPub sig.Pub, err error)
CheckRoundCoord returns the public key of the coordinator for round round. It is just the mod of the round in the sorted list of public keys.
func (*TrueMemberChecker) DoneNextUpdateState ¶
func (mc *TrueMemberChecker) DoneNextUpdateState() error
func (*TrueMemberChecker) FinishUpdateState ¶
func (mc *TrueMemberChecker) FinishUpdateState()
FinishUpdateState does nothing since the members do not change.
func (*TrueMemberChecker) GetAllPubs ¶
GetAllPub returns all pubs in the system
func (*TrueMemberChecker) GetFaultCount ¶
func (mc *TrueMemberChecker) GetFaultCount() int
GetFaultCount returns the number of possilbe faultly nodes that the consensus can handle.
func (*TrueMemberChecker) GetIndex ¶
func (mc *TrueMemberChecker) GetIndex() types.ConsensusIndex
func (*TrueMemberChecker) GetMemberCount ¶
func (mc *TrueMemberChecker) GetMemberCount() int
GetMemberCount returns the number of consensus members.
func (*TrueMemberChecker) GetParticipantCount ¶
func (mc *TrueMemberChecker) GetParticipantCount() int
GetParticipantCount returns the total number of nodes in the system
func (*TrueMemberChecker) GetParticipants ¶
GetParticipant return the pub key of the participants.
func (*TrueMemberChecker) GetStats ¶
func (mc *TrueMemberChecker) GetStats() stats.StatsInterface
func (*TrueMemberChecker) Invalidated ¶
func (mc *TrueMemberChecker) Invalidated() error
Invalidated is called if the member checker has been made invalid. This happens if a different set of members was chosen then was initial proposed.
func (*TrueMemberChecker) IsReady ¶
func (mc *TrueMemberChecker) IsReady() bool
IsReady always returns true.
func (*TrueMemberChecker) New ¶
func (mc *TrueMemberChecker) New(idx types.ConsensusIndex) consinterface.MemberChecker
New generates a new member checker for the index, this is called on the inital member checker each time.
func (*TrueMemberChecker) RandMemberType ¶
func (mc *TrueMemberChecker) RandMemberType() types.RndMemberType
SelectRandMembers returns true if the member checker is selecting random members.
func (*TrueMemberChecker) SetMainChannel ¶
func (mc *TrueMemberChecker) SetMainChannel(mainChannel channelinterface.MainChannel)
SetMainChannel is called on the initial member checker to inform it of the network channel object
func (*TrueMemberChecker) UpdateState ¶
func (mc *TrueMemberChecker) UpdateState(fixedCoord sig.Pub, prevDec []byte, randBytes [32]byte, prevMember consinterface.MemberChecker, prevSM consinterface.GeneralStateMachineInterface, futureFixed types.ConsensusID) (newMemberPubs, newAllPubs []sig.Pub, changedMembers bool)
UpdateState does nothing since the members do not change. func (mc *TrueMemberChecker) UpdateState(prevDec []byte, prevSM consinterface.StateMachineInterface, prevMember MemberChecker) []sig.Pub {
Source Files
¶
- abs_member_checker.go
- abs_rand_coord.go
- abs_rand_interface.go
- abs_rand_known_member_checker.go
- abs_rand_local_member_checker.go
- abs_rand_member_by_id.go
- abs_rand_member_checker.go
- basic_member_checkers.go
- bin_member_checker.go
- custom_member_checker.go
- later_member_checker.go
- member_checker.go
- special_member_checker.go