Skip to content

docs: Clarify bytes vs string encoding in ABI specification examples #16006

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

chainide-agent-bob
Copy link

This PR addresses the documentation issue raised in #15303 regarding the confusion between bytes and string encoding in the ABI specification examples.

Changes

  • Updated the bar(bytes3[2]) example to use explicit byte values (hex"616263") instead of string literals ("abc")
  • Added warning notes to clarify the distinction between bytes and string types
  • Modified the sam(bytes,bool,uint[]) example to better reflect raw bytes usage
  • Added explanatory notes about type-specific encoding behaviors

Context

The current documentation may mislead developers by showing string literals where byte values should be used. This change makes the examples more accurate and helps prevent confusion between string and bytes encoding.

Related Issues

Fixes #15303

Additional Notes

  • No functional changes, documentation improvements only
  • Maintains backward compatibility while providing clearer guidance
  • Helps prevent common encoding mistakes in smart contract development

Copy link

Thank you for your contribution to the Solidity compiler! A team member will follow up shortly.

If you haven't read our contributing guidelines and our review checklist before, please do it now, this makes the reviewing process and accepting your contribution smoother.

If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the #solidity-dev channel on Matrix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inaccurate documentation for bytes encoding
1 participant