Skip to content
This repository has been archived by the owner on Aug 8, 2018. It is now read-only.

Accept peers without DAO header and get rid of serpent #271

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 1 addition & 7 deletions pyethapp/console_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,7 @@ def block_from_rlp(this, rlp_data):
solc_wrapper = None
pass

try:
import serpent
except ImportError:
serpent = None
pass

self.console_locals = dict(eth=Eth(self.app), solidity=solc_wrapper, serpent=serpent,
self.console_locals = dict(eth=Eth(self.app), solidity=solc_wrapper,
denoms=denoms, true=True, false=False, Eth=Eth)

for k, v in list(self.app.script_globals.items()):
Expand Down
4 changes: 3 additions & 1 deletion pyethapp/eth_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ def run(self):
try:
dao_headers = self.deferred.get(block=True, timeout=self.request_timeout)
log.debug("received DAO challenge answer", proto=self.proto, answer=dao_headers)
result = len(dao_headers) == 1 and \
# Accept peers without DAO header
result = len(dao_headers) == 0 or (
dao_headers[0].hash == self.config['DAO_FORK_BLKHASH'] and \
dao_headers[0].extra_data == self.config['DAO_FORK_BLKEXTRA']
)
self.chainservice.on_dao_challenge_answer(self.proto, result)
except gevent.Timeout:
log.debug('challenge dao timed out', proto=self.proto)
Expand Down
22 changes: 0 additions & 22 deletions pyethapp/jsonrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,12 +716,6 @@ def __init__(self):
def compilers(self):
if self.compilers_ is None:
self.compilers_ = {}
try:
import serpent
self.compilers_['serpent'] = serpent.compile
self.compilers_['lll'] = serpent.compile_lll
except ImportError:
pass
try:
import ethereum.tools._solidity
s = ethereum.tools._solidity.get_solidity()
Expand All @@ -744,22 +738,6 @@ def compileSolidity(self, code):
except KeyError:
raise MethodNotFoundError()

@public
@encode_res(data_encoder)
def compileSerpent(self, code):
try:
return self.compilers['serpent'](code)
except KeyError:
raise MethodNotFoundError()

@public
@encode_res(data_encoder)
def compileLLL(self, code):
try:
return self.compilers['lll'](code)
except KeyError:
raise MethodNotFoundError()


class Miner(Subdispatcher):

Expand Down
10 changes: 4 additions & 6 deletions pyethapp/tests/test_console_service.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from builtins import str
from itertools import count
import pytest
import serpent
from devp2p.peermanager import PeerManager
import ethereum
from ethereum.tools import tester
Expand Down Expand Up @@ -121,12 +120,11 @@ def fin():


def test_send_transaction_with_contract(test_app):
serpent_code = '''
def main(a,b):
return(a ^ b)
'''
tx_to = b''
evm_code = serpent.compile(serpent_code)
# Serpent code:
# def main(a,b):
# return(a ^ b)
evm_code = b'a\x00K\x80a\x00\x0e`\x009a\x00YV|\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00`\x005\x04c\x97\xd8W\xaa\x81\x14\x15a\x00IW`\x045`@R`$5``R``Q`@Q\n`\x80R` `\x80\xf3[P[`\x00\xf3'
chain = test_app.services.chain.chain
chainservice = test_app.services.chain
hc_state = State(chainservice.head_candidate.state_root, chain.env)
Expand Down
19 changes: 8 additions & 11 deletions pyethapp/tests/test_jsonrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import pytest
import rlp
import serpent
import ethereum
import ethereum.config
import ethereum.tools.keys
Expand Down Expand Up @@ -580,12 +579,11 @@ def test_send_transaction(test_app):


def test_send_transaction_with_contract(test_app):
serpent_code = '''
def main(a,b):
return(a ^ b)
'''
tx_to = b''
evm_code = serpent.compile(serpent_code)
# Serpent code:
# def main(a,b):
# return(a ^ b)
evm_code = b'a\x00K\x80a\x00\x0e`\x009a\x00YV|\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00`\x005\x04c\x97\xd8W\xaa\x81\x14\x15a\x00IW`\x045`@R`$5``R``Q`@Q\n`\x80R` `\x80\xf3[P[`\x00\xf3'
chainservice = test_app.services.chain
chain = test_app.services.chain.chain
state = State(chainservice.head_candidate.state_root, chain.env)
Expand Down Expand Up @@ -616,12 +614,11 @@ def main(a,b):


def test_send_raw_transaction_with_contract(test_app):
serpent_code = '''
def main(a,b):
return(a ^ b)
'''
tx_to = b''
evm_code = serpent.compile(serpent_code)
# Serpent code:
# def main(a,b):
# return(a ^ b)
evm_code = b'a\x00K\x80a\x00\x0e`\x009a\x00YV|\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00`\x005\x04c\x97\xd8W\xaa\x81\x14\x15a\x00IW`\x045`@R`$5``R``Q`@Q\n`\x80R` `\x80\xf3[P[`\x00\xf3'
chainservice = test_app.services.chain
chain = test_app.services.chain.chain
state = State(chainservice.head_candidate.state_root, chain.env)
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ pyelliptic==1.5.7
tinyrpc[gevent,httpclient,jsonext,websocket,wsgi]
pycryptodome==3.4.6
future
https://github.com/ethereum/serpent/tarball/develop
15 changes: 0 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@ def run_tests(self):

LONG_DESCRIPTION = README + '\n\n' + HISTORY

# requirements
install_requires = set(x.strip() for x in open('requirements.txt'))
install_requires_replacements = {
'https://github.com/ethereum/serpent/tarball/develop': 'ethereum-serpent',
}
install_requires = [install_requires_replacements.get(r, r) for r in install_requires]

# dependency links
dependency_links = [
'https://github.com/ethereum/serpent/tarball/develop#egg=ethereum-serpent-9.99.9',
]

# *IMPORTANT*: Don't manually change the version here. Use the 'bump2version' utility.
# see: https://github.com/ethereum/pyethapp/wiki/Development:-Versions-and-Releases
version = '1.5.1a0'
Expand Down Expand Up @@ -73,10 +61,7 @@ def run_tests(self):
'Programming Language :: Python :: 3.6',
],
cmdclass={'test': PyTest},
install_requires=install_requires,
dependency_links=dependency_links,
tests_require=[
# 'ethereum-serpent>=1.8.1',
'mock==2.0.0',
'pytest-mock==1.6.0',
],
Expand Down