Skip to content

Commit

Permalink
Merge branch 'master' into feat/struct-methods
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Feb 19, 2025
2 parents d94f548 + c75a2da commit ed7ac89
Show file tree
Hide file tree
Showing 239 changed files with 14,845 additions and 2,746 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Bug Report
about: Any general feedback or bug reports about the Vyper Compiler. No new features proposals.
labels: ["needs triage"]
---

### Version Information
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/vip.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Vyper Improvement Proposal (VIP)
about: This is the suggested template for new VIPs.
labels: ["needs triage"]
---
## Simple Summary
"If you can't explain it simply, you don't understand it well enough." Provide a simplified and layman-accessible explanation of the VIP.
Expand Down
23 changes: 16 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-latest]
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v4
Expand All @@ -31,6 +31,10 @@ jobs:
# need to fetch unshallow so that setuptools_scm can infer the version
fetch-depth: 0

# debug
- name: Git shorthash
run: git rev-parse --short HEAD

- name: Python
uses: actions/setup-python@v5
with:
Expand All @@ -45,8 +49,9 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: vyper-${{ runner.os }}
path: dist/vyper.*

windows-build:
Expand All @@ -60,6 +65,10 @@ jobs:
# need to fetch unshallow so that setuptools_scm can infer the version
fetch-depth: 0

# debug
- name: Git shorthash
run: git rev-parse --short HEAD

- name: Python
uses: actions/setup-python@v5
with:
Expand All @@ -73,8 +82,9 @@ jobs:
./make.cmd freeze
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: vyper-${{ runner.os }}
path: dist/vyper.*

publish-release-assets:
Expand All @@ -84,14 +94,13 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: artifacts/
merge-multiple: true

- name: Upload assets
# fun - artifacts are downloaded into "artifact/".
# TODO: this needs to be tested when upgrading to upload-artifact v4
working-directory: artifacts/artifact
working-directory: artifacts
run: |
set -Eeuxo pipefail
for BIN_NAME in $(ls)
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ jobs:
with:
types: |
feat
perf
fix
chore
refactor
# ci: continuous integration
# docs: documentation
# test: test suite
# lang: language changes
# stdlib: changes to the stdlib
# ux: language changes (UX)
# parser: parser changes
# tool: integration
# ir: (old) IR/codegen changes
# codegen: lowering from vyper AST to codegen
Expand All @@ -42,7 +45,9 @@ jobs:
docs
test
lang
stdlib
ux
parser
tool
ir
codegen
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
# fetch unshallow so commit hash matches github release.
# see https://github.com/vyperlang/vyper/blob/8f9a8cac49aafb3fbc9dde78f0f6125c390c32f0/.github/workflows/build.yml#L27-L32
fetch-depth: 0

# debug
- name: Git shorthash
run: git rev-parse --short HEAD

- name: Python
uses: actions/setup-python@v5
Expand Down
140 changes: 127 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,45 @@ jobs:
- name: Run docs
run: sphinx-build -E -b html docs dist/docs -n -q --color

# Symbolic tests
symbolic-tests:
runs-on: "ubuntu-latest"
name: symbolic-tests

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"

- name: Install dependencies
run: pip install .[test]

- name: Install hevm
run: |
# hevm dependency
sudo apt-get install z3
wget --no-verbose -O hevm https://github.com/ethereum/hevm/releases/download/release/0.54.2/hevm-x86_64-linux
chmod +x hevm
mkdir -p "$HOME/.local/bin/"
mv hevm "$HOME/.local/bin/"
echo "$HOME/.local/bin/" >> $GITHUB_PATH
hevm version
- name: Run tests
run: >
pytest
-m "hevm"
--hevm
--cov-config=setup.cfg
--cov=vyper
tests/
# "Regular"/core tests.
tests:
runs-on: ${{ matrix.os || 'ubuntu' }}-latest
Expand Down Expand Up @@ -91,6 +130,12 @@ jobs:
- evm-version: paris
- evm-version: shanghai

# test pre-cancun with opt-codesize and opt-none
- evm-version: shanghai
opt-mode: none
- evm-version: shanghai
opt-mode: codesize

# test py-evm
- evm-backend: py-evm
evm-version: shanghai
Expand All @@ -110,6 +155,7 @@ jobs:
# modes across all python versions - one is enough
- python-version: ["3.10", "310"]
- python-version: ["3.12", "312"]
- python-version: ["3.13", "313"]

# os-specific rules
- os: windows
Expand Down Expand Up @@ -142,23 +188,24 @@ jobs:
--evm-backend ${{ matrix.evm-backend || 'revm' }}
${{ matrix.debug && '--enable-compiler-debug-mode' || '' }}
${{ matrix.experimental-codegen && '--experimental-codegen' || '' }}
--cov-branch
--cov-report xml:coverage.xml
--cov-config=setup.cfg
--cov=vyper
tests/
- name: Upload Coverage
uses: codecov/codecov-action@v3
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
name: coverage-files-${{ github.job }}-${{ strategy.job-index }}
include-hidden-files: true
path: .coverage
if-no-files-found: error

