diff --git a/docs/rfc/003-imports-stabilization.md b/docs/rfc/003-imports-stabilization.md index 5fe231a643..98d89e878e 100644 --- a/docs/rfc/003-imports-stabilization.md +++ b/docs/rfc/003-imports-stabilization.md @@ -25,9 +25,7 @@ that we suggest few changes to Leo CLI and Manifest: - allow custom names for imports to manually resolve name conflicts; - add "curve" and "proving system" sections to the Manifest; - add "include" and "exclude" parameters for "proving system" and "curve"; - -Later this solution can be improved by adding a lock-file which would lock -imported packages based on both their contents and version. +- add a lock file which would store imported dependencies and their relations; # Motivation @@ -109,12 +107,7 @@ To support updated Manifest new command should be added to Leo CLI. ```bash # pull imports -leo install -``` - -Alternatively it can be called `pull`. -``` -leo pull +leo fetch ``` ## Imports Restructurization @@ -155,6 +148,44 @@ first-program => author1-program@0.1.0 second-program => author2-program2@1.0.4 ``` +## Leo.lock + +For imports map to be generated and read by the Leo binary and then by the Leo compiler, +lock file needs to be created. Lock file should be generated by the `leo fetch` command +which will pull the dependencies, process their manifests and put the required information +to the file in the root directory of the program called `Leo.lock`. + +Suggested structure of this file is similar to the Cargo.lock file: + +``` +[[package]] +name = "suit-mk2" +version = "0.2.0" +author = "ironman" +import_name = "suit-mk2" + +[package.dependencies] +garbage = "ironman-suit@0.1.0" + +[[package]] +name = "suit" +version = "0.1.0" +author = "ironman" +import_name = "garbage" +``` + +In the example above you can see that all program dependencies are defined as an +array called `package`, and each of the dependencies contains main information about +it, including the `import_name` field which is the name of the imported package in +the Leo program. Also, it stores relationships between these dependencies in the +field `dependencies`. + +Format described here allows the Leo binary to form an imports map which can be +passed to the compiler. + +It is important to note that Leo.lock file is created only when package has dependencies. +For programs with no dependencies lock file is not required and not created. + ## Recursive Dependencies This improvement introduces recursive dependencies. To solve this case preemptively