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

[move] Implement generic comparison method in move - move part (cmp::compare) #15245

Merged
merged 1 commit into from
Jan 11, 2025

Conversation

igor-aptos
Copy link
Contributor

Description

Separated out move part of the cmp::compare native call (first part is in the #14714), as it requires enums, and can only land after enums are enabled.

How Has This Been Tested?

Key Areas to Review

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 Nov 8, 2024

⏱️ 1h 3m total CI duration on this PR
Slowest 15 Jobs Cumulative Duration Recent Runs
rust-targeted-unit-tests 11m 🟥
check-dynamic-deps 11m 🟩🟩🟩🟩🟩
rust-cargo-deny 7m 🟩🟩🟥🟩🟩
rust-move-tests 6m 🟥
rust-move-tests 6m 🟥
rust-move-tests 4m 🟥
rust-lints 4m 🟩
rust-lints 4m 🟩
rust-move-tests 3m 🟥
general-lints 2m 🟩🟩🟩🟩🟩
semgrep/ci 2m 🟩🟩🟩🟩🟩
rust-check-merge-base 2m 🟩
file_change_determinator 55s 🟩🟩🟩🟩🟩
rust-move-tests 33s 🟥
permission-check 18s 🟩🟩🟩🟩🟩

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

Job Duration vs 7d avg Delta
check-dynamic-deps 4m 2m +176%

settingsfeedbackdocs ⋅ learn more about trunk.io

@igor-aptos igor-aptos force-pushed the igor/enable_move_2_for_framework branch from 686d2de to a85b7e7 Compare November 9, 2024 00:18
@igor-aptos igor-aptos force-pushed the igor/native_compare_move_part branch from 3e9fb56 to 52eebf4 Compare November 9, 2024 00:18
@igor-aptos igor-aptos force-pushed the igor/enable_move_2_for_framework branch from a85b7e7 to 2efd3d0 Compare November 12, 2024 18:04
@igor-aptos igor-aptos force-pushed the igor/native_compare_move_part branch from 52eebf4 to 6d8744d Compare November 12, 2024 18:05
/// - enum's are compared first by their variant, and if equal - they are compared as structs are.
native public(friend) fun compare<T>(first: &T, second: &T): Ordering;

public fun is_eq(self: &Ordering): bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

why not just eq, lt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

primarily to align with Rust naming - https://doc.rust-lang.org/std/cmp/enum.Ordering.html

but secondly, eq soudns much more like a binary operator (i.e. a.eq(b)), vs is_eq sounds like unary - compare(a, b).is_eq()

struct SomeStruct has drop {
field_1: u64,
field_2: u64,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: newline missing here

native public(friend) fun compare<T>(first: &T, second: &T): Ordering;

public fun is_eq(self: &Ordering): bool {
self is Ordering::Equal
Copy link
Contributor

Choose a reason for hiding this comment

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

can we have is_ne/ne? as well?

@igor-aptos igor-aptos force-pushed the igor/enable_move_2_for_framework branch from 2efd3d0 to 81dbdb6 Compare November 15, 2024 00:00
@igor-aptos igor-aptos force-pushed the igor/native_compare_move_part branch from 6d8744d to 3c7a17d Compare November 15, 2024 00:00
@igor-aptos igor-aptos force-pushed the igor/enable_move_2_for_framework branch from 81dbdb6 to 83e27b8 Compare November 15, 2024 20:59
@igor-aptos igor-aptos force-pushed the igor/native_compare_move_part branch from 3c7a17d to 7c84b5f Compare November 15, 2024 20:59
@igor-aptos igor-aptos force-pushed the igor/enable_move_2_for_framework branch from 83e27b8 to f72afc4 Compare November 19, 2024 20:42
@igor-aptos igor-aptos force-pushed the igor/native_compare_move_part branch from 7c84b5f to 0ea0a79 Compare November 19, 2024 20:43
@igor-aptos igor-aptos changed the base branch from igor/enable_move_2_for_framework to igor_copy/use-v2-as-default-in-rust-unit-tests January 7, 2025 20:58
@igor-aptos igor-aptos force-pushed the igor_copy/use-v2-as-default-in-rust-unit-tests branch from c5bf1b0 to 7a63894 Compare January 10, 2025 06:40
@igor-aptos igor-aptos force-pushed the igor/native_compare_move_part branch from 5e9556a to 7c1b9c7 Compare January 10, 2025 06:40
@igor-aptos igor-aptos force-pushed the igor_copy/use-v2-as-default-in-rust-unit-tests branch from 7a63894 to eb4b7a4 Compare January 10, 2025 07:30
@igor-aptos igor-aptos force-pushed the igor/native_compare_move_part branch from 7c1b9c7 to d6f7b1d Compare January 10, 2025 07:31
@igor-aptos igor-aptos force-pushed the igor_copy/use-v2-as-default-in-rust-unit-tests branch from eb4b7a4 to f8b9b81 Compare January 10, 2025 08:34
@igor-aptos igor-aptos force-pushed the igor/native_compare_move_part branch 2 times, most recently from ee38172 to 20d08b0 Compare January 10, 2025 22:40
@igor-aptos igor-aptos changed the base branch from igor_copy/use-v2-as-default-in-rust-unit-tests to main January 10, 2025 22:40
@igor-aptos igor-aptos force-pushed the igor/native_compare_move_part branch from 20d08b0 to 7093dad Compare January 10, 2025 23:08
@igor-aptos igor-aptos enabled auto-merge (rebase) January 10, 2025 23:09

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@igor-aptos igor-aptos force-pushed the igor/native_compare_move_part branch from 7093dad to b6298b6 Compare January 11, 2025 00:16

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

✅ Forge suite realistic_env_max_load success on b6298b6a1e154f26e5121c6ce89ad4d56aefeaf5

two traffics test: inner traffic : committed: 14983.38 txn/s, latency: 2652.82 ms, (p50: 2700 ms, p70: 2700, p90: 2800 ms, p99: 3000 ms), latency samples: 5697000
two traffics test : committed: 99.97 txn/s, latency: 1345.78 ms, (p50: 1300 ms, p70: 1400, p90: 1500 ms, p99: 1600 ms), latency samples: 1720
Latency breakdown for phase 0: ["MempoolToBlockCreation: max: 1.565, avg: 1.531", "ConsensusProposalToOrdered: max: 0.288, avg: 0.285", "ConsensusOrderedToCommit: max: 0.300, avg: 0.293", "ConsensusProposalToCommit: max: 0.588, avg: 0.578"]
Max non-epoch-change gap was: 0 rounds at version 0 (avg 0.00) [limit 4], 0.53s no progress at version 517 (avg 0.19s) [limit 15].
Max epoch-change gap was: 0 rounds at version 0 (avg 0.00) [limit 4], 0.55s no progress at version 2326746 (avg 0.55s) [limit 16].
Test Ok

Copy link
Contributor

✅ Forge suite compat success on 6593fb81261f25490ffddc2252a861c994234c2a ==> b6298b6a1e154f26e5121c6ce89ad4d56aefeaf5

Compatibility test results for 6593fb81261f25490ffddc2252a861c994234c2a ==> b6298b6a1e154f26e5121c6ce89ad4d56aefeaf5 (PR)
1. Check liveness of validators at old version: 6593fb81261f25490ffddc2252a861c994234c2a
compatibility::simple-validator-upgrade::liveness-check : committed: 16550.56 txn/s, latency: 2096.75 ms, (p50: 1700 ms, p70: 1800, p90: 3200 ms, p99: 12300 ms), latency samples: 548780
2. Upgrading first Validator to new version: b6298b6a1e154f26e5121c6ce89ad4d56aefeaf5
compatibility::simple-validator-upgrade::single-validator-upgrading : committed: 7784.01 txn/s, latency: 3877.67 ms, (p50: 4400 ms, p70: 4700, p90: 4800 ms, p99: 4900 ms), latency samples: 142820
compatibility::simple-validator-upgrade::single-validator-upgrade : committed: 7589.57 txn/s, latency: 4422.56 ms, (p50: 4800 ms, p70: 4900, p90: 4900 ms, p99: 5000 ms), latency samples: 253380
3. Upgrading rest of first batch to new version: b6298b6a1e154f26e5121c6ce89ad4d56aefeaf5
compatibility::simple-validator-upgrade::half-validator-upgrading : committed: 7884.46 txn/s, latency: 3766.07 ms, (p50: 4400 ms, p70: 4600, p90: 4700 ms, p99: 4800 ms), latency samples: 146380
compatibility::simple-validator-upgrade::half-validator-upgrade : committed: 7686.13 txn/s, latency: 4304.59 ms, (p50: 4600 ms, p70: 4800, p90: 4800 ms, p99: 4900 ms), latency samples: 261100
4. upgrading second batch to new version: b6298b6a1e154f26e5121c6ce89ad4d56aefeaf5
compatibility::simple-validator-upgrade::rest-validator-upgrading : committed: 11391.39 txn/s, latency: 2597.38 ms, (p50: 2800 ms, p70: 2900, p90: 3700 ms, p99: 3700 ms), latency samples: 199240
compatibility::simple-validator-upgrade::rest-validator-upgrade : committed: 5609.38 txn/s, submitted: 5609.54 txn/s, expired: 0.17 txn/s, latency: 2883.15 ms, (p50: 2800 ms, p70: 3300, p90: 3500 ms, p99: 3700 ms), latency samples: 373529
5. check swarm health
Compatibility test for 6593fb81261f25490ffddc2252a861c994234c2a ==> b6298b6a1e154f26e5121c6ce89ad4d56aefeaf5 passed
Test Ok

@igor-aptos igor-aptos merged commit f9334ca into main Jan 11, 2025
43 of 46 checks passed
@igor-aptos igor-aptos deleted the igor/native_compare_move_part branch January 11, 2025 01:27
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.

3 participants