config

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROTOCOL_VERSION                            = "PROTOCOL_VERSION"
	VIRTUAL_CHAIN_ID                            = "VIRTUAL_CHAIN_ID"
	BENCHMARK_CONSENSUS_RETRY_INTERVAL          = "BENCHMARK_CONSENSUS_RETRY_INTERVAL"
	LEAN_HELIX_CONSENSUS_ROUND_TIMEOUT_INTERVAL = "LEAN_HELIX_CONSENSUS_ROUND_TIMEOUT_INTERVAL"
	CONSENSUS_REQUIRED_QUORUM_PERCENTAGE        = "CONSENSUS_REQUIRED_QUORUM_PERCENTAGE"
	CONSENSUS_MINIMUM_COMMITTEE_SIZE            = "CONSENSUS_MINIMUM_COMMITTEE_SIZE"

	BLOCK_SYNC_BATCH_SIZE               = "BLOCK_SYNC_BATCH_SIZE"
	BLOCK_SYNC_INTERVAL                 = "BLOCK_SYNC_INTERVAL"
	BLOCK_SYNC_COLLECT_RESPONSE_TIMEOUT = "BLOCK_SYNC_COLLECT_RESPONSE_TIMEOUT"
	BLOCK_SYNC_COLLECT_CHUNKS_TIMEOUT   = "BLOCK_SYNC_COLLECT_CHUNKS_TIMEOUT"

	BLOCK_TRANSACTION_RECEIPT_QUERY_GRACE_START       = "BLOCK_TRANSACTION_RECEIPT_QUERY_GRACE_START"
	BLOCK_TRANSACTION_RECEIPT_QUERY_GRACE_END         = "BLOCK_TRANSACTION_RECEIPT_QUERY_GRACE_END"
	BLOCK_TRANSACTION_RECEIPT_QUERY_EXPIRATION_WINDOW = "BLOCK_TRANSACTION_RECEIPT_QUERY_EXPIRATION_WINDOW"

	CONSENSUS_CONTEXT_MINIMAL_BLOCK_TIME              = "CONSENSUS_CONTEXT_MINIMAL_BLOCK_TIME"
	CONSENSUS_CONTEXT_MINIMUM_TRANSACTIONS_IN_BLOCK   = "CONSENSUS_CONTEXT_MINIMUM_TRANSACTIONS_IN_BLOCK"
	CONSENSUS_CONTEXT_MAXIMUM_TRANSACTIONS_IN_BLOCK   = "CONSENSUS_CONTEXT_MAXIMUM_TRANSACTIONS_IN_BLOCK"
	CONSENSUS_CONTEXT_SYSTEM_TIMESTAMP_ALLOWED_JITTER = "CONSENSUS_CONTEXT_SYSTEM_TIMESTAMP_ALLOWED_JITTER"

	STATE_STORAGE_HISTORY_SNAPSHOT_NUM = "STATE_STORAGE_HISTORY_SNAPSHOT_NUM"

	BLOCK_TRACKER_GRACE_DISTANCE = "BLOCK_TRACKER_GRACE_DISTANCE"
	BLOCK_TRACKER_GRACE_TIMEOUT  = "BLOCK_TRACKER_GRACE_TIMEOUT"

	TRANSACTION_POOL_PENDING_POOL_SIZE_IN_BYTES            = "TRANSACTION_POOL_PENDING_POOL_SIZE_IN_BYTES"
	TRANSACTION_POOL_TRANSACTION_EXPIRATION_WINDOW         = "TRANSACTION_POOL_TRANSACTION_EXPIRATION_WINDOW"
	TRANSACTION_POOL_FUTURE_TIMESTAMP_GRACE_TIMEOUT        = "TRANSACTION_POOL_FUTURE_TIMESTAMP_GRACE_TIMEOUT"
	TRANSACTION_POOL_PENDING_POOL_CLEAR_EXPIRED_INTERVAL   = "TRANSACTION_POOL_PENDING_POOL_CLEAR_EXPIRED_INTERVAL"
	TRANSACTION_POOL_COMMITTED_POOL_CLEAR_EXPIRED_INTERVAL = "TRANSACTION_POOL_COMMITTED_POOL_CLEAR_EXPIRED_INTERVAL"
	TRANSACTION_POOL_PROPAGATION_BATCH_SIZE                = "TRANSACTION_POOL_PROPAGATION_BATCH_SIZE"
	TRANSACTION_POOL_PROPAGATION_BATCHING_TIMEOUT          = "TRANSACTION_POOL_PROPAGATION_BATCHING_TIMEOUT"

	GOSSIP_LISTEN_PORT                    = "GOSSIP_LISTEN_PORT"
	GOSSIP_CONNECTION_KEEP_ALIVE_INTERVAL = "GOSSIP_CONNECTION_KEEP_ALIVE_INTERVAL"
	GOSSIP_NETWORK_TIMEOUT                = "GOSSIP_NETWORK_TIMEOUT"

	PUBLIC_API_SEND_TRANSACTION_TIMEOUT = "PUBLIC_API_SEND_TRANSACTION_TIMEOUT"

	PROCESSOR_ARTIFACT_PATH = "PROCESSOR_ARTIFACT_PATH"

	METRICS_REPORT_INTERVAL = "METRICS_REPORT_INTERVAL"

	ETHEREUM_ENDPOINT = "ETHEREUM_ENDPOINT"
)

