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][Compiler-v2] MISSING_ACQUIRES_ANNOTATION error in AptosTokenObjects #11692

Closed
rahxephon89 opened this issue Jan 18, 2024 · 0 comments Β· Fixed by #11701
Closed

[Bug][Compiler-v2] MISSING_ACQUIRES_ANNOTATION error in AptosTokenObjects #11692

rahxephon89 opened this issue Jan 18, 2024 · 0 comments Β· Fixed by #11701
Labels
bug Something isn't working compiler-v2 stale-exempt Prevents issues from being automatically marked and closed as stale

Comments

@rahxephon89
Copy link
Contributor

πŸ› Bug

When running V2 against some tests in AptosToken and AptosTokenObjects, the following error will be generated:

β”Œβ”€β”€ test_invalid_update ──────
β”‚ Test did not error as expected. Expected test to abort with code 65537 originating in the module 0000000000000000000000000000000000000000000000000000000000000001::from_bcs but instead it gave a UNEXPECTED_VERIFIER_ERROR (code 2017) error originating in the module 0000000000000000000000000000000000000000000000000000000000000004::property_map rooted here{
β”‚     message: Unexpected verifier/deserialization error! This likely means there is code stored on chain that is unverifiable!
β”‚ Error: VMError { major_status: MISSING_ACQUIRES_ANNOTATION, sub_status: None, message: None, exec_state: None, location: Module(ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000004, name: Identifier("property_map") }), indices: [(FunctionDefinition, 11)], offsets: [(FunctionDefinitionIndex(11), 6)] },
β”‚     major_status: UNEXPECTED_VERIFIER_ERROR,
β”‚     sub_status: None,
β”‚     location: 0x4::property_map,
β”‚     indices: [(FunctionDefinition, 11)],
β”‚     offsets: [(FunctionDefinitionIndex(11), 6)],
β”‚     exec_state: None,
β”‚ }
└──────────────────

The error is raised from this function:

    public fun read_address<T: key>(object: &Object<T>, key: &String): address acquires PropertyMap {
        let value = read_typed<T, address>(object, key);
        from_bcs::to_address(value)
    }

From the following generated bytecode:

public read_address<Ty0: key>(Arg0: &Object<Ty0>, Arg1: &String): address /* def_idx: 11 */ {
L0:	loc2: vector<u8>
L1:	loc3: String
L2:	loc4: String
L3:	loc5: String
L4:	loc6: String
L5:	loc7: vector<u8>
L6:	loc8: vector<u8>
L7:	loc9: vector<u8>
B0:
	0: MoveLoc[0](Arg0: &Object<Ty0>)
	1: StLoc[2](loc0: &Object<Ty0>)
	2: MoveLoc[1](Arg1: &String)
	3: StLoc[3](loc1: &String)
	4: MoveLoc[2](loc0: &Object<Ty0>)
	5: MoveLoc[3](loc1: &String)
	6: Call read<Ty0>(&Object<Ty0>, &String): String * vector<u8>
        ....

We can see that at instr 6, Call is used instead of CallGeneric, which is suspicious.

@rahxephon89 rahxephon89 added bug Something isn't working stale-exempt Prevents issues from being automatically marked and closed as stale compiler-v2 labels Jan 18, 2024
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 stale-exempt Prevents issues from being automatically marked and closed as stale
Projects
Status: βœ… Done
Development

Successfully merging a pull request may close this issue.

1 participant