setup

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: GPL-3.0 Imports: 30 Imported by: 10

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
  • klaytn_config.go : Defines `KlaytnConfig` 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(cypressTestFlag),
	altsrc.NewBoolFlag(cypressFlag),
	altsrc.NewBoolFlag(baobabTestFlag),
	altsrc.NewBoolFlag(baobabFlag),
	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(mnemonic),
	altsrc.NewStringFlag(mnemonicPath),
	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(kip103CompatibleBlockNumberFlag),
	altsrc.NewStringFlag(kip103ContractAddressFlag),
	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 klaytn 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 Klaytn 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 added in v1.10.0

func BeforeRunHomi(ctx *cli.Context) error

func Gen added in v1.10.0

func Gen(ctx *cli.Context) error

func RandStringRunes

func RandStringRunes(n int) string

func WriteFile added in v1.1.0

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

Types

type GrafanaFile

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

type KlaytnConfig

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

func NewKlaytnConfig added in v1.9.1

func NewKlaytnConfig(networkId int, rpcPort int, wsPort int, p2pPort int, dataDir string, logDir string, runDir string, nodeType string) *KlaytnConfig

func (KlaytnConfig) String

func (k KlaytnConfig) 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