config

package
v1.3.17 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAXIMAL_PROTOCOL_VERSION_SUPPORTED_VALUE = primitives.ProtocolVersion(1) // do not re-define in other places (not even in tests) cannot be smaller than min will fail
	MINIMAL_PROTOCOL_VERSION_SUPPORTED_VALUE = primitives.ProtocolVersion(1) // do not re-define in other places (not even in tests)
	VIRTUAL_CHAIN_ID                         = "VIRTUAL_CHAIN_ID"
	NETWORK_TYPE                             = "NETWORK_TYPE"

	MANAGEMENT_FILE_PATH                = "MANAGEMENT_FILE_PATH"
	MANAGEMENT_MAX_FILE_SIZE            = "MANAGEMENT_MAX_FILE_SIZE"
	MANAGEMENT_POLLING_INTERVAL         = "MANAGEMENT_POLLING_INTERVAL"
	MANAGEMENT_CONSENSUS_GRACE_TIMEOUT  = "MANAGEMENT_CONSENSUS_GRACE_TIMEOUT"
	MANAGEMENT_NETWORK_LIVENESS_TIMEOUT = "MANAGEMENT_NETWORK_LIVENESS_TIMEOUT"

	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_SYNC_DESCENDING_ENABLED             = "BLOCK_SYNC_DESCENDING_ENABLED"
	BLOCK_SYNC_REFERENCE_MAX_ALLOWED_DISTANCE = "BLOCK_SYNC_REFERENCE_MAX_ALLOWED_DISTANCE"

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

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

	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"

	EXPERIMENTAL_EXTERNAL_PROCESSOR_PLUGIN_PATH = "EXPERIMENTAL_EXTERNAL_PROCESSOR_PLUGIN_PATH"
)

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(
	nodeAddress primitives.NodeAddress,
	privateKey primitives.EcdsaSecp256K1PrivateKey,
	constantConsensusLeader primitives.NodeAddress,
	activeConsensusAlgo consensus.ConsensusAlgoType,
	maxTxPerBlock uint32,
	requiredQuorumPercentage uint32,
	virtualChainId primitives.VirtualChainId,
	emptyBlockTime time.Duration,
	managementPollingInterval time.Duration,
	overrides ...NodeConfigKeyValue,
) mutableNodeConfig

func ForGamma

func ForGamma(
	nodeAddress primitives.NodeAddress,
	privateKey primitives.EcdsaSecp256K1PrivateKey,
	constantConsensusLeader primitives.NodeAddress,
	serverAddress string,
	profiling bool,
	overrideJsonAsString string,

) mutableNodeConfig

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

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 ValidateNodeLogic added in v1.3.11

func ValidateNodeLogic(cfg NodeConfig) error

Types

type ArtifactsDependencyVersions added in v1.3.14

type ArtifactsDependencyVersions struct {
	SDK_VER      string
	X_CRYPTO_VER string
}

func GetMainProjectDependencyVersions added in v1.3.14

func GetMainProjectDependencyVersions(pathToMainGoMod string) ArtifactsDependencyVersions

type BlockStorageConfig

type BlockStorageConfig interface {
	NodeAddress() primitives.NodeAddress
	BlockSyncNumBlocksInBatch() uint32
	BlockSyncNoCommitInterval() time.Duration
	BlockSyncCollectResponseTimeout() time.Duration
	BlockSyncCollectChunksTimeout() time.Duration
	BlockSyncDescendingEnabled() bool
	BlockSyncReferenceMaxAllowedDistance() time.Duration
	BlockStorageTransactionReceiptQueryTimestampGrace() time.Duration
	TransactionExpirationWindow() time.Duration
	BlockTrackerGraceTimeout() time.Duration
}

type ConsensusContextConfig

