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

[moveos_std] Support general compare function in compare.move #2418

Closed
jolestar opened this issue Aug 12, 2024 · 0 comments · Fixed by #2495
Closed

[moveos_std] Support general compare function in compare.move #2418

jolestar opened this issue Aug 12, 2024 · 0 comments · Fixed by #2495
Labels
area:stdlib Move stdlib or framework issues help wanted Extra attention is needed skill::move Need the Move language skill to complete the issue
Milestone

Comments

@jolestar
Copy link
Contributor

In #2373, we introduce a compare module in moveos_std and provide compare_vector_u8 function.

We also need to provide a general compare<T>(v1: &T, v2: &T) function.

However, if we directly compare the bcs::to_bytes result, we cannot get the correct result when the T is a number.

https://github.com/aptos-labs/aptos-core/blob/f073f58af972428dce7a398d2bdc9d80495b601a/aptos-move/framework/aptos-stdlib/sources/comparator.move#L26-L35

One solution is to detect the type of T and use different compare strategies.

https://github.com/MystenLabs/sui/blob/58fd1d1d2cadec6fb2cc6b85df61727db56a2ad2/crates/sui-oracle/move/oracle/sources/meta_oracle.move#L79-L135

Dependents:

@jolestar jolestar added help wanted Extra attention is needed skill::move Need the Move language skill to complete the issue area:stdlib Move stdlib or framework issues labels Aug 12, 2024
@jolestar jolestar added this to the TBD milestone Aug 12, 2024
@jolestar jolestar modified the milestones: TBD, Rooch v0.7 Aug 23, 2024
@jolestar jolestar linked a pull request Aug 24, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this to Done in Rooch Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:stdlib Move stdlib or framework issues help wanted Extra attention is needed skill::move Need the Move language skill to complete the issue
Projects
Status: Done
1 participant