generate

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Copyright 2022 Nethermind

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var ErrConsensusClientNotValid = errors.New("invalid consensus client")

ErrConsensusClientNotValid is returned when the consensus client is not valid

View Source
var ErrEmptyData = errors.New("data is nil")

ErrEmptyData is returned when the data is nil

View Source
var ErrExecutionClientNotValid = errors.New("invalid execution client")

ErrExecutionClientNotValid is returned when the execution client is not valid

View Source
var ErrTemplateNotFound = errors.New("template not found")

ErrTemplateNotFound is returned when the template is not found

View Source
var ErrUnableToGetClientsInfo = errors.New("unable to get clients information")

ErrUnableToGetClientsInfo is returned when the client information cannot be retrieved

View Source
var ErrValidatorClientNotValid = errors.New("invalid validator client")

ErrValidatorClientNotValid is returned when the validator client is not valid

Functions

func CleanDockerCompose added in v0.3.0

func CleanDockerCompose(dockerComposePath string) error

CleanDockerCompose This functions is responsible for the process of cleaning a generated docker compose script. params :- a. dockerComposePath string Path of the docker compose file to clean returns :- a. error Error if any

func CleanEnvFile added in v0.3.0

func CleanEnvFile(envFilePath string) error

CleanEnvFile This functions is resposible for the process of cleaning a generated `.env` file. It removes the duplicated env var in the file keeping only the latest apparititon of it. params :- a. envFilePath string Path of the generated `.env` file returns :- a. error Error if any

func CleanGenerated added in v0.3.0

func CleanGenerated(genPath string) error

CleanGenerated This functions handles the process of cleaning the generation results files params :- a. gr GenerationResults The generations results to be cleaned returns:- a. error Error if any

func ComposeFile added in v1.0.0

func ComposeFile(gd *GenData, at io.Writer) error

ComposeFile generates a docker-compose file with the provided GenData

func EnvFile added in v1.0.0

func EnvFile(gd *GenData, at io.Writer) error

EnvFile generates a .env file with the provided GenData

Types

type ComposeData added in v1.0.0

type ComposeData struct {
	Version  string    `yaml:"version,omitempty"`
	Services *Services `yaml:"services"`
	Networks *Networks `yaml:"networks,omitempty"`
}

func ParseCompose added in v1.0.0

func ParseCompose(path string) (*ComposeData, error)

ParseCompose parse a Sedge valid docker-compose script

type ConfigConsensus added in v1.0.0

type ConfigConsensus struct {
	ContainerName string   `yaml:"container_name"`
	Image         string   `yaml:"image"`
	Volumes       []string `yaml:"volumes"`
	Command       []string `yaml:"command"`
	Logging       *Logging `yaml:"logging,omitempty"`
}

type Consensus added in v1.0.0

type Consensus struct {
	StopGracePeriod string   `yaml:"stop_grace_period"`
	ContainerName   string   `yaml:"container_name"`
	Restart         string   `yaml:"restart"`
	Image           string   `yaml:"image"`
	Networks        []string `yaml:"networks"`
	Volumes         []string `yaml:"volumes"`
	Ports           []string `yaml:"ports"`
	Expose          []int    `yaml:"expose"`
	Command         []string `yaml:"command"`
	Logging         *Logging `yaml:"logging,omitempty"`
}

type CustomConfigsSources added in v1.0.0

type CustomConfigsSources struct {
	ChainSpecSrc     string
	NetworkConfigSrc string
	GenesisSrc       string
	DeployBlockSrc   string
}

type CustomNetworkConfigsData added in v1.0.0

type CustomNetworkConfigsData struct {
	ChainSpecPath     string
	NetworkConfigPath string
	GenesisPath       string
	DeployBlockPath   string
}

func CustomNetworkConfigs added in v1.0.0

func CustomNetworkConfigs(generationPath, network string, sources CustomConfigsSources) (CustomNetworkConfigsData, error)

type DependsOn added in v1.0.0

type DependsOn struct {
	ValidatorImport *ValidatorImportDependsOn `yaml:"validator-import"`
}

type DockerComposeData

type DockerComposeData struct {
	Services                []string
	Network                 string
	XeeVersion              bool
	Mev                     bool
	MevBoostOnValidator     bool
	MevPort                 uint16
	MevImage                string
	MevBoostEndpoint        string
	CheckpointSyncUrl       string
	FeeRecipient            string
	ElDiscoveryPort         uint16
	ElMetricsPort           uint16
	ElApiPort               uint16
	ElAuthPort              uint16
	ElWsPort                uint16
	ClDiscoveryPort         uint16
	ClMetricsPort           uint16
	ClApiPort               uint16
	ClAdditionalApiPort     uint16
	VlMetricsPort           uint16
	FallbackELUrls          []string
	ElExtraFlags            []string
	ClExtraFlags            []string
	VlExtraFlags            []string
	ECBootnodes             string
	CCBootnodes             string
	CCBootnodesList         []string
	MapAllPorts             bool
	SplittedNetwork         bool
	ClCheckpointSyncUrl     bool
	LoggingDriver           string
	CustomConsensusConfigs  bool
	CustomNetwork           bool
	CustomChainSpecPath     string
	CustomNetworkConfigPath string
	CustomGenesisPath       string
	CustomDeployBlock       bool
	CustomDeployBlockPath   string // Needed for lighthouse
	VLStartGracePeriod      uint
	UID                     int // Needed for teku
	GID                     int // Needed for teku
	ContainerTag            string
}

