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

[Compiler-v2] Fix check_variant #14952

Merged
merged 3 commits into from
Oct 16, 2024
Merged

[Compiler-v2] Fix check_variant #14952

merged 3 commits into from
Oct 16, 2024

Conversation

rahxephon89
Copy link
Contributor

@rahxephon89 rahxephon89 commented Oct 13, 2024

Description

In the expansion phase, module access with the form A::B is translated into access of the variant B of enum A as ModuleAccess(M1, M2, Some(B)) when A has an alias M1::M2 where M1 is the name of the module where A is defined.

However, when A is both the name of a struct/enum type and the name of a module (which means M1 == A) and B is a constant, a struct/enum type, then A::B needs to be interpreted as ModuleAccess(M1, B, None). This PR refactors the implementation of check_variant(maccess: ModuleAccess)-> bool in the module_builder such that, instead of directly returning false when maccess takes the form ModuleAccess(M1, M2, Some(B)), it will return ModuleAccess(M1, B, None) if M1::B is a constant, schema or a struct.

Close #14950

How Has This Been Tested?

  1. existing tests pass;
  2. add a new test case.

Key Areas to Review

Corner cases such as when a type has an alias with the same name as the module in which it defines.

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 Oct 13, 2024

⏱️ 3h 57m total CI duration on this PR
Slowest 15 Jobs Cumulative Duration Recent Runs
execution-performance / single-node-performance 22m 🟩
rust-move-unit-coverage 16m 🟩
rust-move-unit-coverage 16m 🟩
rust-targeted-unit-tests 16m 🟩
rust-move-unit-coverage 16m 🟩
rust-move-unit-coverage 16m 🟩
rust-move-unit-coverage 15m 🟩
rust-move-unit-coverage 14m 🟩
check-dynamic-deps 12m 🟩🟩🟩🟩🟩 (+2 more)
rust-cargo-deny 11m 🟩🟩🟩🟩🟩 (+1 more)
rust-move-tests 10m 🟩
rust-move-tests 10m 🟩
rust-move-tests 10m 🟩
rust-move-tests 9m 🟩
rust-move-tests 9m 🟩

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

Job Duration vs 7d avg Delta
check-dynamic-deps 2m 1m +123%

settingsfeedbackdocs ⋅ learn more about trunk.io

Copy link
Contributor Author

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

Join @rahxephon89 and the rest of your teammates on Graphite Graphite

@rahxephon89 rahxephon89 changed the title fix check_variant [WIP][Compiler-v2] fix check_variant Oct 13, 2024
Copy link

codecov bot commented Oct 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.1%. Comparing base (b481f94) to head (b131f1b).
Report is 7 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (b481f94) and HEAD (b131f1b). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (b481f94) HEAD (b131f1b)
2 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main   #14952       +/-   ##
===========================================
- Coverage    71.7%    60.1%    -11.7%     
===========================================
  Files        2412      856     -1556     
  Lines      490526   211110   -279416     
===========================================
- Hits       351949   126962   -224987     
+ Misses     138577    84148    -54429     

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

