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.16k stars 3.63k forks source link

[Bug] vm startup failure with gas parameter not exist #11529

Open sylviahuang123 opened 9 months ago

sylviahuang123 commented 9 months ago

testnet, when called the get_stake function, rpc respond { "message": "status VM_STARTUP_FAILURE of type Invariant violation with message VM Startup Failed. Gas parameter txn.write_data.new_item does not exist. Feature version: 13.", "error_code": "invalid_input", "vm_error_code": null }

logs from node cargo[3669654]: 2024-01-02T13:02:34.990513Z [api-27388] ERROR aptos-move/aptos-vm-logging/src/lib.rs:51 VM Startup Failed. Gas parameter txn.write_data.new_item does not exist. Feature version: 13. {"name":"miscellaneous","txn_idx":0}

wrwg commented 9 months ago

@vgao1996 could you check what the reason for this behavior could be?

vgao1996 commented 9 months ago

I'll take a deeper look. The error message Gas parameter txn.write_data.new_item does not exist. Feature version: 13. doesn't look right to me. The gas parameter txn.write_data.new_item is only required up to version 9. https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/aptos-gas-schedule/src/gas_schedule/transaction.rs#L107

vgao1996 commented 9 months ago

I can't seem to reproduce the error. I called the view function get_stake using the following command

aptos move view --function-id 0x1::stake::get_stake --profile testnet --args address:0xa69946a1fb8365a23e8244b3b3cadcaf819c481b31f10e2f0b6fee73af4b3553

and got the following result

{
  "Error": "API error: API error Error(InvalidInput): Failed to execute function: VMError { major_status: ABORTED, sub_status: Some(65550), message: Some(\"0x0000000000000000000000000000000000000000000000000000000000000001::stake::assert_stake_pool_exists at offset 6\"), exec_state: Some(ExecutionState { stack_trace: [(Some(ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000001, name: Identifier(\"stake\") }), FunctionDefinitionIndex(22), 1)] }), location: Module(ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000001, name: Identifier(\"stake\") }), indices: [], offsets: [(FunctionDefinitionIndex(5), 6)] }"
}

Here the query failed with error ESTAKE_POOL_DOES_NOT_EXIST but that's expected since there isn't a pool under the address I entered (0x1). The fact that this error is returned means the VM has successfully started and executed the view function.

Could you share the exact command you used?

It might also help if you could share a output of the aptos info command, so to help us identify the binary you are using. The info should look like this:

{
  "Result": {
    "build_branch": "",
    "build_cargo_version": "cargo 1.74.1 (ecb9851af 2023-10-18)",
    "build_clean_checkout": "true",
    "build_commit_hash": "2ad3009b8900822672f91de20c4421c3dfb63766",
    "build_is_release_build": "false",
    "build_os": "linux-x86_64",
    "build_pkg_version": "2.4.0",
    "build_profile_name": "debug",
    "build_rust_channel": "1.74.1-x86_64-unknown-linux-gnu",
    "build_rust_version": "rustc 1.74.1 (a28077b28 2023-12-04)",
    "build_tag": "",
    "build_time": "2024-01-10 00:31:56 +00:00",
    "build_using_tokio_unstable": "true"
  }
}
vgao1996 commented 9 months ago

Update: we are able to narrow the problem down to two nodes running an older version of the binary. Should be able to figure out a fix soon.

sylviahuang123 commented 8 months ago

update: solved after update to tag 1.9.0, and it's a pre-release version, but refer to the official doc, we use testnet branch, seems a bit irregular.