Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNodeNotProxiedValidator is returned if this node is not a proxied validator ErrNodeNotProxiedValidator = errors.New("node not a proxied validator") // ErrNodeNotProxy is returned if this node is not a proxy ErrNodeNotProxy = errors.New("node not a proxy") // ErrNoProxiedValidator is returned if the proxy has no connected proxied validator ErrNoProxiedValidator = errors.New("no connected proxied validator") // ErrNoCelostatsProxy is returned if there is no connected proxy that sent the celostats message to be signed ErrNoCelostatsProxy = errors.New("no connected proxy that sent the celostats message to be signed") )
Functions ¶
This section is empty.
Types ¶
type BackendForProxiedValidatorEngine ¶
type BackendForProxiedValidatorEngine interface { // Address returns the validator's signing address Address() common.Address // IsValidating returns true if this node is currently validating IsValidating() bool // IsProxiedValidator returns true if this node is a proxied validator IsProxiedValidator() bool // SelfNode returns the owner's node (if this is a proxy, it will return the external node) SelfNode() *enode.Node // Sign signs input data with the validator's ecdsa signing key Sign([]byte) ([]byte, error) // Multicast sends a message to it's connected nodes filtered on the 'addresses' parameter (where each address // is associated with those node's signing key) // If sendToSelf is set to true, then the function will send an event to self via a message event Multicast(addresses []common.Address, payload []byte, ethMsgCode uint64, sendToSelf bool) error // Unicast will asynchronously send a celo message to peer Unicast(peer consensus.Peer, payload []byte, ethMsgCode uint64) // GetValEnodeTableEntries retrieves the entries in the valEnodeTable filtered on the "validators" parameter. // If the parameter is nil, then no filter will be applied. GetValEnodeTableEntries(validators []common.Address) (map[common.Address]*istanbul.AddressEntry, error) // UpdateAnnounceVersion will notify the announce protocol that this validator's valEnodeTable entry has been updated UpdateAnnounceVersion() // GetAnnounceVersion will retrieve the current node's announce version GetAnnounceVersion() uint // RetrieveEnodeCertificateMsgMap will retrieve this node's handshake enodeCertificate RetrieveEnodeCertificateMsgMap() map[enode.ID]*istanbul.EnodeCertMsg // RetrieveValidatorConnSet will retrieve the validator connection set. RetrieveValidatorConnSet() (map[common.Address]bool, error) // AddPeer will add a static peer AddPeer(node *enode.Node, purpose p2p.PurposeFlag) // RemovePeer will remove a static peer RemovePeer(node *enode.Node, purpose p2p.PurposeFlag) // GetProxiedValidatorEngine returns the proxied validator engine created for this Backend. This should only be used for the unit tests. GetProxiedValidatorEngine() ProxiedValidatorEngine }
BackendForProxiedValidatorEngine provides the Istanbul backend application specific functions for Istanbul proxied validator engine
type BackendForProxyEngine ¶
type BackendForProxyEngine interface { // IsProxy returns true if this node is a proxy IsProxy() bool // SelfNode returns the owner's node (if this is a proxy, it will return the external node) SelfNode() *enode.Node // Multicast sends a message to it's connected nodes filtered on the 'addresses' parameter (where each address // is associated with those node's signing key) // If sendToSelf is set to true, then the function will send an event to self via a message event Multicast(addresses []common.Address, payload []byte, ethMsgCode uint64, sendToSelf bool) error // Unicast will asynchronously send a celo message to peer Unicast(peer consensus.Peer, payload []byte, ethMsgCode uint64) // GetValEnodeTableEntries retrieves the entries in the valEnodeTable filtered on the "validators" parameter. // If the parameter is nil, then no filter will be applied. GetValEnodeTableEntries(validators []common.Address) (map[common.Address]*istanbul.AddressEntry, error) // RewriteValEnodeTableEntries will rewrite the val enode table with "entries". RewriteValEnodeTableEntries(entries map[common.Address]*istanbul.AddressEntry) error // SetEnodeCertificateMsgs will set this node's enodeCertificate to be used for connection handshakes SetEnodeCertificateMsgMap(enodeCertificateMsgMap map[enode.ID]*istanbul.EnodeCertMsg) error // RetrieveEnodeCertificateMsgMap will retrieve this node's handshake enodeCertificate RetrieveEnodeCertificateMsgMap() map[enode.ID]*istanbul.EnodeCertMsg // VerifyPendingBlockValidatorSignature is a message validation function to verify that a message's sender is within the validator set // of the current pending block and that the message's address field matches the message's signature's signer VerifyPendingBlockValidatorSignature(data []byte, sig []byte) (common.Address, error) // VerifyValidatorConnectionSetSignature is a message validation function to verify that a message's sender is within the // validator connection set and that the message's address field matches the message's signature's signer VerifyValidatorConnectionSetSignature(data []byte, sig []byte) (common.Address, error) // GetProxy returns the proxy engine created for this Backend. Note: This should be only used for the unit tests. GetProxyEngine() ProxyEngine }
BackendForProxyEngine provides the Istanbul backend application specific functions for Istanbul proxy engine
type ProxiedValidatorEngine ¶
type ProxiedValidatorEngine interface { // Start will start the proxied validator engine. Specifically, it will start the // proxy handler thread. Start() error // Stop will stop the proxied validator engine. Specifically, it will stop the // proxy handler thread. Stop() error // AddProxy will add a new proxy to the proxy handler AddProxy(node, externalNode *enode.Node) error // RemoveProxy will remove a proxy from the proxy handler RemoveProxy(node *enode.Node) error // RegisterProxyPeer is the callback function that should be called // when a proxy connects to a proxied validator. This function will // notify the proxy handler that a proxy has connected. RegisterProxyPeer(proxyPeer consensus.Peer) error // UnregisterProxyPeer is the callback function that should be called // when a proxy is disconnected from a proxied validator. This function will // notify the proxy handler that a proxy has disconnected. UnregisterProxyPeer(proxyPeer consensus.Peer) error // SendDelegateSignMsgToProxy will send a delegate sign message back to the proxy that is designated to // handle celostats. SendDelegateSignMsgToProxy(msg []byte, peerID enode.ID) error // SendForwardMsg will send a forward message to all of the proxies. SendForwardMsgToAllProxies(finalDestAddresses []common.Address, ethMsgCode uint64, payload []byte) error // connected proxy. SendValEnodesShareMsgToAllProxies() error // SendEnodeCertsToAllProxies will send the enode certs to the appropriate proxy. SendEnodeCertsToAllProxies(map[enode.ID]*istanbul.EnodeCertMsg) error // GetValidatorProxyAssignments will retrieve all the remote validator to proxy assignments. GetValidatorProxyAssignments(validators []common.Address) (map[common.Address]*Proxy, error) // GetProxiesAndValAssignments will retrieve all of the proxies (connected or not yet connected) and // the proxy to validator assignments. GetProxiesAndValAssignments() ([]*Proxy, map[enode.ID][]common.Address, error) // IsProxyPeer will check if the peerID is a proxy. IsProxyPeer(peerID enode.ID) (bool, error) // NewEpoch will notify the proxied validator's thread that a new epoch started NewEpoch() error }
func NewProxiedValidatorEngine ¶
func NewProxiedValidatorEngine(backend BackendForProxiedValidatorEngine, config *istanbul.Config) (ProxiedValidatorEngine, error)
New creates a new proxied validator engine.
type ProxiedValidatorInfo ¶
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func (*Proxy) ExternalNode ¶
type ProxyEngine ¶
type ProxyEngine interface { // HandleMsg is the `celo` subprotocol message handler for proxies. HandleMsg(peer consensus.Peer, msgCode uint64, payload []byte) (bool, error) // RegisterProxiedValidatorPeer is the callback function that should be called // when a proxied validator connects to a proxy. This function will save // the proxied validator's peer in the proxy's state. RegisterProxiedValidatorPeer(proxiedValidatorPeer consensus.Peer) // UnregisterProxiedValidatorPeer is the callback function that should be // called when a proxied validator disconnects from a proxy. This function // will remove the proxied validator's peer from the proxy's state. UnregisterProxiedValidatorPeer(proxiedValidatorPeer consensus.Peer) // SendDelegateSignMsgToProxiedValidator will send a delegate sign message to the proxied validator. SendDelegateSignMsgToProxiedValidator(msg []byte) error // SendMsgToProxiedValidators will send the `celo` message to the proxied validators. SendMsgToProxiedValidators(msgCode uint64, msg *istanbul.Message) error // GetProxiedValidatorsInfo will return information about the proxied validators. GetProxiedValidatorsInfo() ([]*ProxiedValidatorInfo, error) }
func NewProxyEngine ¶
func NewProxyEngine(backend BackendForProxyEngine, config *istanbul.Config) (ProxyEngine, error)
NewProxyEngine creates a new proxy engine.
type ProxyInfo ¶
type ProxyInfo struct { InternalNode *enode.Node `json:"internalEnodeUrl"` ExternalNode *enode.Node `json:"externalEnodeUrl"` IsPeered bool `json:"isPeered"` AssignedRemoteValidators []common.Address `json:"validators"` // All validator addresses assigned to the proxy DisconnectTS int64 `json:"disconnectedTimestamp"` // Unix time of the last disconnect of the peer }
ProxyInfo is used to provide info on a proxy that can be given via an RPC
Click to show internal directories.
Click to hide internal directories.