DockerComposeData : Struct Data object to be applied to docker-compose script

func (DockerComposeData) WithConsensusClient added in v1.0.0

func (d DockerComposeData) WithConsensusClient() bool

WithConsensusClient returns true if the consensus client is set

func (DockerComposeData) WithValidatorClient added in v1.0.0

func (d DockerComposeData) WithValidatorClient() bool

WithValidatorClient returns true if the validator client is set

type EnvData

type EnvData struct {
	Services                  []string
	Mev                       bool
	ElImage                   string
	ElDataDir                 string
	CcImage                   string
	CcDataDir                 string
	VlImage                   string
	VlDataDir                 string
	ExecutionApiURL           string
	ExecutionAuthURL          string
	ConsensusApiURL           string
	ConsensusAdditionalApiURL string
	FeeRecipient              string
	JWTSecretPath             string
	ExecutionEngineName       string
	ConsensusClientName       string
	KeystoreDir               string
	Graffiti                  string
	RelayURLs                 string
	CheckpointSyncUrl         string
}

EnvData : Struct Data object to be applied to the docker-compose script environment (.env) template

func (EnvData) WithMevBoostClient added in v1.0.0

func (d EnvData) WithMevBoostClient() bool

WithMevBoostClient returns true if the Mev-Boost client is set

type Execution added in v1.0.0

type Execution struct {
	StopGracePeriod string   `yaml:"stop_grace_period"`
	ContainerName   string   `yaml:"container_name"`
	Restart         string   `yaml:"restart"`
	Image           string   `yaml:"image"`
	Networks        []string `yaml:"networks"`
	Volumes         []string `yaml:"volumes"`
	Ports           []string `yaml:"ports"`
	Expose          []int    `yaml:"expose"`
	Command         []string `yaml:"command"`
	Logging         *Logging `yaml:"logging,omitempty"`
}

type GenData added in v1.0.0

type GenData struct {
	Services                []string
	ExecutionClient         *clients.Client
	ConsensusClient         *clients.Client
	ValidatorClient         *clients.Client
	Network                 string
	CheckpointSyncUrl       string
	FeeRecipient            string
	JWTSecretPath           string
	FallbackELUrls          []string
	ElExtraFlags            []string
	ClExtraFlags            []string
	VlExtraFlags            []string
	MapAllPorts             bool
	Mev                     bool
	RelayURLs               []string
	MevImage                string
	MevBoostService         bool
	MevBoostEndpoint        string
	MevBoostOnValidator     bool
	Ports                   map[string]uint16
	Graffiti                string
	LoggingDriver           string
	ECBootnodes             []string
	CCBootnodes             []string
	CustomChainSpecPath     string
	CustomNetworkConfigPath string
	CustomGenesisPath       string
	CustomDeployBlock       string
	CustomDeployBlockPath   string
	VLStartGracePeriod      uint
	ExecutionApiUrl         string
	ExecutionAuthUrl        string
	ConsensusApiUrl         string
	ContainerTag            string
	LatestVersion           bool
}

GenData : Struct Data object for script's generation

type Logging added in v1.0.0

type Logging struct {
	Driver  string   `yaml:"driver"`
	Options *Options `yaml:"options"`
}

type Mevboost added in v1.0.0

type Mevboost struct {
	Image         string   `yaml:"image"`
	Networks      []string `yaml:"networks"`
	ContainerName string   `yaml:"container_name"`
	Restart       string   `yaml:"restart"`
	Entrypoint    []string `yaml:"entrypoint"`
}

type Networks added in v1.0.0

type Networks struct {
	Sedge *Sedge `yaml:"sedge"`
}

type Options added in v1.0.0

type Options struct {
	MaxSize string `yaml:"max-size"`
	MaxFile string `yaml:"max-file"`
}

type Sedge added in v1.0.0

type Sedge struct {
	Name string `yaml:"name"`
}

type Services added in v1.0.0

type Services struct {
	Execution        *Execution        `yaml:"execution,omitempty"`
	Mevboost         *Mevboost         `yaml:"mev-boost,omitempty"`
	Consensus        *Consensus        `yaml:"consensus,omitempty"`
	ValidatorBlocker *ValidatorBlocker `yaml:"validator-blocker,omitempty"`
	Validator        *Validator        `yaml:"validator,omitempty"`
	ConfigConsensus  *ConfigConsensus  `yaml:"config_consensus,omitempty"`
}

type Validator added in v1.0.0

type Validator struct {
	ContainerName string     `yaml:"container_name"`
	Image         string     `yaml:"image"`
	DependsOn     *DependsOn `yaml:"depends_on"`
	Networks      []string   `yaml:"networks"`
	Ports         []string   `yaml:"ports"`
	Volumes       []string   `yaml:"volumes"`
	Command       []string   `yaml:"command"`
	Logging       *Logging   `yaml:"logging,omitempty"`
}

type ValidatorBlocker added in v1.0.0

type ValidatorBlocker struct {
	Image         string `yaml:"image"`
	ContainerName string `yaml:"container_name"`
	Command       string `yaml:"command"`
}

type ValidatorImportDependsOn added in v1.0.0

type ValidatorImportDependsOn struct {
	Condition string `yaml:"condition"`
}

Jump to

Keyboard shortcuts

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