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

Updates integration image to support v0.200.0-rc3 #1294

Merged
merged 2 commits into from
Apr 3, 2020
Merged
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
13 changes: 7 additions & 6 deletions integration/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ARG CONTRACTS_VERSION="0.36.0"
ARG PFS_VERSION="918ee6ef2dcfe293d1ce57c11f5ca23c8e9d68f3"
ARG RAIDEN_VERSION="2e741dfdf4bfa564dec760abd5e3d8b2c9d30715"
ARG CONTRACTS_VERSION="0.37.0-beta"
ARG SERVICES_VERSION="37050f5522f20ed74a5773fd39c75c9c243b7384"
ARG RAIDEN_VERSION="f29c6da85e2871b87eaec5ffcde33d569413346f"
ARG SYNAPSE_VERSION=1.10.0
ARG OS_NAME="LINUX"
ARG GETH_VERSION="1.9.9"
ARG GETH_URL_LINUX="https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.9.9-01744997.tar.gz"
Expand All @@ -19,7 +20,7 @@ RUN git checkout ${RAIDEN_VERSION}
RUN make install

FROM python:3.7 as synapse-builder
ARG SYNAPSE_VERSION=1.5.1
ARG SYNAPSE_VERSION

RUN python -m venv /synapse-venv \
&& /synapse-venv/bin/pip install "matrix-synapse[sqlite]==${SYNAPSE_VERSION}" \
Expand Down Expand Up @@ -120,12 +121,12 @@ COPY synapse/exec/ /usr/local/bin/
COPY --from=synapse-builder /synapse-venv /opt/synapse/venv

# Services
ARG PFS_VERSION
ARG SERVICES_VERSION

WORKDIR /opt/services
RUN git clone https://github.com/raiden-network/raiden-services.git
WORKDIR /opt/services/raiden-services
RUN git checkout "${PFS_VERSION}"
RUN git checkout "${SERVICES_VERSION}"

RUN apt-get update \
&& apt-get install -y --no-install-recommends python3-dev \
Expand Down
69 changes: 69 additions & 0 deletions integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,72 @@ After starting the container you can access the following services:
It is suggested to run the tests using the `run-integration.sh`. The script starts a temporary container,
runs the tests and then stops and deletes the container. This makes sure that tests are always run in
a clean environment.

## Updating the image
Unless there are some major changes in some of the dependencies or the different part updating the environment should
be as simple as updating the following arguments in the `Dockerfile`.

```dockerfile
ARG CONTRACTS_VERSION="0.37.0-beta"
ARG SERVICES_VERSION="37050f5522f20ed74a5773fd39c75c9c243b7384"
ARG RAIDEN_VERSION="f29c6da85e2871b87eaec5ffcde33d569413346f"
ARG SYNAPSE_VERSION=1.10.0
```

