[moveos_std] Support general compare function in compare.move
#2418
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
In #2373, we introduce a
compare
module in moveos_std and providecompare_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:
The text was updated successfully, but these errors were encountered: