config

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 31 Imported by: 1

README

List ENV variables:

ZKEVM_NODE_LOG_LEVEL
ZKEVM_NODE_LOG_OUTPUTS
ZKEVM_NODE_DATABASE_NAME
ZKEVM_NODE_DATABASE_USER
ZKEVM_NODE_DATABASE_PASSWORD
ZKEVM_NODE_DATABASE_HOST
ZKEVM_NODE_DATABASE_PORT
ZKEVM_NODE_ETHERMAN_URL
ZKEVM_NODE_ETHERMAN_PRIVATEKEYPATH
ZKEVM_NODE_ETHERMAN_PRIVATEKEYPASSWORD
ZKEVM_NODE_SYNCHRONIZER_SYNCINTERVAL
ZKEVM_NODE_SEQUENCER_INTERVALTOPROPOSEBATCH
ZKEVM_NODE_SEQUENCER_SYNCEDBLOCKDIF
ZKEVM_NODE_SEQUENCER_STRATEGY_TX_SELECTOR_TYPE
ZKEVM_NODE_SEQUENCER_STRATEGY_TX_SELECTOR_TX_SORTER_TYPE
ZKEVM_NODE_SEQUENCER_STRATEGY_TX_PROFITABILITY_CHECKER_TYPE
ZKEVM_NODE_SEQUENCER_STRATEGY_TX_PROFITABILITY_CHECKER_MIN_REWARD
ZKEVM_NODE_SEQUENCER_STRATEGY_POSSIBLE_TIME_TO_SEND_TX
ZKEVM_NODE_AGGREGATOR_INTERVALTOCONSOLIDATESTATE
ZKEVM_NODE_AGGREGATOR_TX_PROFITABILITY_CHECKER_TYPE
ZKEVM_NODE_AGGREGATOR_TX_PROFITABILITY_MIN_REWARD
ZKEVM_NODE_PROVER_PROVERURI

Documentation

Index

Constants

View Source
const (
	// FlagYes is the flag for yes.
	FlagYes = "yes"
	// FlagCfg is the flag for cfg.
	FlagCfg = "cfg"
	// FlagNetwork is the flag for the network name. Valid values: ["testnet", "mainnet", "cardona", "custom"].
	FlagNetwork = "network"
	// FlagCustomNetwork is the flag for the custom network file. This is required if --network=custom
	FlagCustomNetwork = "custom-network-file"
	// FlagAmount is the flag for amount.
	FlagAmount = "amount"
	// FlagRemoteMT is the flag for remote-merkletree.
	FlagRemoteMT = "remote-merkletree"
	// FlagComponents is the flag for components.
	FlagComponents = "components"
	// FlagHTTPAPI is the flag for http.api.
	FlagHTTPAPI = "http.api"
	// FlagKeyStorePath is the path of the key store file containing the private key of the account going to sing and approve the tokens
	FlagKeyStorePath = "key-store-path"
	// FlagPassword is the password needed to decrypt the key store
	FlagPassword = "password"
	// FlagMigrations is the flag for migrations.
	FlagMigrations = "migrations"
	// FlagOutputFile is the flag for the output file
	FlagOutputFile = "output"
	// FlagMaxAmount is the flag to avoid to use the flag FlagAmount
	FlagMaxAmount = "max-amount"
	// FlagDocumentationFileType is the flag for the choose which file generate json-schema
	FlagDocumentationFileType = "config-file"
)
View Source
const CardonaNetworkConfigJSON = `` /* 93217-byte string literal not displayed */

CardonaNetworkConfigJSON is the hardcoded network configuration to be used for the official mainnet setup

View Source
const DefaultValues = `` /* 5204-byte string literal not displayed */

DefaultValues is the default configuration

View Source
const MainnetNetworkConfigJSON = `` /* 93194-byte string literal not displayed */

MainnetNetworkConfigJSON is the hardcoded network configuration to be used for the official mainnet setup

View Source
const TestnetNetworkConfigJSON = `` /* 92708-byte string literal not displayed */

TestnetNetworkConfigJSON is the hardcoded network configuration to be used for the official mainnet setup

Variables

This section is empty.

Functions

func LoadGenesisFileAsString added in v0.0.990

func LoadGenesisFileAsString(cfgPath string) (string, error)

LoadGenesisFileAsString loads the genesis file as a string

Types

type Config

