Skip to content
This repository has been archived by the owner on Oct 27, 2024. It is now read-only.

Commit

Permalink
Update to latest raiden revision
Browse files Browse the repository at this point in the history
  • Loading branch information
karlb committed May 16, 2019
1 parent 82c94eb commit 6d8cdb2
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 57 deletions.
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
git+https://github.com/raiden-network/raiden.git@0f3b278ae2f20b05a692c94f77d17e365926e9b8
#git+https://github.com/raiden-network/raiden-contracts.git
git+https://github.com/raiden-network/raiden.git@aab0172eaa2306e8aa6dc9f540eaf7b9c654f85f

raiden-contracts==0.19.0
raiden-contracts==0.19.1

structlog==18.2.0
colorama==0.3.9
Expand All @@ -12,7 +13,7 @@ web3==4.9.1
eth-utils==1.4.1
eth-abi==1.3.0
eth-account==0.3.0
py_ecc==1.6.0
py_ecc<=1.5.0
py-solc==3.2.0
rlp==1.1.0

Expand Down
65 changes: 28 additions & 37 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
from setuptools import find_packages, setup

REQ_REPLACE = {
'git+https://github.com/raiden-network/raiden.git@0f3b278ae2f20b05a692c94f77d17e365926e9b8': 'raiden',
"git+https://github.com/raiden-network/raiden.git@aab0172eaa2306e8aa6dc9f540eaf7b9c654f85f": "raiden"
}

DESCRIPTION = 'Raiden Services contain additional tools for the Raiden Network.'
DESCRIPTION = "Raiden Services contain additional tools for the Raiden Network."


def read_requirements(path: str):
Expand All @@ -20,7 +20,7 @@ def read_requirements(path: str):
with open(path) as requirements:
for line in requirements.readlines():
line = line.strip()
if line and line[0] in ('#', '-'):
if line and line[0] in ("#", "-"):
continue
if line in REQ_REPLACE.keys():
line = REQ_REPLACE[line]
Expand All @@ -30,49 +30,40 @@ def read_requirements(path: str):


def read(*names, **kwargs):
return io.open(
join(dirname(__file__), *names),
encoding=kwargs.get('encoding', 'utf8'),
).read()
return io.open(join(dirname(__file__), *names), encoding=kwargs.get("encoding", "utf8")).read()


setup(
name='raiden-services',
version='0.0.1',
license='MIT',
name="raiden-services",
version="0.0.1",
license="MIT",
description=DESCRIPTION,
author='Brainbot Labs Est.',
author_email='contact@brainbot.li',
url='https://github.com/raiden-network/raiden-services',
packages=find_packages('src'),
package_dir={'': 'src'},
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
author="Brainbot Labs Est.",
author_email="contact@brainbot.li",
url="https://github.com/raiden-network/raiden-services",
packages=find_packages("src"),
package_dir={"": "src"},
py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")],
include_package_data=True,
zip_safe=False,
classifiers=[
# complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
],
keywords=[
'raiden', 'ethereum', 'blockchain',
],
install_requires=[
read_requirements('requirements.txt'),
],
extras_require={
'dev': read_requirements('requirements-dev.txt'),
},
keywords=["raiden", "ethereum", "blockchain"],
install_requires=[read_requirements("requirements.txt")],
extras_require={"dev": read_requirements("requirements-dev.txt")},
entry_points={
'console_scripts': [
'pathfinding-service=pathfinding_service.cli:main',
'claim-pfs-fees=pathfinding_service.claim_fees:main',
'monitoring-service=monitoring_service.cli:main',
'request-collector=request_collector.cli:main',
],
"console_scripts": [
"pathfinding-service=pathfinding_service.cli:main",
"claim-pfs-fees=pathfinding_service.claim_fees:main",
"monitoring-service=monitoring_service.cli:main",
"request-collector=request_collector.cli:main",
]
},
)
38 changes: 21 additions & 17 deletions tests/monitoring/request_collector/test_server.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
# pylint: disable=redefined-outer-name
import pytest
from eth_utils import decode_hex, to_checksum_address
from eth_utils import encode_hex, to_checksum_address

from raiden.messages import RequestMonitoring, SignedBlindedBalanceProof
from raiden.tests.utils import factories
from raiden.utils.signer import LocalSigner
from raiden.utils.typing import TokenAmount
from monitoring_service.states import HashedBalanceProof
from raiden.messages import RequestMonitoring
from raiden.utils.typing import ChannelID, TokenAmount, TokenNetworkAddress
from raiden_contracts.tests.utils import get_random_privkey
from raiden_libs.utils import private_key_to_address


@pytest.fixture
def build_request_monitoring():
non_closing_signer = LocalSigner(decode_hex(get_random_privkey()))

def f(chain_id=1, **kwargs):
balance_proof = factories.create(factories.BalanceProofSignedStateProperties(**kwargs))
balance_proof.canonical_identifier.chain_identifier = chain_id
partner_signed_balance_proof = SignedBlindedBalanceProof.from_balance_proof_signed_state(
balance_proof
non_closing_privkey = get_random_privkey()
non_closing_address = private_key_to_address(non_closing_privkey)

def f(chain_id=1, amount=50, nonce=1):
balance_proof = HashedBalanceProof(
channel_identifier=ChannelID(1),
token_network_address=TokenNetworkAddress(b"1" * 20),
chain_id=chain_id,
nonce=nonce,
additional_hash="",
balance_hash=encode_hex(bytes([amount])),
priv_key=get_random_privkey(),
)
request_monitoring = RequestMonitoring(
onchain_balance_proof=partner_signed_balance_proof, reward_amount=TokenAmount(55)
request_monitoring = balance_proof.get_request_monitoring(
privkey=non_closing_privkey, reward_amount=TokenAmount(55)
)
request_monitoring.sign(non_closing_signer)

# usually not a property of RequestMonitoring, but added for convenience in these tests
request_monitoring.non_closing_signer = to_checksum_address( # type: ignore
non_closing_signer.address
non_closing_address
)
return request_monitoring

Expand Down Expand Up @@ -55,7 +59,7 @@ def store_successful(reward_proof_signature=None, **kwargs):

def test_ignore_old_nonce(ms_database, build_request_monitoring, request_collector):
def stored_mr_after_proccessing(amount, nonce):
request_monitoring = build_request_monitoring(transferred_amount=amount, nonce=nonce)
request_monitoring = build_request_monitoring(amount=amount, nonce=nonce)
request_collector.on_monitor_request(request_monitoring)
return ms_database.get_monitor_request(
token_network_address=to_checksum_address(
Expand Down

0 comments on commit 6d8cdb2

Please sign in to comment.