@rahxephon89 rahxephon89 force-pushed the teng/fix-14950 branch 2 times, most recently from bdae453 to 1dda9aa Compare October 14, 2024 06:33
@rahxephon89 rahxephon89 changed the title [WIP][Compiler-v2] fix check_variant [WIP][Compiler-v2] Fix check_variant Oct 14, 2024
@rahxephon89 rahxephon89 changed the title [WIP][Compiler-v2] Fix check_variant [Compiler-v2] Fix check_variant Oct 14, 2024
@rahxephon89 rahxephon89 marked this pull request as ready for review October 14, 2024 07:18
} else {
true
(true, maccess.clone())
Copy link
Contributor

Choose a reason for hiding this comment

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

Under what condition would this case happen? Do we have tests that cover this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It covers all other cases where maccess cannot be interpreted as a variant so I don't think we need new test cases here.

@rahxephon89 rahxephon89 enabled auto-merge (squash) October 16, 2024 05:41

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

✅ Forge suite realistic_env_max_load success on b131f1b518847f44fdfacce84abbdf02cccf1baa

two traffics test: inner traffic : committed: 13497.47 txn/s, latency: 2947.81 ms, (p50: 2700 ms, p70: 3000, p90: 3300 ms, p99: 3800 ms), latency samples: 5132020
two traffics test : committed: 99.89 txn/s, latency: 2723.57 ms, (p50: 2500 ms, p70: 2700, p90: 2900 ms, p99: 9200 ms), latency samples: 1720
Latency breakdown for phase 0: ["QsBatchToPos: max: 0.234, avg: 0.219", "QsPosToProposal: max: 0.330, avg: 0.250", "ConsensusProposalToOrdered: max: 0.322, avg: 0.301", "ConsensusOrderedToCommit: max: 0.470, avg: 0.453", "ConsensusProposalToCommit: max: 0.773, avg: 0.754"]
Max non-epoch-change gap was: 0 rounds at version 0 (avg 0.00) [limit 4], 1.22s no progress at version 2404516 (avg 0.21s) [limit 15].
Max epoch-change gap was: 0 rounds at version 0 (avg 0.00) [limit 4], 7.98s no progress at version 2404514 (avg 7.98s) [limit 15].
Test Ok

Copy link
Contributor

✅ Forge suite compat success on 7eeba4cd15892717741a614add1afde004c7855f ==> b131f1b518847f44fdfacce84abbdf02cccf1baa

Compatibility test results for 7eeba4cd15892717741a614add1afde004c7855f ==> b131f1b518847f44fdfacce84abbdf02cccf1baa (PR)
1. Check liveness of validators at old version: 7eeba4cd15892717741a614add1afde004c7855f
compatibility::simple-validator-upgrade::liveness-check : committed: 13336.69 txn/s, latency: 2274.96 ms, (p50: 2100 ms, p70: 2200, p90: 3000 ms, p99: 8500 ms), latency samples: 512800
2. Upgrading first Validator to new version: b131f1b518847f44fdfacce84abbdf02cccf1baa
compatibility::simple-validator-upgrade::single-validator-upgrading : committed: 7452.11 txn/s, latency: 3865.33 ms, (p50: 4200 ms, p70: 4500, p90: 4700 ms, p99: 4800 ms), latency samples: 142180
compatibility::simple-validator-upgrade::single-validator-upgrade : committed: 6320.82 txn/s, latency: 4807.87 ms, (p50: 5000 ms, p70: 5200, p90: 5300 ms, p99: 6500 ms), latency samples: 239500
3. Upgrading rest of first batch to new version: b131f1b518847f44fdfacce84abbdf02cccf1baa
compatibility::simple-validator-upgrade::half-validator-upgrading : committed: 6773.48 txn/s, latency: 4185.62 ms, (p50: 4800 ms, p70: 5100, p90: 5300 ms, p99: 5400 ms), latency samples: 127320
compatibility::simple-validator-upgrade::half-validator-upgrade : committed: 6548.06 txn/s, latency: 4884.94 ms, (p50: 5000 ms, p70: 5100, p90: 6800 ms, p99: 7300 ms), latency samples: 219980
4. upgrading second batch to new version: b131f1b518847f44fdfacce84abbdf02cccf1baa
compatibility::simple-validator-upgrade::rest-validator-upgrading : committed: 5432.20 txn/s, latency: 4381.84 ms, (p50: 2500 ms, p70: 7000, p90: 8000 ms, p99: 12500 ms), latency samples: 126960
compatibility::simple-validator-upgrade::rest-validator-upgrade : committed: 9652.07 txn/s, latency: 2842.07 ms, (p50: 2800 ms, p70: 3000, p90: 3200 ms, p99: 5800 ms), latency samples: 368400
5. check swarm health
Compatibility test for 7eeba4cd15892717741a614add1afde004c7855f ==> b131f1b518847f44fdfacce84abbdf02cccf1baa passed
Test Ok

Copy link
Contributor

✅ Forge suite framework_upgrade success on 7eeba4cd15892717741a614add1afde004c7855f ==> b131f1b518847f44fdfacce84abbdf02cccf1baa

Compatibility test results for 7eeba4cd15892717741a614add1afde004c7855f ==> b131f1b518847f44fdfacce84abbdf02cccf1baa (PR)
Upgrade the nodes to version: b131f1b518847f44fdfacce84abbdf02cccf1baa
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1328.49 txn/s, submitted: 1329.65 txn/s, failed submission: 1.16 txn/s, expired: 1.16 txn/s, latency: 2414.16 ms, (p50: 2100 ms, p70: 2400, p90: 4000 ms, p99: 6000 ms), latency samples: 114320
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1210.04 txn/s, submitted: 1213.48 txn/s, failed submission: 3.44 txn/s, expired: 3.44 txn/s, latency: 2605.00 ms, (p50: 2400 ms, p70: 2700, p90: 4200 ms, p99: 6300 ms), latency samples: 105540
5. check swarm health
Compatibility test for 7eeba4cd15892717741a614add1afde004c7855f ==> b131f1b518847f44fdfacce84abbdf02cccf1baa passed
Upgrade the remaining nodes to version: b131f1b518847f44fdfacce84abbdf02cccf1baa
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1237.80 txn/s, submitted: 1240.91 txn/s, failed submission: 3.10 txn/s, expired: 3.10 txn/s, latency: 2665.32 ms, (p50: 2600 ms, p70: 3000, p90: 4200 ms, p99: 5100 ms), latency samples: 103700
Test Ok

@rahxephon89 rahxephon89 merged commit 0e4f5df into main Oct 16, 2024
85 of 95 checks passed
@rahxephon89 rahxephon89 deleted the teng/fix-14950 branch October 16, 2024 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants