Documentation
¶
Index ¶
- Constants
- Variables
- func RemoveQuotesForVars(data string) string
- func RemoveTypeMarks(data string) string
- func SaveConfigToFile(cfg *Config, saveConfigPath string) error
- func SaveDataToFile(fullPath, reason string, data []byte) error
- type CommonConfig
- type Config
- type ConfigRender
- func (c *ConfigRender) GetUnresolvedVars(tpl *fasttemplate.Template, data map[string]interface{}, useEnv bool) []string
- func (c *ConfigRender) GetVars(configData string) []string
- func (c *ConfigRender) Merge() (string, error)
- func (c *ConfigRender) ReadTemplateAdnDefinedValues(data string) (*fasttemplate.Template, map[string]interface{}, error)
- func (c *ConfigRender) Render() (string, error)
- func (c *ConfigRender) ResolveCycle(partialResolvedConfigData string) (string, error)
- func (c *ConfigRender) ResolveVars(fullConfigData string) (string, error)
- type DeprecatedField
- type DeprecatedFieldsError
- type FileData
- type L1NetworkConfig
- type L2RPCClientConfig
- type RPCClientConfig
- type RPCMode
Constants ¶
const ( // FlagCfg is the flag for cfg. FlagCfg = "cfg" // FlagComponents is the flag for components. FlagComponents = "components" // FlagSaveConfigPath is the flag to save the final configuration file FlagSaveConfigPath = "save-config-path" // FlagDisableDefaultConfigVars is the flag to force all variables to be set on config-files FlagDisableDefaultConfigVars = "disable-default-config-vars" // FlagAllowDeprecatedFields is the flag to allow deprecated fields FlagAllowDeprecatedFields = "allow-deprecated-fields" EnvVarPrefix = "CDK" ConfigType = "toml" SaveConfigFileName = "aggkit_config.toml" DefaultCreationFilePermissions = os.FileMode(0600) )
const DefaultMandatoryVars = `` /* 974-byte string literal not displayed */
This values doesnt have a default value because depend on the environment / deployment
const DefaultValues = `` /* 8775-byte string literal not displayed */
DefaultValues is the default configuration
const DefaultVars = `` /* 319-byte string literal not displayed */
This doesnt below to config, but are the vars used to avoid repetition in config-files
Variables ¶
var ( ErrCycleVars = fmt.Errorf("cycle vars") ErrMissingVars = fmt.Errorf("missing vars") ErrUnsupportedConfigFileType = fmt.Errorf("unsupported config file type") )
var ( ErrMissingRPCURL = errors.New("missing RPC URL") ErrMissingRollupAddress = errors.New("missing rollup address") ErrMissingRollupManagerAddress = errors.New("missing rollup manager address") ErrMissingPOLTokenAddress = errors.New("missing POL token address") ErrMissingGlobalExitRootManagerAddress = errors.New("missing global exit root manager address") )
Functions ¶
func RemoveQuotesForVars ¶
func RemoveTypeMarks ¶
func SaveConfigToFile ¶
func SaveDataToFile ¶
Types ¶
type CommonConfig ¶ added in v0.7.0
type CommonConfig struct {
// L2URL is the URL of the L2 node
L2RPC L2RPCClientConfig `mapstructure:"L2RPC"`
}
Config holds the common configuration for the Aggkit services
type Config ¶
type Config struct {
// Configure Log level for all the services, allow also to store the logs in a file
Log log.Config
// Common Config that affects all the services
Common CommonConfig
// L1NetworkConfig represents the L1 network config and contains RPC URL alongside L1 contract addresses.
L1NetworkConfig L1NetworkConfig
// REST contains the configuration settings for the REST service in the Aggkit
REST common.RESTConfig
// RPC is the config for the RPC server
RPC jRPC.Config
// Configuration of the reorg detector service to be used for the L1
ReorgDetectorL1 reorgdetector.Config
// Configuration of the reorg detector service to be used for the L2
ReorgDetectorL2 reorgdetector.Config
// Configuration of the aggOracle service
AggOracle aggoracle.Config
// Configuration of the L1 Info Treee Sync service
L1InfoTreeSync l1infotreesync.Config
// BridgeL1Sync is the configuration for the synchronizer of the bridge of the L1
BridgeL1Sync bridgesync.Config
// BridgeL2Sync is the configuration for the synchronizer of the bridge of the L2
BridgeL2Sync bridgesync.Config
// L2GERSync is the config for the synchronizer in charge of syncing the GER injected on L2.
// Needed for the bridge service (RPC)
L2GERSync l2gersync.Config
// AggSender is the configuration of the agg sender service
AggSender aggsendercfg.Config
// Prometheus is the configuration of the prometheus service
Prometheus prometheus.Config
// AggchainProofGen is the configuration of the Aggchain Proof Generation Tool
AggchainProofGen prover.Config
// Profiling is the configuration of the profiling service
Profiling pprof.Config
// Validator is the configuration of the aggsender validator service
Validator validator.Config
}
Config represents the configuration of the entire Aggkit Node The file is TOML format
type ConfigRender ¶
type ConfigRender struct {
// 0: default, 1: specific
FilesData []FileData
// Function to resolve environment variables typically: Os.LookupEnv
LookupEnvFunc func(key string) (string, bool)
EnvinormentPrefix string
}
func NewConfigRender ¶
func NewConfigRender(filesData []FileData, envinormentPrefix string) *ConfigRender
func (*ConfigRender) GetUnresolvedVars ¶
func (c *ConfigRender) GetUnresolvedVars(tpl *fasttemplate.Template, data map[string]interface{}, useEnv bool) []string
GetUnresolvedVars returns the vars in template that are no on data In this case we don't use environment variables
func (*ConfigRender) GetVars ¶
func (c *ConfigRender) GetVars(configData string) []string
GetVars returns the vars in template
func (*ConfigRender) Merge ¶
func (c *ConfigRender) Merge() (string, error)
func (*ConfigRender) ReadTemplateAdnDefinedValues ¶
func (c *ConfigRender) ReadTemplateAdnDefinedValues(data string) (*fasttemplate.Template, map[string]interface{}, error)
The variables in data must be in format template: A={{B}} no A="{{B}}"
func (*ConfigRender) Render ¶
func (c *ConfigRender) Render() (string, error)
- Merge all files - Resolve all variables inside
func (*ConfigRender) ResolveCycle ¶
func (c *ConfigRender) ResolveCycle(partialResolvedConfigData string) (string, error)
ResolveCycle resolve the cycle vars: It iterate to configData, each step must reduce the number of 'vars' if not means that there are cycle vars
func (*ConfigRender) ResolveVars ¶
func (c *ConfigRender) ResolveVars(fullConfigData string) (string, error)
type DeprecatedField ¶
type DeprecatedFieldsError ¶
type DeprecatedFieldsError struct {
// key is the rule and the value is the field's name that matches the rule
Fields map[DeprecatedField][]string
}
func NewErrDeprecatedFields ¶
func NewErrDeprecatedFields() *DeprecatedFieldsError
func (*DeprecatedFieldsError) AddDeprecatedField ¶
func (e *DeprecatedFieldsError) AddDeprecatedField(fieldName string, rule DeprecatedField)
func (*DeprecatedFieldsError) Error ¶
func (e *DeprecatedFieldsError) Error() string
type L1NetworkConfig ¶ added in v0.5.0
type L1NetworkConfig struct {
// RPC client configuration for the L1 network
RPC RPCClientConfig `mapstructure:"RPC"`
// Chain ID of the L1 network
ChainID uint64 `json:"chainId"`
// RollupAddr Address of the L1 rollup contract
RollupAddr gethcommon.Address `json:"polygonZkEVMAddress"`
// RollupManagerAddr Address of the L1 contract
RollupManagerAddr gethcommon.Address `json:"polygonRollupManagerAddress"`
// POLTokenAddr Address of the L1 POL token Contract
POLTokenAddr gethcommon.Address `json:"polTokenAddress"`
// GlobalExitRootManagerAddr Address of the L1 GlobalExitRootManager contract
GlobalExitRootManagerAddr gethcommon.Address `json:"polygonZkEVMGlobalExitRootAddress"`
}
L1NetworkConfig represents the configuration of the network used in L1
func (*L1NetworkConfig) Validate ¶ added in v0.7.0
func (c *L1NetworkConfig) Validate() error
Validate checks if the L1NetworkConfig is valid
type L2RPCClientConfig ¶ added in v0.7.0
type L2RPCClientConfig struct {
// RPCClientConfig contains the basic RPC client configuration
RPCClientConfig `mapstructure:",squash"`
// Mode defines the mode of the RPC client (basic or op)
// In basic mode, the client connects to a standard RPC endpoint.
// In op mode, the client connects to an Optimistic RPC endpoint.
Mode RPCMode `jsonschema:"enum=basic, enum=op" mapstructure:"Mode"`
// ExtraParams contains any additional parameters that may be needed for the RPC client
ExtraParams map[string]any `jsonschema:"omitempty" mapstructure:",remain"`
}
L2RPCClientConfig represents the configuration of the L2 RPC client
func (L2RPCClientConfig) GetString ¶ added in v0.7.0
func (c L2RPCClientConfig) GetString(key string) (string, error)
func (*L2RPCClientConfig) Validate ¶ added in v0.7.0
func (c *L2RPCClientConfig) Validate() error
Validate checks if the L2RPCClientConfig is valid
type RPCClientConfig ¶ added in v0.7.0
type RPCClientConfig struct {
common.RetryPolicyGenericConfig `mapstructure:",squash"`
// URL is the URL of the RPC client
URL string `mapstructure:"URL"`
}
RPCClientConfig represents the configuration of the RPC client
func (*RPCClientConfig) Validate ¶ added in v0.7.0
func (c *RPCClientConfig) Validate() error
Validate checks if the RPCClientConfig is valid