setup

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Overview

setup package generates config files following the given deployment options. It creates the given number of genesis.json and nodekeys

Source Files

Each file contains the following contents

  • cmd.go : Provides functions to generate config files with given deployment configuration
  • flags.go : Defines command line flags which can be used in `setup` command
  • kaia_config.go : Defines `KaiaConfig` and provides a template to build it
  • prometheus_config.go : Defines `PrometheusConfig` and provides a template to build it

Index

Constants

View Source
const (
	DefaultTcpPort uint16 = 32323
	TypeNotDefined        = -1
	TypeDocker            = 0
	TypeLocal             = 1
	TypeRemote            = 2
	TypeDeploy            = 3
	DirScript             = "scripts"
	DirKeys               = "keys"
	DirPnScript           = "scripts_pn"
	DirPnKeys             = "keys_pn"
	DirTestKeys           = "keys_test"
	CNIpNetwork           = "10.11.2"
	PNIpNetwork1          = "10.11.10"
	PNIpNetwork2          = "10.11.11"
)

Variables

View Source
var GrafanaFiles = [...]GrafanaFile{
	{
		// contains filtered or unexported fields
	},
	{
		// contains filtered or unexported fields
	},
}
View Source
var HomiFlags = []cli.Flag{
	homiYamlFlag,
	altsrc.NewStringFlag(genTypeFlag),
	altsrc.NewBoolFlag(mainnetTestFlag),
	altsrc.NewBoolFlag(mainnetFlag),
	altsrc.NewBoolFlag(kairosTestFlag),
	altsrc.NewBoolFlag(kairosFlag),
	altsrc.NewBoolFlag(serviceChainFlag),
	altsrc.NewBoolFlag(serviceChainTestFlag),
	altsrc.NewBoolFlag(cliqueFlag),
	altsrc.NewIntFlag(numOfCNsFlag),
	altsrc.NewIntFlag(numOfValidatorsFlag),
	altsrc.NewIntFlag(numOfPNsFlag),
	altsrc.NewIntFlag(numOfENsFlag),
	altsrc.NewIntFlag(numOfSCNsFlag),
	altsrc.NewIntFlag(numOfSPNsFlag),
	altsrc.NewIntFlag(numOfSENsFlag),
	altsrc.NewIntFlag(numOfTestKeyFlag),
	altsrc.NewStringFlag(mnemonicFlag),
	altsrc.NewStringFlag(mnemonicPathFlag),
	altsrc.NewStringFlag(cnNodeKeyDirFlag),
	altsrc.NewStringFlag(pnNodeKeyDirFlag),
	altsrc.NewStringFlag(enNodeKeyDirFlag),
	altsrc.NewUint64Flag(chainIDFlag),
	altsrc.NewUint64Flag(serviceChainIDFlag),
	altsrc.NewUint64Flag(unitPriceFlag),
	altsrc.NewIntFlag(deriveShaImplFlag),
	altsrc.NewStringFlag(fundingAddrFlag),
	altsrc.NewBoolFlag(patchAddressBookFlag),
	altsrc.NewStringFlag(patchAddressBookAddrFlag),
	altsrc.NewStringFlag(outputPathFlag),
	altsrc.NewBoolFlag(addressBookMockFlag),
	altsrc.NewStringFlag(dockerImageIdFlag),
	altsrc.NewBoolFlag(fasthttpFlag),
	altsrc.NewIntFlag(networkIdFlag),
	altsrc.NewBoolFlag(nografanaFlag),
	altsrc.NewBoolFlag(useTxGenFlag),
	altsrc.NewIntFlag(txGenRateFlag),
	altsrc.NewIntFlag(txGenThFlag),
	altsrc.NewIntFlag(txGenConnFlag),
	altsrc.NewStringFlag(txGenDurFlag),
	altsrc.NewIntFlag(rpcPortFlag),
	altsrc.NewIntFlag(wsPortFlag),
	altsrc.NewIntFlag(p2pPortFlag),
	altsrc.NewStringFlag(dataDirFlag),
	altsrc.NewStringFlag(logDirFlag),
	altsrc.NewBoolFlag(governanceFlag),
	altsrc.NewStringFlag(govModeFlag),
	altsrc.NewStringFlag(governingNodeFlag),
	altsrc.NewStringFlag(govParamContractFlag),
	altsrc.NewStringFlag(rewardMintAmountFlag),
	altsrc.NewStringFlag(rewardRatioFlag),
	altsrc.NewStringFlag(rewardKip82RatioFlag),
	altsrc.NewBoolFlag(rewardGiniCoeffFlag),
	altsrc.NewUint64Flag(rewardStakingFlag),
	altsrc.NewUint64Flag(rewardProposerFlag),
	altsrc.NewStringFlag(rewardMinimumStakeFlag),
	altsrc.NewBoolFlag(rewardDeferredTxFeeFlag),
	altsrc.NewUint64Flag(istEpochFlag),
	altsrc.NewUint64Flag(istProposerPolicyFlag),
	altsrc.NewUint64Flag(istSubGroupFlag),
	altsrc.NewUint64Flag(cliqueEpochFlag),
	altsrc.NewUint64Flag(cliquePeriodFlag),
	altsrc.NewInt64Flag(istanbulCompatibleBlockNumberFlag),
	altsrc.NewInt64Flag(londonCompatibleBlockNumberFlag),
	altsrc.NewInt64Flag(ethTxTypeCompatibleBlockNumberFlag),
	altsrc.NewInt64Flag(magmaCompatibleBlockNumberFlag),
	altsrc.NewInt64Flag(koreCompatibleBlockNumberFlag),
	altsrc.NewInt64Flag(shanghaiCompatibleBlockNumberFlag),
	altsrc.NewInt64Flag(cancunCompatibleBlockNumberFlag),
	altsrc.NewInt64Flag(kaiaCompatibleBlockNumberFlag),
	altsrc.NewInt64Flag(kip103CompatibleBlockNumberFlag),
	altsrc.NewStringFlag(kip103ContractAddressFlag),
	altsrc.NewInt64Flag(kip160CompatibleBlockNumberFlag),
	altsrc.NewStringFlag(kip160ContractAddressFlag),
	altsrc.NewInt64Flag(randaoCompatibleBlockNumberFlag),
	altsrc.NewStringFlag(kip113ProxyAddressFlag),
	altsrc.NewStringFlag(kip113LogicAddressFlag),
	altsrc.NewBoolFlag(kip113MockFlag),
	altsrc.NewBoolFlag(registryMockFlag),
}
View Source
var SetupCommand = &cli.Command{
	Name:  "setup",
	Usage: "Generate Kaia CN's init files",
	Description: `This tool helps generate:
		* Genesis Block (genesis.json)
		* Static nodes for all CNs(Consensus Node)
		* CN details
		* Docker-compose

		for Kaia Consensus Node.

Args :
		type : [local | remote | deploy | docker (default)]
`,
	Action:    Gen,
	Flags:     HomiFlags,
	ArgsUsage: "type",
}
View Source
var Types = [4]string{"docker", "local", "remote", "deploy"}

