Documentation ¶
Index ¶
- Constants
- func LoadGenesisFileAsString(cfgPath string) (string, error)
- type Config
- type ConfigJsonSchemaGenerater
- func (s ConfigJsonSchemaGenerater[T]) GenerateJsonSchema(cli *cli.Context) (*jsonschema.Schema, error)
- func (s ConfigJsonSchemaGenerater[T]) GenerateJsonSchemaAndWriteToFile(cli *cli.Context, output_filename string) error
- func (s ConfigJsonSchemaGenerater[T]) SerializeJsonSchema(schema *jsonschema.Schema) ([]byte, error)
- type GenesisFromJSON
- type NetworkConfig
Constants ¶
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", "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" )
const DefaultValues = `` /* 4554-byte string literal not displayed */
DefaultValues is the default configuration
const MainnetNetworkConfigJSON = `` /* 93117-byte string literal not displayed */
MainnetNetworkConfigJSON is the hardcoded network configuration to be used for the official mainnet setup
const TestnetNetworkConfigJSON = `` /* 92710-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 ¶
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-sequencer/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 of the sequencer service Sequencer sequencer.Config // Configuration of the sequence sender service SequenceSender sequencesender.Config // Configuration of the genesis of the network. This is used to known the initial state of the network NetworkConfig NetworkConfig // 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 // 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
type ConfigJsonSchemaGenerater ¶
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 ¶
func NewNetworkConfigJsonSchemaGenerater() ConfigJsonSchemaGenerater[GenesisFromJSON]
NewNetworkConfigJsonSchemaGenerater returns a new class for generating json-schema of the network-custom config file (.json)
func NewNodeConfigJsonSchemaGenerater ¶
func NewNodeConfigJsonSchemaGenerater() ConfigJsonSchemaGenerater[Config]
NewNodeConfigJsonSchemaGenerater returns a new class for generating json-schema of the node config file (.toml)
func (ConfigJsonSchemaGenerater[T]) GenerateJsonSchema ¶
func (s ConfigJsonSchemaGenerater[T]) GenerateJsonSchema(cli *cli.Context) (*jsonschema.Schema, error)
GenerateJsonSchema launchs the generation, and returns the schema
func (ConfigJsonSchemaGenerater[T]) GenerateJsonSchemaAndWriteToFile ¶
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 ¶
func (s ConfigJsonSchemaGenerater[T]) SerializeJsonSchema(schema *jsonschema.Schema) ([]byte, error)
SerializeJsonSchema serializes the schema in JSON to be stored
type GenesisFromJSON ¶
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"` // DEPRECATED L2: address of the `PolygonZkEVMGlobalExitRootL2 proxy` smart contract L2GlobalExitRootManagerAddr common.Address // L2: address of the `PolygonZkEVMBridge proxy` smart contract L2BridgeAddr common.Address // L1: Genesis of the rollup, first block number and root Genesis state.Genesis }
NetworkConfig is the configuration struct for the different environments
func LoadGenesisFromJSONString ¶
func LoadGenesisFromJSONString(jsonStr string) (NetworkConfig, error)
LoadGenesisFromJSONString loads the genesis file from JSON string