Skip to content

Commit

Permalink
Updating (#1)
Browse files Browse the repository at this point in the history
* Change to assert_tx_failed

* Add staticcall opcode for constant function calls

* Test constant external function calls

* Remove repetitive assert_tx_failed

* Create Viper VIP template

* Add link to VIP template to the issue template

* Improve rlp decoding gas estimation

* Add VIP link to contributing docs

* fix issue vyperlang#453

* use clamp constants for literals as well

* fix num_min_literal parsing failure

* fix test coverage

* fix issue vyperlang#448: compile_lll.py: buggy translation of LLL operator `sha3_32`

* add sha3_32 compilation test

* Add checks preventing assigning values on defining types.

* Fix gas estimation error

* Fix repeat LLL with <= 0 iteration

* Add test for repat lll

* Add depth check to with "set" statement

* Require function visibility declaration

* Add tests for public decorator

* Add public decorator to tests (vyperlang#474)

* Document function visibility requirements

* Clarifies expectation in error message

This would have helped me when I saw this error learning Viper for the first time.

* Note internal or public decorator requirement

* Fixes test with for function visibility.

* Add the install instructions for the Viper snap

This requries vyperlang#445, and enabling the continuous delivery on https://build.snapcraft.io

* Allow for gas estimation tests for constants

* Add gas estimation for create_with_code_of

* ad logs to company.v.py with tests

* document event in structure of a contract

* move events before global declarations

* remove unused import

* types.py: Remove duplicated method

Fix vyperlang#488

* Adds support -f bytecode_runtime.

* cleans up test_logs

* Use revert opcode for assert statements

* Show lineno of base_type_conversion error

Fix vyperlang#498

* Show lineno of undeclared function visibility

Fix vyperlang#489

* Adds basic test for bytecode_runtime generation.

* add clamp_nonzero to modulo arithemetic

* Add modulo tests and refactor simple auction example

* Use `with` to decrease repetition

* Change vipercoin from returning false to throwing

* Add check to as_num256 to make sure number is greater than 0

* Improve contributing .rst

- Fixes a link that wasn't displaying correctly.
- Makes some instructions more concise.
- Changes old `:ref:building-from-source`, to link to installation instructions.

* Added testing and deployment doc

* Fix augassignment checks

* Test for in list invalids

* Remove repetitive error and fix typo

* Begin adding built in erc20 external call functionality

* Add implied erc20 token abi fucntionality

* Add on chain market maker example

* Test implied erc20 abi functionality

* Update on chain market maker and erc20 abi

* Change @internal decorator to @Private decorator.

* Add support for logging a variable of list type.

* Adds tests for logging of list types.

* Fix for log packing on list variable.

* Add error if log has wrong number of arguments

* Add log test and improve bytes as input

* Improve variable naming / fix bytes as input

* Clean up tests

* Adds Fix vyperlang#531. Check return type of lists match.

* Adds more tests for logging of lists.

* Adds Fix vyperlang#504 for clamping decimal literals correctly.

* Use revert for clamps

* Fix exponents with units

* Create a contract data type

* Remove .python-version, update .gitignore

* Improve vipercoin example: link out to resources describing attack vectors

* Test the contract data type

* Update version of ethereum

* Improves gas estimate on internal call.

* Removed suicide keyword

* Carry over add_gas_estimate in optimizer.

* Adds gas estimation for internal calls.

* Added test for invalid keyword

* not official a language > officially

* Changing notes to be indented blocks starting on the line after .. note:: 

https://sublime-and-sphinx-guide.readthedocs.io/en/latest/notes_warnings.html

* Adds storage list logging support.

* Adds test to check list logging is of correct (sub)type.

* Splitting comments over two lines where necessary to fit on the page on readthedocs

* Update to use conftest; fix some incorrect tests

* Update Safe Remote Purchases: line numbers, minor edits

* Updates from code review

* Add modulo math checks

* Adds support for logging bytes from storage.

* Adds exception to limit to 32 bytes of bytes type logging (restriction for the time being).

* virtualenv -p /usr/local/lib/python3.6/bin/python3 > virtualenv -p python3.6

Related: vyperlang#558

* Add a note on how to fix `fatal error: openssl/aes.h: No such file or directory` in the `make` output

* removed extraneous backtick `

* Minor edits

with ``num`` type > with the ``num`` type
crowdfunding period is over - as determined> crowdfunding period is over—as determined

* Minor edits voting

add a comma > to vote, and each
add a comma > to vote, or

* Adds basic single list argument call functionality.

* Improve for loop error

* Adds test for logging a decimal list.

* :ref:`function-calls` > :ref:`Function-calls`

* Minor edits types.rst

* Fixes handling of static array in call.

- Also adds tests for many mixed cases of calling with a list parameter.

* Adds test for mixed bytes - list calling arguments.

* Add length check to event topics

* Fix and test logging with units

* Improve type parsing error message

* Add valid call keyword list to utils

* Add length check to event topics

* Partial fix for vyperlang#590. Adds check for a minimum of one return statement.

* Fixes test that were missing return statements.

* Adds example of return checker behaving incorrectly.

* Adds if statement block scoping.

* Add blockscoping to for loop.

* Add blockscope tests.

* Update dockerfile to use slim image base

* Remove commented out directives

* Reduce num256_add gas cost

* Tag built image as viper

* Add built-in function docs

* Fix on chain market maker

* Add comments to on chain market maker

* Change badges from viper to vyper

* Fix rlp decoding loop memory

* Fix call data copy gas estimation

* Implement continue

Add `continue` to pseudo_opcodes, LLL, and viper.

* Fix example ERC20 token

Discovered that it doesn't compile by trying to compile all of the
example contracts in `examples/`. This fixes ERC20.v.py by resolving
compiler complaints.

* Add internal call arg count check

* cleaned up linter errors under tests/compiler

* cleaned up imports and replaced boolean assertion under test_simple_auction

* fixed linter errors in tests/examples/company

* fixed linter errors on tests/examples/market_maker

* fixed linter errors under tests/exmaples/safe_remote_purchase

* cleaned up linter errors tests/examples/tokens

* fixed linter errors on tests/examples/voting

* fixed linter errors on tests/examples/wallets

* fixed linter errors in tests/parsers/features

* test_extract32.py: renamed first function to test_extract32_extraction

* fixed linter errors

* cleaned up linter errors tests/parser

* Adds test for passing list from storage.

* Make blockscopes use set() instead of list().

* specified flake8 script on travis to include tests/

* cleaned up exception block for test_test_bytes

* cleaned up bare except under test_arbitration_code

* cleaned up bare imports to handle ValueOutOfBounds exception in tests/parser/features/test_constructor.py

* cleaned up bare imports test_raw_call

* test_test_slice4: cleaned up test assertions for raised exceptions

* cleaned up bare excepts in test_extract32

* fixed linter error tests/parser/features/test_internal_call.py

* setup.cfg: set flake8 exclusion only for docs

* Fixes vyperlang#547, correct handling of units for exponent notation.

* Adds tests for unit exponents.

* edited travis script for flake8

* Fix err msg for functions without enough arguments

* Add an error message for calls to undefined top-level functions

Previously, the compiler would error ungracefully if an undefined
top-level function was called, due to an unhandled case in `Expr.call`.

The compiler now also makes suggestions when a non-existent top-level function
is mistakenly called instead of a contract method.

* Add `.gitattributes` syntax highlighting trick

* Add .gitattributes file

* Prevent mixed list type from occuring.

* Fixes test that contain mixed list types.

* pep8 fixes

* Remove num256 greater than 0 check for bytes32

* Bump version: 0.0.2 → 0.0.3
  • Loading branch information
anistark authored Jan 12, 2018
1 parent d8f61c7 commit e4f6a17
Show file tree
Hide file tree
Showing 163 changed files with 6,001 additions and 2,358 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.vy linguist-language=Python
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
If you're proposing a new feature please follow the [VIP Template] (https://github.com/ethereum/viper/tree/master/.github/VIP_TEMPLATE.md)

* viper Version: x.x.x
* pyethereum Version: x.x.x
* OS: osx/linux/win
Expand Down
31 changes: 31 additions & 0 deletions .github/VIP_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
This is the suggested template for new VIPs.

## Preamble

VIP: <to be assigned>
Title: <VIP title>
Author: <list of authors' names and optionally, email addresses>
Type: <Standard Track | Informational | Meta>
Status: Draft
Created: <date created on, in ISO 8601 (yyyy-mm-dd) format>
Requires (*optional): <VIP number(s)>
Replaces (*optional): <VIP number(s)>


## 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.

## Abstract
A short description of the technical issue being addressed.

## Motivation
The motivation is critical for VIPs that add or change Viper's functionality. It should clearly explain why the existing Viper functionality is inadequate to address the problem that the VIP solves as well as how the VIP is in line with Viper's goals and design philosopy.

## Specification
The technical specification should describe the syntax and semantics of any new feature. The specification should be detailed enough to allow any developer to implement the functionality

## Backwards Compatibility
All VIPs that introduce backwards incompatibilities must include a section describing these incompatibilities and their severity. The VIP must explain how the author proposes to deal with these incompatibilities.

## Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/)
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ htmlcov/
docs/_build
docs/modules.rst

# IDEs
.idea/
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ install:

script:
- python setup.py test
- flake8 viper
- flake8 viper/ tests/

after_success:
- coveralls
25 changes: 18 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
FROM python:3.6
FROM python:3.6-slim

MAINTAINER Obul <obulpathi@merkletree.vc>
# Specify label-schema specific arguments and labels.
ARG BUILD_DATE
ARG VCS_REF
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="viper" \
org.label-schema.description="Viper is an experimental programming language" \
org.label-schema.url="https://viper.readthedocs.io/en/latest/" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/ethereum/viper" \
org.label-schema.vendor="Ethereum" \
org.label-schema.schema-version="1.0"

# coincurve requires libgmp
RUN apt-get update && \
apt-get install -y libgmp-dev
apt-get install -y --no-install-recommends apt-utils gcc libc6-dev libc-dev libssl-dev libgmp-dev && \
rm -rf /var/lib/apt/lists/*

ADD . /code

# download and install Viper
WORKDIR /code
RUN git clone https://github.com/ethereum/viper.git
WORKDIR /code/viper
RUN python setup.py install
RUN python setup.py install && \
apt-get purge -y --auto-remove apt-utils gcc libc6-dev libc-dev libssl-dev
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ docs:
$(MAKE) -C docs clean
$(MAKE) -C docs html
open docs/_build/html/index.html

docker-build:
@docker build -t viper \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` .
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![Join the chat at https://gitter.im/bethereum/viper](https://badges.gitter.im/ethereum/viper.svg)](https://gitter.im/ethereum/viper?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/ethereum/viper.svg?branch=master)](https://travis-ci.org/ethereum/viper)
[![Documentation Status](https://readthedocs.org/projects/viper/badge/?version=latest)](http://viper.readthedocs.io/en/latest/?badge=latest)
[![Coverage Status](https://coveralls.io/repos/github/ethereum/viper/badge.svg?branch=master)](https://coveralls.io/github/ethereum/viper?branch=master)
[![Join the chat at https://gitter.im/bethereum/vyper](https://badges.gitter.im/ethereum/vyper.svg)](https://gitter.im/ethereum/vyper?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/ethereum/vyper.svg?branch=master)](https://travis-ci.org/ethereum/vyper)
[![Documentation Status](https://readthedocs.org/projects/vyper/badge/?version=latest)](http://vyper.readthedocs.io/en/latest/?badge=latest)
[![Coverage Status](https://coveralls.io/repos/github/ethereum/vyper/badge.svg?branch=master)](https://coveralls.io/github/ethereum/vyper?branch=master)

# Principles and Goals

Expand Down Expand Up @@ -31,7 +31,7 @@ Viper does NOT strive to be a 100% replacement for everything that can be done i
**Note: Viper is still alpha software, use with care**

# Installation
See the [Viper documentation](https://viper.readthedocs.io/en/latest/installing-viper.html)
See the [Viper documentation](https://vyper.readthedocs.io/en/latest/installing-viper.html)
for build instructions.

# Compiling a contract
Expand All @@ -43,6 +43,8 @@ To compile a contract, use:
**Note: Since .vy is not official a language supported by any syntax highlights or linter,
it is recommended to name your viper file into `.v.py` to have a python highlights.**

**Alternative for GitHub syntax highlighting: Add a `.gitattributes` file with the line `*.vy linguist-language=Python`**

There is also an [online compiler](https://viper.tools/) available you can use to experiment with
the language and compile to ``bytecode`` and/or ``LLL``.

Expand All @@ -59,5 +61,5 @@ For testing strategy, please see [Testing](no-link)
# Contributing
* See Issues tab, and feel free to submit your own issues
* Add PRs if you discover a solution to an existing issue
* For further discussions and questions talk to us on [gitter](https://gitter.im/ethereum/viper)
* For more information, see [Contributing](http://viper.readthedocs.io/en/latest/contributing.html)
* For further discussions and questions talk to us on [gitter](https://gitter.im/ethereum/vyper)
* For more information, see [Contributing](http://vyper.readthedocs.io/en/latest/contributing.html)
10 changes: 9 additions & 1 deletion bin/viper
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,30 @@ import viper

from viper import compiler, optimizer
from viper.parser.parser import parse_to_lll
from viper.parser import parser_utils


parser = argparse.ArgumentParser(description='Viper {0} programming language for Ethereum'.format(viper.__version__))
parser.add_argument('input_file', help='Viper sourcecode to compile')
parser.add_argument('-f', help='Format to print', choices=['abi', 'json', 'bytecode', 'ir'], default='bytecode', dest='format')
parser.add_argument('-f', help='Format to print', choices=['abi', 'json', 'bytecode', 'bytecode_runtime', 'ir'], default='bytecode', dest='format')
parser.add_argument('--show-gas-estimates', help='Show gas estimates in ir output mode.', action="store_true")

args = parser.parse_args()

if __name__ == '__main__':

with open(args.input_file) as fh:
code = fh.read()
if args.show_gas_estimates:
parser_utils.LLLnode.repr_show_gas = True

if args.format == 'abi':
print(compiler.mk_full_signature(code))
elif args.format == 'json':
print(json.dumps(compiler.mk_full_signature(code)))
elif args.format == 'bytecode':
print('0x' + compiler.compile(code).hex())
elif args.format == 'bytecode_runtime':
print('0x' + compiler.compile(code, bytecode_runtime=True).hex())
elif args.format == 'ir':
print(optimizer.optimize(parse_to_lll(code)))
Loading

0 comments on commit e4f6a17

Please sign in to comment.