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

inefficient selector table checks #3037

Open
charles-cooper opened this issue Aug 6, 2022 · 0 comments
Open

inefficient selector table checks #3037

charles-cooper opened this issue Aug 6, 2022 · 0 comments
Labels
bug - bytecode performance bug affecting bytecode performance (not correctness)

Comments

@charles-cooper
Copy link
Member

charles-cooper commented Aug 6, 2022

Version Information

  • vyper Version (output of vyper --version): v0.3.5
  • Python Version (output of python --version: 3.8.10

What's your issue about?

we perform a calldatasize >= 4 check (cf. #1603) even when no selectors have trailing 0s. when no selectors have trailing 0s, there is no risk of ambiguity with missing calldata bytes and so the check is not necessary

we perform a calldatasize == 4 check when there are no function arguments (cf. #2911). however when there are no trailing 0s, it can be omitted because the selector table already checks exact equality of the selector.

EDIT: we no longer perform the calldatasize == 4 check, rather we only ever perform checks of the first type (check calldatasize >= 4), see #3090.

How can it be fixed?

Fill this in if you know how to fix it.

@charles-cooper charles-cooper added the bug - bytecode performance bug affecting bytecode performance (not correctness) label Aug 6, 2022
@charles-cooper charles-cooper changed the title selector table checks optimize selector table checks Aug 6, 2022
@charles-cooper charles-cooper changed the title optimize selector table checks inefficient selector table checks Aug 6, 2022
emc415 added a commit to emc415/vyper that referenced this issue Sep 23, 2022
Addresses the first half of inefficient selector table checks (issue vyperlang#3037) by only running a check for calldatasize >= 4 if a zero selector function is present.
(wip: currently checks on all selectors which contain a 0)
emc415 added a commit to emc415/vyper that referenced this issue Sep 28, 2022
…lang#3037)

changed import and associated function calls
updated check for zero selector functions
removed/updated comments
emc415 added a commit to emc415/vyper that referenced this issue Sep 28, 2022
…g#3037)

Only performs a calldatasize == 4 check when there are trailing 0s in selector

wip: figure out whether to check hex, int, or bytecode of selector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug - bytecode performance bug affecting bytecode performance (not correctness)
Projects
None yet
Development

No branches or pull requests

1 participant