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

Update cheatsheet.rst #15064

Merged
merged 1 commit into from May 2, 2024
Merged

Conversation

PatrickAlphaC
Copy link
Contributor

@PatrickAlphaC PatrickAlphaC commented Apr 27, 2024

The documentation currently says:

``abi.encodeCall(function functionPointer, (...)) returns (bytes memory)``: ABI-encodes a call to ``functionPointer`` with the arguments found in the
  tuple. Performs a full type-check, ensuring the types match the function signature. Result equals ``abi.encodeWithSelector(functionPointer.selector, (...))``

However, this is not correct.

abi.encodeWithSelector does not take a tuple as a second argument, instead, it takes an unended list of arguments. Saying these two are identical, is then not correct:

  • abi.encodeCall(function functionPointer, (...))
  • abi.encodeWithSelector(functionPointer.selector, (...))

It should be that these two are identical:

  • abi.encodeCall(function functionPointer, (...))
  • abi.encodeWithSelector(functionPointer.selector, ...)

subtle, but maybe there is a clearer way to say that encodeWithSelector is the same as the unpacked tuple from encodeCall.

The documentation currently says:

````
``abi.encodeCall(function functionPointer, (...)) returns (bytes memory)``: ABI-encodes a call to ``functionPointer`` with the arguments found in the
  tuple. Performs a full type-check, ensuring the types match the function signature. Result equals ``abi.encodeWithSelector(functionPointer.selector, (...))``
````

However, this is not correct.

`abi.encodeWithSelector` does not take a tuple as a second argument, instead, it takes an unended list of arguments. Saying these two are identical, is then not correct:

- `abi.encodeCall(function functionPointer, (...)) `
- `abi.encodeWithSelector(functionPointer.selector, (...))`

It should be that these two are identical:

- `abi.encodeCall(function functionPointer, (...)) `
- `abi.encodeWithSelector(functionPointer.selector, ...)`

subtle, but maybe there is a clearly way to say that `encodeWithSelector` is the same as the unpacked tuple from `encodeCall`.
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.

Copy link
Member

@r0qs r0qs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @PatrickAlphaC, thank you for catching that.

@r0qs r0qs requested review from nikola-matic, mehtavishwa30 and matheusaaguiar and removed request for nikola-matic May 2, 2024 16:26
@matheusaaguiar matheusaaguiar merged commit ae79d13 into ethereum:develop May 2, 2024
74 checks passed
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.

None yet

3 participants