Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use eth-tester. #815

Merged
merged 26 commits into from
May 17, 2018
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ab26da5
Patch get_contract and get_contract_from_lll to use web3 + eth_tester.
jacqueswww Apr 6, 2018
3bd918e
Add tester fixture.
jacqueswww Apr 6, 2018
d367177
Zero pad array after slicing.
jacqueswww May 7, 2018
15b678d
Use fixed168x10 instead of decimal10 for the abi notation.
jacqueswww May 7, 2018
170c66e
Convert more tests to use eth-tester.
jacqueswww May 7, 2018
bd3fba2
Fixes company.v.py tests to use eth-tester.
jacqueswww May 8, 2018
c6d1935
Converts vypercoin example tests to use eth-tester.
jacqueswww May 8, 2018
47ad231
Convert more tests to use eth-tester.
jacqueswww May 8, 2018
79c90a4
Convert more tests to use eth-tester.
jacqueswww May 10, 2018
746c404
Fix is_contract to return either 0x0 or 0x1 on the byte level.
jacqueswww May 10, 2018
7b01b6b
Move zero padding to return statement instead of the slice function.
jacqueswww May 10, 2018
d570441
Convert more tests to use eth-tester.
jacqueswww May 10, 2018
fab39d9
Fixes ecrecover tests to use eth_tester.
jacqueswww May 11, 2018
b1b576e
Fix zero padding for returning bytes in log statements.
jacqueswww May 14, 2018
575f8e0
Fix rlpdecoder tests.
jacqueswww May 14, 2018
b366459
Fix test_rawcall.
jacqueswww May 14, 2018
099eb2b
Merge branch 'master' into eth_tester
jacqueswww May 15, 2018
c15f7e8
Fix zero_pad_i allocation on log statement data.
jacqueswww May 15, 2018
2def2db
Use monkeypatch for patching.
jacqueswww May 15, 2018
dff29db
Clean up tests a bit.
jacqueswww May 15, 2018
f78a259
PEP8 Fixes
jacqueswww May 16, 2018
72e36c0
Merge master.
jacqueswww May 16, 2018
de0f2fc
Merge branch 'master' into eth_tester
jacqueswww May 16, 2018
bcd66f2
Fix indentation.
jacqueswww May 16, 2018
077c72a
Remove pyethereum compiler dummy object.
jacqueswww May 16, 2018
236f9fe
Fixes gas-estimation to use eth-tester.
jacqueswww May 16, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions examples/wallet/wallet.v.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
# Warning: NOT AUDITED. Do not use to store substantial quantities of funds.

# A list of the owners addresses (there are a maximum of 5 owners)
owners: address[5]
owners: public(address[5])
# The number of owners required to approve a transaction
threshold: int128
# The number of transactions that have been approved
seq: int128
seq: public(int128)


@public
def __init__(_owners: address[5], _threshold: int128):
Expand All @@ -15,6 +16,12 @@ def __init__(_owners: address[5], _threshold: int128):
self.owners[i] = _owners[i]
self.threshold = _threshold


@public
def test_ecrecover(h: bytes32, v:uint256, r:uint256, s:uint256) -> address:
return ecrecover(h, v, r, s)


# `@payable` allows functions to receive ether
@public
@payable
Expand All @@ -35,8 +42,8 @@ def approve(_seq: int128, to: address, value: wei_value, data: bytes[4096], sigd
h2: bytes32 = sha3(concat("\x19Ethereum Signed Message:\n32", h))
# Verifies that the caller of approve has entered the correct transaction number
assert self.seq == _seq
# Iterates through all the owners and verifies that there signatures,
# given as the sigdata argument are correct
# # Iterates through all the owners and verifies that there signatures,
# # given as the sigdata argument are correct
for i in range(5):
if sigdata[i][0]:
# If an invalid signature is given for an owner then the contract throws
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
url='https://github.com/ethereum/vyper',
license=license,
packages=find_packages(exclude=('tests', 'docs')),
install_requires=['py-evm>=0.2.0a12'],
install_requires=['py-evm==0.2.0a16'],
setup_requires=['pytest-runner'],
tests_require=['pytest', 'pytest-cov', 'ethereum==2.3.1'],
tests_require=['pytest', 'pytest-cov', 'eth-tester==0.1.0b24'],
scripts=['bin/vyper', 'bin/vyper-serve', 'bin/vyper-run']
)
16 changes: 16 additions & 0 deletions tests/compiler/LLL/test_compile_lll.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,19 @@ def test_lll_compile_fail(bad_lll, get_contract_from_lll, assert_compile_failed)
@pytest.mark.parametrize('good_lll', valid_list)
def test_compile_lll_good(good_lll, get_contract_from_lll):
get_contract_from_lll(LLLnode.from_list(good_lll))


def test_ninja(get_contract_from_lll):

ninja_lll = LLLnode.from_list(
['seq',
['return',
0,
['lll',
['seq',
['calldatacopy', 0, 4, 32],
['return', 0, 32],
'stop'
],
0]]])
c = get_contract_from_lll(ninja_lll)
2 changes: 1 addition & 1 deletion tests/compiler/LLL/test_repeat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