Functions

func BeforeRunHomi

func BeforeRunHomi(ctx *cli.Context) error

func Gen

func Gen(ctx *cli.Context) error

func RandStringRunes

func RandStringRunes(n int) string

func WriteFile

func WriteFile(content []byte, parentFolder string, fileName string)

Types

type GrafanaFile

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

type KaiaConfig

type KaiaConfig struct {
	NetworkId int
	RPCPort   int
	WSPort    int
	P2PPort   int
	DataDir   string
	LogDir    string
	RunDir    string
	NodeType  string
}

func NewKaiaConfig

func NewKaiaConfig(networkId int, rpcPort int, wsPort int, p2pPort int, dataDir string, logDir string, runDir string, nodeType string) *KaiaConfig

func (KaiaConfig) String

func (k KaiaConfig) String() string

type PrometheusConfig

type PrometheusConfig struct {
	CnIps []string
	PnIps []string
}

func NewPrometheusConfig

func NewPrometheusConfig(cnNum int, cnNetworkIp string, pnNum int, pnNetworkId1 string, pnNetworkId2 string) PrometheusConfig

func (PrometheusConfig) String

func (pConfig PrometheusConfig) String() string

type ValidatorInfo

type ValidatorInfo struct {
	Address  common.Address
	Nodekey  string
	NodeInfo string
}

Jump to

Keyboard shortcuts

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