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

[script-composer] Add infer functionality, fix multiple return values #15438

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

runtian-zhou
Copy link
Contributor

@runtian-zhou runtian-zhou commented Dec 2, 2024

Description

Fixes two issues for the script composer:

  1. The current code handled call convention incorrectly. The returned values are stored in the reverse order.
  2. Infer the operation type for copyable and droppable values, so that caller wouldn't need to distinguish between copy and move for those primitive values.

How Has This Been Tested?

Added three test cases:

  1. Created a function to return two values and make sure it can be stored properly.
  2. Created a transaction that invokes a function that returned a copyable and droppable value, and use the destructor twice. This can be built properly (positive case)
  3. Created a transaction that invokes a function that returned a droppable but not copyable value, and use the destructor twice. Builder will complain on this case (negative case)

Key Areas to Review

Whether we tested the two features sufficiently.

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Performance improvement
  • Refactoring
  • Dependency update
  • Documentation update
  • Tests

Which Components or Systems Does This Change Impact?

  • Validator Node
  • Full Node (API, Indexer, etc.)
  • Move/Aptos Virtual Machine
  • Aptos Framework
  • Aptos CLI/SDK
  • Developer Infrastructure
  • Move Compiler
  • Other (specify)

Checklist

  • I have read and followed the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I identified and added all stakeholders and component owners affected by this change as reviewers
  • I tested both happy and unhappy path of the functionality
  • I have made corresponding changes to the documentation

Copy link

trunk-io bot commented Dec 2, 2024

⏱️ 34m total CI duration on this PR
Job Cumulative Duration Recent Runs
rust-move-tests 13m 🟩
rust-move-tests 13m
rust-cargo-deny 4m 🟩🟩
check-dynamic-deps 2m 🟩🟩
general-lints 53s 🟩🟩
semgrep/ci 43s 🟩🟩
file_change_determinator 20s 🟩🟩
permission-check 5s 🟩🟩
permission-check 4s 🟩🟩
check-branch-prefix 1s 🟩

settingsfeedbackdocs ⋅ learn more about trunk.io

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@runtian-zhou runtian-zhou force-pushed the 12-02-_script-composer_add_infer_functionality_fix_multiple_return_values branch from c573176 to 7f016d4 Compare December 2, 2024 12:46
@runtian-zhou runtian-zhou marked this pull request as ready for review December 2, 2024 12:49
script
.code
.code
.push(Bytecode::StLoc((arg + parameters_count) as u8));
.push(Bytecode::StLoc((*arg + parameters_count) as u8));
Copy link
Contributor

Choose a reason for hiding this comment

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

Although not part of this PR, do we check for "returns + parameters < 255", or does that happen later when running the script?

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.

2 participants