Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultJSONMarshal(v interface{}) ([]byte, error)
- func NewTestGenesis(networkID uint32, aChainBalances AChainBalanceMap, ...) (*genesis.UnparsedConfig, error)
- func WaitForHealthy(ctx context.Context, node Node) error
- type AChainBalanceMap
- type FlagsMap
- type Network
- type NetworkConfig
- type Node
- type NodeConfig
- type NodeURI
Constants ¶
const ( DefaultNodeCount = 2 // Minimum required to ensure connectivity-based health checks will pass DefaultFundedKeyCount = 50 DefaultGasLimit = uint64(100_000_000) // Gas limit is arbitrary // Arbitrarily large amount of DIONE to fund keys on the A-Chain for testing DefaultFundedKeyAChainAmount = 30 * units.MegaDione )
const (
DefaultNodeTickerInterval = 50 * time.Millisecond
)
Variables ¶
var ( // Arbitrarily large amount of DIONE (10^12) to fund keys on the D-Chain for testing DefaultFundedKeyDChainAmount = new(big.Int).Exp(big.NewInt(10), big.NewInt(30), nil) )
var ErrNotRunning = errors.New("not running")
Functions ¶
func DefaultJSONMarshal ¶
Marshal to json with default prefix and indent.
func NewTestGenesis ¶
func NewTestGenesis( networkID uint32, aChainBalances AChainBalanceMap, dChainBalances core.GenesisAlloc, validatorIDs []ids.NodeID, ) (*genesis.UnparsedConfig, error)
Create a genesis struct valid for bootstrapping a test network. Note that many of the genesis fields (e.g. reward addresses) are randomly generated or hard-coded.
Types ¶
type AChainBalanceMap ¶
Helper type to simplify configuring A-Chain genesis balances
type FlagsMap ¶
type FlagsMap map[string]interface{}
Defines a mapping of flag keys to values intended to be supplied to an invocation of an OdysseyGo node.
func ReadFlagsMap ¶
Utility function simplifying construction of a FlagsMap from a file.
func (FlagsMap) GetStringVal ¶
GetStringVal simplifies retrieving a map value as a string.
func (FlagsMap) SetDefaults ¶
SetDefaults ensures the effectiveness of flag overrides by only setting values supplied in the defaults map that are not already explicitly set.
type Network ¶
type Network interface { GetConfig() NetworkConfig GetNodes() []Node AddEphemeralNode(w io.Writer, flags FlagsMap) (Node, error) }
Defines network capabilities supportable regardless of how a network is orchestrated.
type NetworkConfig ¶
type NetworkConfig struct { Genesis *genesis.UnparsedConfig DChainConfig FlagsMap DefaultFlags FlagsMap FundedKeys []*secp256k1.PrivateKey }
NetworkConfig defines configuration shared or common to all nodes in a given network.
func (*NetworkConfig) EnsureGenesis ¶
func (c *NetworkConfig) EnsureGenesis(networkID uint32, validatorIDs []ids.NodeID) error
Ensure genesis is generated if not already present.
type Node ¶
type Node interface { GetID() ids.NodeID GetConfig() NodeConfig GetProcessContext() node.NodeProcessContext IsHealthy(ctx context.Context) (bool, error) Stop() error }
Defines node capabilities supportable regardless of how a network is orchestrated.
type NodeConfig ¶
NodeConfig defines configuration for an OdysseyGo node.
func NewNodeConfig ¶
func NewNodeConfig() *NodeConfig
func (*NodeConfig) EnsureBLSSigningKey ¶
func (nc *NodeConfig) EnsureBLSSigningKey() error
Ensures a BLS signing key is generated if not already present.
func (*NodeConfig) EnsureKeys ¶
func (nc *NodeConfig) EnsureKeys() error
Ensures staking and signing keys are generated if not already present and that the node ID (derived from the staking keypair) is set.
func (*NodeConfig) EnsureNodeID ¶
func (nc *NodeConfig) EnsureNodeID() error
Attempt to derive the node ID from the node configuration.
func (*NodeConfig) EnsureStakingKeypair ¶
func (nc *NodeConfig) EnsureStakingKeypair() error
Ensures a staking keypair is generated if not already present.
func (*NodeConfig) SetNetworkingConfigDefaults ¶
func (nc *NodeConfig) SetNetworkingConfigDefaults( httpPort uint16, stakingPort uint16, bootstrapIDs []string, bootstrapIPs []string, )
Convenience method for setting networking flags.