Documentation
¶
Index ¶
- Constants
- Variables
- type BalancesMsg
- type BatchHeaderMsg
- type Committee
- type GetBatchMsg
- type NotifyFinalResultPostedMsg
- type NotifyReqMsg
- type Operator
- type PeerMsgHeader
- type PeerStatus
- type PendingBatchMsg
- type ProcessorIsReady
- type RequestMsg
- type RequestProcessingStatus
- type SignedHashMsg
- type StartProcessingBatchMsg
- type StateIndexPingPongMsg
- type StateManager
- type StateTransactionEvidenced
- type StateTransactionMsg
- type StateTransitionMsg
- type StateUpdateMsg
- type TestTraceMsg
- type TimerTick
- type TransactionInclusionLevelMsg
Constants ¶
const ( RequestProcessingStatusUnknown = RequestProcessingStatus(iota) RequestProcessingStatusBacklog RequestProcessingStatusCompleted )
const ( // confirmation time assumption. Average time from posting a transaction to finality ConfirmationTime = 10 * time.Second // additional period after committee quorum of connections is reached AdditionalConnectPeriod = 3 * time.Second // time tick for consensus and state manager objects TimerTickPeriod = 100 * time.Millisecond // retry delay for congested input channel for the consensus and state manager objects.channel. ReceiveMsgChannelRetryDelay = 500 * time.Millisecond RequestBalancesPeriod = 10 * time.Second // if node is behind the current state (not synced) it send GetBatch messages to pseudo-randomly // selected peer to get the batch it needs. Node expects answer, if not the message is repeated to another // peer after some time PeriodBetweenSyncMessages = 1 * time.Second // if pongs do not make a quorum, pings are repeated to all peer nodes RepeatPingAfter = 5 * time.Second // State Manager is requesting transaction to confirm a pending batch from the goshimmer node. // Request is repeated if necessary. StateTransactionRequestTimeout = 10 * time.Second // maximum time difference allowed between leader and local clocks for consensus MaxClockDifferenceAllowed = 3 * time.Second )
const ( MsgStateIndexPingPong = 0 + peering.FirstCommitteeMsgCode MsgNotifyRequests = 1 + peering.FirstCommitteeMsgCode MsgNotifyFinalResultPosted = 2 + peering.FirstCommitteeMsgCode MsgStartProcessingRequest = 3 + peering.FirstCommitteeMsgCode MsgSignedHash = 4 + peering.FirstCommitteeMsgCode MsgGetBatch = 5 + peering.FirstCommitteeMsgCode MsgStateUpdate = 6 + peering.FirstCommitteeMsgCode MsgBatchHeader = 7 + peering.FirstCommitteeMsgCode MsgTestTrace = 8 + peering.FirstCommitteeMsgCode )
Variables ¶
var ConstructorNew func(bootupData *registry.BootupData, log *logger.Logger, onActivation func()) Committee
Functions ¶
This section is empty.
Types ¶
type BalancesMsg ¶
type BalancesMsg struct {
Balances map[valuetransaction.ID][]*balance.Balance
}
type BatchHeaderMsg ¶
type BatchHeaderMsg struct {
PeerMsgHeader
// state index of the batch
Size uint16
// approving transaction id
StateTransactionId valuetransaction.ID
}
the header of the batch message sent by peers in the process of syncing it is sent as a first message while syncing a batch
type Committee ¶
type Committee interface {
Address() *address.Address
OwnerAddress() *address.Address
Color() *balance.Color
Size() uint16
Quorum() uint16
OwnPeerIndex() uint16
NumPeers() uint16
SendMsg(targetPeerIndex uint16, msgType byte, msgData []byte) error
SendMsgToCommitteePeers(msgType byte, msgData []byte, ts int64) uint16
SendMsgInSequence(msgType byte, msgData []byte, seqIndex uint16, seq []uint16) (uint16, error)
IsAlivePeer(peerIndex uint16) bool
ReceiveMessage(msg interface{})
InitTestRound()
HasQuorum() bool
PeerStatus() []*PeerStatus
//
SetReadyStateManager()
SetReadyConsensus()
Dismiss()
IsDismissed() bool
GetRequestProcessingStatus(*sctransaction.RequestId) RequestProcessingStatus
}
type GetBatchMsg ¶
type GetBatchMsg struct {
PeerMsgHeader
}
request batch of updates from peer. Used in syn process
type NotifyFinalResultPostedMsg ¶
type NotifyFinalResultPostedMsg struct {
PeerMsgHeader
TxId valuetransaction.ID
}
message is sent by the leader to all peers immediately after the final transaction is posted to the tangle. Main purpose of the message is to prevent unnecessary leader rotation in long confirmation times Final signature is sent to prevent possibility for a leader node to lie (is it necessary)
type NotifyReqMsg ¶
type NotifyReqMsg struct {
PeerMsgHeader
// list of request ids ordered by the time of arrival
RequestIds []sctransaction.RequestId
}
message is sent to the leader of the state processing it is sent upon state change or upon arrival of the new request the receiving operator will ignore repeating messages
type Operator ¶
type Operator interface {
EventProcessorReady(ProcessorIsReady)
EventStateTransitionMsg(*StateTransitionMsg)
EventBalancesMsg(BalancesMsg)
EventRequestMsg(*RequestMsg)
EventNotifyReqMsg(*NotifyReqMsg)
EventStartProcessingBatchMsg(*StartProcessingBatchMsg)
EventResultCalculated(*vm.VMTask)
EventSignedHashMsg(*SignedHashMsg)
EventNotifyFinalResultPostedMsg(*NotifyFinalResultPostedMsg)
EventTransactionInclusionLevelMsg(msg *TransactionInclusionLevelMsg)
EventTimerMsg(TimerTick)
//
IsRequestInBacklog(*sctransaction.RequestId) bool
}
type PeerMsgHeader ¶
type PeerMsgHeader struct {
// is set upon receive the message
SenderIndex uint16
// state index in the context of which the message is sent
StateIndex uint32
}
all peer messages have this
type PeerStatus ¶
func (*PeerStatus) String ¶
func (p *PeerStatus) String() string
type PendingBatchMsg ¶
message of complete batch. Is sent by consensus operator to the state manager as a VM result - state manager to itself when batch is completed after syncing
type ProcessorIsReady ¶
type ProcessorIsReady struct {
ProgramHash string // base58
}
message sent to notify VM processor is ready. It is a successful finish of asynchronous loading of the processor
type RequestMsg ¶
type RequestMsg struct {
*sctransaction.Transaction
Index uint16
}
func (*RequestMsg) RequestBlock ¶
func (reqMsg *RequestMsg) RequestBlock() *sctransaction.RequestBlock
func (*RequestMsg) RequestId ¶
func (reqMsg *RequestMsg) RequestId() *sctransaction.RequestId
func (*RequestMsg) Timelock ¶
func (reqMsg *RequestMsg) Timelock() uint32
type RequestProcessingStatus ¶
type RequestProcessingStatus int
type SignedHashMsg ¶
type SignedHashMsg struct {
PeerMsgHeader
// timestamp of this message. Field is set upon receive the message to sender's timestamp
Timestamp int64
// returns hash of all req ids
BatchHash hashing.HashValue
// original timestamp, the parameter for calculations, which is signed as part of the essence
OrigTimestamp int64
// hash of the signed data (essence)
EssenceHash hashing.HashValue
SigShare tbdn.SigShare
}
after calculations the result peer responds to the start processing msg with SignedHashMsg, which contains result hash and signatures
type StartProcessingBatchMsg ¶
type StartProcessingBatchMsg struct {
PeerMsgHeader
// timestamp of the message. Field is set upon receive the message to sender's timestamp
Timestamp int64
// batch of request ids
RequestIds []sctransaction.RequestId
// reward address
RewardAddress address.Address
// balances/outputs
Balances map[valuetransaction.ID][]*balance.Balance
}
message is sent by the leader to other peers to initiate request processing other peers are expected to check is timestamp is acceptable then process request batch and sign the result hash with the timestamp proposed by the leader
type StateIndexPingPongMsg ¶
type StateIndexPingPongMsg struct {
PeerMsgHeader
RSVP bool
}
Ping is sent to receive Pong
type StateManager ¶
type StateManager interface {
EvidenceStateIndex(idx uint32)
EventStateIndexPingPongMsg(msg *StateIndexPingPongMsg)
EventGetBatchMsg(msg *GetBatchMsg)
EventBatchHeaderMsg(msg *BatchHeaderMsg)
EventStateUpdateMsg(msg *StateUpdateMsg)
EventStateTransactionMsg(msg *StateTransactionMsg)
EventPendingBatchMsg(msg PendingBatchMsg)
EventTimerMsg(msg TimerTick)
}
type StateTransactionEvidenced ¶
type StateTransactionEvidenced struct {
TxId valuetransaction.ID
StateHash hashing.HashValue
}
message is sent to the consensus manager after it receives state transaction which is valid but not confirmed yet.
type StateTransactionMsg ¶
type StateTransactionMsg struct {
*sctransaction.Transaction
}
type StateTransitionMsg ¶
type StateTransitionMsg struct {
// new variable state
VariableState state.VirtualState
// corresponding state transaction
StateTransaction *sctransaction.Transaction
// processed requests
RequestIds []*sctransaction.RequestId
// is the state index last seen
Synchronized bool
}
state manager notifies consensus operator about changed state only sent internally within committee state transition is always from state N to state N+1
type StateUpdateMsg ¶
type StateUpdateMsg struct {
PeerMsgHeader
// state update
StateUpdate state.StateUpdate
// position in a batch
BatchIndex uint16
}
state update sent to peer. Used in sync process, as part of batch
type TestTraceMsg ¶
type TestTraceMsg struct {
PeerMsgHeader
InitTime int64
InitPeerIndex uint16
Sequence []uint16
NumHops uint16
}
used for testing of the communications
type TransactionInclusionLevelMsg ¶
type TransactionInclusionLevelMsg struct {
TxId *valuetransaction.ID
Level byte
}
Directories
¶
| Path | Synopsis |
|---|---|
|
the file contains functions responsible for the request batch selection logic
|
the file contains functions responsible for the request batch selection logic |
|
statemgr package implements object which is responsible for the smart contract ledger state to be synchronized and validated
|
statemgr package implements object which is responsible for the smart contract ledger state to be synchronized and validated |