Skip to content

fix(vyper): correct shift and division assignment operator mappings - #3067

Open
racequite wants to merge 1 commit into
crytic:masterfrom
racequite:master
Open

fix(vyper): correct shift and division assignment operator mappings#3067
racequite wants to merge 1 commit into
crytic:masterfrom
racequite:master

Conversation

@racequite

Copy link
Copy Markdown

Description

Fix incorrect Vyper AST operator mappings for shift operations and division assignment.

Previously, Vyper Shr and Shl were mapped to the opposite binary operators, so >> could be parsed as << and vice versa. The augmented assignment mapping had the same issue for >>= and <<=, and also mapped Div to -= instead of /=.

These operator strings are passed into BinaryOperationType.get_type() and AssignmentOperationType.get_type(), so the incorrect mapping could affect SlithIR generation and analyses that depend on arithmetic or bitwise semantics.

Changes

  • Map Shr to >> and Shl to <<
  • Map Div augmented assignment to /=
  • Map Shr to >>= and Shl to <<=
  • Add unit tests covering the affected Vyper operator mappings

Testing

python -m pytest tests/unit/vyper_parsing/test_ast.py -q
image

@racequite
racequite requested a review from smonicas as a code owner July 31, 2026 16:19
@CLAassistant

CLAassistant commented Jul 31, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants