pontem-network / dove

🛠️ Diem/Pontem Move package manager
MIT License
35 stars 13 forks source link

Named addresses not working with Dove run 1.6.0-86817ac #180

Open villesundell opened 2 years ago

villesundell commented 2 years ago

Hello! Using TaoHe, consider the following file, and place it to scripts/:

script {
    use TaoHe::Errors;

    fun dummy_1() {
        assert(true, Errors::ownable_not_owned());
    }
}

It results the following error message while running dove run -v "dummy_1()":

error[E03002]: unbound module
   ┌─ /home/ville/projects/taohe/scripts/dummy.move:17:9
   │
17 │     use TaoHe::Errors;
   │         ^^^^^^^^^^^^^ Invalid 'use'. Unbound module: 'TaoHe::Errors'

error[E03002]: unbound module
   ┌─ /home/ville/projects/taohe/scripts/dummy.move:20:22
   │
20 │         assert(true, Errors::ownable_not_owned());
   │                      ^^^^^^ Unbound module alias 'Errors'

...while this works fine (also you can use the upstream dummy() to verify this):

script {
    fun dummy_2() {
        assert(true, 123);
    }
}

TaoHe namespace (and even TaoHe::Errors) is used multiple times in sources/, and is compiling fine. This problem (or some variation of it) seems to occur with dove test too.

villesundell commented 2 years ago

This is still happening with 1.5.4, however, one should use the following file to replicate the error:

script {
    use TaoHe::Errors;

    fun dummy_1() {
        assert!(false, Errors::ownable_not_owned());
    }
}

The error message is also different now:

Execution failed due to unresolved type argument(s) (i.e., `--type-args 0x1::M:T` when there is no module named M at 0x1 or no type named T in module 0x1::M)

(Also, maybe dove prove is also experiencing the same problem?)

villesundell commented 2 years ago

This problem is still present in 1.6.0, and now the test problem fixed in 1.5.6 resurrected in 1.6.0.

The test problem being:

┌── test_wrap ──────
│ ITE: An unknown error was reported. Location: 
│ VMError (if there is one): VMError {
│     major_status: UNEXPECTED_VERIFIER_ERROR,
│     sub_status: None,
│     message: Some(
│         "Unexpected verifier/deserialization error! This likely means there is code stored on chain that is unverifiable!\nError: VMError { major_status: MISSING_DEPENDENCY, sub_status: None, message: None, location: Module(ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000001, name: Identifier(\"DiemAccount\") }), indices: [(FunctionHandle, 0)], offsets: [] }",
│     ),
│     location: Module(
│         ModuleId {
│             address: 0000000000000000000000000000000000000000000000000000000000000001,
│             name: Identifier(
│                 "DiemAccount",
│             ),
│         },
│     ),
│     indices: [
│         (
│             FunctionHandle,
│             0,
│         ),
│     ],
│     offsets: [],
│ }
└──────────────────

Might open a new issue for this for clarity :slightly_smiling_face: