Documentation
¶
Index ¶
- Constants
- func RegisterChainConstructor(constr chainConstructor)
- type BalancesMsg
- type BlockHeaderMsg
- type Chain
- type GetBlockMsg
- type NotifyFinalResultPostedMsg
- type NotifyReqMsg
- type Operator
- type PeerMsgHeader
- type PeerStatus
- type PendingBlockMsg
- 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
- type VMResultMsg
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 // check arg solidification period CheckArgSolidificationEvery = 1 * time.Second )
const ( MsgStateIndexPingPong = 0 + peering.FirstUserMsgCode MsgNotifyRequests = 1 + peering.FirstUserMsgCode MsgNotifyFinalResultPosted = 2 + peering.FirstUserMsgCode MsgStartProcessingRequest = 3 + peering.FirstUserMsgCode MsgSignedHash = 4 + peering.FirstUserMsgCode MsgGetBatch = 5 + peering.FirstUserMsgCode MsgStateUpdate = 6 + peering.FirstUserMsgCode MsgBatchHeader = 7 + peering.FirstUserMsgCode MsgTestTrace = 8 + peering.FirstUserMsgCode )
Message types for the committee communications.
Variables ¶
This section is empty.
Functions ¶
func RegisterChainConstructor ¶
func RegisterChainConstructor(constr chainConstructor)
Types ¶
type BalancesMsg ¶
type BalancesMsg struct {
Balances map[valuetransaction.ID][]*balance.Balance
}
type BlockHeaderMsg ¶
type BlockHeaderMsg struct {
PeerMsgHeader
Size uint16
AnchorTransactionID valuetransaction.ID
}
the header of the block message sent by peers in the process of syncing it is sent as a first message while syncing a batch
type Chain ¶
type Chain interface {
ID() *coretypes.ChainID
Color() *balance.Color
Address() address.Address
Size() uint16
Quorum() uint16
OwnPeerIndex() uint16
NumPeers() uint16
SendMsg(targetPeerIndex uint16, msgType byte, msgData []byte) error
SendMsgToCommitteePeers(msgType byte, msgData []byte, ts int64) uint16
IsAlivePeer(peerIndex uint16) bool
ReceiveMessage(msg interface{})
InitTestRound()
HasQuorum() bool
PeerStatus() []*PeerStatus
BlobCache() coretypes.BlobCache
//
SetReadyStateManager()
SetReadyConsensus()
Dismiss()
IsDismissed() bool
// requests
GetRequestProcessingStatus(*coretypes.RequestID) RequestProcessingStatus
EventRequestProcessed() *events.Event
// chain processors
Processors() *processors.ProcessorCache
}
func New ¶
func New( chr *registry.ChainRecord, log *logger.Logger, netProvider peering.NetworkProvider, dksProvider tcrypto.RegistryProvider, blobProvider coretypes.BlobCache, onActivation func(), ) Chain
type GetBlockMsg ¶
type GetBlockMsg struct {
PeerMsgHeader
}
request block 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 []coretypes.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 {
EventStateTransitionMsg(*StateTransitionMsg)
EventBalancesMsg(BalancesMsg)
EventRequestMsg(*RequestMsg)
EventNotifyReqMsg(*NotifyReqMsg)
EventStartProcessingBatchMsg(*StartProcessingBatchMsg)
EventResultCalculated(msg *VMResultMsg)
EventSignedHashMsg(*SignedHashMsg)
EventNotifyFinalResultPostedMsg(*NotifyFinalResultPostedMsg)
EventTransactionInclusionLevelMsg(msg *TransactionInclusionLevelMsg)
EventTimerMsg(TimerTick)
Close()
//
IsRequestInBacklog(*coretypes.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
BlockIndex uint32
}
all peer messages have this
type PeerStatus ¶
func (*PeerStatus) String ¶
func (p *PeerStatus) String() string
type PendingBlockMsg ¶
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 RequestMsg ¶
type RequestMsg struct {
*sctransaction.Transaction
Index uint16
FreeTokens coretypes.ColoredBalances
}
func (*RequestMsg) RequestBlock ¶
func (reqMsg *RequestMsg) RequestBlock() *sctransaction.RequestSection
func (*RequestMsg) RequestId ¶
func (reqMsg *RequestMsg) RequestId() *coretypes.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 []coretypes.RequestID
// reward address
FeeDestination coretypes.AgentID
// 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)
EventGetBlockMsg(msg *GetBlockMsg)
EventBlockHeaderMsg(msg *BlockHeaderMsg)
EventStateUpdateMsg(msg *StateUpdateMsg)
EventStateTransactionMsg(msg *StateTransactionMsg)
EventPendingBlockMsg(msg PendingBlockMsg)
EventTimerMsg(msg TimerTick)
Close()
}
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
AnchorTransaction *sctransaction.Transaction
// processed requests
RequestIDs []*coretypes.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
IndexInTheBlock 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
}
type VMResultMsg ¶
VMResultMsg is the message sent by the async VM task to the chan object upon success full finish
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 |