Skip to content

Commit

Permalink
Merge branch 'master' into docs/range_bound
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Sep 20, 2023
2 parents b613cb9 + 1711569 commit 97db73a
Show file tree
Hide file tree
Showing 51 changed files with 1,575 additions and 374 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and release artifacts
name: Build artifacts

on:
workflow_dispatch:
Expand All @@ -8,8 +8,9 @@ on:
push:
branches:
- master
pull_request:
release:
types: [released]
types: [published] # releases and pre-releases (release candidates)

defaults:
run:
Expand Down Expand Up @@ -38,10 +39,11 @@ jobs:

- name: Generate Binary
run: >-
pip install --no-binary pycryptodome . &&
pip install --no-binary pycryptodome --no-binary cbor2 . &&
pip install pyinstaller &&
make freeze
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -98,6 +100,16 @@ jobs:
-X POST \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"\
-H "Content-Type: application/octet-stream" \
"https://uploads.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets?name=${BIN_NAME}" \
"https://uploads.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets?name=${BIN_NAME/+/%2B}" \
--data-binary "@${BIN_NAME}"
done
# check build success for pull requests
build-success:
if: always()
runs-on: ubuntu-latest
needs: [windows-build, unix-build]
steps:
- name: check that all builds succeeded
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
6 changes: 6 additions & 0 deletions .github/workflows/era-tester.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,20 @@ jobs:
- name: Run tester (fast)
# Run era tester with no LLVM optimizations
continue-on-error: true
if: ${{ github.ref != 'refs/heads/master' }}
run: |
cd era-compiler-tester
cargo run --release --bin compiler-tester -- --path=tests/vyper/ --mode="M0B0 ${{ env.VYPER_VERSION }}"
- name: Run tester (slow)
# Run era tester across the LLVM optimization matrix
continue-on-error: true
if: ${{ github.ref == 'refs/heads/master' }}
run: |
cd era-compiler-tester
cargo run --release --bin compiler-tester -- --path=tests/vyper/ --mode="M*B* ${{ env.VYPER_VERSION }}"
- name: Mark as success
run: |
exit 0
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Publish to PyPI

on:
release:
types: [released]
types: [published] # releases and pre-releases (release candidates)

jobs:

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
- id: black
name: black