type Config struct {
	// This define is a trusted node (`true`) or a permission less (`false`). If you don't known
	// set to `false`
	IsTrustedSequencer bool `mapstructure:"IsTrustedSequencer"`
	// Last batch number before  a forkid change (fork upgrade). That implies that
	// greater batch numbers are going to be trusted but no virtualized neither verified.
	// So after the batch number `ForkUpgradeBatchNumber` is virtualized and verified you could update
	// the system (SC,...) to new forkId and remove this value to allow the system to keep
	// Virtualizing and verifying the new batchs.
	// Check issue [#2236](https://github.com/0xPolygonHermez/zkevm-node/issues/2236) to known more
	// This value overwrite `SequenceSender.ForkUpgradeBatchNumber`
	ForkUpgradeBatchNumber uint64 `mapstructure:"ForkUpgradeBatchNumber"`
	// Which is the new forkId
	ForkUpgradeNewForkId uint64 `mapstructure:"ForkUpgradeNewForkId"`
	// Configure Log level for all the services, allow also to store the logs in a file
	Log log.Config
	// Configuration of the etherman (client for access L1)
	Etherman etherman.Config
	// Configuration for ethereum transaction manager
	EthTxManager ethtxmanager.Config
	// Pool service configuration
	Pool pool.Config
	// Configuration for RPC service. THis one offers a extended Ethereum JSON-RPC API interface to interact with the node
	RPC jsonrpc.Config
	// Configuration of service `Syncrhonizer`. For this service is also really important the value of `IsTrustedSequencer`
	// because depending of this values is going to ask to a trusted node for trusted transactions or not
	Synchronizer synchronizer.Config
	// Configuration of the sequencer service
	Sequencer sequencer.Config
	// Configuration of the sequence sender service
	SequenceSender sequencesender.Config
	// Configuration of the aggregator service
	Aggregator aggregator.Config
	// Configuration of the genesis of the network. This is used to known the initial state of the network
	NetworkConfig NetworkConfig
	// Configuration of the gas price suggester service
	L2GasPriceSuggester gasprice.Config
	// Configuration of the executor service
	Executor executor.Config
	// Configuration of the merkle tree client service. Not use in the node, only for testing
	MTClient merkletree.Config
	// Configuration of the metrics service, basically is where is going to publish the metrics
	Metrics metrics.Config
	// Configuration of the event database connection
	EventLog event.Config
	// Configuration of the hash database connection
	HashDB db.Config
	// State service configuration
	State state.Config
}

Config represents the configuration of the entire Hermez Node The file is TOML format You could find some examples:

  • `config/environments/local/local.node.config.toml`: running a permisionless node
  • `config/environments/mainnet/node.config.toml`
  • `config/environments/public/node.config.toml`
  • `test/config/test.node.config.toml`: configuration for a trusted node used in CI

func Default

func Default() (*Config, error)

Default parses the default configuration values.

func Load

func Load(ctx *cli.Context, loadNetworkConfig bool) (*Config, error)

Load loads the configuration

type ConfigJsonSchemaGenerater added in v0.0.990

type ConfigJsonSchemaGenerater[T any] struct {
	// contains filtered or unexported fields
}

ConfigJsonSchemaGenerater are the parameters to generate a json-schema based on the T struct The parametrization of the function are used for unittest

func NewNetworkConfigJsonSchemaGenerater added in v0.0.990

func NewNetworkConfigJsonSchemaGenerater() ConfigJsonSchemaGenerater[GenesisFromJSON]

NewNetworkConfigJsonSchemaGenerater returns a new class for generating json-schema of the network-custom config file (.json)

func NewNodeConfigJsonSchemaGenerater added in v0.0.990

func NewNodeConfigJsonSchemaGenerater() ConfigJsonSchemaGenerater[Config]

NewNodeConfigJsonSchemaGenerater returns a new class for generating json-schema of the node config file (.toml)

func (ConfigJsonSchemaGenerater[T]) GenerateJsonSchema added in v0.0.990

func (s ConfigJsonSchemaGenerater[T]) GenerateJsonSchema(cli *cli.Context) (*jsonschema.Schema, error)

GenerateJsonSchema launchs the generation, and returns the schema

func (ConfigJsonSchemaGenerater[T]) GenerateJsonSchemaAndWriteToFile added in v0.0.990

func (s ConfigJsonSchemaGenerater[T]) GenerateJsonSchemaAndWriteToFile(cli *cli.Context, output_filename string) error

GenerateJsonSchemaAndWriteToFile generate the schema and store in `output_filename` file

func (ConfigJsonSchemaGenerater[T]) SerializeJsonSchema added in v0.0.990

func (s ConfigJsonSchemaGenerater[T]) SerializeJsonSchema(schema *jsonschema.Schema) ([]byte, error)

SerializeJsonSchema serializes the schema in JSON to be stored

type GenesisFromJSON added in v0.0.990

type GenesisFromJSON struct {
	// L1: root hash of the genesis block
	Root string `json:"root"`
	// L1: block number of the genesis block
	GenesisBlockNum uint64 `json:"genesisBlockNumber"`
	// L2:  List of states contracts used to populate merkle tree at initial state
	Genesis []genesisAccountFromJSON `json:"genesis"`
	// L1: configuration of the network
	L1Config etherman.L1Config
}

GenesisFromJSON is the config file for network_custom

type NetworkConfig

type NetworkConfig struct {
	// L1: Configuration related to L1
	L1Config etherman.L1Config `json:"l1Config"`
	// L1: Genesis of the rollup, first block number and root
	Genesis state.Genesis
}

NetworkConfig is the configuration struct for the different environments

func LoadGenesisFromJSONString added in v0.0.990

func LoadGenesisFromJSONString(jsonStr string) (NetworkConfig, error)

LoadGenesisFromJSONString loads the genesis file from JSON string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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