aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

[Bug] Aptos TS/JS SDK calls the getAccountResources method to return a problem, the first 0 of the address is omitted.

Open cryptosunshine opened this issue 3 years ago • 5 comments

🐛 Bug

To reproduce Typescript

Code snippet to reproduce

# const client = new AptosClient('https://fullnode.devnet.aptoslabs.com');
# const address = "0x0ed74576610ef9dcc5a89b9aee9203fa31ca28189f34591406dbce556a6e5aae"
# client.getAccountResources(address).then(result)

Stack trace/error message

...
4: {type: '0xed74576610ef9dcc5a89b9aee9203fa31ca28189f34591406dbce556a6e5aae::Message::MessageHolder', data: {…}

Expect to return

...
4: {type: '0x0ed74576610ef9dcc5a89b9aee9203fa31ca28189f34591406dbce556a6e5aae::Message::MessageHolder', data: {…}

Question

In the address in the type,0 is missing during base conversion.

Supplementary question.

image

cryptosunshine avatar Aug 02 '22 07:08 cryptosunshine

Thanks for reporting. @banool, API returns the address with the leading 0 missing.

jjleng avatar Aug 02 '22 08:08 jjleng

I'll take a look, though this might be expected behaviour. Confusingly one of these trims zeroes while the other doesn't. I can audit this in the new API and make it work the same. Stay posted.

banool avatar Aug 02 '22 14:08 banool

Note, this behavior comes straight from the Move layer.

banool avatar Aug 03 '22 20:08 banool

This comes straight from the Move layer.

Struct names, function names, and other identifiers use a short str approach which trims the leading 0s

gregnazario avatar Sep 03 '22 01:09 gregnazario

This issue is stale because it has been open 45 days with no activity. Remove the stale label or comment - otherwise this will be closed in 15 days.

github-actions[bot] avatar Nov 07 '22 06:11 github-actions[bot]

This issue is stale because it has been open 45 days with no activity. Remove the stale label or comment - otherwise this will be closed in 15 days.

github-actions[bot] avatar Dec 24 '22 01:12 github-actions[bot]

I think whatever we have is going to be in a quirky state for a long time... but we should probably have a longer term tracking issue to identify where 0 is truncated....

davidiw avatar Dec 24 '22 05:12 davidiw