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

chore: add test for compute_calls_instructions_len #1183

Merged
merged 20 commits into from Dec 15, 2023

Conversation

Br1ght0ne
Copy link
Member

@Br1ght0ne Br1ght0ne commented Nov 1, 2023

Close #1129.

I added a test case for an empty (random) contract, would like some feedback on what kinds of non-empty contracts to test.

Checklist

  • I have linked to any relevant issues.
  • I have updated the documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary labels.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@iqdecay
Copy link
Contributor

iqdecay commented Nov 1, 2023

This PR should test all the combinations of possible compute_calls_instructions_len, which, from memory, depend on whether we use nested heap types or not, whether we use simple types, or heap types. There should be at least 3 cases IIRC. Also depends, if the Enum returned has heap types as variants, then the length returned is different based on the variant that the discriminant points to.

@Br1ght0ne
Copy link
Member Author

@iqdecay Thank you for the pointers - will do.

@Br1ght0ne Br1ght0ne marked this pull request as draft November 1, 2023 15:56
@Br1ght0ne Br1ght0ne marked this pull request as ready for review November 7, 2023 14:04
MujkicA
MujkicA previously approved these changes Nov 8, 2023
Copy link
Contributor

@MujkicA MujkicA left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@digorithm digorithm left a comment

Choose a reason for hiding this comment

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

LGTM -- just a minor documentation-related nit.

packages/fuels-programs/src/call_utils.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@iqdecay iqdecay left a comment

Choose a reason for hiding this comment

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

I think we could make these tests test "harder" our assumptions, which are so convoluted it's better we keep testing them and document it.

packages/fuels-programs/src/call_utils.rs Outdated Show resolved Hide resolved
packages/fuels-programs/src/call_utils.rs Outdated Show resolved Hide resolved
packages/fuels-programs/src/call_utils.rs Outdated Show resolved Hide resolved
iqdecay
iqdecay previously approved these changes Dec 1, 2023
Copy link
Contributor

@iqdecay iqdecay left a comment

Choose a reason for hiding this comment

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

great!

Copy link
Contributor

@hal3e hal3e left a comment

Choose a reason for hiding this comment

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

This looks very good. Left some small suggestions.

packages/fuels-programs/src/call_utils.rs Outdated Show resolved Hide resolved
packages/fuels-programs/src/call_utils.rs Outdated Show resolved Hide resolved
packages/fuels-programs/src/call_utils.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@MujkicA MujkicA left a comment

Choose a reason for hiding this comment

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

Nice

Copy link
Contributor

@hal3e hal3e left a comment

Choose a reason for hiding this comment

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

Thanks!

@Br1ght0ne Br1ght0ne enabled auto-merge (squash) December 13, 2023 19:26
@Br1ght0ne Br1ght0ne merged commit f74e9bb into master Dec 15, 2023
40 checks passed
@Br1ght0ne Br1ght0ne deleted the oleksii/test-compute-instruction-len branch December 15, 2023 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test: test compute_call_instructions_len
6 participants