Documentation ¶
Index ¶
- Constants
- Variables
- func BootstrapAddrs(logger *zap.Logger, bootstrapPeers string, self peer.ID) (bootstrappers []peer.AddrInfo, isBootstrapNode bool)
- func ConnectToPeers(ctx context.Context, logger *zap.Logger, h host.Host, peers []peer.AddrInfo) (successes int)
- func DefaultConnectionManager() (*connmgr.BasicConnMgr, error)
- func GetBootstrapPeers(env common.Environment) (string, error)
- func GetCcqBootstrapPeers(env common.Environment) (string, error)
- func GetNetworkId(env common.Environment) string
- func NewHost(logger *zap.Logger, ctx context.Context, networkID string, ...) (host.Host, error)
- func NewRegistry() *registry
- func Run(params *RunParams) func(ctx context.Context) error
- type Components
- type RunOpt
- func WithChainGovernorConfigListener(signedGovCfgRecvC chan *gossipv1.SignedChainGovernorConfig) RunOpt
- func WithChainGovernorStatusListener(signedGovStatusRecvC chan *gossipv1.SignedChainGovernorStatus) RunOpt
- func WithComponents(components *Components) RunOpt
- func WithDisableHeartbeatVerify(disableHeartbeatVerify bool) RunOpt
- func WithGuardianOptions(nodeName string, guardianSigner guardiansigner.GuardianSigner, ...) RunOpt
- func WithObservationRequestListener(obsvReqRecvC chan<- *gossipv1.ObservationRequest) RunOpt
- func WithProcessorFeaturesFunc(processorFeaturesFunc func() string) RunOpt
- func WithSignedObservationBatchListener(batchObsvC chan<- *common.MsgWithTimeStamp[gossipv1.SignedObservationBatch]) RunOpt
- func WithSignedObservationListener(obsvRecvC chan<- *common.MsgWithTimeStamp[gossipv1.SignedObservation]) RunOpt
- func WithSignedVAAListener(signedIncomingVaaRecvC chan<- *gossipv1.SignedVAAWithQuorum) RunOpt
- type RunParams
Constants ¶
const DefaultPort = 8999
const DevnetNetworkId = "/wormhole/dev"
The Devnet bootstrap peers are derived from the guardian key so we can't include them here.
const HighWaterMarkDefault = 400
const LowWaterMarkDefault = 100
const MainnetBootstrapPeers = "" /* 332-byte string literal not displayed */
const MainnetCcqBootstrapPeers = "" /* 332-byte string literal not displayed */
const MainnetNetworkId = "/wormhole/mainnet/2"
This is the definitive source for the default network parameters. Please reference these (or use the methods below), but avoid copying them!
const MaxObservationBatchDelay = time.Second
MaxObservationBatchDelay is the longest we will wait before publishing any queued up observations.
const MaxObservationBatchSize = 4000
MaxObservationBatchSize is the maximum number of observations that will fit in a single `SignedObservationBatch` message.
const P2P_SUBSCRIPTION_BUFFER_SIZE = 1024
const P2P_VALIDATE_QUEUE_SIZE = 1024
const TESTNET_BOOTSTRAP_DHI = 350
TESTNET_BOOTSTRAP_DHI configures how many nodes may connect to the testnet bootstrap node. This number should not exceed HighWaterMark.
const TestnetBootstrapPeers = "" /* 332-byte string literal not displayed */
const TestnetCcqBootstrapPeers = "" /* 332-byte string literal not displayed */
const TestnetNetworkId = "/wormhole/testnet/2/1"
Variables ¶
var (
DefaultRegistry = NewRegistry()
)
Functions ¶
func BootstrapAddrs ¶
func BootstrapAddrs(logger *zap.Logger, bootstrapPeers string, self peer.ID) (bootstrappers []peer.AddrInfo, isBootstrapNode bool)
BootstrapAddrs takes a comma-separated string of multi-address strings and returns an array of []peer.AddrInfo that does not include `self`. if `self` is part of `bootstrapPeers`, return isBootstrapNode=true
func ConnectToPeers ¶
func ConnectToPeers(ctx context.Context, logger *zap.Logger, h host.Host, peers []peer.AddrInfo) (successes int)
ConnectToPeers connects `h` to `peers` and returns the number of successful connections.
func DefaultConnectionManager ¶
func DefaultConnectionManager() (*connmgr.BasicConnMgr, error)
func GetBootstrapPeers ¶
func GetBootstrapPeers(env common.Environment) (string, error)
GetBootstrapPeers returns the default p2p bootstrap peers for mainnet and testnet. For any other environment, it returns an error.
func GetCcqBootstrapPeers ¶
func GetCcqBootstrapPeers(env common.Environment) (string, error)
GetCcqBootstrapPeers returns the default ccq bootstrap peers for mainnet and testnet. For any other environment, it returns an error.
func GetNetworkId ¶
func GetNetworkId(env common.Environment) string
GetNetworkId returns the default network ID.
func NewRegistry ¶
func NewRegistry() *registry
Types ¶
type Components ¶
type Components struct { // P2PIDInHeartbeat determines if the guardian will put it's libp2p node ID in the authenticated heartbeat payload P2PIDInHeartbeat bool ListeningAddressesPatterns []string // Port on which the Guardian is going to bind Port uint // ConnMgr is the ConnectionManager that the Guardian is going to use ConnMgr *connmgr.BasicConnMgr // ProtectedHostByGuardianKey is used to ensure that only one p2p peer can be protected by any given known guardian key ProtectedHostByGuardianKey map[eth_common.Address]peer.ID // ProtectedHostByGuardianKeyLock is only useful to prevent a race condition in test as ProtectedHostByGuardianKey // is only accessed by a single routine at any given time in a running Guardian. ProtectedHostByGuardianKeyLock sync.Mutex // WarnChannelOverflow: If true, errors due to overflowing channels will produce logger.Warn // WARNING: This should not be enabled in production. It is only used in node tests to watch for overflows. WarnChannelOverflow bool // SignedHeartbeatLogLevel is the log level at which SignedHeartbeatReceived events will be logged. SignedHeartbeatLogLevel zapcore.Level // GossipParams is used to configure the GossipSub instance used by the Guardian. GossipParams pubsub.GossipSubParams // GossipAdvertiseAddress is an override for the external IP advertised via p2p to other peers. GossipAdvertiseAddress string }
func DefaultComponents ¶
func DefaultComponents() *Components
func (*Components) ListeningAddresses ¶
func (f *Components) ListeningAddresses() []string
type RunOpt ¶
RunOpt is used to specify optional parameters.
func WithChainGovernorConfigListener ¶
func WithChainGovernorConfigListener(signedGovCfgRecvC chan *gossipv1.SignedChainGovernorConfig) RunOpt
WithChainGovernorConfigListener is used to set the channel to receive `SignedChainGovernorConfig` messages.
func WithChainGovernorStatusListener ¶
func WithChainGovernorStatusListener(signedGovStatusRecvC chan *gossipv1.SignedChainGovernorStatus) RunOpt
WithChainGovernorStatusListener is used to set the channel to receive `SignedChainGovernorStatus` messages.
func WithComponents ¶
func WithComponents(components *Components) RunOpt
WithComponents is used to set the components if you need something other than the defaults.
func WithDisableHeartbeatVerify ¶
WithDisableHeartbeatVerify is used to set disableHeartbeatVerify.
func WithGuardianOptions ¶
func WithGuardianOptions( nodeName string, guardianSigner guardiansigner.GuardianSigner, obsvRecvC chan<- *common.MsgWithTimeStamp[gossipv1.SignedObservation], batchObsvRecvC chan<- *common.MsgWithTimeStamp[gossipv1.SignedObservationBatch], signedIncomingVaaRecvC chan<- *gossipv1.SignedVAAWithQuorum, obsvReqRecvC chan<- *gossipv1.ObservationRequest, gossipControlSendC chan []byte, gossipAttestationSendC chan []byte, gossipVaaSendC chan []byte, obsvReqSendC <-chan *gossipv1.ObservationRequest, acct *accountant.Accountant, gov *governor.ChainGovernor, disableHeartbeatVerify bool, components *Components, ibcFeaturesFunc func() string, gatewayRelayerEnabled bool, ccqEnabled bool, signedQueryReqC chan<- *gossipv1.SignedQueryRequest, queryResponseReadC <-chan *query.QueryResponsePublication, ccqBootstrapPeers string, ccqPort uint, ccqAllowedPeers string, ) RunOpt
WithGuardianOptions is used to set options that are only meaningful to the guardian.
func WithObservationRequestListener ¶
func WithObservationRequestListener(obsvReqRecvC chan<- *gossipv1.ObservationRequest) RunOpt
WithObservationRequestListener is used to set the channel to receive `ObservationRequest` messages.
func WithProcessorFeaturesFunc ¶
WithProcessorFeaturesFunc is used to set the processor features function.
func WithSignedObservationBatchListener ¶
func WithSignedObservationBatchListener(batchObsvC chan<- *common.MsgWithTimeStamp[gossipv1.SignedObservationBatch]) RunOpt
WithSignedObservationBatchListener is used to set the channel to receive `SignedObservationBatch` messages.
func WithSignedObservationListener ¶
func WithSignedObservationListener(obsvRecvC chan<- *common.MsgWithTimeStamp[gossipv1.SignedObservation]) RunOpt
WithSignedObservationListener is used to set the channel to receive `SignedObservation` messages.
func WithSignedVAAListener ¶
func WithSignedVAAListener(signedIncomingVaaRecvC chan<- *gossipv1.SignedVAAWithQuorum) RunOpt
WithSignedVAAListener is used to set the channel to receive `SignedVAAWithQuorum messages`.
type RunParams ¶
type RunParams struct {
// contains filtered or unexported fields
}
RunParams is used to pass parameters into `p2p.Run()`. It allows applications to specify only what they need.
func NewRunParams ¶
func NewRunParams( bootstrapPeers string, networkID string, priv crypto.PrivKey, gst *common.GuardianSetState, rootCtxCancel context.CancelFunc, opts ...RunOpt, ) (*RunParams, error)
NewRunParams is used to create the `RunParams` which gets passed into `p2p.Run()`. It takes the required parameters, plus any desired optional ones, which can be set using the various `With` functions defined below.