move icon indicating copy to clipboard operation
move copied to clipboard

[account-address] Make display and hex outputs consistent

Open gregnazario opened this issue 2 years ago • 7 comments

Motivation

Now, all default outputs should be 0xCAPS. Additionally, there is now a from_hex_fuzzy() which handles both 0x and non-0x inputs for the time being.

This is built as follows:

  1. from_hex -> Only hex characters, exact length
  2. from_hex_literal -> Only 0x with hex characters, with length extension
  3. from_hex_fuzzy -> Match either condition
  4. short_str_lossless -> With 0x, but drop leading 0s
  5. Drop the to_hex and to_hex_literal since we can now use Display or Debug using the proper formatter. Additionally to remove any confusion around it. All of are now consistent as upper case.

https://github.com/move-language/move/issues/53

gregnazario avatar Apr 19 '22 02:04 gregnazario

@tnowacki lmk how this looks

gregnazario avatar Apr 19 '22 02:04 gregnazario

Overall it looks fine to me! but I imagine there might be some changes if you have tests to fix (they are all red, not sure if related, looks like it might not be). Just ping me again when things are passing :)

tnowacki avatar Apr 19 '22 22:04 tnowacki

@tnowacki it looks like there is a compilation issue in addition to the tests failing, though the compilation issue doesn't look like it's due to me

gregnazario avatar Apr 20 '22 17:04 gregnazario

Does this fix https://github.com/diem/move/issues/141 ?

mkurnikov avatar Apr 22 '22 07:04 mkurnikov

Does this fix diem/move#141 ?

It should at least make it easier to fix :P, unsure right now if it fixes it or not

tnowacki avatar Apr 22 '22 16:04 tnowacki

Let's switch the calls in manifest_parser to from_hex_literal. Requesting changes to make sure we get those tests back from the revert.

Thanks for all of this! It should have been done long ago

Sorry, been very distracted on other things, I'll probably come back on a pass through this in a week or two.

gregnazario avatar Apr 28 '22 19:04 gregnazario

@gregnazario, ping me when you want another review! (looks like you are still working through some changes)

tnowacki avatar May 09 '22 16:05 tnowacki