github.com/MetalBlockchain/metalgo@v1.11.9/tests/fixture/tmpnet/defaults.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package tmpnet 5 6 import ( 7 "time" 8 9 "github.com/MetalBlockchain/metalgo/config" 10 "github.com/MetalBlockchain/metalgo/utils/logging" 11 "github.com/MetalBlockchain/metalgo/vms/platformvm/txs/executor" 12 ) 13 14 const ( 15 // Interval appropriate for network operations that should be 16 // retried periodically but not too often. 17 DefaultPollingInterval = 500 * time.Millisecond 18 19 // Validator start time must be a minimum of SyncBound from the 20 // current time for validator addition to succeed, and adding 20 21 // seconds provides a buffer in case of any delay in processing. 22 DefaultValidatorStartTimeDiff = executor.SyncBound + 20*time.Second 23 24 DefaultNetworkTimeout = 2 * time.Minute 25 26 // Minimum required to ensure connectivity-based health checks will pass 27 DefaultNodeCount = 2 28 29 // Arbitrary number of pre-funded keys to create by default 30 DefaultPreFundedKeyCount = 50 31 32 // A short minimum stake duration enables testing of staking logic. 33 DefaultMinStakeDuration = time.Second 34 35 defaultConfigFilename = "config.json" 36 ) 37 38 // Flags appropriate for networks used for all types of testing. 39 func DefaultTestFlags() FlagsMap { 40 return FlagsMap{ 41 config.NetworkPeerListPullGossipFreqKey: "250ms", 42 config.NetworkMaxReconnectDelayKey: "1s", 43 config.HealthCheckFreqKey: "2s", 44 config.AdminAPIEnabledKey: true, 45 config.IndexEnabledKey: true, 46 } 47 } 48 49 // Flags appropriate for tmpnet networks. 50 func DefaultTmpnetFlags() FlagsMap { 51 // Supply only non-default configuration to ensure that default values will be used. 52 flags := FlagsMap{ 53 // Specific to tmpnet deployment 54 config.PublicIPKey: "127.0.0.1", 55 config.HTTPHostKey: "127.0.0.1", 56 config.StakingHostKey: "127.0.0.1", 57 config.LogDisplayLevelKey: logging.Off.String(), // Display logging not needed since nodes run headless 58 config.LogLevelKey: logging.Debug.String(), 59 // Specific to e2e testing 60 config.MinStakeDurationKey: DefaultMinStakeDuration.String(), 61 config.ProposerVMUseCurrentHeightKey: true, 62 } 63 flags.SetDefaults(DefaultTestFlags()) 64 return flags 65 } 66 67 // A set of chain configurations appropriate for testing. 68 func DefaultChainConfigs() map[string]FlagsMap { 69 return map[string]FlagsMap{ 70 // Supply only non-default configuration to ensure that default 71 // values will be used. Available C-Chain configuration options are 72 // defined in the `github.com/MetalBlockchain/coreth/evm` package. 73 "C": { 74 "warp-api-enabled": true, 75 "log-level": "trace", 76 }, 77 } 78 }