aptos-labs / aptos-core

Aptos is a layer 1 blockchain built to support the widespread use of blockchain through better technology and user experience.
https://aptosfoundation.org
Other
6.07k stars 3.61k forks source link

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

Open brmataptos opened 2 months ago

brmataptos commented 2 months ago

šŸ› Bug

Running

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

Leads to 3 failures:

brmataptos commented 2 months ago

@rahxephon89

rahxephon89 commented 2 months ago

@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 commented 2 months ago

We may need V2 specific golden files for api tests. But I think we can close this one because we already have an issue https://github.com/aptos-labs/aptos-core/issues/13638 for it? @brmataptos

brmataptos commented 2 months ago

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 commented 2 months ago

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