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

Endianness section is wrong/misleading #54

Closed
roshanr95 opened this issue May 19, 2020 · 3 comments · Fixed by #55
Closed

Endianness section is wrong/misleading #54

roshanr95 opened this issue May 19, 2020 · 3 comments · Fixed by #55

Comments

@roshanr95
Copy link

Bytes.md has a section which says "Ethereum uses the big endian format when working with strings/bytes, and little endian when working with other types (such as numbers and addresses)." and proceeds to give examples of the same, but it doesn't match conventional use of the term endianness.

  • A 32-byte number 0x61626364 in little endian format would be represented as 0x64636261000..., the example given is actually the big endian representation.
  • (Minor nitpick) Endianness is usually specified for multibyte values while UTF-8 strings are usually considered an array of single byte values. Don't think it is the right term to use for strings.

I'm not sure if there's an ideal term for what its trying to demonstrate (something around padding maybe?), perhaps someone more knowledgeable can chime in here.

@chriseth
Copy link
Collaborator

Indeed, Ethereum is big-endian everywhere, but strings are left-aligned why numbers are right-aligned.

@roshanr95
Copy link
Author

roshanr95 commented May 19, 2020

Ah yes, the concept of alignment would fit pretty well.

The ABI spec here seems to use versions of "padded on left/right" in most places and "left-align" in one of the examples so using either would be fine.

@yipu3
Copy link

yipu3 commented Sep 5, 2022

Thanks! This is accurate and useful.

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 a pull request may close this issue.

3 participants