Variables

View Source
var CommitVersion string
View Source
var SemanticVersion string

Functions

func ForAcceptanceTestNetwork

func ForAcceptanceTestNetwork(
	federationNodes map[string]FederationNode,
	constantConsensusLeader primitives.NodeAddress,
	activeConsensusAlgo consensus.ConsensusAlgoType,
	maxTxPerBlock uint32,
	requiredQuorumPercentage uint32,
) mutableNodeConfig

func ForE2E

func ForE2E(
	processorArtifactPath string,
	federationNodes map[string]FederationNode,
	gossipPeers map[string]GossipPeer,
	constantConsensusLeader primitives.NodeAddress,
	activeConsensusAlgo consensus.ConsensusAlgoType,
) mutableNodeConfig

config for end-to-end tests (very similar to production but slightly faster)

func ForProduction

func ForProduction(processorArtifactPath string) mutableNodeConfig

config for a production node (either main net or test net)

func GetCurrentSourceFileDirPath

func GetCurrentSourceFileDirPath() string

func GetProjectSourceRootPath

func GetProjectSourceRootPath() string

func GetProjectSourceTmpPath

func GetProjectSourceTmpPath() string

Types

type ArrayFlags

type ArrayFlags []string

func (*ArrayFlags) Set

func (i *ArrayFlags) Set(value string) error

func (*ArrayFlags) String

func (i *ArrayFlags) String() string

type BlockStorageConfig

type BlockStorageConfig interface {
	NodeAddress() primitives.NodeAddress
	BlockSyncBatchSize() uint32
	BlockSyncNoCommitInterval() time.Duration
	BlockSyncCollectResponseTimeout() time.Duration
	BlockSyncCollectChunksTimeout() time.Duration
	BlockTransactionReceiptQueryGraceStart() time.Duration
	BlockTransactionReceiptQueryGraceEnd() time.Duration
	BlockTransactionReceiptQueryExpirationWindow() time.Duration
}

type ConsensusContextConfig

type ConsensusContextConfig interface {
	ProtocolVersion() primitives.ProtocolVersion
	VirtualChainId() primitives.VirtualChainId
	ConsensusContextMaximumTransactionsInBlock() uint32
	ConsensusContextMinimumTransactionsInBlock() uint32
	ConsensusContextMinimalBlockTime() time.Duration
	FederationNodes(asOfBlock uint64) map[string]FederationNode
	ConsensusMinimumCommitteeSize() uint32
	ConsensusContextSystemTimestampAllowedJitter() time.Duration
}

Config based on https://github.com/orbs-network/orbs-spec/blob/master/behaviors/config/services.md#consensus-context

func ForConsensusContextTests

func ForConsensusContextTests(federationNodes map[string]FederationNode) ConsensusContextConfig

type FederationNode

type FederationNode interface {
	NodeAddress() primitives.NodeAddress
}

func NewHardCodedFederationNode

func NewHardCodedFederationNode(nodeAddress primitives.NodeAddress) FederationNode

type GossipPeer

type GossipPeer interface {
	GossipPort() int
	GossipEndpoint() string
}

func NewHardCodedGossipPeer

func NewHardCodedGossipPeer(gossipPort int, gossipEndpoint string) GossipPeer

type GossipTransportConfig

type GossipTransportConfig interface {
	NodeAddress() primitives.NodeAddress
	GossipPeers(asOfBlock uint64) map[string]GossipPeer
	GossipListenPort() uint16
	GossipConnectionKeepAliveInterval() time.Duration
	GossipNetworkTimeout() time.Duration
}

func ForDirectTransportTests

func ForDirectTransportTests(gossipPeers map[string]GossipPeer) GossipTransportConfig

func ForGossipAdapterTests

func ForGossipAdapterTests(nodeAddress primitives.NodeAddress, gossipListenPort int, gossipPeers map[string]GossipPeer) GossipTransportConfig

type NodeConfig

