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

Improve test and abort safety with is_stack_unbiasable() check #13291

Closed
wants to merge 2 commits into from

Conversation

igor-aptos
Copy link
Contributor

Description

Implement safety measure as described in the AIP.

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
  • Other (specify)

How Has This Been Tested?

Key Areas to Review

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 May 15, 2024

⏱️ 3h 31m total CI duration on this PR
Job Cumulative Duration Recent Runs
rust-targeted-unit-tests 1h 6m 🟥🟩🟩
rust-move-unit-coverage 1h 2m 🟩🟩🟩
rust-move-tests 40m 🟥🟩🟩
rust-lints 17m 🟥🟥🟩
run-tests-main-branch 14m 🟩🟩🟩
general-lints 5m 🟩🟩🟩
check-dynamic-deps 4m 🟩🟩🟩
semgrep/ci 1m 🟩🟩🟩
file_change_determinator 20s 🟩🟩
file_change_determinator 18s 🟩🟩
permission-check 8s 🟩🟩
permission-check 5s 🟩🟩
permission-check 4s 🟩🟩
permission-check 4s 🟩🟩

🚨 1 job on the last run was significantly faster/slower than expected

Job Duration vs 7d avg Delta
run-tests-main-branch 5m 4m +30%

settingsfeedbackdocs ⋅ learn more about trunk.io

Copy link

codecov bot commented May 15, 2024

Codecov Report

Attention: Patch coverage is 68.57143% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 57.5%. Comparing base (7719765) to head (7c4ccd1).
Report is 19 commits behind head on main.

Files Patch % Lines
aptos-move/framework/src/natives/randomness.rs 66.6% 6 Missing ⚠️
...s-gas-schedule/src/gas_schedule/aptos_framework.rs 0.0% 3 Missing ⚠️
...hird_party/move/move-vm/runtime/src/interpreter.rs 81.8% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             main   #13291     +/-   ##
=========================================
- Coverage    57.6%    57.5%   -0.1%     
=========================================
  Files         834      834             
  Lines      198396   198584    +188     
=========================================
+ Hits       114325   114345     +20     
- Misses      84071    84239    +168     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@igor-aptos igor-aptos requested a review from vgao1996 May 15, 2024 22:15
Comment on lines +62 to +69
if context.gas_feature_version() >= RELEASE_V1_13 {
context.charge(RANDOMNESS_FETCH_AND_INCREMENT_BASE)?;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vgao1996 - should every native function charge some base gas, or if function is simple enough - charging of native call is enough?

i.e. randomness had no gas charging before, so I added it here. not sure if that is needed


if context.gas_feature_version() >= RELEASE_V1_13 {
context
.charge(RANDOMNESS_UNBIASABLE_CHECK_PER_STACK * NumArgs::new(visited))?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

is PerArg/NumArgs the best thing to use for per_count gas charge?

@igor-aptos igor-aptos force-pushed the igor/improve_test_and_abort_safety branch from da544d8 to 7c4ccd1 Compare May 16, 2024 06:01
@igor-aptos igor-aptos closed this Jun 3, 2024
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.

None yet

2 participants