fix(Languages/{es,en}/29_Selector): pass address, not string, to abi.encodeWithSelector - #915
Open
vuyua9 wants to merge 1 commit into
Open
Conversation
…encodeWithSelector
The Spanish and English localizations of 29_Selector pass the mint(address)
argument as a string literal instead of an address literal:
abi.encodeWithSelector(0x6a627842, "0x2c44b726ADF1963cA47Af88B284C06f30380fC78")
The selector 0x6a627842 is mint(address), so abi.encodeWithSelector expects an
address argument. Passing a string produces a different calldata encoding
(string offset + length + bytes payload) than the address encoding the chapter
documents (4-byte selector + 32-byte left-padded address):
0x6a6278420000000000000000000000002c44b726adf1963ca47af88b284c06f30380fc78
The pt-br localization already passes the argument as an address literal
(without quotes); this PR brings es and en in line with pt-br and with the
calldata documented in the same chapter.
Files changed:
- Languages/es/29_Selector_es/Selector.sol
- Languages/es/29_Selector_es/readme.md
- Languages/en/29_Selector_en/Selector.sol
- Languages/en/29_Selector_en/readme.md
Four single-line edits, +4/-4.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & Why
The Spanish and English localizations of
29_Selectorpass themint(address)argument toabi.encodeWithSelectoras a string literal instead of an address literal:The selector
0x6a627842ismint(address), soabi.encodeWithSelectorexpects anaddressargument. Passing astringproduces a completely different calldata encoding (string offset + length + bytes payload) than the 4-byte selector + 32-byte left-padded address the chapter itself documents just above the example:The pt-br localization already passes the argument correctly as an
addressliteral (no quotes). This PR bringsesandenin line withpt-brand with the documented calldata.Files
Languages/es/29_Selector_es/Selector.solLanguages/es/29_Selector_es/readme.mdLanguages/en/29_Selector_en/Selector.solLanguages/en/29_Selector_en/readme.mdFour single-line edits,
+4 / -4. Each change is exactly:Type of PR
Cross-reference
The pt-br version (
Languages/pt-br/29_Selector/Selector.sol) was used as the canonical correct pattern.