aptos-core
aptos-core copied to clipboard
[compiler-v2][linter] Support attributes to suppress specific lint warnings
Description
In this PR, we add support for suppressing specific lint warnings via attributes on functions and modules.
For example, when lint checks are enabled, running compiler v2 on the following code will report a warning:
module 0xc0ffee::m {
public fun test(x: u8) {
if (x < 0) abort 1;
}
}
But, you can now add one or more lint checks to skip using the #[lint::skip(...)] attribute. For the code below, we will not report a warning when lint checks are enabled in compiler v2.
module 0xc0ffee::m {
#[lint::skip(unnecessary_numerical_extreme_comparison)]
public fun test(x: u8) {
if (x < 0) abort 1;
}
}
Multiple lint checks can also be suppressed: #[lint::skip(blocks_in_conditions, while_true)].
Important notes for the reviewer
- Lint checks are not yet directly exposed to the user, and can only be exercised when compiling with v2 and
MVC_EXP=lint-checks=onenv flag. - Many error checks on the attribute
#[lint::skip(...)]are performed only when lint checks are enabled. General checks on attributes (such as, unknown top-level attribute name such as#[lint::skippps], misplaced attribute) done regardless of whether lint checks are on, but once we have a syntactically well-formed#[lint::skip(...)]attribute, further checks are only performed when lint checks are enabled (i.e., because this is tool specific, it is offloaded to the tool). - Based on the above point, we do not perform further extensive checks on
#[lint::skip(...)]attribute when using compiler v1, which does not have a linter. To allow a user to use compiler v1 and v2 on the same code base, we probably do not want to throw an error/warning on seeing#[lint::skip(...)]attributes when using compiler v1, but this can be discussed (and whatever we want to do could be done in a followup PR).
Type of Change
- [x] New feature
Which Components or Systems Does This Change Impact?
- [x] Move/Aptos Virtual Machine
How Has This Been Tested?
- Several new tests were added to check the newly added functionality
- All baseline updates of existing tests were checked for sanity
⏱️ 5h 25m total CI duration on this PR
🚨 1 job on the last run was significantly faster/slower than expected
| Job | Duration | vs 7d avg | Delta |
|---|---|---|---|
| forge-e2e-test / forge | 22m | 14m |
This stack of pull requests is managed by Graphite. Learn more about stacking.
Join @vineethk and the rest of your teammates on
Graphite
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 59.6%. Comparing base (
25c9f79) to head (ed908e4). Report is 4 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #14362 +/- ##
========================================
Coverage 59.6% 59.6%
========================================
Files 839 840 +1
Lines 205183 205286 +103
========================================
+ Hits 122293 122390 +97
- Misses 82890 82896 +6
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Forge is running suite compat on d1bf834728a0cf166d993f4728dfca54f3086fb0 ==> d392cf016fb9211e6997bcb455523abafec6ccb2
- Grafana dashboard (auto-refresh)
- Humio Logs
- Axiom Logs
- Validator CPU Profile
- Fullnode CPU Profile
- Test runner output
- Test run is land-blocking
Forge is running suite realistic_env_max_load on d392cf016fb9211e6997bcb455523abafec6ccb2
- Grafana dashboard (auto-refresh)
- Humio Logs
- Axiom Logs
- Validator CPU Profile
- Fullnode CPU Profile
- Test runner output
- Test run is land-blocking
Forge is running suite framework_upgrade on d1bf834728a0cf166d993f4728dfca54f3086fb0 ==> d392cf016fb9211e6997bcb455523abafec6ccb2
- Grafana dashboard (auto-refresh)
- Humio Logs
- Axiom Logs
- Validator CPU Profile
- Fullnode CPU Profile
- Test runner output
- Test run is land-blocking
:white_check_mark: Forge suite realistic_env_max_load success on d392cf016fb9211e6997bcb455523abafec6ccb2
two traffics test: inner traffic : committed: 12144.61 txn/s, latency: 3275.56 ms, (p50: 3000 ms, p90: 3800 ms, p99: 5700 ms), latency samples: 4617660
two traffics test : committed: 99.98 txn/s, latency: 2704.61 ms, (p50: 2600 ms, p90: 3300 ms, p99: 6300 ms), latency samples: 1760
Latency breakdown for phase 0: ["QsBatchToPos: max: 0.254, avg: 0.219", "QsPosToProposal: max: 0.487, avg: 0.430", "ConsensusProposalToOrdered: max: 0.329, avg: 0.317", "ConsensusOrderedToCommit: max: 0.640, avg: 0.611", "ConsensusProposalToCommit: max: 0.960, avg: 0.928"]
Max non-epoch-change gap was: 0 rounds at version 0 (avg 0.00) [limit 4], 0.85s no progress at version 2529822 (avg 0.23s) [limit 15].
Max epoch-change gap was: 0 rounds at version 0 (avg 0.00) [limit 4], 7.42s no progress at version 2529820 (avg 7.42s) [limit 15].
Test Ok
- Grafana dashboard
- Humio Logs
- Axiom Logs
- Validator CPU Profile
- Fullnode CPU Profile
- Test runner output
- Test run is land-blocking
:white_check_mark: Forge suite compat success on d1bf834728a0cf166d993f4728dfca54f3086fb0 ==> d392cf016fb9211e6997bcb455523abafec6ccb2
Compatibility test results for d1bf834728a0cf166d993f4728dfca54f3086fb0 ==> d392cf016fb9211e6997bcb455523abafec6ccb2 (PR)
1. Check liveness of validators at old version: d1bf834728a0cf166d993f4728dfca54f3086fb0
compatibility::simple-validator-upgrade::liveness-check : committed: 8711.42 txn/s, latency: 3382.48 ms, (p50: 1900 ms, p90: 6000 ms, p99: 34500 ms), latency samples: 399000
2. Upgrading first Validator to new version: d392cf016fb9211e6997bcb455523abafec6ccb2
compatibility::simple-validator-upgrade::single-validator-upgrading : committed: 4755.71 txn/s, latency: 5786.80 ms, (p50: 4500 ms, p90: 8800 ms, p99: 11000 ms), latency samples: 92920
compatibility::simple-validator-upgrade::single-validator-upgrade : committed: 6526.35 txn/s, latency: 4690.35 ms, (p50: 4500 ms, p90: 7600 ms, p99: 7900 ms), latency samples: 242400
3. Upgrading rest of first batch to new version: d392cf016fb9211e6997bcb455523abafec6ccb2
compatibility::simple-validator-upgrade::half-validator-upgrading : committed: 7762.07 txn/s, latency: 3524.38 ms, (p50: 3900 ms, p90: 4200 ms, p99: 4400 ms), latency samples: 140180
compatibility::simple-validator-upgrade::half-validator-upgrade : committed: 7458.16 txn/s, latency: 4285.97 ms, (p50: 4400 ms, p90: 6100 ms, p99: 6400 ms), latency samples: 246940
4. upgrading second batch to new version: d392cf016fb9211e6997bcb455523abafec6ccb2
compatibility::simple-validator-upgrade::rest-validator-upgrading : committed: 9598.94 txn/s, latency: 2641.71 ms, (p50: 2400 ms, p90: 5200 ms, p99: 6600 ms), latency samples: 210880
compatibility::simple-validator-upgrade::rest-validator-upgrade : committed: 6376.08 txn/s, latency: 4971.59 ms, (p50: 2500 ms, p90: 11700 ms, p99: 12900 ms), latency samples: 240080
5. check swarm health
Compatibility test for d1bf834728a0cf166d993f4728dfca54f3086fb0 ==> d392cf016fb9211e6997bcb455523abafec6ccb2 passed
Test Ok
- Grafana dashboard
- Humio Logs
- Axiom Logs
- Validator CPU Profile
- Fullnode CPU Profile
- Test runner output
- Test run is land-blocking
:white_check_mark: Forge suite framework_upgrade success on d1bf834728a0cf166d993f4728dfca54f3086fb0 ==> d392cf016fb9211e6997bcb455523abafec6ccb2
Compatibility test results for d1bf834728a0cf166d993f4728dfca54f3086fb0 ==> d392cf016fb9211e6997bcb455523abafec6ccb2 (PR)
Upgrade the nodes to version: d392cf016fb9211e6997bcb455523abafec6ccb2
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1182.87 txn/s, submitted: 1185.99 txn/s, failed submission: 3.12 txn/s, expired: 3.12 txn/s, latency: 2662.48 ms, (p50: 2400 ms, p90: 4200 ms, p99: 6100 ms), latency samples: 106120
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1166.14 txn/s, submitted: 1167.96 txn/s, failed submission: 1.82 txn/s, expired: 1.82 txn/s, latency: 2728.71 ms, (p50: 2400 ms, p90: 5100 ms, p99: 7200 ms), latency samples: 102300
5. check swarm health
Compatibility test for d1bf834728a0cf166d993f4728dfca54f3086fb0 ==> d392cf016fb9211e6997bcb455523abafec6ccb2 passed
Upgrade the remaining nodes to version: d392cf016fb9211e6997bcb455523abafec6ccb2
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1236.67 txn/s, submitted: 1240.72 txn/s, failed submission: 4.05 txn/s, expired: 4.05 txn/s, latency: 2611.52 ms, (p50: 2400 ms, p90: 4200 ms, p99: 5400 ms), latency samples: 109860
Test Ok
- Grafana dashboard
- Humio Logs
- Axiom Logs
- Validator CPU Profile
- Fullnode CPU Profile
- Test runner output
- Test run is land-blocking
Forge is running suite compat on d1bf834728a0cf166d993f4728dfca54f3086fb0 ==> ed908e4f91916ba441f456966e914af3d1b2779a
- Grafana dashboard (auto-refresh)
- Humio Logs
- Axiom Logs
- Validator CPU Profile
- Fullnode CPU Profile
- Test runner output
- Test run is land-blocking
Forge is running suite realistic_env_max_load on ed908e4f91916ba441f456966e914af3d1b2779a
- Grafana dashboard (auto-refresh)
- Humio Logs
- Axiom Logs
- Validator CPU Profile
- Fullnode CPU Profile
- Test runner output
- Test run is land-blocking
Forge is running suite framework_upgrade on d1bf834728a0cf166d993f4728dfca54f3086fb0 ==> ed908e4f91916ba441f456966e914af3d1b2779a
- Grafana dashboard (auto-refresh)
- Humio Logs
- Axiom Logs
- Validator CPU Profile
- Fullnode CPU Profile
- Test runner output
- Test run is land-blocking
:white_check_mark: Forge suite compat success on d1bf834728a0cf166d993f4728dfca54f3086fb0 ==> ed908e4f91916ba441f456966e914af3d1b2779a
Compatibility test results for d1bf834728a0cf166d993f4728dfca54f3086fb0 ==> ed908e4f91916ba441f456966e914af3d1b2779a (PR)
1. Check liveness of validators at old version: d1bf834728a0cf166d993f4728dfca54f3086fb0
compatibility::simple-validator-upgrade::liveness-check : committed: 10219.78 txn/s, latency: 2850.35 ms, (p50: 2000 ms, p90: 3500 ms, p99: 30100 ms), latency samples: 424140
2. Upgrading first Validator to new version: ed908e4f91916ba441f456966e914af3d1b2779a
compatibility::simple-validator-upgrade::single-validator-upgrading : committed: 6253.67 txn/s, latency: 4277.57 ms, (p50: 4300 ms, p90: 5900 ms, p99: 6200 ms), latency samples: 118140
compatibility::simple-validator-upgrade::single-validator-upgrade : committed: 6691.37 txn/s, latency: 4581.83 ms, (p50: 4600 ms, p90: 7100 ms, p99: 7500 ms), latency samples: 223860
3. Upgrading rest of first batch to new version: ed908e4f91916ba441f456966e914af3d1b2779a
compatibility::simple-validator-upgrade::half-validator-upgrading : committed: 7143.77 txn/s, latency: 3968.89 ms, (p50: 4400 ms, p90: 4900 ms, p99: 5000 ms), latency samples: 132900
compatibility::simple-validator-upgrade::half-validator-upgrade : committed: 6238.36 txn/s, latency: 4927.68 ms, (p50: 5100 ms, p90: 5500 ms, p99: 7100 ms), latency samples: 239280
4. upgrading second batch to new version: ed908e4f91916ba441f456966e914af3d1b2779a
compatibility::simple-validator-upgrade::rest-validator-upgrading : committed: 11988.54 txn/s, latency: 2233.74 ms, (p50: 2400 ms, p90: 2600 ms, p99: 2800 ms), latency samples: 211040
compatibility::simple-validator-upgrade::rest-validator-upgrade : committed: 9350.53 txn/s, latency: 2910.86 ms, (p50: 2600 ms, p90: 3200 ms, p99: 12100 ms), latency samples: 393780
5. check swarm health
Compatibility test for d1bf834728a0cf166d993f4728dfca54f3086fb0 ==> ed908e4f91916ba441f456966e914af3d1b2779a passed
Test Ok
- Grafana dashboard
- Humio Logs
- Axiom Logs
- Validator CPU Profile
- Fullnode CPU Profile
- Test runner output
- Test run is land-blocking
:white_check_mark: Forge suite framework_upgrade success on d1bf834728a0cf166d993f4728dfca54f3086fb0 ==> ed908e4f91916ba441f456966e914af3d1b2779a
Compatibility test results for d1bf834728a0cf166d993f4728dfca54f3086fb0 ==> ed908e4f91916ba441f456966e914af3d1b2779a (PR)
Upgrade the nodes to version: ed908e4f91916ba441f456966e914af3d1b2779a
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1331.82 txn/s, submitted: 1334.72 txn/s, failed submission: 2.90 txn/s, expired: 2.90 txn/s, latency: 2379.75 ms, (p50: 2100 ms, p90: 4200 ms, p99: 5700 ms), latency samples: 119280
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1242.92 txn/s, submitted: 1244.54 txn/s, failed submission: 1.62 txn/s, expired: 1.62 txn/s, latency: 2600.97 ms, (p50: 2400 ms, p90: 4200 ms, p99: 5500 ms), latency samples: 107540
5. check swarm health
Compatibility test for d1bf834728a0cf166d993f4728dfca54f3086fb0 ==> ed908e4f91916ba441f456966e914af3d1b2779a passed
Upgrade the remaining nodes to version: ed908e4f91916ba441f456966e914af3d1b2779a
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1238.46 txn/s, submitted: 1240.68 txn/s, failed submission: 2.23 txn/s, expired: 2.23 txn/s, latency: 2484.08 ms, (p50: 2100 ms, p90: 4200 ms, p99: 6200 ms), latency samples: 111260
Test Ok
- Grafana dashboard
- Humio Logs
- Axiom Logs
- Validator CPU Profile
- Fullnode CPU Profile
- Test runner output
- Test run is land-blocking
:white_check_mark: Forge suite realistic_env_max_load success on ed908e4f91916ba441f456966e914af3d1b2779a
two traffics test: inner traffic : committed: 11972.73 txn/s, latency: 3321.25 ms, (p50: 3300 ms, p90: 3900 ms, p99: 4800 ms), latency samples: 4552300
two traffics test : committed: 99.96 txn/s, latency: 2739.58 ms, (p50: 2500 ms, p90: 3300 ms, p99: 10000 ms), latency samples: 1780
Latency breakdown for phase 0: ["QsBatchToPos: max: 0.259, avg: 0.223", "QsPosToProposal: max: 0.561, avg: 0.485", "ConsensusProposalToOrdered: max: 0.348, avg: 0.333", "ConsensusOrderedToCommit: max: 0.654, avg: 0.587", "ConsensusProposalToCommit: max: 0.986, avg: 0.919"]
Max non-epoch-change gap was: 0 rounds at version 0 (avg 0.00) [limit 4], 0.95s no progress at version 2529728 (avg 0.24s) [limit 15].
Max epoch-change gap was: 0 rounds at version 0 (avg 0.00) [limit 4], 7.41s no progress at version 2529726 (avg 7.41s) [limit 15].
Test Ok
- Grafana dashboard
- Humio Logs
- Axiom Logs
- Validator CPU Profile
- Fullnode CPU Profile
- Test runner output
- Test run is land-blocking