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] [break] Support TypeTag and StructTag to canonical string with prefix #2515

Merged
merged 9 commits into from
Aug 29, 2024

Conversation

baichuan3
Copy link
Collaborator

Summary

  1. Support TypeTag, StructTag and AccountAddress to canonical string with prefix 0x.
  2. Unify the canonical and non-canonical string format to
    0x00000000000000000000000000000001::string::String or
    0x0000000000000000000000000000000a::module_name1::type_name1<0x0000000000000000000000000000000a::module_name2::type_name2<u64>>

Other impacts include possible break of SDK and front-end applications, please confirm @wow-sven

  1. The to_canonical_string() method of TypeTag, StructTag and AccountAddress returns a prefix containing 0x by default
  2. The generated type name contains the 0x prefix
  3. Generation of NamedObjectID
  4. Generation of some field keys

Copy link

vercel bot commented Aug 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rooch-portal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 29, 2024 0:17am
rooch-portal-v2.1 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 29, 2024 0:17am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
rooch ⬜️ Ignored (Inspect) Visit Preview Aug 29, 2024 0:17am

Copy link

github-actions bot commented Aug 27, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

Copy link
Contributor

@jolestar jolestar left a comment

Choose a reason for hiding this comment

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

The named object ID in the unit test and the testsuit *.feature files also need to be updated.

moveos/moveos-types/src/move_types.rs Outdated Show resolved Hide resolved
let test_type_tag = TypeTag::from_str(type_tag_str)?;
assert_eq!(type_tag_str, test_type_tag.to_string());
assert_eq!(type_tag_canonical_str, test_type_tag.to_canonical_string());
Ok(())
}

#[test]
fn test_strange_format_type_tag() -> Result<()> {
let type_tag_str = "0x900f053234b0ba66ad062b277896b28e049f2813d388da375efcd54b6e429dbe::coin::Coin<0000000000000000000000000000000000000000000000000000000000000003::gas_coin::GasCoin>";
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an invalid type_tag_str, we do not need to support it.

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.

[Move] Add prefix to to_canonical_string
3 participants