Skip to content
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

[Bug][move-compiler-v2] unbound function module in function_info.move:99:12 #13216

Closed
brmataptos opened this issue May 6, 2024 · 2 comments
Closed
Assignees
Labels
bug Something isn't working compiler-v2

Comments

@brmataptos
Copy link
Contributor

brmataptos commented May 6, 2024

🐛 Bug

@movekevin reports that a user reports:

I started getting recently these kind of errors on deployment:
error: unbound module
   ┌─ /home/.../move/https___github_com_aptos-labs_aptos-core_git_main/aptos-move/framework/aptos-framework/sources/function_info.move:99:12
   │
99 │     friend aptos_framework::function_info_tests;
   │            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Unbound module '(aptos_framework=0x1)::function_info_tests'
@brmataptos brmataptos added the bug Something isn't working label May 6, 2024
@brmataptos brmataptos self-assigned this May 6, 2024
@brmataptos
Copy link
Contributor Author

I've managed to see this problem intermittently but can't reproduce it reliably. I think that (1) the libraries are being built without #[test_only] code, but then a user #[test] function which includes module aptos_framework::function_info may wind up parsing the #[test_only] friend ... at the end of that module which refers to a module (function_info_tests) which doesn't exist in the current compilation environment. The right solution may be to fix the compiler to silently ignore a friend declaration referring to an unknown module.

File aptos-move/framework/aptos/framework/tests/function_info_tests_.move has:

#[test_only]
module aptos_framework::function_info_tests {
...
}

and file aptos-move/framework/aptos-framework/sources/function_info.move has:

/// The `function_info` module defines the `FunctionInfo` type which simulates a function pointer.
module aptos_framework::function_info {
...
    // Test only dependencies so we can invoke those friend functions.
    #[test_only]
    friend aptos_framework::function_info_tests;
}

I think the problem is that (1) the #[test_only] code is excluded from the compiled Aptos Framework, but the

@brmataptos
Copy link
Contributor Author

This has been hard to reproduce, but I found it happening in a case where I had files from a previous build/tool left behind in a Move package build/ directory, which were found by the move-package mechanism to search for dependency source files.

We'll close this with 3 followup issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler-v2
Projects
Status: Done
Development

No branches or pull requests

2 participants