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

Add VM error code #697

Merged
merged 1 commit into from
Nov 7, 2024
Merged

Add VM error code #697

merged 1 commit into from
Nov 7, 2024

Conversation

sausagee
Copy link
Contributor

@sausagee sausagee commented Nov 6, 2024

Description

Add VM error code FAILED_TO_DESERIALIZE_ARGUMENT

Checklist

CI

@sausagee sausagee requested a review from a team as a code owner November 6, 2024 00:21
@sausagee sausagee requested review from gregnazario and removed request for a team November 6, 2024 00:21
Copy link

vercel bot commented Nov 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
developer-docs-nextra ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 7, 2024 1:30am

Copy link

@ziaptos ziaptos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline comments optional

Copy link

@ziaptos ziaptos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline comments optional

@@ -107,6 +107,7 @@ sequence number and try again.
| RESOURCE_ALREADY_EXISTS | We tried to create a resource under an account where that resource already exists. | Check the contract and possibly change it to handle resources that already exist |
| UNKNOWN_STATUS | A reserved status to represent an unknown vm status. This is std::u64::MAX, but we can't pattern match on that, so put the hardcoded value in. | N/A |
| LINKER_ERROR | This may be due to the function has not been published on chain or by trying to call an invalid function as the result of either an incorrect account address, module name, or function name. This might not happen locally if the sources are available locally but have yet to be published on-chain. | There are many reasons, but you should check your account addresses, module names, and function names to determine that they're correct and published |
| FAILED_TO_DESERIALIZE_ARGUMENT | The is due to exceeding the limit on the number of nested or unpacked structs (including in a vector). The limit is currently 10. | N/A |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be other reasons for this error to be thrown (i.e. bad serialized format. Maybe we should say that as well?). Also for solution, we can say something like "Re-submit the transaction with fewer number of nested XYZ if possible?"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are other reasons for this right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC structs are checked, but the fields of these structs are not. https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/src/extended_checks.rs#L240

They are checked when the the arguments are deserialized. It would cause panic. The limit 10 is deduced drom the max number of overall args.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at transaction_arg_validation.rs, I see that error thrown in a few other places as well:

  1. When "The serialized arguments to constructor contained extra data" (line 290)
  2. When deserializing utf8 but struct_constructors are disabled (line 419)
  3. Same, but when the string argument is too long (line 432)
  4. When BCS deserialization fails for utf8 (line 441)
    ... Some more BCS deserialization errors

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Please re-review

Add VM error code `FAILED_TO_DESERIALIZE_ARGUMENT`
@sausagee sausagee merged commit 4cdcb91 into main Nov 7, 2024
5 checks passed
@sausagee sausagee deleted the sausagee-patch-1 branch November 7, 2024 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants