-
Notifications
You must be signed in to change notification settings - Fork 717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Component] share loading entry for component and module #2945
Conversation
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
Hello, I am a code review bot on flows.network. Here are my reviews of code commits in this PR. The pull request titled "[Component] share loading entry for component and module" introduces significant changes to the existing software project. The changes include the creation of a new Component class which attributes "magic", "version", and "layer", and an addition of this Component enumeration, along with new methods in the Loader class. The Loader's logic to load the module has been modified to allow for component loading, and there is a stub implementation of a validate function for the new Component class. Firstly, a significant potential issue is the absence of validation logic for the new Component class, which may allow invalid or malformed components to pass the validation process. The error handling in newly added methods in the Loader class could be significantly improved, more specifically, those methods return a generic unformatted error if the "loadUnit" call fails. Moreover, the concurrent access and dependencies/side-effects of components have not been addressed in this pull request. Also, new methods being added without documentation might cause difficulties to other developers in correctly utilizing these new features. Aside from that, the PR implements some substantial changes such as the introduction of two new loading functions "loadUniversalWASM" and "loadModuleAOT" and modifications of component loading logic. There are also concerns with the PR like the lack of added test cases, need for better error handling, and possible readability issues due to cognitive complexity in some methods. Additionally, the PR makes changes to the "validate" function, but seems to be lacking in an explanation of the purpose and functionality of changes. There's also uncertainty about the impact on other modules using this function and whether the changes themselves are tested thoroughly. Another patch introduces component handling along with error messages upon failure, but the file validity checks or alternative execution pathways on failure are lacking. Furthermore, a worrying fact is the moved Ahead-Of-Time related methods might need adjustments across all the components relying on them. Affected unit tests should be updated to still cover these loading functions. Another significant aspect introduced is the ability to run WebAssembly files with new types of objects. However, this functionality appears to be incomplete and currently unvalidated, which could result in runtime errors. Lastly, the patch intending to avoid variable shadowing by passing the parsing results directly might make debugging challenging. It's not clear how the error situations are handled when the Wasm unit parsing fails. These changes could confuse other developers if the necessity of such changes is not well-documented. In conclusion, the pull request introduces a lot of new features and functions enhancing the existing capabilities but also brings several potential issues. Proper documentation, implementing full functionality, thorough testing, and clearer error handling should be the primary focus to make this PR safer and more beneficial. DetailsCommit 79db08fc0d01a259c6a43d059886433846bd2a14Key changes:
Potential problems:
Commit c4d345cce5cccb7752922e91ea2796a24680490bThe pull request "[Component] share loading entry for component and module" primarily makes changes to the loader code of an existing software component. The key changes in the pull request can be summarized as follows:
Also, the pull request results in a total reduction of 6 lines of code, suggesting refactoring and possible optimization. Potential Problems:
Commit 20852ae3b3263b5705debb61f99d0a5c48ab4cd2The key change in this patch that is titled "[PATCH 3/8] the missing validate for prototype" is in the file The original line read as follows: Expect<void> validate(const AST::Component &) { return {}; } The modified line reads as follows: Expect<void> Validator::validate(const AST::Component &) { return {}; } The main change here is that the Potential Issues:
Commit ac218b23eb738a7458fe48963cdd28de03ba59e7The changes in this pull request primarily involve replacing the "loadModule" method with the "loadWasmUnit" method in several places in the "vm.cpp" file. The replaced methods are part of conditional statements that check if the resources are correctly loaded. After replacing "loadModule" with "loadWasmUnit", the author also adds a new condition to check if the loaded resource is an instance of the AST::Module class. If the condition is true, the code continues the previously established flow; however, if it's false, it logs an error ("component executable is not done yet" or "component load is not done yet") and returns an unexpected result. Key Changes:
Potential Problems:
Commit 536cd4c0be31c82e75dfd8aef3328c25ea0a3d9aThe patch essentially moves some AOT (Ahead-Of-Time) related methods from Even though there is no modification in the methods' implementation, this change could have potential impacts on the codebase.
In terms of code quality, the patch looks fine. Undocumented public methods or classes may negatively impact maintainability. To help others understand the functionality more easily, it would be better if comments describing the methods were also included. The logging messages in English are good for troubleshooting, but if the software is meant to support multiple languages, consider adding support for localized error messages. Finally, it is also crucial to ensure that the changed files still adhere to the overall coding style and standards as the rest of your codebase. Commit 65bcec5556372e35c059a2180595bd4d34effd20The changes made introduces setup to run WebAssembly(WASM) files with
This update could cause potential issues:
Given that some of the implementation has not been completed yet and the lack of testing, it's not advisable to merge this pull request without further development and testing. Commit 3d1eed909671bd560aa99eacb26eaae491609c2fThis patch includes changes to the More particularly, the changes ensure that instead of declaring a new variable to store the parsed Wasm unit and then use that variable to call In terms of potential problems, the patch seems to be quite straightforward and doesn't introduce any complex changes that could lead to issues. However, one possible concern could be the removing of intermediate variables can make debugging slightly more challenging, as it's now less straightforward to examine the exact value of the module or component after parsing. Considerations might be made concerning error handling; more specifically, the case when parsing a Wasm unit fails. Although the |
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
Codecov Report
@@ Coverage Diff @@
## master #2945 +/- ##
==========================================
- Coverage 80.89% 80.75% -0.14%
==========================================
Files 150 151 +1
Lines 21638 21711 +73
Branches 4354 4394 +40
==========================================
+ Hits 17504 17533 +29
- Misses 2965 2999 +34
- Partials 1169 1179 +10
📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
leave error message for future component model validating & instantiation Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
dc9cc4e
to
360e8c0
Compare
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
@dannypsnl Please rebase to the latest master commit. |
I was originally want to keep component model in the branch till we complete all of them, but that will make it be hard to merge back at that time. My plan is, I will complete a loader automatically treat both of component and module binary in the same entry point in this PR, once I complete I will convert it to ready.
Then we will have a foundation for further development of component model.
The first step of #2943