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] aptos-api tests fail with MOVE_COMPILER_V2=true #13869

Open
brmataptos opened this issue Jul 1, 2024 · 6 comments · May be fixed by #15408
Open

[Bug][move-compiler-v2] aptos-api tests fail with MOVE_COMPILER_V2=true #13869

brmataptos opened this issue Jul 1, 2024 · 6 comments · May be fixed by #15408
Labels
bug Something isn't working compiler-v2-stable compiler-v2 stale-exempt Prevents issues from being automatically marked and closed as stale

Comments

@brmataptos
Copy link
Contributor

🐛 Bug

Running

MOVE_COMPILER_V2=true cargo test --profile ci -p aptos-api

Leads to 3 failures:

  • tests::state_test::test_get_account_module has a different goldenfile, due to a bytecode signature difference.
    • It might be a good idea to generalize the test so that it can tolerate one of several golden file outputs, or perhaps to use a specific file when testing with MOVE_COMPILER_V2=true. This would be easy to add to api/test-context/src/golden_output.rs.
  • tests::accounts_test::test_get_account_modules_by_ledger_version reports:
Compiling, may take a little while to download git dependencies...
Warning: unknown field name found. Expected one of [name, version, authors, license], but found 'upgrade_policy'
Warning: unknown field name found. Expected one of [name, version, authors, license], but found 'upgrade_policy'
Compiling, may take a little while to download git dependencies...
Warning: unknown field name found. Expected one of [name, version, authors, license], but found 'upgrade_policy'
Warning: unknown field name found. Expected one of [name, version, authors, license], but found 'upgrade_policy'
thread 'tests::accounts_test::test_get_account_modules_by_ledger_version' panicked at /Users/brm/code/aptos-core/api/test-context/src/test_context.rs:976:9:
assertion `left == right` failed: 
response: {
  "message": "Failed to get resources from storage: failed to get prefixed state value iterator AptosDB Other Error: ledger version too new",
  "error_code": "internal_error",
  "vm_error_code": null
}

  left: 200
 right: 500
  • tests::transactions_test::test_get_account_transactions has a shorter error, perhaps because compilation output is mixed into the above output:
thread 'tests::transactions_test::test_get_account_transactions' panicked at /Users/brm/code/aptos-core/api/test-context/src/test_context.rs:976:9:
assertion `left == right` failed: 
response: {
  "message": "Failed to get resources from storage: failed to get prefixed state value iterator AptosDB Other Error: ledger version too new",
  "error_code": "internal_error",
  "vm_error_code": null
}

  left: 200
 right: 500
@brmataptos
Copy link
Contributor Author

@rahxephon89

@rahxephon89
Copy link
Contributor

@brmataptos, when I ran the command you gave, only one error is generated, which makes sense because V2 generates different bytecode:

---- tests::state_test::test_get_account_module stdout ----
thread 'tests::state_test::test_get_account_module' panicked at /....cargo/registry/src/index.crates.io-6f17d22bba15001f/goldenfile-1.6.0/src/differs.rs:15:5:
assertion failed: `(left == right)`'
  left: `"{\n  \"bytecode\": \"0xa11ceb0b060000000c010002020208030a2805322307557b08d0012006f0010a10fa019a010a94030d0ca1037e0d9f04060fa504040002000306000004070000050001000006020300000704050000080406000009070800000a0..."` (truncated)
 right: `"{\n  \"bytecode\": \"0xa11ceb0b060000000b010002020208030a2805322607587b08d3012010f301c0010ab3030d0cc00382010dc204060fc804040000000106000003070000060001000007030400000406070000080608000009090a0000020604000..."` (truncated)

