dot

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: LGPL-3.0 Imports: 41 Imported by: 0

Documentation

Overview

Copyright 2020 ChainSafe Systems (ON) Corp. This file is part of gossamer.

The gossamer library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The gossamer library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the gossamer library. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidKeystoreType = errors.New("invalid keystore type")

ErrInvalidKeystoreType when trying to create a service with the wrong keystore type

View Source
var ErrNoKeysProvided = errors.New("no keys provided for authority node")

ErrNoKeysProvided is returned when no keys are given for an authority node

Functions

func CreateJSONRawFile added in v0.2.0

func CreateJSONRawFile(bs *BuildSpec, fp string) *os.File

CreateJSONRawFile will generate an Json File

func ExportConfig

func ExportConfig(cfg *Config, fp string) *os.File

ExportConfig exports a dot configuration to a toml configuration file

func ExportTomlConfig added in v0.2.0

func ExportTomlConfig(cfg *ctoml.Config, fp string) *os.File

ExportTomlConfig exports a dot configuration to a toml configuration file

func InitNode

func InitNode(cfg *Config) error

InitNode initializes a new dot node from the provided dot node configuration and JSON formatted genesis file.

func NewTestGenesis

func NewTestGenesis(t *testing.T) *genesis.Genesis

NewTestGenesis returns a test genesis instance using "gssmr" raw data

func NewTestGenesisAndRuntime

func NewTestGenesisAndRuntime(t *testing.T) string

NewTestGenesisAndRuntime create a new test runtime and a new test genesis file with the test runtime stored in raw data and returns the genesis file nolint

func NewTestGenesisFile

func NewTestGenesisFile(t *testing.T, cfg *Config) *os.File

NewTestGenesisFile returns a human-readable test genesis file using "gssmr" human readable data

func NewTestGenesisRawFile added in v0.2.0

func NewTestGenesisRawFile(t *testing.T, cfg *Config) *os.File

NewTestGenesisRawFile returns a test genesis-raw file using "gssmr" raw data

func NodeInitialized

func NodeInitialized(basepath string, expected bool) bool

NodeInitialized returns true if, within the configured data directory for the node, the state database has been created and the genesis data has been loaded

func RPCServiceEnabled

func RPCServiceEnabled(cfg *Config) bool

RPCServiceEnabled returns true if the rpc service is enabled

func WriteConfig added in v0.2.0

func WriteConfig(data []byte, fp string) *os.File

WriteConfig writes the config `data` in the file 'fp'.

Types

type AccountConfig

type AccountConfig struct {
	Key    string // TODO: change to array
	Unlock string // TODO: change to array
}

AccountConfig is to marshal/unmarshal account config vars

type BlockProducer added in v0.2.0

type BlockProducer interface {
	services.Service

	GetBlockChannel() <-chan types.Block
	SetRuntime(runtime.LegacyInstance) error
	Pause() error
	Resume() error
	Authorities() []*types.Authority
	SetAuthorities([]*types.Authority) error
	SetRandomness([types.RandomnessLength]byte)
	SetThreshold(*big.Int)
}

BlockProducer is the interface that a block production service must implement

type BuildSpec added in v0.2.0

type BuildSpec struct {
	// contains filtered or unexported fields
}

BuildSpec object for working with building genesis JSON files

func BuildFromDB added in v0.2.0

func BuildFromDB(path string) (*BuildSpec, error)

BuildFromDB builds a BuildSpec from the DB located at path

func BuildFromGenesis added in v0.2.0

func BuildFromGenesis(path string, authCount int) (*BuildSpec, error)

BuildFromGenesis builds a BuildSpec based on the human-readable genesis file at path

func (*BuildSpec) ToJSON added in v0.2.0

func (b *BuildSpec) ToJSON() ([]byte, error)

ToJSON outputs genesis JSON in human-readable form

func (*BuildSpec) ToJSONRaw added in v0.2.0

func (b *BuildSpec) ToJSONRaw() ([]byte, error)

ToJSONRaw outputs genesis JSON in raw form

type Config

type Config struct {
	Global  GlobalConfig
	Log     LogConfig
	Init    InitConfig
	Account AccountConfig
	Core    CoreConfig
	Network NetworkConfig
	RPC     RPCConfig
	System  types.SystemInfo
}

Config is a collection of configurations throughout the system

func GssmrConfig

func GssmrConfig() *Config

GssmrConfig returns a new test configuration using the provided basepath

func KsmccConfig

func KsmccConfig() *Config

KsmccConfig returns a "ksmcc" node configuration

func NewTestConfig

func NewTestConfig(t *testing.T) *Config

NewTestConfig returns a new test configuration using the provided basepath

func NewTestConfigWithFile

func NewTestConfigWithFile(t *testing.T) (*Config, *os.File)

NewTestConfigWithFile returns a new test configuration and a temporary configuration file

func (*Config) String

func (c *Config) String() string

String will return the json representation for a Config

type CoreConfig

type CoreConfig struct {
	Roles            byte
	BabeAuthority    bool
	GrandpaAuthority bool
	BabeThreshold    *big.Int
	SlotDuration     uint64
	WasmInterpreter  string
}

CoreConfig is to marshal/unmarshal toml core config vars

type GlobalConfig

type GlobalConfig struct {
	Name     string
	ID       string
	BasePath string
	LogLvl   log.Lvl
}

GlobalConfig is used for every node command

type InitConfig

type InitConfig struct {
	GenesisRaw string
	// TestFirstEpoch determines whether to use test data for the first epoch
	// If set to false, node initialization will load the babe configuration from the runtime to use as first epoch data
	TestFirstEpoch bool
}

InitConfig is the configuration for the node initialization

type LogConfig added in v0.2.0

type LogConfig struct {
	CoreLvl           log.Lvl
	SyncLvl           log.Lvl
	NetworkLvl        log.Lvl
	RPCLvl            log.Lvl
	StateLvl          log.Lvl
	RuntimeLvl        log.Lvl
	BlockProducerLvl  log.Lvl
	FinalityGadgetLvl log.Lvl
}

LogConfig represents the log levels for individual packages

type NetworkConfig

type NetworkConfig struct {
	Port        uint32
	Bootnodes   []string
	ProtocolID  string
	NoBootstrap bool
	NoMDNS      bool
}

NetworkConfig is to marshal/unmarshal toml network config vars

type Node

type Node struct {
	Name     string
	Services *services.ServiceRegistry // registry of all node services
	StopFunc func()                    // func to call when node stops, currently used for profiling
	// contains filtered or unexported fields
}

Node is a container for all the components of a node.

func NewNode

func NewNode(cfg *Config, ks *keystore.GlobalKeystore, stopFunc func()) (*Node, error)

NewNode creates a new dot node from a dot node configuration

func (*Node) Start

func (n *Node) Start() error

Start starts all dot node services

func (*Node) Stop

func (n *Node) Stop()

Stop stops all dot node services

type RPCConfig

type RPCConfig struct {
	Enabled   bool
	Port      uint32
	Host      string
	Modules   []string
	WSPort    uint32
	WSEnabled bool
}

RPCConfig is to marshal/unmarshal toml RPC config vars

Directories

Path Synopsis
config
rpc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL