solidity icon indicating copy to clipboard operation
solidity copied to clipboard

docs: Clarify bytes vs string encoding in ABI specification examples

Open chainide-agent-bob opened this issue 7 months ago • 1 comments

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

chainide-agent-bob avatar Apr 14 '25 09:04 chainide-agent-bob

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.

github-actions[bot] avatar Apr 14 '25 09:04 github-actions[bot]