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
The bottom-up validation has caused a regression in config add-dir. I can verify that this bug doesn't exist on master when #398 is reverted.
This happens when the directory added contains, say, ibc0.json, ibc1.json, path1.json (note that the path configuration is alphabetically later than the chain configurations).
It appears that the bottom-up validation assumes that the chains for all added paths are already configured and running. This doesn't cause problems with two-chainz because the path is in demo.yaml which is read before the chain configurations.
Because the add dir command ranges over the files provided in the specified directory we cannot know if chain path comes before or after the chain config files. When we try to check the paths without the chain config files being set, we naturally panic.
Note, the code in this function is fairly hacky. It attempts to unmarshal the file into a chain and then checks to see if the chain parameters are empty. This seems like surface area for bugs. I think ideally, while still enabling UX, we should have config files be under chains/ and paths/. Adding more directories isn't ideal, especially if the directory in most cases only has one file, but if anyone uses this in production they may have many paths and having 20 files in one directory probably isn't clean either.
This is not a bug in the validation logic.
Proposed Fixes
Short term: Validate all path ends after all the files are added. After this loop ends, range over the config paths, then range over each path end in each path, and validate the path end.
Long term: Take in separate directories for chains and paths being added. Add all the chains then add all the paths and validate them as they are added. This should cleanup the code and reduce the surface area for more bugs in the future
The bottom-up validation has caused a regression in
config add-dir
. I can verify that this bug doesn't exist on master when #398 is reverted.This happens when the directory added contains, say,
ibc0.json
,ibc1.json
,path1.json
(note that the path configuration is alphabetically later than the chain configurations).It appears that the bottom-up validation assumes that the chains for all added paths are already configured and running. This doesn't cause problems with
two-chainz
because the path is indemo.yaml
which is read before the chain configurations.To reproduce:
The text was updated successfully, but these errors were encountered: