Documentation
¶
Index ¶
- type Announce
- type BFTSignature
- type ChallengeCommit
- type ChallengePrepare
- type Commitment
- type CreateProtocolFunction
- type Exception
- type ProtocolBFTCoSi
- func (bft *ProtocolBFTCoSi) Dispatch() error
- func (bft *ProtocolBFTCoSi) RegisterOnDone(fn func())
- func (bft *ProtocolBFTCoSi) RegisterOnSignatureDone(fn func(*BFTSignature))
- func (bft *ProtocolBFTCoSi) Shutdown() error
- func (bft *ProtocolBFTCoSi) Signature() *BFTSignature
- func (bft *ProtocolBFTCoSi) Start() error
- type Response
- type RoundType
- type VerificationFunction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BFTSignature ¶
type BFTSignature struct {
// cosi signature
Sig []byte
Msg []byte
// List of peers that did not want to sign.
Exceptions []Exception
}
BFTSignature is what a bftcosi protocol outputs. It contains the signature, the message and some possible exceptions.
func (*BFTSignature) Verify ¶
Verify returns whether the verification of the signature succeeds or not. Specifically, it adjusts the signature according to the exception in the signature, so it can be verified by dedis/crypto/cosi. publics is a slice of all public signatures, and the msg is the msg being signed.
type ChallengeCommit ¶
type ChallengeCommit struct {
// Challenge for the current round
Challenge kyber.Scalar
// Signature is the signature response generated at the previous round (prepare)
Signature *BFTSignature
}
ChallengeCommit is the challenge used by BftCoSi during the "commit" phase. It contains the basic challenge (out of the block we want to sign) + the signature of the "prepare" round. It also contains the exception list coming from the "prepare" phase. This exception list has been collected by the root during the response of the "prepare" phase and broadcast it through the challenge of the "commit". These are needed in order to verify the signature and to see how many peers did not sign. It's not spoofable because otherwise the signature verification will be wrong.
type ChallengePrepare ¶
ChallengePrepare is the challenge used by ByzCoin during the "prepare" phase. It contains the basic challenge plus the message from which the challenge has been generated.
type Commitment ¶
Commitment is the commitment packets that is sent for both rounds
type CreateProtocolFunction ¶
CreateProtocolFunction is a function type which creates a new protocol used in FtCosi protocol for creating sub leader protocols.
type Exception ¶
Exception represents the exception mechanism used in BFTCosi to indicate a signer did not want to sign. The index is the index of the public key of the cosigner that do not want to sign. The commit is needed in order to be able to correctly verify the signature
type ProtocolBFTCoSi ¶
type ProtocolBFTCoSi struct {
// the node we are represented-in
*onet.TreeNodeInstance
// The message that will be signed by the BFTCosi
Msg []byte
// Data going along the msg to the verification
Data []byte
// Timeout is how long to wait while gathering commits.
Timeout time.Duration
// VerificationFunction will be called
// during the (start/handle) challenge prepare phase of the protocol
VerificationFunction VerificationFunction
// contains filtered or unexported fields
}
ProtocolBFTCoSi is the main struct for running the protocol
func NewBFTCoSiProtocol ¶
func NewBFTCoSiProtocol(n *onet.TreeNodeInstance, verify VerificationFunction) (*ProtocolBFTCoSi, error)
NewBFTCoSiProtocol returns a new bftcosi struct
func (*ProtocolBFTCoSi) Dispatch ¶
func (bft *ProtocolBFTCoSi) Dispatch() error
Dispatch makes sure that the order of the messages is correct by waiting on each channel in the correct order. By closing the channels for the leafs we can avoid having `if !bft.IsLeaf` in the code.
func (*ProtocolBFTCoSi) RegisterOnDone ¶
func (bft *ProtocolBFTCoSi) RegisterOnDone(fn func())
RegisterOnDone registers a callback to call when the bftcosi protocols has really finished
func (*ProtocolBFTCoSi) RegisterOnSignatureDone ¶
func (bft *ProtocolBFTCoSi) RegisterOnSignatureDone(fn func(*BFTSignature))
RegisterOnSignatureDone register a callback to call when the bftcosi protocol reached a signature on the block
func (*ProtocolBFTCoSi) Shutdown ¶
func (bft *ProtocolBFTCoSi) Shutdown() error
Shutdown closes all channels in case we're done
func (*ProtocolBFTCoSi) Signature ¶
func (bft *ProtocolBFTCoSi) Signature() *BFTSignature
Signature will generate the final signature, the output of the BFTCoSi protocol. The signature contains the commit round signature, with the message. If the prepare phase failed, the signature will be nil and the Exceptions will contain the exception from the prepare phase. It can be useful to see which cosigners refused to sign (each exceptions contains the index of a refusing-to-sign signer). Expect this function to have an undefined behavior when called from a non-root Node.
func (*ProtocolBFTCoSi) Start ¶
func (bft *ProtocolBFTCoSi) Start() error
Start will start both rounds "prepare" and "commit" at same time. The "commit" round will wait till the end of the "prepare" round during its challenge phase.
type Response ¶
Response is the struct used by ByzCoin during the response. It contains the response + the basic exception list.
type RoundType ¶
type RoundType int32
RoundType is a type to know if we are in the "prepare" round or the "commit" round
type VerificationFunction ¶
VerificationFunction can be passes to each protocol node. It will be called (in a go routine) during the (start/handle) challenge prepare phase of the protocol. The passed message is the same as sent in the challenge phase. The `Data`-part is only to help the VerificationFunction do it's job. In the case of the services, this part should be replaced by the correct passing of the service-configuration-data, which is not done yet.