config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: MIT Imports: 20 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"
	INTER_NODE_SYNC_AUDIT_BLOCKS_YOUNGER_THAN   = "INTER_NODE_SYNC_AUDIT_BLOCKS_YOUNGER_THAN"
	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"
	GOSSIP_RECONNECT_INTERVAL             = "GOSSIP_RECONNECT_INTERVAL"

	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"

	NTP_ENDPOINT = "NTP_ENDPOINT"

	SIGNER_ENDPOINT = "SIGNER_ENDPOINT"
)

Variables

View Source
var CommitVersion string
View Source
var SemanticVersion string

these get written in build-binaries.sh during linking

Functions

func ForAcceptanceTestNetwork

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

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.Logger) *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
	NetworkType() protocol.SignerNetworkType
}

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
	GossipReconnectInterval() time.Duration
}

func ForDirectTransportTests

func ForDirectTransportTests(gossipPeers map[string]GossipPeer, keepAliveInterval time.Duration, networkTimeout 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
	LeanHelixConsensusRoundTimeoutInterval() time.Duration
	LeanHelixConsensusMaximumCommitteeSize() uint32
	LeanHelixShowDebug() bool
	ActiveConsensusAlgo() consensus.ConsensusAlgoType
	VirtualChainId() primitives.VirtualChainId
	NetworkType() protocol.SignerNetworkType

	InterNodeSyncAuditBlocksYoungerThan() time.Duration
}

type LeanHelixConsensusConfigForTests added in v1.1.0

type LeanHelixConsensusConfigForTests interface {
	LeanHelixConsensusConfig
	SignerConfig
}

func ForLeanHelixConsensusTests added in v0.7.11

func ForLeanHelixConsensusTests(keyPair *testKeys.TestEcdsaSecp256K1KeyPair, auditBlocksYoungerThan time.Duration) LeanHelixConsensusConfigForTests

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
	InterNodeSyncAuditBlocksYoungerThan() time.Duration

	// 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
	GossipReconnectInterval() 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

	// NTP Network Time Protocol
	NTPEndpoint() string

	// Remote signer
	SignerEndpoint() string
}

func ForBenchmarkConsensusTests added in v1.1.0

func ForBenchmarkConsensusTests(keyPair *testKeys.TestEcdsaSecp256K1KeyPair, leaderKeyPair *testKeys.TestEcdsaSecp256K1KeyPair, validators map[string]ValidatorNode) NodeConfig

func ForE2E

func ForE2E(
	httpAddress string,
	gossipListenPort int,
	nodeAddress primitives.NodeAddress,
	nodePrivateKey primitives.EcdsaSecp256K1PrivateKey,
	gossipPeers map[string]GossipPeer,
	genesisValidatorNodes map[string]ValidatorNode,
	blockStorageDataDirPrefix string,
	processorArtifactPath string,
	ethereumEndpoint string,
	constantConsensusLeader primitives.NodeAddress,
	activeConsensusAlgo consensus.ConsensusAlgoType,
) NodeConfig

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

func GetNodeConfigFromFiles added in v1.1.0

func GetNodeConfigFromFiles(configFiles ArrayFlags, httpAddress string) (NodeConfig, error)

type NodeConfigValue

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

type OverridableConfig

type OverridableConfig interface {
	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 SignerConfig added in v1.1.0

type SignerConfig interface {
	NodePrivateKey() primitives.EcdsaSecp256K1PrivateKey
	SignerEndpoint() string
}

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
	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
}

type TransactionPoolConfigForTests added in v1.1.0

type TransactionPoolConfigForTests interface {
	TransactionPoolConfig
	SignerConfig
}

func ForTransactionPoolTests

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

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