constants

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ChainAliasPrefix denotes a prefix for an alias that belongs to a blockchain ID.
	ChainAliasPrefix string = "bc"

	// VMAliasPrefix denotes a prefix for an alias that belongs to a VM ID.
	VMAliasPrefix string = "vm"
)
View Source
const (
	DefaultTokenSymbl = "AVAX"
	CaminoTokenSymbol = "CAM"

	DefaultTokenName = "Avalanche"
	CaminoTokenName  = "Camino"
)

Const variables to be exported

View Source
const (
	MainnetID uint32 = 1
	FujiID    uint32 = 5

	CaminoID     uint32 = 1000
	ColumbusID   uint32 = 1001
	KopernikusID uint32 = 1002

	TestnetID  uint32 = ColumbusID
	UnitTestID uint32 = 10
	LocalID    uint32 = 12345

	MainnetName = "mainnet"
	FujiName    = "fuji"

	CaminoName     = "camino"
	ColumbusName   = "columbus"
	KopernikusName = "kopernikus"
	TestnetName    = "testnet"
	UnitTestName   = "testing"
	LocalName      = "local"

	MainnetHRP    = "avax"
	FujiHRP       = "fuji"
	CaminoHRP     = "camino"
	ColumbusHRP   = "columbus"
	KopernikusHRP = "kopernikus"
	UnitTestHRP   = "testing"
	LocalHRP      = "local"
	FallbackHRP   = "custom"
)

Const variables to be exported

View Source
const (
	// Request ID used when sending a Put message to gossip an accepted container
	// (ie not sent in response to a Get)
	GossipMsgRequestID uint32 = math.MaxUint32

	// The network must be "tcp", "tcp4", "tcp6", "unix" or "unixpacket".
	NetworkType = "tcp"

	DefaultMaxMessageSize  = 2 * units.MiB
	DefaultPingPongTimeout = 30 * time.Second
	DefaultPingFrequency   = 3 * DefaultPingPongTimeout / 4
	DefaultByteSliceCap    = 128

	MaxContainersLen = int(4 * DefaultMaxMessageSize / 5)

	// MinConnectedStakeBuffer is the safety buffer for calculation of MinConnectedStake.
	// This increases the required stake percentage above alpha/k. Must be [0-1]
	// 0 means MinConnectedStake = alpha/k, 1 means MinConnectedStake = 1 (fully connected)
	MinConnectedStakeBuffer = .2

	DefaultNetworkPeerListNumValidatorIPs        = 15
	DefaultNetworkPeerListValidatorGossipSize    = 20
	DefaultNetworkPeerListNonValidatorGossipSize = 0
	DefaultNetworkPeerListPeersGossipSize        = 10
	DefaultNetworkPeerListGossipFreq             = time.Minute

	// Inbound Connection Throttling
	DefaultInboundConnUpgradeThrottlerCooldown = 10 * time.Second
	DefaultInboundThrottlerMaxConnsPerSec      = 256

	// Outbound Connection Throttling
	DefaultOutboundConnectionThrottlingRps = 50
	DefaultOutboundConnectionTimeout       = 30 * time.Second

	// Timeouts
	DefaultNetworkInitialTimeout        = 5 * time.Second
	DefaultNetworkMinimumTimeout        = 2 * time.Second
	DefaultNetworkMaximumTimeout        = 10 * time.Second
	DefaultNetworkMaximumInboundTimeout = 10 * time.Second
	DefaultNetworkTimeoutHalflife       = 5 * time.Minute
	DefaultNetworkTimeoutCoefficient    = 2
	DefaultNetworkReadHandshakeTimeout  = 15 * time.Second

	DefaultNetworkCompressionEnabled        = true // TODO remove when NetworkCompressionEnabledKey is removed
	DefaultNetworkCompressionType           = compression.TypeGzip
	DefaultNetworkMaxClockDifference        = time.Minute
	DefaultNetworkAllowPrivateIPs           = true
	DefaultNetworkRequireValidatorToConnect = false
	DefaultNetworkPeerReadBufferSize        = 8 * units.KiB
	DefaultNetworkPeerWriteBufferSize       = 8 * units.KiB

	DefaultNetworkTCPProxyEnabled = false

	// The PROXY protocol specification recommends setting this value to be at
	// least 3 seconds to cover a TCP retransmit.
	// Ref: https://www.haproxy.org/download/2.3/doc/proxy-protocol.txt
	// Specifying a timeout of 0 will actually result in a timeout of 200ms, but
	// a timeout of 0 should generally not be provided.
	DefaultNetworkTCPProxyReadTimeout = 3 * time.Second

	// Benchlist
	DefaultBenchlistFailThreshold      = 10
	DefaultBenchlistDuration           = 15 * time.Minute
	DefaultBenchlistMinFailingDuration = 2*time.Minute + 30*time.Second

	// Router
	DefaultConsensusGossipFrequency                        = 10 * time.Second
	DefaultConsensusAppConcurrency                         = 2
	DefaultConsensusShutdownTimeout                        = 30 * time.Second
	DefaultConsensusGossipAcceptedFrontierValidatorSize    = 0
	DefaultConsensusGossipAcceptedFrontierNonValidatorSize = 0
	DefaultConsensusGossipAcceptedFrontierPeerSize         = 15
	DefaultConsensusGossipOnAcceptValidatorSize            = 0
	DefaultConsensusGossipOnAcceptNonValidatorSize         = 0
	DefaultConsensusGossipOnAcceptPeerSize                 = 10
	DefaultAppGossipValidatorSize                          = 10
	DefaultAppGossipNonValidatorSize                       = 0
	DefaultAppGossipPeerSize                               = 0

	// Inbound Throttling
	DefaultInboundThrottlerAtLargeAllocSize         = 6 * units.MiB
	DefaultInboundThrottlerVdrAllocSize             = 32 * units.MiB
	DefaultInboundThrottlerNodeMaxAtLargeBytes      = DefaultMaxMessageSize
	DefaultInboundThrottlerMaxProcessingMsgsPerNode = 1024
	DefaultInboundThrottlerBandwidthRefillRate      = 512 * units.KiB
	DefaultInboundThrottlerBandwidthMaxBurstSize    = DefaultMaxMessageSize
	DefaultInboundThrottlerCPUMaxRecheckDelay       = 5 * time.Second
	DefaultInboundThrottlerDiskMaxRecheckDelay      = 5 * time.Second

	// Outbound Throttling
	DefaultOutboundThrottlerAtLargeAllocSize    = 32 * units.MiB
	DefaultOutboundThrottlerVdrAllocSize        = 32 * units.MiB
	DefaultOutboundThrottlerNodeMaxAtLargeBytes = DefaultMaxMessageSize

	// Network Health
	DefaultHealthCheckAveragerHalflife = 10 * time.Second

	DefaultNetworkHealthMaxTimeSinceMsgSent     = time.Minute
	DefaultNetworkHealthMaxTimeSinceMsgReceived = time.Minute
	DefaultNetworkHealthMaxPortionSendQueueFill = 0.9
	DefaultNetworkHealthMinPeers                = 1
	DefaultNetworkHealthMaxSendFailRate         = .9

	// Metrics
	DefaultUptimeMetricFreq = 30 * time.Second

	// Delays
	DefaultNetworkInitialReconnectDelay = time.Second
	DefaultNetworkMaxReconnectDelay     = time.Minute
)