- repo: https://gitlab.com/pycqa/flake8
- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
hooks:
- id: flake8
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**Vyper compiler security audit competition starts 14th September with $150k worth of bounties.** [See the competition on CodeHawks](https://www.codehawks.com/contests/cll5rujmw0001js08menkj7hc) and find [more details in this blog post](https://mirror.xyz/0xBA41A04A14aeaEec79e2D694B21ba5Ab610982f1/WTZ3l3MLhTz9P4avq6JqipN5d4HJNiUY-d8zT0pfmXg).

<img src="https://raw.githubusercontent.com/vyperlang/vyper/master/logo/vyper-logo-transparent.svg?sanitize=true" alt="" width="110">

Expand Down
24 changes: 23 additions & 1 deletion docs/built-in-functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,11 @@ Cryptography
* ``s``: second 32 bytes of signature
* ``v``: final 1 byte of signature

Returns the associated address, or ``0`` on error.
Returns the associated address, or ``empty(address)`` on error.

.. note::

Prior to Vyper ``0.3.10``, the ``ecrecover`` function could return an undefined (possibly nonzero) value for invalid inputs to ``ecrecover``. For more information, please see `GHSA-f5x6-7qgp-jhf3 <https://github.com/vyperlang/vyper/security/advisories/GHSA-f5x6-7qgp-jhf3>`_.

.. code-block:: python
Expand Down Expand Up @@ -573,6 +577,24 @@ Math
>>> ExampleContract.foo(3.1337)
4
.. py:function:: epsilon(typename) -> Any
Returns the smallest non-zero value for a decimal type.

* ``typename``: Name of the decimal type (currently only ``decimal``)

.. code-block:: python
@external
@view
def foo() -> decimal:
return epsilon(decimal)
.. code-block:: python
>>> ExampleContract.foo()
Decimal('1E-10')
.. py:function:: floor(value: decimal) -> int256
Round a decimal down to the nearest integer.
Expand Down
6 changes: 5 additions & 1 deletion docs/installing-vyper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,13 @@ Each tagged version of vyper is uploaded to `pypi <https://pypi.org/project/vype
To install a specific version use:
::

pip install vyper==0.2.15
pip install vyper==0.3.7

You can check if Vyper is installed completely or not by typing the following in your terminal/cmd:

::

vyper --version
nix
***

Expand Down
64 changes: 63 additions & 1 deletion docs/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,64 @@ Release Notes
for advisory links:
:'<,'>s/\v(https:\/\/github.com\/vyperlang\/vyper\/security\/advisories\/)([-A-Za-z0-9]+)/(`\2 <\1\2>`_)/g
..
v0.3.10 ("Black Adder")
***********************
v0.3.10rc1
**********

Date released: 2023-09-06
=========================

v0.3.10 is a performance focused release. It adds a ``codesize`` optimization mode (`#3493 <https://github.com/vyperlang/vyper/pull/3493>`_), adds new vyper-specific ``#pragma`` directives (`#3493 <https://github.com/vyperlang/vyper/pull/3493>`_), uses Cancun's ``MCOPY`` opcode for some compiler generated code (`#3483 <https://github.com/vyperlang/vyper/pull/3483>`_), and generates selector tables which now feature O(1) performance (`#3496 <https://github.com/vyperlang/vyper/pull/3496>`_).

Breaking changes:
-----------------

- add runtime code layout to initcode (`#3584 <https://github.com/vyperlang/vyper/pull/3584>`_)
- drop evm versions through istanbul (`#3470 <https://github.com/vyperlang/vyper/pull/3470>`_)
- remove vyper signature from runtime (`#3471 <https://github.com/vyperlang/vyper/pull/3471>`_)

Non-breaking changes and improvements:
--------------------------------------

- O(1) selector tables (`#3496 <https://github.com/vyperlang/vyper/pull/3496>`_)
- implement bound= in ranges (`#3537 <https://github.com/vyperlang/vyper/pull/3537>`_, `#3551 <https://github.com/vyperlang/vyper/pull/3551>`_)
- add optimization mode to vyper compiler (`#3493 <https://github.com/vyperlang/vyper/pull/3493>`_)
- improve batch copy performance (`#3483 <https://github.com/vyperlang/vyper/pull/3483>`_, `#3499 <https://github.com/vyperlang/vyper/pull/3499>`_, `#3525 <https://github.com/vyperlang/vyper/pull/3525>`_)

Notable fixes:
--------------

- fix ``ecrecover()`` behavior when signature is invalid (`GHSA-f5x6-7qgp-jhf3 <https://github.com/vyperlang/vyper/security/advisories/GHSA-f5x6-7qgp-jhf3>`_, `#3586 <https://github.com/vyperlang/vyper/pull/3586>`_)
- fix: order of evaluation for some builtins (`#3583 <https://github.com/vyperlang/vyper/pull/3583>`_, `#3587 <https://github.com/vyperlang/vyper/pull/3587>`_)
- fix: pycryptodome for arm builds (`#3485 <https://github.com/vyperlang/vyper/pull/3485>`_)
- let params of internal functions be mutable (`#3473 <https://github.com/vyperlang/vyper/pull/3473>`_)
- typechecking of folded builtins in (`#3490 <https://github.com/vyperlang/vyper/pull/3490>`_)
- update tload/tstore opcodes per latest 1153 EIP spec (`#3484 <https://github.com/vyperlang/vyper/pull/3484>`_)
- fix: raw_call type when max_outsize=0 is set (`#3572 <https://github.com/vyperlang/vyper/pull/3572>`_)
- fix: implements check for indexed event arguments (`#3570 <https://github.com/vyperlang/vyper/pull/3570>`_)

Other docs updates, chores and fixes:
-------------------------------------

- relax restrictions on internal function signatures (`#3573 <https://github.com/vyperlang/vyper/pull/3573>`_)
- note on security advisory in release notes for versions ``0.2.15``, ``0.2.16``, and ``0.3.0`` (`#3553 <https://github.com/vyperlang/vyper/pull/3553>`_)
- fix: yanked version in release notes (`#3545 <https://github.com/vyperlang/vyper/pull/3545>`_)
- update release notes on yanked versions (`#3547 <https://github.com/vyperlang/vyper/pull/3547>`_)
- improve error message for conflicting methods IDs (`#3491 <https://github.com/vyperlang/vyper/pull/3491>`_)
- document epsilon builtin (`#3552 <https://github.com/vyperlang/vyper/pull/3552>`_)
- relax version pragma parsing (`#3511 <https://github.com/vyperlang/vyper/pull/3511>`_)
- fix: issue with finding installed packages in editable mode (`#3510 <https://github.com/vyperlang/vyper/pull/3510>`_)
- add note on security advisory for ``ecrecover`` in docs (`#3539 <https://github.com/vyperlang/vyper/pull/3539>`_)
- add ``asm`` option to cli help (`#3585 <https://github.com/vyperlang/vyper/pull/3585>`_)
- add message to error map for repeat range check (`#3542 <https://github.com/vyperlang/vyper/pull/3542>`_)
- fix: public constant arrays (`#3536 <https://github.com/vyperlang/vyper/pull/3536>`_)


v0.3.9 ("Common Adder")
******
***********************

Date released: 2023-05-29

Expand Down Expand Up @@ -187,6 +243,7 @@ Bugfixes:

v0.3.5
******
**THIS RELEASE HAS BEEN PULLED**

Date released: 2022-08-05

Expand Down Expand Up @@ -335,6 +392,7 @@ Special thanks to @skellet0r for some major features in this release!

v0.3.0
*******
⚠️ A critical security vulnerability has been discovered in this version and we strongly recommend using version `0.3.1 <https://github.com/vyperlang/vyper/releases/tag/v0.3.1>`_ or higher. For more information, please see the Security Advisory `GHSA-5824-cm3x-3c38 <https://github.com/vyperlang/vyper/security/advisories/GHSA-5824-cm3x-3c38>`_.

Date released: 2021-10-04

Expand Down Expand Up @@ -367,6 +425,7 @@ Special thanks to contributions from @skellet0r and @benjyz for this release!

v0.2.16
*******
⚠️ A critical security vulnerability has been discovered in this version and we strongly recommend using version `0.3.1 <https://github.com/vyperlang/vyper/releases/tag/v0.3.1>`_ or higher. For more information, please see the Security Advisory `GHSA-5824-cm3x-3c38 <https://github.com/vyperlang/vyper/security/advisories/GHSA-5824-cm3x-3c38>`_.

Date released: 2021-08-27

Expand All @@ -391,6 +450,7 @@ Special thanks to contributions from @skellet0r, @sambacha and @milancermak for

v0.2.15
*******
⚠️ A critical security vulnerability has been discovered in this version and we strongly recommend using version `0.3.1 <https://github.com/vyperlang/vyper/releases/tag/v0.3.1>`_ or higher. For more information, please see the Security Advisory `GHSA-5824-cm3x-3c38 <https://github.com/vyperlang/vyper/security/advisories/GHSA-5824-cm3x-3c38>`_.

Date released: 23-07-2021

Expand All @@ -403,6 +463,7 @@ Fixes:

v0.2.14
*******
**THIS RELEASE HAS BEEN PULLED**

Date released: 20-07-2021

Expand Down Expand Up @@ -521,6 +582,7 @@ Fixes:

v0.2.6
******
**THIS RELEASE HAS BEEN PULLED**

Date released: 10-10-2020

Expand Down
2 changes: 1 addition & 1 deletion docs/structure-of-a-contract.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Vyper supports several source code directives to control compiler modes and help
Version Pragma
--------------

The version pragma ensures that a contract is only compiled by the intended compiler version, or range of versions. Version strings use `NPM <https://docs.npmjs.com/about-semantic-versioning>`_ style syntax.
The version pragma ensures that a contract is only compiled by the intended compiler version, or range of versions. Version strings use `NPM <https://docs.npmjs.com/about-semantic-versioning>`_ style syntax. Starting from v0.4.0 and up, version strings will use `PEP440 version specifiers <https://peps.python.org/pep-0440/#version-specifiers>_`.

As of 0.3.10, the recommended way to specify the version pragma is as follows:

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ def _global_version(version):
python_requires=">=3.10,<4",
py_modules=["vyper"],
install_requires=[
"cbor2>=5.4.6,<6",
"asttokens>=2.0.5,<3",
"pycryptodome>=3.5.1,<4",
"semantic-version>=2.10,<3",
"packaging>=23.1,<24",
"importlib-metadata",
"wheel",
],
Expand Down
82 changes: 82 additions & 0 deletions tests/ast/test_metadata_journal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
from vyper.ast.metadata import NodeMetadata
from vyper.exceptions import VyperException


def test_metadata_journal_basic():
m = NodeMetadata()

m["x"] = 1
assert m["x"] == 1


def test_metadata_journal_commit():
m = NodeMetadata()

with m.enter_typechecker_speculation():
m["x"] = 1

assert m["x"] == 1


def test_metadata_journal_exception():
m = NodeMetadata()

m["x"] = 1
try:
with m.enter_typechecker_speculation():
m["x"] = 2
m["x"] = 3

assert m["x"] == 3
raise VyperException("dummy exception")

except VyperException:
pass

# rollback upon exception
assert m["x"] == 1


def test_metadata_journal_rollback_inner():
m = NodeMetadata()

m["x"] = 1
with m.enter_typechecker_speculation():
m["x"] = 2

try:
with m.enter_typechecker_speculation():
m["x"] = 3
m["x"] = 4 # test multiple writes

assert m["x"] == 4
raise VyperException("dummy exception")

except VyperException:
pass

assert m["x"] == 2


def test_metadata_journal_rollback_outer():
m = NodeMetadata()

m["x"] = 1
try:
with m.enter_typechecker_speculation():
m["x"] = 2

with m.enter_typechecker_speculation():
m["x"] = 3
m["x"] = 4 # test multiple writes

assert m["x"] == 4

m["x"] = 5

raise VyperException("dummy exception")

except VyperException:
pass

assert m["x"] == 1
Loading

0 comments on commit 97db73a

Please sign in to comment.