Documentation ¶
Index ¶
- Constants
- type AuthToken
- type ChanMsg
- type Client
- type MetricPool
- type Peer
- func (me *Peer) ConfirmSnapshotForPeer(idForNetwork, snap crypto.Hash)
- func (me *Peer) ConnectRelayer(idForNetwork crypto.Hash, addr string)
- func (me *Peer) GetNeighbors(key crypto.Hash) []*Peer
- func (me *Peer) GetRemoteRelayers(key crypto.Hash) []*Peer
- func (me *Peer) IsRelayer() bool
- func (me *Peer) ListenConsumers() error
- func (me *Peer) Metric() map[string]*MetricPool
- func (me *Peer) Neighbors() []*Peer
- func (me *Peer) SendCommitmentsMessage(idForNetwork crypto.Hash, commitments []*crypto.Key) error
- func (me *Peer) SendFullChallengeMessage(idForNetwork crypto.Hash, s *common.Snapshot, ...) error
- func (me *Peer) SendGraphMessage(idForNetwork crypto.Hash) error
- func (me *Peer) SendSnapshotAnnouncementMessage(idForNetwork crypto.Hash, s *common.Snapshot, R crypto.Key, spend crypto.Key) error
- func (me *Peer) SendSnapshotCommitmentMessage(idForNetwork crypto.Hash, snap crypto.Hash, R crypto.Key, wantTx bool) error
- func (me *Peer) SendSnapshotConfirmMessage(idForNetwork crypto.Hash, snap crypto.Hash) error
- func (me *Peer) SendSnapshotFinalizationMessage(idForNetwork crypto.Hash, s *common.Snapshot) error
- func (me *Peer) SendSnapshotResponseMessage(idForNetwork crypto.Hash, snap crypto.Hash, si *[32]byte) error
- func (me *Peer) SendTransactionChallengeMessage(idForNetwork crypto.Hash, snap crypto.Hash, cosi *crypto.CosiSignature, ...) error
- func (me *Peer) SendTransactionMessage(idForNetwork crypto.Hash, ver *common.VersionedTransaction) error
- func (me *Peer) SendTransactionRequestMessage(idForNetwork crypto.Hash, tx crypto.Hash) error
- func (me *Peer) Teardown()
- type PeerMessage
- type QuicClient
- type QuicRelayer
- type SyncHandle
- type SyncPoint
- type Transport
- type TransportMessage
Constants ¶
View Source
const ( PeerMessageTypePing = 1 // not used because too more than enough graph sync messages PeerMessageTypeAuthentication = 3 PeerMessageTypeGraph = 4 PeerMessageTypeSnapshotConfirm = 5 PeerMessageTypeTransactionRequest = 6 PeerMessageTypeTransaction = 7 PeerMessageTypeSnapshotAnnouncement = 10 // leader send snapshot to peer PeerMessageTypeSnapshotCommitment = 11 // peer generate ri based, send Ri to leader PeerMessageTypeTransactionChallenge = 12 // leader send bitmask Z and aggregated R to peer PeerMessageTypeSnapshotResponse = 13 // peer generate A from nodes and Z, send response si = ri + H(R || A || M)ai to leader PeerMessageTypeSnapshotFinalization = 14 // leader generate A, verify si B = ri B + H(R || A || M)ai B = Ri + H(R || A || M)Ai, then finalize based on threshold PeerMessageTypeCommitments = 15 PeerMessageTypeFullChallenge = 16 PeerMessageTypeRelay = 200 PeerMessageTypeConsumers = 201 MsgPriorityNormal = 0 MsgPriorityHigh = 1 )
View Source
const ( MaxIncomingStreams = 1024 HandshakeTimeout = 10 * time.Second IdleTimeout = 60 * time.Second WriteDeadline = 10 * time.Second ReadDeadline = 2 * WriteDeadline )
View Source
const ( TransportMessageVersion = 2 TransportMessageMaxSize = 32 * 1024 * 1024 TransportMessageHeaderSize = 6 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetricPool ¶
type MetricPool struct { PeerMessageTypePing uint32 `json:"ping"` PeerMessageTypeAuthentication uint32 `json:"authentication"` PeerMessageTypeGraph uint32 `json:"graph"` PeerMessageTypeSnapshotConfirm uint32 `json:"snapshot-confirm"` PeerMessageTypeTransactionRequest uint32 `json:"transaction-request"` PeerMessageTypeTransaction uint32 `json:"transaction"` PeerMessageTypeSnapshotAnnouncement uint32 `json:"snapshot-announcement"` PeerMessageTypeSnapshotCommitment uint32 `json:"snapshot-commitment"` PeerMessageTypeTransactionChallenge uint32 `json:"transaciton-challenge"` PeerMessageTypeSnapshotResponse uint32 `json:"snapshot-response"` PeerMessageTypeSnapshotFinalization uint32 `json:"snapshot-finalization"` PeerMessageTypeCommitments uint32 `json:"commitments"` PeerMessageTypeFullChallenge uint32 `json:"full-challenge"` PeerMessageTypeRelay uint32 `json:"relay"` // contains filtered or unexported fields }
func (*MetricPool) String ¶
func (mp *MetricPool) String() string
type Peer ¶
type Peer struct { IdForNetwork crypto.Hash Address string // contains filtered or unexported fields }
func (*Peer) ConfirmSnapshotForPeer ¶
func (*Peer) GetRemoteRelayers ¶ added in v0.18.10
func (*Peer) ListenConsumers ¶
func (*Peer) Metric ¶
func (me *Peer) Metric() map[string]*MetricPool
func (*Peer) SendCommitmentsMessage ¶
func (*Peer) SendFullChallengeMessage ¶
func (*Peer) SendSnapshotAnnouncementMessage ¶
func (*Peer) SendSnapshotCommitmentMessage ¶
func (*Peer) SendSnapshotConfirmMessage ¶
func (*Peer) SendSnapshotFinalizationMessage ¶
func (*Peer) SendSnapshotResponseMessage ¶
func (*Peer) SendTransactionChallengeMessage ¶
func (me *Peer) SendTransactionChallengeMessage(idForNetwork crypto.Hash, snap crypto.Hash, cosi *crypto.CosiSignature, tx *common.VersionedTransaction) error
func (*Peer) SendTransactionMessage ¶
func (*Peer) SendTransactionRequestMessage ¶
type PeerMessage ¶
type PeerMessage struct { Type uint8 Snapshot *common.Snapshot SnapshotHash crypto.Hash Transaction *common.VersionedTransaction TransactionHash crypto.Hash Cosi crypto.CosiSignature Commitment crypto.Key Challenge crypto.Key Response [32]byte WantTx bool Commitments []*crypto.Key Graph []*SyncPoint Data []byte // contains filtered or unexported fields }
type QuicClient ¶
type QuicClient struct {
// contains filtered or unexported fields
}
func NewQuicConsumer ¶
func NewQuicConsumer(ctx context.Context, relayer string) (*QuicClient, error)
func (*QuicClient) Close ¶
func (c *QuicClient) Close(code string) error
func (*QuicClient) Receive ¶
func (c *QuicClient) Receive() (*TransportMessage, error)
func (*QuicClient) RemoteAddr ¶
func (c *QuicClient) RemoteAddr() net.Addr
func (*QuicClient) Send ¶
func (c *QuicClient) Send(data []byte) error
type QuicRelayer ¶
type QuicRelayer struct {
// contains filtered or unexported fields
}
func NewQuicRelayer ¶
func NewQuicRelayer(listenAddr string) (*QuicRelayer, error)
func (*QuicRelayer) Close ¶
func (t *QuicRelayer) Close() error
type SyncHandle ¶
type SyncHandle interface { GetCacheStore() *ristretto.Cache[[]byte, any] SignData(data []byte) crypto.Signature BuildAuthenticationMessage(relayerId crypto.Hash) []byte AuthenticateAs(recipientId crypto.Hash, msg []byte, timeoutSec int64) (*AuthToken, error) BuildGraph() []*SyncPoint UpdateSyncPoint(peerId crypto.Hash, points []*SyncPoint, data []byte, sig *crypto.Signature) error ReadAllNodesWithoutState() []crypto.Hash ReadSnapshotsSinceTopology(offset, count uint64) ([]*common.SnapshotWithTopologicalOrder, error) ReadSnapshotsForNodeRound(nodeIdWithNetwork crypto.Hash, round uint64) ([]*common.SnapshotWithTopologicalOrder, error) SendTransactionToPeer(peerId, tx crypto.Hash) error CachePutTransaction(peerId crypto.Hash, ver *common.VersionedTransaction) error CosiQueueExternalAnnouncement(peerId crypto.Hash, s *common.Snapshot, R *crypto.Key, sig *crypto.Signature) error CosiAggregateSelfCommitments(peerId crypto.Hash, snap crypto.Hash, commitment *crypto.Key, wantTx bool, data []byte, sig *crypto.Signature) error CosiQueueExternalChallenge(peerId crypto.Hash, snap crypto.Hash, cosi *crypto.CosiSignature, ver *common.VersionedTransaction) error CosiQueueExternalFullChallenge(peerId crypto.Hash, s *common.Snapshot, commitment, challenge *crypto.Key, cosi *crypto.CosiSignature, ver *common.VersionedTransaction) error CosiAggregateSelfResponses(peerId crypto.Hash, snap crypto.Hash, response *[32]byte) error VerifyAndQueueAppendSnapshotFinalization(peerId crypto.Hash, s *common.Snapshot) error CosiQueueExternalCommitments(peerId crypto.Hash, commitments []*crypto.Key, data []byte, sig *crypto.Signature) error }
type TransportMessage ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.