Documentation
¶
Index ¶
- Constants
- type BuilderNode
- func (bn *BuilderNode) BlockKeyReader() <-chan messages.PeerMsg
- func (bn *BuilderNode) BlockKeySend(peer peer.ID, sig []byte) error
- func (bn *BuilderNode) BundleReader() <-chan messages.PeerMsg
- func (bn *BuilderNode) BundleSend(broadcastType commons.Broadcast, bundle []byte) error
- func (bn *BuilderNode) GetApprovedBuilderPeers() []peer.ID
- func (bn *BuilderNode) GetApprovedSearcherPeers() []peer.ID
- func (bn *BuilderNode) GetBuilderPeersOnTopic() peer.IDSlice
- func (bn *BuilderNode) GetSearcherPeersOnTopic() peer.IDSlice
- func (bn *BuilderNode) GossipB(msg message.OutboundMessage) error
- func (bn *BuilderNode) PreconfReader() <-chan messages.PeerMsg
- func (bn *BuilderNode) PreconfSend(broadcastType commons.Broadcast, preconf []byte) error
- func (bn *BuilderNode) PublishB(msg message.OutboundMessage) error
- func (bn *BuilderNode) SignatureReader() <-chan messages.PeerMsg
- func (bn *BuilderNode) SignatureSend(peer peer.ID, sig []byte) error
- func (bn *BuilderNode) StreamB(peerID peer.ID, msg message.OutboundMessage) error
- type ConnectionGater
- type IBuilderNode
- type INode
- type ISearcherNode
- type Node
- func (n *Node) Close(reason string, code int)
- func (n *Node) CreateStream(proto string, handler func(stream network.Stream))
- func (n *Node) GetAddrs() []multiaddr.Multiaddr
- func (n *Node) GetEthAddress() common.Address
- func (n *Node) GetPeerID() peer.ID
- func (n *Node) GetPeers() peer.IDSlice
- func (n *Node) GetStake() *big.Int
- func (n *Node) GetToken() []byte
- func (n *Node) Ready() <-chan struct{}
- func (n *Node) SendMsg(proto protocol.ID, p peer.ID, msg string) error
- type SearcherNode
- func (sn *SearcherNode) BidReader() <-chan messages.PeerMsg
- func (sn *SearcherNode) BidSend(broadcastType commons.Broadcast, bid []byte) error
- func (sn *SearcherNode) CommitmentReader() <-chan messages.PeerMsg
- func (sn *SearcherNode) CommitmentSend(broadcastType commons.Broadcast, commitment []byte) error
- func (sn *SearcherNode) GetApprovedBuilderPeers() []peer.ID
- func (sn *SearcherNode) GetBuilderPeersOnTopic() peer.IDSlice
- func (sn *SearcherNode) GossipS(msg message.OutboundMessage) error
- func (sn *SearcherNode) PublishS(msg message.OutboundMessage) error
- func (sn *SearcherNode) StreamS(peerID peer.ID, msg message.OutboundMessage) error
Constants ¶
const ( Undecided connectionAllowance = iota DenyBlockedPeer DenyNotEnoughStake DenySearcherToSearcher Accept )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuilderNode ¶
type BuilderNode struct {
Node
SearcherNode
// contains filtered or unexported fields
}
func (*BuilderNode) BlockKeyReader ¶
func (bn *BuilderNode) BlockKeyReader() <-chan messages.PeerMsg
read block keys from the node
func (*BuilderNode) BlockKeySend ¶
func (bn *BuilderNode) BlockKeySend(peer peer.ID, sig []byte) error
stream block key over the node for specific peer
func (*BuilderNode) BundleReader ¶
func (bn *BuilderNode) BundleReader() <-chan messages.PeerMsg
read bundles from the node
func (*BuilderNode) BundleSend ¶
func (bn *BuilderNode) BundleSend(broadcastType commons.Broadcast, bundle []byte) error
gossip or publish bundles over the node
func (*BuilderNode) GetApprovedBuilderPeers ¶
func (bn *BuilderNode) GetApprovedBuilderPeers() []peer.ID
get approved builder peers
func (*BuilderNode) GetApprovedSearcherPeers ¶
func (bn *BuilderNode) GetApprovedSearcherPeers() []peer.ID
get approved searcher peers
func (*BuilderNode) GetBuilderPeersOnTopic ¶
func (bn *BuilderNode) GetBuilderPeersOnTopic() peer.IDSlice
get connected builder peer list on topic
func (*BuilderNode) GetSearcherPeersOnTopic ¶
func (bn *BuilderNode) GetSearcherPeersOnTopic() peer.IDSlice
get connected searcher peer list on topic
func (*BuilderNode) GossipB ¶
func (bn *BuilderNode) GossipB(msg message.OutboundMessage) error
gossip message over pubsub gossip proto
func (*BuilderNode) PreconfReader ¶
func (bn *BuilderNode) PreconfReader() <-chan messages.PeerMsg
read preconfirmation bids from the node
func (*BuilderNode) PreconfSend ¶
func (bn *BuilderNode) PreconfSend(broadcastType commons.Broadcast, preconf []byte) error
gossip or publish preconfirmation bids over the node
func (*BuilderNode) PublishB ¶
func (bn *BuilderNode) PublishB(msg message.OutboundMessage) error
publish message over pubsub topic
func (*BuilderNode) SignatureReader ¶
func (bn *BuilderNode) SignatureReader() <-chan messages.PeerMsg
read signatures from the node
func (*BuilderNode) SignatureSend ¶
func (bn *BuilderNode) SignatureSend(peer peer.ID, sig []byte) error
stream signature over the node for specific peer
func (*BuilderNode) StreamB ¶
func (bn *BuilderNode) StreamB(peerID peer.ID, msg message.OutboundMessage) error
stream message over pubsub stream proto
type ConnectionGater ¶
type ConnectionGater interface {
// GetPeerType get peer type builder or searcher
GetPeerType(p peer.ID) (peerType commons.PeerType)
// DeletePeer delete registered peer
DeletePeer(p peer.ID)
// InterceptPeerDial intercepts peer dialing
InterceptPeerDial(p peer.ID) (allow bool)
// InterceptAddrDial intercepts address dialing
InterceptAddrDial(peer.ID, multiaddr.Multiaddr) (allow bool)
// InterceptAccept intercepts connection acceptance
InterceptAccept(network.ConnMultiaddrs) (allow bool)
// InterceptSecured intercepts secured connection
InterceptSecured(network.Direction, peer.ID, network.ConnMultiaddrs) (allow bool)
// InterceptUpgraded intercepts upgraded connection
InterceptUpgraded(network.Conn) (allow bool, reason control.DisconnectReason)
}
make sure the connections are between builder<>builder, builder<>searcher!
type IBuilderNode ¶
type IBuilderNode interface {
// INode extends the IBuilderNode interface and adds methods specific to node functionality.
INode
// ISearcherNode extends the IBuilderNode interface and adds methods specific to searchers functionality.
ISearcherNode
// GetBuilderPeersOnTopic returns the list of connected builder peers on the topic.
GetBuilderPeersOnTopic() peer.IDSlice
// GetSearcherPeersOnTopic returns the list of connected searcher peers on the topic.
GetSearcherPeersOnTopic() peer.IDSlice
// GetApprovedBuilderPeers returns the list of approved builder peers on the psio.
GetApprovedBuilderPeers() []peer.ID
// GetApprovedBuilderPeers returns the list of approved searcher peers on the psio.
GetApprovedSearcherPeers() []peer.ID
// Publish publishes a message over the topic.
PublishB(message.OutboundMessage) error
// Stream stream a message over the proto to specific peer.
StreamB(peer.ID, message.OutboundMessage) error
// Gossip gossip a message over the gossip proto to specific peers.
GossipB(message.OutboundMessage) error
// SignatureReader returns a channel for reading signatures from the node.
SignatureReader() <-chan messages.PeerMsg
// BlockKeyReader returns a channel for reading block keys from the node.
BlockKeyReader() <-chan messages.PeerMsg
// BundleReader returns a channel for reading bundels from the node.
BundleReader() <-chan messages.PeerMsg
// PreconfReader returns a channel for reading pre-confirmation bids from the node.
PreconfReader() <-chan messages.PeerMsg
// SignatureSend sends signature over the node.
SignatureSend(peer.ID, []byte) error
// BlockKeySend sends block key over the node.
BlockKeySend(peer.ID, []byte) error
// BundleSend sends bundles over the node.
BundleSend(commons.Broadcast, []byte) error
// PreconfSend sends a pre-confirmation bid over the node.
PreconfSend(commons.Broadcast, []byte) error
}
func NewBuilderNode ¶
func NewBuilderNode(logger log.Logger, key *ecdsa.PrivateKey, rollup rollup.Rollup, registry *prometheus.Registry) IBuilderNode
create builder node
type INode ¶
type INode interface {
// GetPeerID returns the peer id of the node.
GetPeerID() peer.ID
//GetAddrs() returns the peer addrs of the node.
GetAddrs() []multiaddr.Multiaddr
// GetToken returns the token of the node.
GetToken() []byte
// GetEthAddress returns the eth address of the node.
GetEthAddress() common.Address
// GetStake returns the stake amount of the node.
GetStake() *big.Int
// GetPeers returns the list of connected peers.
GetPeers() peer.IDSlice
// Close closes the node with the given reason and code.
Close(string, int)
// Ready returns a channel that signals when the node is ready.
Ready() <-chan struct{}
}
type ISearcherNode ¶
type ISearcherNode interface {
// INode extends the ISearcherNode interface and adds methods specific to node functionality.
INode
// GetBuilderPeersOnTopic returns the list of connected builder peers on the topic.
GetBuilderPeersOnTopic() peer.IDSlice
// GetApprovedBuilderPeers returns the list of approved builder peers on the psio.
GetApprovedBuilderPeers() []peer.ID
// Publish publishes a message over the topic.
PublishS(message.OutboundMessage) error
// Stream stream a message over the proto to specific peer.
StreamS(peer.ID, message.OutboundMessage) error
// Gossip gossip a message over the gossip proto to specific peers.
GossipS(message.OutboundMessage) error
// read the bids from searchers on the builders
// BidReader returns a channel for reading bids from the node. NOTE: currently in the testing phase
BidReader() <-chan messages.PeerMsg
// read the commitments from builders on the searchers
// CommitmentReader returns a channel for reading commitments from the node. NOTE: currently in the testing phase
CommitmentReader() <-chan messages.PeerMsg
// send from searchers to builders | recommended broadcast type: Publish
// BidSend sends bid over the node. NOTE: currently in the testing phase
BidSend(commons.Broadcast, []byte) error
// send from builders to searchers | recommended broadcast type: Gossip
// CommitmentSend sends commitments over the node. NOTE: currently in the testing phase
CommitmentSend(commons.Broadcast, []byte) error
}
func NewSearcherNode ¶
func NewSearcherNode(logger log.Logger, key *ecdsa.PrivateKey, rollup rollup.Rollup, registry *prometheus.Registry) ISearcherNode
create searcher node
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
specific node fields
func (*Node) CreateStream ¶
create new stream proto
type SearcherNode ¶
type SearcherNode struct {
Node
// contains filtered or unexported fields
}
func (*SearcherNode) BidReader ¶
func (sn *SearcherNode) BidReader() <-chan messages.PeerMsg
read bids from the node
func (*SearcherNode) BidSend ¶
func (sn *SearcherNode) BidSend(broadcastType commons.Broadcast, bid []byte) error
gossip or publish bids over the node
func (*SearcherNode) CommitmentReader ¶
func (sn *SearcherNode) CommitmentReader() <-chan messages.PeerMsg
read commitments from the node
func (*SearcherNode) CommitmentSend ¶
func (sn *SearcherNode) CommitmentSend(broadcastType commons.Broadcast, commitment []byte) error
gossip or publish commitments over the node
func (*SearcherNode) GetApprovedBuilderPeers ¶
func (sn *SearcherNode) GetApprovedBuilderPeers() []peer.ID
get approved builder peers
func (*SearcherNode) GetBuilderPeersOnTopic ¶
func (sn *SearcherNode) GetBuilderPeersOnTopic() peer.IDSlice
get connected builder peer list on topic
func (*SearcherNode) GossipS ¶
func (sn *SearcherNode) GossipS(msg message.OutboundMessage) error
gossip message over pubsub gossip proto
func (*SearcherNode) PublishS ¶
func (sn *SearcherNode) PublishS(msg message.OutboundMessage) error
publish message over pubsub topic
func (*SearcherNode) StreamS ¶
func (sn *SearcherNode) StreamS(peerID peer.ID, msg message.OutboundMessage) error
stream message over pubsub stream proto