type NodeConfig interface {
	// shared
	ProtocolVersion() primitives.ProtocolVersion
	VirtualChainId() primitives.VirtualChainId
	NodeAddress() primitives.NodeAddress
	NodePrivateKey() primitives.EcdsaSecp256K1PrivateKey
	NetworkSize(asOfBlock uint64) uint32
	FederationNodes(asOfBlock uint64) map[string]FederationNode
	GossipPeers(asOfBlock uint64) map[string]GossipPeer

	// consensus
	ConstantConsensusLeader() primitives.NodeAddress
	ActiveConsensusAlgo() consensus.ConsensusAlgoType
	ConsensusRequiredQuorumPercentage() uint32
	ConsensusMinimumCommitteeSize() uint32

	// Lean Helix consensus
	LeanHelixConsensusRoundTimeoutInterval() time.Duration

	// benchmark consensus
	BenchmarkConsensusRetryInterval() time.Duration

	// block storage
	BlockSyncBatchSize() uint32
	BlockSyncNoCommitInterval() time.Duration
	BlockSyncCollectResponseTimeout() time.Duration
	BlockTransactionReceiptQueryGraceStart() time.Duration
	BlockTransactionReceiptQueryGraceEnd() time.Duration
	BlockTransactionReceiptQueryExpirationWindow() time.Duration
	BlockSyncCollectChunksTimeout() time.Duration

	// state storage
	StateStorageHistorySnapshotNum() uint32

	// block tracker
	BlockTrackerGraceDistance() uint32
	BlockTrackerGraceTimeout() time.Duration

	// consensus context
	ConsensusContextMinimalBlockTime() time.Duration
	ConsensusContextMinimumTransactionsInBlock() uint32
	ConsensusContextMaximumTransactionsInBlock() uint32
	ConsensusContextSystemTimestampAllowedJitter() time.Duration

	// transaction pool
	TransactionPoolPendingPoolSizeInBytes() uint32
	TransactionPoolTransactionExpirationWindow() time.Duration
	TransactionPoolFutureTimestampGraceTimeout() time.Duration
	TransactionPoolPendingPoolClearExpiredInterval() time.Duration
	TransactionPoolCommittedPoolClearExpiredInterval() time.Duration
	TransactionPoolPropagationBatchSize() uint16
	TransactionPoolPropagationBatchingTimeout() time.Duration

	// gossip
	GossipListenPort() uint16
	GossipConnectionKeepAliveInterval() time.Duration
	GossipNetworkTimeout() time.Duration

	// public api
	SendTransactionTimeout() time.Duration

	// processor
	ProcessorArtifactPath() string

	// metrics
	MetricsReportInterval() time.Duration

	// ethereum connector (crosschain)
	EthereumEndpoint() string
}

func ForGamma

func ForGamma(
	federationNodes map[string]FederationNode,
	nodeAddress primitives.NodeAddress,
	nodePrivateKey primitives.EcdsaSecp256K1PrivateKey,
	constantConsensusLeader primitives.NodeAddress,
	activeConsensusAlgo consensus.ConsensusAlgoType,
) NodeConfig

config for gamma dev network that runs with in-memory adapters except for contract compilation

type NodeConfigValue

type NodeConfigValue struct {
	Uint32Value   uint32
	DurationValue time.Duration
	StringValue   string
}

type OverridableConfig

type OverridableConfig interface {
	NodeConfig
	OverrideNodeSpecificValues(
		gossipListenPort int,
		nodeAddress primitives.NodeAddress,
		nodePrivateKey primitives.EcdsaSecp256K1PrivateKey) NodeConfig
}

type PublicApiConfig

type PublicApiConfig interface {
	SendTransactionTimeout() time.Duration
	VirtualChainId() primitives.VirtualChainId
}

func ForPublicApiTests

func ForPublicApiTests(virtualChain uint32, txTimeout time.Duration) PublicApiConfig

type StateStorageConfig

type StateStorageConfig interface {
	StateStorageHistorySnapshotNum() uint32
	BlockTrackerGraceDistance() uint32
	BlockTrackerGraceTimeout() time.Duration
}

func ForStateStorageTest

func ForStateStorageTest(numOfStateRevisionsToRetain uint32, graceBlockDiff uint32, graceTimeoutMillis uint64) StateStorageConfig

type TransactionPoolConfig

type TransactionPoolConfig interface {
	NodeAddress() primitives.NodeAddress
	NodePrivateKey() primitives.EcdsaSecp256K1PrivateKey
	VirtualChainId() primitives.VirtualChainId
	BlockTrackerGraceDistance() uint32
	BlockTrackerGraceTimeout() time.Duration
	TransactionPoolPendingPoolSizeInBytes() uint32
	TransactionPoolTransactionExpirationWindow() time.Duration
	TransactionPoolFutureTimestampGraceTimeout() time.Duration
	TransactionPoolPendingPoolClearExpiredInterval() time.Duration
	TransactionPoolCommittedPoolClearExpiredInterval() time.Duration
	TransactionPoolPropagationBatchSize() uint16
	TransactionPoolPropagationBatchingTimeout() time.Duration
}

func ForTransactionPoolTests

func ForTransactionPoolTests(sizeLimit uint32, keyPair *testKeys.TestEcdsaSecp256K1KeyPair) TransactionPoolConfig

type Version added in v0.7.1

type Version struct {
	Semantic string
	Commit   string
}

func GetVersion added in v0.7.1

func GetVersion() Version

func (Version) String added in v0.7.1

func (v Version) String() string

Jump to

Keyboard shortcuts

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