def test_repeat(t, get_contract_from_lll, assert_compile_failed):
def test_repeat(get_contract_from_lll, assert_compile_failed):
good_lll = ['repeat', 0, 0, 1, ['seq']]
bad_lll_1 = ['repeat', 0, 0, 0, ['seq']]
bad_lll_2 = ['repeat', 0, 0, -1, ['seq']]
Expand Down
4 changes: 2 additions & 2 deletions tests/compiler/LLL/test_with.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


def test_with_depth(t, get_contract_from_lll, assert_compile_failed):
def test_with_depth(get_contract_from_lll, assert_compile_failed):
_16_with_statements = ['with', 'var_1', 0,
['with', 'var_2', 0,
['with', 'var_3', 0,
Expand Down Expand Up @@ -37,7 +37,7 @@ def test_with_depth(t, get_contract_from_lll, assert_compile_failed):
assert_compile_failed(lambda: get_contract_from_lll(_17_with_statements), Exception)


def test_with_set_depth(t, get_contract_from_lll, assert_compile_failed):
def test_with_set_depth(get_contract_from_lll, assert_compile_failed):
_16_with_statements = ['with', 'var_1', 0,
['with', 'var_2', 0,
['with', 'var_3', 0,
Expand Down
16 changes: 8 additions & 8 deletions tests/compiler/test_clamps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


def test_uclamplt(t, get_contract_from_lll, assert_compile_failed):
def test_uclamplt(get_contract_from_lll, assert_compile_failed):
lll = ['uclamplt', 2, 1]
assert_compile_failed(lambda: get_contract_from_lll(lll), Exception)
lll = ['uclamplt', 1, 1]
Expand All @@ -9,7 +9,7 @@ def test_uclamplt(t, get_contract_from_lll, assert_compile_failed):
get_contract_from_lll(lll)


def test_uclample(t, get_contract_from_lll, assert_compile_failed):
def test_uclample(get_contract_from_lll, assert_compile_failed):
lll = ['uclample', 2, 1]
assert_compile_failed(lambda: get_contract_from_lll(lll), Exception)
lll = ['uclample', 1, 1]
Expand All @@ -18,7 +18,7 @@ def test_uclample(t, get_contract_from_lll, assert_compile_failed):
get_contract_from_lll(lll)


def test_uclampgt(t, get_contract_from_lll, assert_compile_failed):
def test_uclampgt(get_contract_from_lll, assert_compile_failed):
lll = ['uclampgt', 1, 2]
assert_compile_failed(lambda: get_contract_from_lll(lll), Exception)
lll = ['uclampgt', 1, 1]
Expand All @@ -27,7 +27,7 @@ def test_uclampgt(t, get_contract_from_lll, assert_compile_failed):
get_contract_from_lll(lll)


def test_uclampge(t, get_contract_from_lll, assert_compile_failed):
def test_uclampge(get_contract_from_lll, assert_compile_failed):
lll = ['uclampge', 1, 2]
assert_compile_failed(lambda: get_contract_from_lll(lll), Exception)
lll = ['uclampge', 1, 1]
Expand All @@ -36,7 +36,7 @@ def test_uclampge(t, get_contract_from_lll, assert_compile_failed):
get_contract_from_lll(lll)


def test_uclamplt_and_clamplt(t, get_contract_from_lll, assert_compile_failed):
def test_uclamplt_and_clamplt(get_contract_from_lll, assert_compile_failed):
lll = ['uclamplt', 2, 1]
assert_compile_failed(lambda: get_contract_from_lll(lll), Exception)
lll = ['uclamplt', 1, 1]
Expand All @@ -51,7 +51,7 @@ def test_uclamplt_and_clamplt(t, get_contract_from_lll, assert_compile_failed):
get_contract_from_lll(lll)


def test_uclample_clample(t, get_contract_from_lll, assert_compile_failed):
def test_uclample_clample(get_contract_from_lll, assert_compile_failed):
lll = ['uclample', 2, 1]
assert_compile_failed(lambda: get_contract_from_lll(lll), Exception)
lll = ['uclample', 1, 1]
Expand All @@ -66,7 +66,7 @@ def test_uclample_clample(t, get_contract_from_lll, assert_compile_failed):
get_contract_from_lll(lll)


def test_uclampgt_and_clampgt(t, get_contract_from_lll, assert_compile_failed):
def test_uclampgt_and_clampgt(get_contract_from_lll, assert_compile_failed):
lll = ['uclampgt', 1, 2]
assert_compile_failed(lambda: get_contract_from_lll(lll), Exception)
lll = ['uclampgt', 1, 1]
Expand All @@ -81,7 +81,7 @@ def test_uclampgt_and_clampgt(t, get_contract_from_lll, assert_compile_failed):
get_contract_from_lll(lll)


def test_uclampge_and_clampge(t, get_contract_from_lll, assert_compile_failed):
def test_uclampge_and_clampge(get_contract_from_lll, assert_compile_failed):
lll = ['uclampge', 1, 2]
assert_compile_failed(lambda: get_contract_from_lll(lll), Exception)
lll = ['uclampge', 1, 1]
Expand Down
Loading