Vyper
Testing & QualityvyperVyper is an Agent Skill for testing & quality published in the majiayu000/claude-skill-registry repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Vyper compiler internals - AST nodes, type system, compilation pipeline, IR generation for debugging codegen bugs
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/majiayu000/claude-skill-registry/blob/HEAD/skills/development/vyper/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/vyper, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Vyper Compiler Skill
Overview
Vyper is a Pythonic smart contract language for the EVM. The Vyper compiler transforms source code into EVM bytecode. In Ivy's differential fuzzing, we compare the compiled bytecode execution (via Boa) against Ivy's direct AST interpretation to find compiler bugs.
Installation
Vyper is already installed in the project's venv/. Always activate before use:
source venv/bin/activate
Reading Vyper Source Code
The Vyper compiler source is installed in the venv. To inspect it:
# Find vyper installation path
python -c "import vyper; print(vyper.__file__)"
# Typically at: venv/lib/python3.x/site-packages/vyper/
Key modules to understand:
vyper/ast/- AST node definitions and parsingvyper/semantics/- Type system and semantic analysisvyper/codegen/- IR and bytecode generationvyper/compiler/- Compilation pipeline
AST Structure
Vyper AST nodes are in vyper.ast.nodes. Key nodes:
from vyper.ast import nodes as ast
# Statement nodes
ast.Assign, ast.AnnAssign, ast.If, ast.For, ast.Return
ast.Assert, ast.Raise, ast.Pass, ast.Break, ast.Continue
# Expression nodes
ast.BinOp, ast.Compare, ast.BoolOp, ast.UnaryOp
ast.Call, ast.Subscript, ast.Attribute
ast.Name, ast.Int, ast.Str, ast.Bytes
Type System
from vyper.semantics.types import (
IntegerT, # int128, int256, uint8, uint256, etc.
BoolT, # bool
AddressT, # address
BytesT, # Bytes[N]
StringT, # String[N]
DArrayT, # DynArray[T, N]
SArrayT, # T[N] (static array)
HashMapT, # HashMap[K, V]
StructT, # struct definitions
TupleT, # tuples
)
Compilation Pipeline
from vyper.compiler import compile_code
from vyper.compiler.phases import CompilerData
# Get compiler data (AST, types, etc.)
compiler_data = CompilerData(source_code)
# Access annotated AST
annotated_ast = compiler_data.vyper_module
# Compile to bytecode
output = compile_code(source_code, output_formats=["bytecode", "abi"])
Debugging Tips
- When a divergence occurs, check if it's a compiler codegen bug:
- Compare the annotated AST against expected semantics
- Check if the IR generation is correct
- Verify bytecode matches IR intent
- Use
vyper.compile_code(src, output_formats=["ir"])to inspect IR - The
venompipeline (experimental) may have different bugs than legacy