You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the Materializer manifest configuration uses a lazy-loading approach for the optional fendermint_additional_config field. This field is represented using a single type (FendermintConfigSource) that can either be a file path or a fully loaded configuration. While we eventually trigger the loading (via load_all_fendermint_configs), a Node can exist in an intermediate state where the configuration is not yet loaded. This mixing of unresolved and resolved states in one type can lead to subtle bugs and makes it less clear when and where errors might occur.
Proposed Solution:
Separate Types:
Manifest Types: Create types that mirror the YAML structure (e.g., NodeManifest or NodeRaw). In these types,fendermint_additional_config remains as a file path (or is omitted).
Internal Types: Create internal types (e.g.,Node) where all configuration fields are fully resolved. In particular,fendermint_additional_config should be an optional FendermintConfig that is already loaded and parsed.
Conversion Step:
Implement conversion methods (or TryFrom implementations) that take a manifest type and a base_dir to resolve relative paths. This conversion should eagerly load and parse the TOML file, returning a fully-resolved Node, or an error if loading/parsing fails.
Integration:
Update the configuration loading pipeline so that after deserializing the YAML into the manifest types, we immediately convert all parts (rootnet, subnets, etc.) into their internal counterparts. This ensures that by the time our application logic uses the configuration, all nodes are in a consistent, fully loaded state.
This change ensures that the conversion from raw (manifest) configuration to internal configuration is performed eagerly, avoiding any deferred/lazy loading of external files.
Acceptance Criteria:
Node configuration is split into manifest and internal types.
The conversion step eagerly loads all external configuration, returning errors immediately on failure.
The rest of the configuration pipeline (rootnet, subnets, etc.) is updated to use the new internal types.
All tests pass and configuration errors are caught during startup rather than at runtime.
The text was updated successfully, but these errors were encountered:
Currently, the Materializer manifest configuration uses a lazy-loading approach for the optional
fendermint_additional_config
field. This field is represented using a single type (FendermintConfigSource
) that can either be a file path or a fully loaded configuration. While we eventually trigger the loading (viaload_all_fendermint_configs
), aNode
can exist in an intermediate state where the configuration is not yet loaded. This mixing of unresolved and resolved states in one type can lead to subtle bugs and makes it less clear when and where errors might occur.Proposed Solution:
Separate Types:
Manifest Types: Create types that mirror the YAML structure (e.g.,
NodeManifest
orNodeRaw
). In these types,fendermint_additional_config
remains as a file path (or is omitted).Internal Types: Create internal types (e.g.,
Node
) where all configuration fields are fully resolved. In particular,fendermint_additional_config
should be an optionalFendermintConfig
that is already loaded and parsed.Conversion Step:
Implement conversion methods (or TryFrom implementations) that take a manifest type and a base_dir to resolve relative paths. This conversion should eagerly load and parse the TOML file, returning a fully-resolved Node, or an error if loading/parsing fails.
Integration:
Update the configuration loading pipeline so that after deserializing the YAML into the manifest types, we immediately convert all parts (rootnet, subnets, etc.) into their internal counterparts. This ensures that by the time our application logic uses the configuration, all nodes are in a consistent, fully loaded state.
Example Code Snippet:
This change ensures that the conversion from raw (manifest) configuration to internal configuration is performed eagerly, avoiding any deferred/lazy loading of external files.
Acceptance Criteria:
The text was updated successfully, but these errors were encountered: