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 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 GenesisFromJSON
- type NetworkConfig
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 ( // LeafTypeBalance specifies that leaf stores Balance LeafTypeBalance leafType = 0 // LeafTypeNonce specifies that leaf stores Nonce LeafTypeNonce leafType = 1 // LeafTypeCode specifies that leaf stores Code LeafTypeCode leafType = 2 // LeafTypeStorage specifies that leaf stores Storage Value LeafTypeStorage leafType = 3 // LeafTypeSCLength specifies that leaf stores Storage Value LeafTypeSCLength leafType = 4 )
const DefaultMandatoryVars = `` /* 1126-byte string literal not displayed */
This values doesnt have a default value because depend on the environment / deployment
const DefaultValues = `` /* 5569-byte string literal not displayed */
DefaultValues is the default configuration
const DefaultVars = `` /* 145-byte string literal not displayed */
This doesnt below to config, but are the vars used to avoid repetition in config-files
Variables ¶
Functions ¶
func RemoveQuotesForVars ¶
func RemoveTypeMarks ¶
func SaveConfigToFile ¶
func SaveDataToFile ¶
Types ¶
type Config ¶
type Config struct {
// Configuration of the etherman (client for access L1)
Etherman ethermanconfig.Config
// Configure Log level for all the services, allow also to store the logs in a file
Log log.Config
// Configuration of the genesis of the network. This is used to known the initial state of the network
NetworkConfig NetworkConfig
// Common Config that affects all the services
Common common.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
// RPC is the config for the RPC server
RPC jRPC.Config
// ClaimSponsor is the config for the claim sponsor
ClaimSponsor claimsponsor.EVMClaimSponsorConfig
// 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
// LastGERSync is the config for the synchronizer in charge of syncing the last GER injected on L2.
// Needed for the bridge service (RPC)
LastGERSync lastgersync.Config
// AggSender is the configuration of the agg sender service
AggSender aggsender.Config
// Prometheus is the configuration of the prometheus service
Prometheus prometheus.Config
}
Config represents the configuration of the entire CDK 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 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 ethermanconfig.L1Config
}
GenesisFromJSON is the config file for network_custom
type NetworkConfig ¶
type NetworkConfig struct {
// L1: Configuration related to L1
L1Config ethermanconfig.L1Config `mapstructure:"L1"`
// L1: Genesis of the rollup, first block number and root
Genesis state.Genesis
}
NetworkConfig is the configuration struct for the different environments