Differences (-left|+right):
 {
-  "bytecode": "0xa11ceb0b060000000c010002020208030a2805322307557b08d0012006f0010a10fa019a010a94030d0ca1037e0d9f04060fa504040002000306000004070000050001000006020300000704050000080406000009070800000a040300000b090500000c0906000205070301080002050301080101060800010301050206080006080101010106080100076163636f756e74066f626a6563740467756964044755494402494406637265617465096372656174655f69640c6372656174696f6e5f6e756d0f63726561746f725f616464726573730565715f69640269640f69645f6372656174696f6e5f6e756d1269645f63726561746f725f616464726573730461646472000000000000000000000000000000000000000000000000000000000000000103080000000000000000126170746f733a3a6d657461646174615f763185010100000000000000001d45475549445f47454e455241544f525f4e4f545f5055424c49534845445b475549442067656e657261746f72206d757374206265207075626c6973686564206168656164206f66206669727374207573616765206f6620606372656174655f776974685f6361706162696c697479602066756e6374696f6e2e00000002010a080101020207030d0500030000050d0a01140c020a02060100000000000000160b01150b020b001201120002010100000a040b010b00120102020100000a050b00100010011402030100000a050b00100010021402040100000a050b0010000b012102050100000a040b0010001402060100000a040b0010011402070100000a040b00100214020000010001010000000100",
+  "bytecode": "0xa11ceb0b060000000b010002020208030a2805322607587b08d3012010f301c0010ab3030d0cc00382010dc204060fc804040000000106000003070000060001000007030400000406070000080608000009090a000002060400000a0b0700000b0b08000205070301080002030302050301080100010608000103010502060800060801010101060801046775696404475549440269640249440c6372656174696f6e5f6e756d046164647206637265617465096372656174655f69640f63726561746f725f616464726573730565715f69640f69645f6372656174696f6e5f6e756d1269645f63726561746f725f61646472657373076163636f756e74066f626a656374000000000000000000000000000000000000000000000000000000000000000114636f6d70696c6174696f6e5f6d6574616461746110010c322e302d756e737461626c650131126170746f733a3a6d657461646174615f763185010100000000000000001d45475549445f47454e455241544f525f4e4f545f5055424c49534845445b475549442067656e657261746f72206d757374206265207075626c6973686564206168656164206f66206669727374207573616765206f6620606372656174655f776974685f6361706162696c697479602066756e6374696f6e2e00000002010208010102020403050500030000020f0a01140601000000000000000c020c030a030b02160b01150b030b0012011200020101000005040b010b001201020201000005050b001000100114020301000005050b001000100214020401000005050b0010000b0121020501000005040b00100014020601000005040b00100114020701000005040b0010021402000001000101000c000d00",
   "abi": {
     "address": "0x1",
     "name": "guid",
     "friends": [


note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: run with `UPDATE_GOLDENFILES=1` to update goldenfiles
error: goldenfile changed: aptos_api__tests__state_test__test_get_account_module.json


failures:
    tests::state_test::test_get_account_module

@rahxephon89
Copy link
Contributor

rahxephon89 commented Jul 3, 2024

We may need V2 specific golden files for api tests.
But I think we can close this one because we already have an issue #13638 for it? @brmataptos

@sausagee sausagee added the stale-exempt Prevents issues from being automatically marked and closed as stale label Jul 10, 2024
@brmataptos
Copy link
Contributor Author

I still see the failure for test_get_account_transactions ("ledger version too new"), in addition to the golden file one:

---- tests::transactions_test::test_get_account_transactions stdout ----
thread 'tests::transactions_test::test_get_account_transactions' panicked at /Users/brm/code/aptos-core/api/test-context/src/test_context.rs:977:9:
assertion `left == right` failed: 
response: {
  "message": "Failed to get resources from storage: failed to get prefixed state value iterator AptosDB Other Error: ledger version too new",
  "error_code": "internal_error",
  "vm_error_code": null
}

  left: 200
 right: 500


failures:
    tests::state_test::test_get_account_module
    tests::transactions_test::test_get_account_transactions

@wrwg
Copy link
Contributor

wrwg commented Jul 17, 2024

If we want to use v2 as default for framework code this needs to be fixed.

@wrwg wrwg moved this from 🆕 New to 📋 Backlog in Move Language and Runtime Jul 17, 2024
@wrwg wrwg closed this as completed Aug 29, 2024
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Move Language and Runtime Aug 29, 2024
@wrwg wrwg reopened this Aug 29, 2024
@github-project-automation github-project-automation bot moved this from ✅ Done to 📋 Backlog in Move Language and Runtime Aug 29, 2024
@brmataptos brmataptos removed their assignment Sep 23, 2024
@vineethk
Copy link
Contributor

@rahxephon89 now that we are planning to use v2 for framework, should we just update the golden file? We can just have v2 only golden file?

@vineethk vineethk linked a pull request Jan 8, 2025 that will close this issue
22 tasks
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-stable compiler-v2 stale-exempt Prevents issues from being automatically marked and closed as stale
Projects
Status: 📋 Backlog
Development

Successfully merging a pull request may close this issue.

5 participants