Instantly share code, notes, and snippets.

View factory.py
import collections
import inspect
EMPTY = object()
# Goals:
# - Make it easier to write tests:
# - Reduce the number of variables a test needs to manage by introducing hidden state
# - Automate duplicated tasks:
# - Creating topologies
View t.py
from eth_utils import to_canonical_address
from raiden.storage import serialize, sqlite
from raiden.storage.wal import WriteAheadLog
from raiden.transfer import node, views
from raiden.transfer.architecture import StateManager
serializer = serialize.JSONSerializer()
View original_state_changes
{"transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "payment_network": {"address": "0xB9633dd9a9a71F22C933bF121d7a22008f66B908", "tokennetworks": [], "_type": "raiden.transfer.state.PaymentNetworkState", "_version": 0}, "block_number": 0, "_type": "raiden.transfer.state_change.ContractReceiveNewPaymentNetwork", "_version": 0}
{"transaction_hash": "0xf74fe1122b8b811085aa9b2743670791a91fafa6f9c9512fb16e778cbbdb1432", "payment_network_identifier": "0xB9633dd9a9a71F22C933bF121d7a22008f66B908", "token_network": {"address": "0xa5C9ECf54790334B73E5DfA1ff5668eB425dC474", "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "network_graph": {"token_network_id": "0xa5C9ECf54790334B73E5DfA1ff5668eB425dC474", "network": "[]", "channel_identifier_to_participants": {}, "_type": "raiden.transfer.state.TokenNetworkGraphState", "_version": 0}, "partneraddresses_to_channels": {}, "_type": "raiden.transfer.state.TokenNetworkState", "_version": 0}, "block_number": 6532988, "_type"
View 1_t.py
import sys
from eth_utils import to_canonical_address
from raiden.storage import serialize, sqlite
from raiden.storage.wal import WriteAheadLog
from raiden.transfer import node, views
from raiden.transfer.architecture import StateManager
from raiden.utils import serialization
View 1_diff
9,10c9,10
< "nonce": 3,
< "transferred_amount": 10,
---
> "nonce": 1,
> "transferred_amount": 0,
32,33c32,33
< "nonce": 3,
< "transferred_amount": 10,
---
View concat.log
{
"transaction_hash": "0xbd49dd5bbe5175a23595ca8e2e7f77a19e3e1fe54fa4ae170aa5c8c62e992ec1",
"token_network_identifier": "0xa5C9ECf54790334B73E5DfA1ff5668eB425dC474",
"channel_state": {
"identifier": 46,
"chain_id": 1,
"token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"payment_network_identifier": "0xB9633dd9a9a71F22C933bF121d7a22008f66B908",
"token_network_identifier": "0xa5C9ECf54790334B73E5DfA1ff5668eB425dC474",
"reveal_timeout": 50,
View node04.log
{
"transaction_hash": "0xbd49dd5bbe5175a23595ca8e2e7f77a19e3e1fe54fa4ae170aa5c8c62e992ec1",
"token_network_identifier": "0xa5C9ECf54790334B73E5DfA1ff5668eB425dC474",
"channel_state": {
"identifier": 46,
"chain_id": 1,
"token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"payment_network_identifier": "0xB9633dd9a9a71F22C933bF121d7a22008f66B908",
"token_network_identifier": "0xa5C9ECf54790334B73E5DfA1ff5668eB425dC474",
"reveal_timeout": 50,
View t.py
from raiden.transfer.architecture import StateManager
from raiden.storage import serialize, sqlite
from raiden.transfer import node
from raiden.storage.wal import WriteAheadLog
def replay_wal(storage):
all_state_changes = storage.get_statechanges_by_identifier(
from_identifier=0,
to_identifier='latest',
View gist:bb16a51096550f90f91339d0fd92bbe8
travis_fold:start:worker_info
Worker information
hostname: fd103e0e-d1ca-4351-b2ff-f17423c6293a@1.production-1-worker-org-gce-n827
version: v4.5.1 https://github.com/travis-ci/worker/tree/ce724b775b2d5dc4c57b849f4cf4a123e1e34d70
instance: travis-job-3509424d-b09d-4880-b2ee-5febc8d3bab5 travis-ci-sardonyx-xenial-1539708025-01f27ab (via amqp)
startup: 11.094853817s
travis_fold:end:worker_info
travis_fold:start:system_info
Build system information
Build language: python
View gist:6dc5c55b1fb0b5eee8028c4e43c6972c
travis_fold:start:worker_info
Worker information
hostname: c152b6b9-8111-4995-9552-30ec878d8659@1.production-1-worker-org-gce-82t3
version: v4.5.1 https://github.com/travis-ci/worker/tree/ce724b775b2d5dc4c57b849f4cf4a123e1e34d70
instance: travis-job-88e1253b-f1cf-47eb-958a-ec27bd50976a travis-ci-sardonyx-xenial-1539708025-01f27ab (via amqp)
startup: 7.129373486s
travis_fold:end:worker_info
travis_fold:start:system_info
Build system information
Build language: python