type ConsensusContextConfig interface {
	VirtualChainId() primitives.VirtualChainId
	ConsensusContextMaximumTransactionsInBlock() uint32
	LeanHelixConsensusMinimumCommitteeSize() uint32
	ConsensusContextSystemTimestampAllowedJitter() time.Duration
	ConsensusContextTriggersEnabled() bool
	ManagementConsensusGraceTimeout() time.Duration
}

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

func ForConsensusContextTests

func ForConsensusContextTests(triggersEnabled bool) ConsensusContextConfig

type EthereumCrosschainConnectorConfig added in v0.7.11

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

type ExtraConfig added in v1.3.0

type ExtraConfig interface {
}

type FilesPaths added in v1.3.17

type FilesPaths []string

func (*FilesPaths) Set added in v1.3.17

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

func (*FilesPaths) String added in v1.3.17

func (i *FilesPaths) String() string

type FilesystemBlockPersistenceConfig added in v0.7.11

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

type GossipTransportConfig

type GossipTransportConfig interface {
	NodeAddress() primitives.NodeAddress
	GossipListenPort() uint16
	GossipConnectionKeepAliveInterval() time.Duration
	GossipNetworkTimeout() time.Duration
	GossipReconnectInterval() time.Duration
}

func ForDirectTransportTests

func ForDirectTransportTests(nodeAddress primitives.NodeAddress, keepAliveInterval time.Duration, networkTimeout time.Duration) GossipTransportConfig

func ForGossipAdapterTests

func ForGossipAdapterTests(nodeAddress primitives.NodeAddress) GossipTransportConfig

type HttpServerConfig added in v0.7.11

type HttpServerConfig interface {
	HttpAddress() string
	Profiling() bool
	ManagementFilePath() string
	ManagementPollingInterval() time.Duration
	TransactionPoolTimeBetweenEmptyBlocks() time.Duration
}

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, consensusRoundTimeoutInterval 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
	VirtualChainId() primitives.VirtualChainId
	NetworkType() protocol.SignerNetworkType
	NodeAddress() primitives.NodeAddress
	NodePrivateKey() primitives.EcdsaSecp256K1PrivateKey
	TransactionExpirationWindow() time.Duration

	// Management
	ManagementFilePath() string
	ManagementMaxFileSize() uint32
	ManagementPollingInterval() time.Duration
	ManagementConsensusGraceTimeout() time.Duration
	ManagementNetworkLivenessTimeout() 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
	BlockSyncDescendingEnabled() bool
	BlockSyncReferenceMaxAllowedDistance() 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
	ConsensusContextTriggersEnabled() bool

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

	// Build-dependent configuration
	ExtraConfig
}

func ForBenchmarkConsensusTests added in v1.1.0

func ForBenchmarkConsensusTests(keyPair *testKeys.TestEcdsaSecp256K1KeyPair, leaderKeyPair *testKeys.TestEcdsaSecp256K1KeyPair) NodeConfig

func ForE2E

func ForE2E(
	httpAddress string,
	virtualChainId primitives.VirtualChainId,
	gossipListenPort int,
	nodeAddress primitives.NodeAddress,
	nodePrivateKey primitives.EcdsaSecp256K1PrivateKey,
	managementFilePath string,
	blockStorageDataDirPrefix string,
	processorArtifactPath string,
	ethereumEndpoint string,
	constantConsensusLeader primitives.NodeAddress,
	activeConsensusAlgo consensus.ConsensusAlgoType,
	experimentalExternalProcessorPluginPath string,
) NodeConfig

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

func GetNodeConfigFromFiles added in v1.1.0

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

type NodeConfigKeyValue added in v1.3.17

type NodeConfigKeyValue struct {
	Key   string
	Value NodeConfigValue
}

type NodeConfigMap added in v1.3.17

type NodeConfigMap map[string]NodeConfigValue

type NodeConfigValue

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

type OverridableConfig

type OverridableConfig interface {
	NodeConfig
	Modify(newValues ...NodeConfigKeyValue)
}

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
}

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