### Raiden
Starting with Raiden, you need to visit the Raiden [repository](https://github.com/raiden-network/raiden/) and
locate the version of Raiden you want to use for the integration tests. This can be a tagged version or a specific commit.

You need to locate the the git commit hash and update the `RAIDEN_VERSION` argument:

```dockerfile
ARG RAIDEN_VERSION="f29c6da85e2871b87eaec5ffcde33d569413346f"
```

### Contracts
Raiden will have a pinned version of `raiden-contracts`. You can locate the version of the contracts by looking into the
[requirements.txt](https://github.com/raiden-network/raiden/blob/f29c6da85e2871b87eaec5ffcde33d569413346f/requirements/requirements.txt#L75)
for the commit you are interested. The requirements entry will look like this:

```requirements.txt
raiden-contracts==v0.37.0-beta # via -r requirements.in
```

You have to update the `CONTRACTS_VERSION` argument with the contract's version required by Raiden:

```dockerfile
ARG CONTRACTS_VERSION="0.37.0-beta"
```

### Services
The next step would be updating the service. To locate a compatible version of Raiden Services you can go to the [requirements.txt](https://github.com/raiden-network/raiden-services/blob/37050f5522f20ed74a5773fd39c75c9c243b7384/requirements.txt#L2)
file and locate the a version or commit that is compatible.

You can find a release or a commit that is compatible with the contract version located above using GitHub's [blame](https://github.com/raiden-network/raiden-services/blame/37050f5522f20ed74a5773fd39c75c9c243b7384/requirements.txt#L2) interface.
As soon as you locate the commit you are interested you need to update the `SERVICES_VERSION` argument.

```dockerfile
ARG SERVICES_VERSION="37050f5522f20ed74a5773fd39c75c9c243b7384"
```

### Transport
The transport configuration is based on the [Raiden Service Bundle](https://github.com/raiden-network/raiden-service-bundle/) `RSB`.

The configuration has been slightly modified over the original RSB configuration to fit the purposes of the integration image.
When merging changes from upstream please evaluate if these changes are required or not.

- `setup/room_ensurer.py` is based on [room_ensurer.py](https://github.com/raiden-network/raiden-service-bundle/blob/master/build/room_ensurer/room_ensurer.py)
- `synapse/auth/admin_user_auth_provider.py` is based on [admin_user_auth_provider.py](https://github.com/raiden-network/raiden-service-bundle/blob/master/build/synapse/admin_user_auth_provider.py)
- `synapse/auth/eth_auth_provider.py` is based on [eth_auth_provider.py](https://github.com/raiden-network/raiden-service-bundle/blob/master/build/synapse/eth_auth_provider.py)
- `synapse/exec/synapse-entrypoint.sh` is based on [synapse-entrypoint.sh](https://github.com/raiden-network/raiden-service-bundle/blob/master/build/synapse/synapse-entrypoint.sh)
- `synapse/exec/render_config_template.py` is based on [render_config_template.py](https://github.com/raiden-network/raiden-service-bundle/blob/master/build/synapse/render_config_template.py)
- `synapse/synapse.template.yaml` is based on [synapse.template.yaml](https://github.com/raiden-network/raiden-service-bundle/blob/master/config/synapse/synapse.template.yaml)

You can find the Synapse version used in the RSB [here](https://github.com/raiden-network/raiden-service-bundle/blob/e368e925003cac8d09c1d9007cf80c90f6ad73c3/BUILD_VERSIONS#L2).
To update the synapse version used in the integration you need to locate the following argument in the `Dockerfile`:

```dockerfile
ARG SYNAPSE_VERSION=1.10.0
```

Then you need to change the value accordingly.
4 changes: 2 additions & 2 deletions integration/geth/deploy_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@click.option("--rpc-url", default="http://localhost:8545")
def main(keystore_file: str, contract_version: str, password: str, output: str, rpc_url: str):
web3 = Web3(HTTPProvider(rpc_url, request_kwargs={'timeout': 60}))
web3.middleware_stack.inject(geth_poa_middleware, layer=0)
web3.middleware_onion.inject(geth_poa_middleware, layer=0)

with open(keystore_file, 'r') as keystore:
encrypted_key = keystore.read()
Expand All @@ -60,7 +60,7 @@ def main(keystore_file: str, contract_version: str, password: str, output: str,
print('Account with insuficient funds.')
exit(1)

print(f'Deploying contracts on behalf of {owner}')
print(f'Deploying contracts {contract_version} on behalf of {owner}')

deployer = ContractDeployer(
web3=web3,
Expand Down
3 changes: 2 additions & 1 deletion integration/setup/pfs-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ export WORKER_COUNT=1
export ETH_RPC="http://localhost:8545"

/opt/services/venv/bin/python -m pathfinding_service.cli \
--accept-disclaimer \
--keystore-file /opt/services/keystore/UTC--2020-03-11T15-39-16.935381228Z--2b5e1928c25c5a326dbb61fc9713876dd2904e34 \
--token-network-registry-address "${TOKEN_NETWORK_REGISTRY_ADDRESS}" \
--token-network-registry-contract-address "${TOKEN_NETWORK_REGISTRY_ADDRESS}" \
--user-deposit-contract-address "${USER_DEPOSIT_ADDRESS}" \
--one-to-n-contract-address "${ONE_TO_N_ADDRESS}" \
--matrix-server http://localhost
2 changes: 1 addition & 1 deletion integration/synapse/auth/admin_user_auth_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def check_password(self, user_id: str, password: str):
user_exists = yield self.account_handler.check_user_exists(user_id)
if not user_exists:
self.log.info("First well known admin user login, registering: user=%r", user_id)
user_id = yield self.account_handler.hs.get_registration_handler().register_user(
user_id = yield self.account_handler._hs.get_registration_handler().register_user(
localpart=username, admin=True
)
_, access_token = yield self.account_handler.register_device(user_id)
Expand Down
8 changes: 4 additions & 4 deletions integration/synapse/auth/eth_auth_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import logging
import re
from binascii import unhexlify, hexlify
from binascii import unhexlify
from typing import Callable

from coincurve import PublicKey
Expand Down Expand Up @@ -72,7 +72,7 @@ class EthAuthProvider:
def __init__(self, config, account_handler):
self.account_handler = account_handler
self.config = config
self.hs_hostname = self.account_handler.hs.hostname
self.hs_hostname = self.account_handler._hs.hostname
self.log = logging.getLogger(__name__)

@defer.inlineCallbacks
Expand Down Expand Up @@ -108,8 +108,8 @@ def check_password(self, user_id: str, password: str):
self.log.error(
"Invalid account password/signature. user=%r, expected=%r, recovered=%r",
user_id,
hexlify(user_addr),
hexlify(rec_addr),
user_addr,
rec_addr,
)
defer.returnValue(False)

Expand Down
2 changes: 1 addition & 1 deletion raiden-ts/raiden-contracts
Submodule raiden-contracts updated 275 files