core-tests-success:
if: always()
# summary result from test matrix.
# see https://github.community/t/status-check-for-a-matrix-jobs/127354/7
runs-on: ubuntu-latest
needs: [tests]
needs: [tests, symbolic-tests]
steps:
- name: Check tests tests all succeeded
if: ${{ needs.tests.result != 'success' }}
Expand Down Expand Up @@ -202,16 +249,17 @@ jobs:
--splits 120 \
--group ${{ matrix.group }} \
--splitting-algorithm least_duration \
--cov-branch \
--cov-report xml:coverage.xml \
--cov-config=setup.cfg \
--cov=vyper \
tests/
- name: Upload Coverage
uses: codecov/codecov-action@v3
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
name: coverage-files-${{ github.job }}-${{ strategy.job-index }}
include-hidden-files: true
path: .coverage
if-no-files-found: error

slow-tests-success:
if: always()
Expand All @@ -224,3 +272,69 @@ jobs:
- name: Check slow tests all succeeded
if: ${{ needs.fuzzing.result != 'success' }}
run: exit 1

coverage-report:
# Consolidate code coverage using `coverage combine` and
# call coverage report with fail-under=90
runs-on: ubuntu-latest
needs: [tests, fuzzing]

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"

- name: Install coverage
run: pip install coverage

- name: Download coverage artifacts
uses: actions/download-artifact@v4
with:
pattern: coverage-files-*
path: coverage-files

- name: Combine coverage
run: |
coverage combine coverage-files/**/.coverage
- name: Coverage report
# coverage report and fail if coverage is too low
run: |
coverage report --fail-under=90
- name: Generate coverage.xml
run: |
coverage xml
- name: Upload coverage artifacts
# upload coverage sqlite db for debugging
# upload coverage.xml artifact for downstream codecov upload action
uses: actions/upload-artifact@v4
with:
name: coverage-artifacts
include-hidden-files: true
path: |
.coverage
coverage.xml
if-no-files-found: error

upload-coverage:
# upload coverage to the codecov app
runs-on: ubuntu-latest
needs: [coverage-report]

steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: coverage-artifacts

- name: Upload Coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ vyper/vyper_git_commithash.txt
*.spec

# mac
.DS_Store
.DS_Store
10 changes: 10 additions & 0 deletions FUNDING.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"drips": {
"ethereum": {
"ownedBy": "0x70CCBE10F980d80b7eBaab7D2E3A73e87D67B775"
}
},
"opRetro": {
"projectId": "0x9ca1f7b0e0d10d3bd2619e51a54f2e4175e029c87a2944cf1ebc89164ba77ea0"
}
}
2 changes: 1 addition & 1 deletion FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
custom: https://etherscan.io/address/0x70CCBE10F980d80b7eBaab7D2E3A73e87D67B775
custom: ["https://etherscan.io/address/0x70CCBE10F980d80b7eBaab7D2E3A73e87D67B775", "https://giveth.io/project/vyper"]
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Build Status](https://github.com/vyperlang/vyper/workflows/Test/badge.svg)](https://github.com/vyperlang/vyper/actions/workflows/test.yml)
[![Documentation Status](https://readthedocs.org/projects/vyper/badge/?version=latest)](http://docs.vyperlang.org/en/latest/?badge=latest "ReadTheDocs")
[![Discord](https://img.shields.io/discord/969926564286459934.svg?label=%23vyper)](https://discord.gg/6tw7PTM7C2)
[![Telegram](https://img.shields.io/badge/Vyperholics🐍-Telegram-blue)](https://t.me/vyperlang)

[![PyPI](https://badge.fury.io/py/vyper.svg)](https://pypi.org/project/vyper "PyPI")
[![Docker](https://img.shields.io/docker/cloud/build/vyperlang/vyper)](https://hub.docker.com/r/vyperlang/vyper "DockerHub")
Expand Down Expand Up @@ -49,9 +50,13 @@ be a bit behind the latest version found in the master branch of this repository

```bash
make dev-init
python setup.py test
./quicktest.sh -m "not fuzzing"
```

## Testing (with hevm)

Install hevm by downloading it from the releases page (https://github.com/ethereum/hevm/releases/latest) and making sure it is in your PATH. hevm tests can be enabled with `--hevm` flag, and hevm tests can be selected with the `-m hevm` marker. For instance, `./quicktest.sh -m "hevm" --hevm`.

## Developing (working on the compiler)

A useful script to have in your PATH is something like the following:
Expand All @@ -66,7 +71,9 @@ To run a python performance profile (to find compiler perf hotspots):
PYTHONPATH=. python -m cProfile -s tottime vyper/cli/vyper_compile.py "$@"
```

To get a call graph from a python profile, https://stackoverflow.com/a/23164271/ is helpful.
To get a call graph from a python profile, pip install `gprof2dot` and `xdot`, and run it like `gprof2dot -f pstats stats | xdot -`. (See https://stackoverflow.com/a/23164271/).

The utility timer functions `timeit`, `profileit` and `cumtimeit` are available in `vyper/utils.py`.


# Contributing
Expand Down
Loading

0 comments on commit ed7ac89

Please sign in to comment.