Documentation ¶
Overview ¶
Consensus. Single instance of it.
Used sub-protocols (on the same thread):
- DSS -- Distributed Schnorr Signature
- ACS -- Asynchronous Common Subset
Used components (running on other threads):
- Mempool
- StateMgr
- VM
> INPUT: baseAliasOutputID > ON Startup: > Start a DSS. > Ask Mempool for backlog (based on baseAliasOutputID). > Ask StateMgr for a virtual state (based on baseAliasOutputID). > UPON Reception of responses from Mempool, StateMgr and DSS NonceIndexes: > Produce a batch proposal. > Start the ACS. > UPON Reception of ACS output: > IF result is possible THEN > Submit agreed NonceIndexes to DSS. > Send the BLS partial signature. > ELSE > OUTPUT SKIP > UPON Reception of N-2F BLS partial signatures: > Start VM. > UPON Reception of VM Result: > IF result is non-empty THEN > Save the produced block to SM. > Submit the result hash to the DSS. > ELSE > OUTPUT SKIP > UPON Reception of VM Result and a signature from the DSS > IF rotation THEN > OUTPUT Signed Governance TX. > ELSE > Save the block to the StateMgr. > OUTPUT Signed State Transition TX
We move all the synchronization logic to separate objects (upon_...). They are responsible for waiting specific data and then triggering the next state action once. This way we hope to solve a lot of race conditions gracefully. The `upon` predicates and the corresponding done functions should not depend on each other. If some data is needed at several places, it should be passed to several predicates.
TODO: Handle the requests gracefully in the VM before getting the initTX. TODO: Reconsider the termination. Do we need to wait for DSS, RND?
Index ¶
- func NewInputMempoolProposal(requestRefs []*isc.RequestRef) gpa.Input
- func NewInputMempoolRequests(requests []isc.Request) gpa.Input
- func NewInputProposal(baseAliasOutput *isc.AliasOutputWithID) gpa.Input
- func NewInputStateMgrBlockSaved() gpa.Input
- func NewInputStateMgrDecidedVirtualState(chainState state.State) gpa.Input
- func NewInputStateMgrProposalConfirmed() gpa.Input
- func NewInputTimeData(timeData time.Time) gpa.Input
- func NewInputVMResult(task *vm.VMTask) gpa.Input
- type Cons
- type Output
- type OutputStatus
- type Result
- type SyncACS
- type SyncDSS
- type SyncMP
- type SyncRND
- type SyncSM
- type SyncTX
- type SyncVM
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewInputMempoolProposal ¶
func NewInputMempoolProposal(requestRefs []*isc.RequestRef) gpa.Input
func NewInputProposal ¶
func NewInputProposal(baseAliasOutput *isc.AliasOutputWithID) gpa.Input
Types ¶
type Output ¶
type Output struct { Status OutputStatus Terminated bool // // Requests for other components. NeedMempoolProposal *isc.AliasOutputWithID // Requests for the mempool are needed for this Base Alias Output. NeedMempoolRequests []*isc.RequestRef // Request payloads are needed from mempool for this IDs/Hash. NeedStateMgrStateProposal *isc.AliasOutputWithID // Query for a proposal for Virtual State (it will go to the batch proposal). NeedStateMgrDecidedState *isc.AliasOutputWithID // Query for a decided Virtual State to be used by VM. NeedStateMgrSaveBlock state.StateDraft // Ask StateMgr to save the produced block. NeedVMResult *vm.VMTask // VM Result is needed for this (agreed) batch. // // Following is the final result. // All the fields are filled, if State == Completed. Result *Result }
type OutputStatus ¶
type OutputStatus byte
const ( Running OutputStatus = iota // Instance is still running. Completed // Consensus reached, TX is prepared for publication. Skipped // Consensus reached, no TX should be posted for this LogIndex. )
func (OutputStatus) String ¶
func (os OutputStatus) String() string
type Result ¶
type Result struct { Transaction *iotago.Transaction // The TX for committing the block. BaseAliasOutput iotago.OutputID // AO consumed in the TX. NextAliasOutput *isc.AliasOutputWithID // AO produced in the TX. StateDraft state.StateDraft // The state diff produced. }
type SyncACS ¶
type SyncACS interface { StateProposalReceived(proposedBaseAliasOutput *isc.AliasOutputWithID) gpa.OutMessages MempoolRequestsReceived(requestRefs []*isc.RequestRef) gpa.OutMessages DSSIndexProposalReceived(dssIndexProposal []int) gpa.OutMessages TimeDataReceived(timeData time.Time) gpa.OutMessages ACSOutputReceived(output gpa.Output) gpa.OutMessages String() string }
func NewSyncACS ¶
func NewSyncACS( inputsReadyCB func(baseAliasOutput *isc.AliasOutputWithID, requestRefs []*isc.RequestRef, dssIndexProposal []int, timeData time.Time) gpa.OutMessages, outputReadyCB func(output map[gpa.NodeID][]byte) gpa.OutMessages, terminatedCB func(), ) SyncACS
type SyncDSS ¶
type SyncDSS interface { InitialInputReceived() gpa.OutMessages DSSOutputReceived(output gpa.Output) gpa.OutMessages DecidedIndexProposalsReceived(decidedIndexProposals map[gpa.NodeID][]int) gpa.OutMessages MessageToSignReceived(messageToSign []byte) gpa.OutMessages String() string }
func NewSyncDSS ¶
func NewSyncDSS( initialInputsReadyCB func() gpa.OutMessages, indexProposalReadyCB func(indexProposals []int) gpa.OutMessages, signingInputsReadyCB func(decidedIndexProposals map[gpa.NodeID][]int, messageToSign []byte) gpa.OutMessages, outputReadyCB func(signature []byte) gpa.OutMessages, ) SyncDSS
type SyncMP ¶
type SyncMP interface { BaseAliasOutputReceived(baseAliasOutput *isc.AliasOutputWithID) gpa.OutMessages ProposalReceived(requestRefs []*isc.RequestRef) gpa.OutMessages RequestsNeeded(requestRefs []*isc.RequestRef) gpa.OutMessages RequestsReceived(requests []isc.Request) gpa.OutMessages String() string }
func NewSyncMP ¶
func NewSyncMP( proposalInputsReadyCB func(baseAliasOutput *isc.AliasOutputWithID) gpa.OutMessages, proposalReceivedCB func(requestRefs []*isc.RequestRef) gpa.OutMessages, requestsNeededCB func(requestIDs []*isc.RequestRef) gpa.OutMessages, requestsReceivedCB func(requests []isc.Request) gpa.OutMessages, ) SyncMP
type SyncRND ¶
type SyncRND interface { CanProceed(dataToSign []byte) gpa.OutMessages BLSPartialSigReceived(sender gpa.NodeID, partialSig []byte) gpa.OutMessages }
func NewSyncRND ¶
type SyncSM ¶
type SyncSM interface { // // State proposal. ProposedBaseAliasOutputReceived(baseAliasOutput *isc.AliasOutputWithID) gpa.OutMessages StateProposalConfirmedByStateMgr() gpa.OutMessages // // Decided state. DecidedVirtualStateNeeded(decidedBaseAliasOutput *isc.AliasOutputWithID) gpa.OutMessages DecidedVirtualStateReceived(chainState state.State) gpa.OutMessages // // Save the block. BlockProduced(block state.StateDraft) gpa.OutMessages BlockSaved() gpa.OutMessages // // Supporting stuff. String() string }
func NewSyncSM ¶
func NewSyncSM( stateProposalQueryInputsReadyCB func(baseAliasOutput *isc.AliasOutputWithID) gpa.OutMessages, stateProposalReceivedCB func(proposedAliasOutput *isc.AliasOutputWithID) gpa.OutMessages, decidedStateQueryInputsReadyCB func(decidedBaseAliasOutput *isc.AliasOutputWithID) gpa.OutMessages, decidedStateReceivedCB func(chainState state.State) gpa.OutMessages, saveProducedBlockInputsReadyCB func(producedBlock state.StateDraft) gpa.OutMessages, saveProducedBlockDoneCB func() gpa.OutMessages, ) SyncSM
type SyncTX ¶
type SyncTX interface { VMResultReceived(vmResult *vm.VMTask) gpa.OutMessages SignatureReceived(signature []byte) gpa.OutMessages BlockSaved() gpa.OutMessages String() string }
type SyncVM ¶
type SyncVM interface { DecidedBatchProposalsReceived(aggregatedProposals *bp.AggregatedBatchProposals) gpa.OutMessages DecidedStateReceived(chainState state.State) gpa.OutMessages RandomnessReceived(randomness hashing.HashValue) gpa.OutMessages RequestsReceived(requests []isc.Request) gpa.OutMessages VMResultReceived(vmResult *vm.VMTask) gpa.OutMessages String() string }
Source Files ¶
- cons.go
- input_mempool_proposal.go
- input_mempool_requests.go
- input_proposal.go
- input_statemgr_block_saved.go
- input_statemgr_decided_virtual_state.go
- input_statemgr_proposal_confirmed.go
- input_time_data.go
- input_vm_result.go
- msg.go
- msg_bls_partial_sig.go
- sync_acs.go
- sync_dss.go
- sync_mp.go
- sync_rnd.go
- sync_sm.go
- sync_tx.go
- sync_vm.go
- termCondition.go
- util.go