Const variables to be exported

Variables

View Source
var (
	// PlatformName exports the name of the platform
	PlatformName = "camino"

	// AppName exports the name of the application
	AppName = "caminogo"
)

Variables to be exported Can be overwritten with -X during build step

View Source
var (
	NetworkIDToTokenSymbol = map[uint32]string{
		CaminoID:     CaminoTokenSymbol,
		ColumbusID:   CaminoTokenSymbol,
		KopernikusID: CaminoTokenSymbol,
	}

	NetworkIDToTokenName = map[uint32]string{
		CaminoID:     CaminoTokenName,
		ColumbusID:   CaminoTokenName,
		KopernikusID: CaminoTokenName,
	}
)

Variables to be exported

Variables to be exported

View Source
var (
	PlatformVMID = ids.ID{'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', 'v', 'm'}
	AVMID        = ids.ID{'a', 'v', 'm'}
	EVMID        = ids.ID{'e', 'v', 'm'}
)

Functions

func GetHRP

func GetHRP(networkID uint32) string

GetHRP returns the Human-Readable-Part of bech32 addresses for a networkID

func IsActiveNetwork

func IsActiveNetwork(networkID uint32) bool

func NetworkID

func NetworkID(networkName string) (uint32, error)

NetworkID returns the ID of the network with name [networkName]

func NetworkName

func NetworkName(networkID uint32) string

NetworkName returns a human readable name for the network with ID [networkID]

func TokenName

func TokenName(networkID uint32) string

NetworkName returns a human readable name for the network with ID [networkID]

func TokenSymbol

func TokenSymbol(networkID uint32) string

GetHRP returns the Human-Readable-Part of bech32 addresses for a networkID

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL