config

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROTOCOL_VERSION = "PROTOCOL_VERSION"
	VIRTUAL_CHAIN_ID = "VIRTUAL_CHAIN_ID"
	NETWORK_TYPE     = "NETWORK_TYPE"

	BENCHMARK_CONSENSUS_RETRY_INTERVAL             = "BENCHMARK_CONSENSUS_RETRY_INTERVAL"
	BENCHMARK_CONSENSUS_REQUIRED_QUORUM_PERCENTAGE = "BENCHMARK_CONSENSUS_REQUIRED_QUORUM_PERCENTAGE"

	LEAN_HELIX_CONSENSUS_ROUND_TIMEOUT_INTERVAL = "LEAN_HELIX_CONSENSUS_ROUND_TIMEOUT_INTERVAL"
	LEAN_HELIX_CONSENSUS_MINIMUM_COMMITTEE_SIZE = "LEAN_HELIX_CONSENSUS_MINIMUM_COMMITTEE_SIZE"
	LEAN_HELIX_CONSENSUS_MAXIMUM_COMMITTEE_SIZE = "LEAN_HELIX_CONSENSUS_MAXIMUM_COMMITTEE_SIZE"
	LEAN_HELIX_SHOW_DEBUG                       = "LEAN_HELIX_SHOW_DEBUG"

	BLOCK_SYNC_NUM_BLOCKS_IN_BATCH      = "BLOCK_SYNC_NUM_BLOCKS_IN_BATCH"
	BLOCK_SYNC_NO_COMMIT_INTERVAL       = "BLOCK_SYNC_NO_COMMIT_INTERVAL"
	BLOCK_SYNC_COLLECT_RESPONSE_TIMEOUT = "BLOCK_SYNC_COLLECT_RESPONSE_TIMEOUT"
	BLOCK_SYNC_COLLECT_CHUNKS_TIMEOUT   = "BLOCK_SYNC_COLLECT_CHUNKS_TIMEOUT"

	BLOCK_STORAGE_TRANSACTION_RECEIPT_QUERY_TIMESTAMP_GRACE = "BLOCK_STORAGE_TRANSACTION_RECEIPT_QUERY_TIMESTAMP_GRACE"

	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_EXPIRATION_WINDOW                          = "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"
	TRANSACTION_POOL_TIME_BETWEEN_EMPTY_BLOCKS             = "TRANSACTION_POOL_TIME_BETWEEN_EMPTY_BLOCKS"
	TRANSACTION_POOL_NODE_SYNC_REJECT_TIME                 = "TRANSACTION_POOL_NODE_SYNC_REJECT_TIME"

	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"
	PUBLIC_API_NODE_SYNC_WARNING_TIME   = "PUBLIC_API_NODE_SYNC_WARNING_TIME"

	PROCESSOR_ARTIFACT_PATH               = "PROCESSOR_ARTIFACT_PATH"
	PROCESSOR_SANITIZE_DEPLOYED_CONTRACTS = "PROCESSOR_SANITIZE_DEPLOYED_CONTRACTS"

	METRICS_REPORT_INTERVAL = "METRICS_REPORT_INTERVAL"

	ETHEREUM_ENDPOINT                  = "ETHEREUM_ENDPOINT"
	ETHEREUM_FINALITY_TIME_COMPONENT   = "ETHEREUM_FINALITY_TIME_COMPONENT"
	ETHEREUM_FINALITY_BLOCKS_COMPONENT = "ETHEREUM_FINALITY_BLOCKS_COMPONENT"

	LOGGER_HTTP_ENDPOINT            = "LOGGER_HTTP_ENDPOINT"
	LOGGER_BULK_SIZE                = "LOGGER_BULK_SIZE"
	LOGGER_FILE_TRUNCATION_INTERVAL = "LOGGER_FILE_TRUNCATION_INTERVAL"
	LOGGER_FULL_LOG                 = "LOGGER_FULL_LOG"

	BLOCK_STORAGE_FILE_SYSTEM_DATA_DIR                = "BLOCK_STORAGE_FILE_SYSTEM_DATA_DIR"
	BLOCK_STORAGE_FILE_SYSTEM_MAX_BLOCK_SIZE_IN_BYTES = "BLOCK_STORAGE_FILE_SYSTEM_MAX_BLOCK_SIZE_IN_BYTES"

	PROFILING = "PROFILING"

	HTTP_ADDRESS = "HTTP_ADDRESS"
)

Variables

View Source
var CommitVersion string
View Source
var SemanticVersion string

Functions

func ForAcceptanceTestNetwork

func ForAcceptanceTestNetwork(
	genesisValidatorNodes map[string]ValidatorNode,
	constantConsensusLeader primitives.NodeAddress,
	activeConsensusAlgo consensus.ConsensusAlgoType,
	maxTxPerBlock uint32,
	requiredQuorumPercentage uint32,
	virtualChainId primitives.VirtualChainId,
) mutableNodeConfig

func ForE2E

func ForE2E(
	processorArtifactPath string,
	genesisValidatorNodes map[string]ValidatorNode,
	gossipPeers map[string]GossipPeer,
	constantConsensusLeader primitives.NodeAddress,
	activeConsensusAlgo consensus.ConsensusAlgoType,
	ethereumEndpoint string,
) 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

func NewValidator added in v0.7.11

func NewValidator(logger log.BasicLogger) *validator

func TemplateForGamma added in v0.7.11

func TemplateForGamma(
	genesisValidatorNodes map[string]ValidatorNode,
	constantConsensusLeader primitives.NodeAddress,
) mutableNodeConfig

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

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
	BlockSyncNumBlocksInBatch() uint32
	BlockSyncNoCommitInterval() time.Duration
	BlockSyncCollectResponseTimeout() time.Duration
	BlockSyncCollectChunksTimeout() time.Duration
	BlockStorageTransactionReceiptQueryTimestampGrace() time.Duration
	TransactionExpirationWindow() time.Duration
	BlockTrackerGraceTimeout() time.Duration
}

type ConsensusContextConfig

type ConsensusContextConfig interface {
	ProtocolVersion() primitives.ProtocolVersion
	VirtualChainId() primitives.VirtualChainId
	ConsensusContextMaximumTransactionsInBlock() uint32
	GenesisValidatorNodes() map[string]ValidatorNode
	LeanHelixConsensusMinimumCommitteeSize() 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(genesisValidatorNodes map[string]ValidatorNode) ConsensusContextConfig

type EthereumCrosschainConnectorConfig added in v0.7.11

type EthereumCrosschainConnectorConfig interface {
	EthereumFinalityTimeComponent() time.Duration
	EthereumFinalityBlocksComponent() uint32
}

type FilesystemBlockPersistenceConfig added in v0.7.11

type FilesystemBlockPersistenceConfig interface {
	BlockStorageFileSystemDataDir() string
	BlockStorageFileSystemMaxBlockSizeInBytes() uint32
	VirtualChainId() primitives.VirtualChainId
}

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() map[string]GossipPeer
	GossipListenPort() uint16
	GossipConnectionKeepAliveInterval() time.Duration
	GossipNetworkTimeout() time.Duration
}

func ForDirectTransportTests

func ForDirectTransportTests(gossipPeers map[string]GossipPeer, keepAliveInterval time.Duration) GossipTransportConfig

func ForGossipAdapterTests

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

type HttpServerConfig added in v0.7.11

type HttpServerConfig interface {
	HttpAddress() string
	Profiling() bool
}

type LeanHelixConsensusConfig added in v0.7.11

type LeanHelixConsensusConfig interface {
	NodeAddress() primitives.NodeAddress
	NodePrivateKey() primitives.EcdsaSecp256K1PrivateKey
	LeanHelixConsensusRoundTimeoutInterval() time.Duration
	LeanHelixConsensusMaximumCommitteeSize() uint32
	LeanHelixShowDebug() bool
	ActiveConsensusAlgo() consensus.ConsensusAlgoType
	VirtualChainId() primitives.VirtualChainId
	NetworkType() protocol.SignerNetworkType
}

func ForLeanHelixConsensusTests added in v0.7.11

func ForLeanHelixConsensusTests(keyPair *testKeys.TestEcdsaSecp256K1KeyPair) LeanHelixConsensusConfig

type NativeProcessorConfig added in v0.7.11

type NativeProcessorConfig interface {
	ProcessorSanitizeDeployedContracts() bool
	VirtualChainId() primitives.VirtualChainId
}

func ForNativeProcessorTests added in v0.7.11

func ForNativeProcessorTests(id primitives.VirtualChainId) NativeProcessorConfig

type NodeConfig

type NodeConfig interface {
	// shared
	ProtocolVersion() primitives.ProtocolVersion
	VirtualChainId() primitives.VirtualChainId
	NetworkType() protocol.SignerNetworkType
	NodeAddress() primitives.NodeAddress
	NodePrivateKey() primitives.EcdsaSecp256K1PrivateKey
	GenesisValidatorNodes() map[string]ValidatorNode
	GossipPeers() map[string]GossipPeer
	TransactionExpirationWindow() time.Duration

	// consensus
	ActiveConsensusAlgo() consensus.ConsensusAlgoType

	// Lean Helix consensus
	LeanHelixConsensusRoundTimeoutInterval() time.Duration
	LeanHelixConsensusMinimumCommitteeSize() uint32
	LeanHelixConsensusMaximumCommitteeSize() uint32
	LeanHelixShowDebug() bool

	// benchmark consensus
	BenchmarkConsensusRetryInterval() time.Duration
	BenchmarkConsensusRequiredQuorumPercentage() uint32
	BenchmarkConsensusConstantLeader() primitives.NodeAddress

	// block storage
	BlockSyncNumBlocksInBatch() uint32
	BlockSyncNoCommitInterval() time.Duration
	BlockSyncCollectResponseTimeout() time.Duration
	BlockSyncCollectChunksTimeout() time.Duration
	BlockStorageTransactionReceiptQueryTimestampGrace() time.Duration
	BlockStorageFileSystemDataDir() string
	BlockStorageFileSystemMaxBlockSizeInBytes() uint32

	// state storage
	StateStorageHistorySnapshotNum() uint32

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

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

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

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

	// public api
	PublicApiSendTransactionTimeout() time.Duration
	PublicApiNodeSyncWarningTime() time.Duration

	// processor
	ProcessorArtifactPath() string
	ProcessorSanitizeDeployedContracts() bool

	// ethereum connector (crosschain)
	EthereumEndpoint() string
	EthereumFinalityTimeComponent() time.Duration
	EthereumFinalityBlocksComponent() uint32

	// logger
	LoggerHttpEndpoint() string
	LoggerBulkSize() uint32
	LoggerFileTruncationInterval() time.Duration
	LoggerFullLog() bool

	// http server
	HttpAddress() string

	// profiling
	Profiling() bool
}

type NodeConfigValue

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

type OverridableConfig

type OverridableConfig interface {
	NodeConfig
	OverrideNodeSpecificValues(httpAddress string, gossipListenPort int, nodeAddress primitives.NodeAddress, nodePrivateKey primitives.EcdsaSecp256K1PrivateKey, blockStorageDataDirPrefix string) NodeConfig
	ForNode(nodeAddress primitives.NodeAddress, privateKey primitives.EcdsaSecp256K1PrivateKey) NodeConfig
}

type PublicApiConfig

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

func ForPublicApiTests

func ForPublicApiTests(virtualChain uint32, txTimeout time.Duration, outOfSyncWarningTime 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
	TransactionExpirationWindow() time.Duration
	TransactionPoolFutureTimestampGraceTimeout() time.Duration
	TransactionPoolPendingPoolClearExpiredInterval() time.Duration
	TransactionPoolCommittedPoolClearExpiredInterval() time.Duration
	TransactionPoolPropagationBatchSize() uint16
	TransactionPoolPropagationBatchingTimeout() time.Duration
	TransactionPoolTimeBetweenEmptyBlocks() time.Duration
	TransactionPoolNodeSyncRejectTime() time.Duration
}

func ForTransactionPoolTests

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

type ValidatorNode added in v0.7.11

type ValidatorNode interface {
	NodeAddress() primitives.NodeAddress
}

func NewHardCodedValidatorNode added in v0.7.11

func NewHardCodedValidatorNode(nodeAddress primitives.NodeAddress) ValidatorNode

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