Skip to content

Commit 98f0044

Browse files
author
Fernando Cezar
authored
replase eth_utils to_checksum_address with a cached wrapper (#1078)
1 parent e2adbde commit 98f0044

File tree

29 files changed

+55
-41
lines changed

29 files changed

+55
-41
lines changed

src/monitoring_service/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import pkg_resources
55
import structlog
6-
from eth_utils import to_checksum_address
76
from flask import Flask
87
from flask_restful import Resource
98
from gevent.pywsgi import WSGIServer
@@ -15,6 +14,7 @@
1514
from monitoring_service.constants import API_PATH, DEFAULT_INFO_MESSAGE
1615
from monitoring_service.service import MonitoringService
1716
from raiden_libs.api import ApiWithErrorHandler
17+
from utils import to_checksum_address
1818

1919
log = structlog.get_logger(__name__)
2020

src/monitoring_service/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import click
88
import structlog
9-
from eth_utils import to_checksum_address
109
from web3 import Web3
1110
from web3.contract import Contract
1211

@@ -31,6 +30,7 @@
3130
DEFAULT_API_PORT_MS,
3231
DEFAULT_POLL_INTERVALL,
3332
)
33+
from utils import to_checksum_address
3434

3535
log = structlog.get_logger(__name__)
3636

src/monitoring_service/database.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import List, Optional, Union
44

55
import structlog
6-
from eth_utils import decode_hex, encode_hex, to_canonical_address, to_checksum_address, to_hex
6+
from eth_utils import decode_hex, encode_hex, to_canonical_address, to_hex
77

88
from monitoring_service.events import (
99
ActionClaimRewardTriggeredEvent,
@@ -26,6 +26,7 @@
2626
TransactionHash,
2727
)
2828
from raiden_libs.database import BaseDatabase, hex256
29+
from utils import to_checksum_address
2930

3031
SubEvent = Union[ActionMonitoringTriggeredEvent, ActionClaimRewardTriggeredEvent]
3132

src/monitoring_service/states.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import Iterable, Optional
33

44
from eth_typing.evm import HexAddress
5-
from eth_utils import decode_hex, encode_hex, to_checksum_address
5+
from eth_utils import decode_hex, encode_hex
66
from web3 import Web3
77

88
from raiden.constants import EMPTY_SIGNATURE
@@ -27,6 +27,7 @@
2727
from raiden_contracts.utils.proofs import pack_balance_proof, pack_reward_proof
2828
from raiden_contracts.utils.type_aliases import PrivateKey
2929
from raiden_libs.states import BlockchainState
30+
from utils import to_checksum_address
3031

3132

3233
@dataclass

src/pathfinding_service/api.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@
77
import marshmallow
88
import pkg_resources
99
import structlog
10-
from eth_utils import (
11-
is_checksum_address,
12-
is_same_address,
13-
to_canonical_address,
14-
to_checksum_address,
15-
)
10+
from eth_utils import is_checksum_address, is_same_address, to_canonical_address
1611
from flask import Flask, Response, request
1712
from flask_restful import Resource
1813
from gevent.pywsgi import WSGIServer
@@ -55,6 +50,7 @@
5550
from raiden_libs.constants import UDC_SECURITY_MARGIN_FACTOR_PFS
5651
from raiden_libs.exceptions import ApiException
5752
from raiden_libs.marshmallow import ChecksumAddress, HexedBytes
53+
from utils import to_checksum_address
5854

5955
log = structlog.get_logger(__name__)
6056
T = TypeVar("T")

src/pathfinding_service/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import click
88
import gevent
99
import structlog
10-
from eth_utils import to_canonical_address, to_checksum_address
10+
from eth_utils import to_canonical_address
1111
from web3 import Web3
1212
from web3.contract import Contract
1313

@@ -30,6 +30,7 @@
3030
DEFAULT_API_PORT_PFS,
3131
DEFAULT_POLL_INTERVALL,
3232
)
33+
from utils import to_checksum_address
3334

3435
log = structlog.get_logger(__name__)
3536

src/pathfinding_service/database.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from uuid import UUID
66

77
import structlog
8-
from eth_utils import to_canonical_address, to_checksum_address
8+
from eth_utils import to_canonical_address
99

1010
from pathfinding_service.model import IOU
1111
from pathfinding_service.model.channel import Channel
@@ -24,6 +24,7 @@
2424
TokenNetworkAddress,
2525
)
2626
from raiden_libs.database import BaseDatabase, hex256
27+
from utils import to_checksum_address
2728

2829
log = structlog.get_logger(__name__)
2930

src/pathfinding_service/model/channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from typing import ClassVar, Tuple, Type
44

55
import marshmallow
6-
from eth_utils import to_checksum_address
76
from marshmallow.fields import NaiveDateTime
87
from marshmallow_dataclass import add_schema
98

@@ -20,6 +19,7 @@
2019
TokenNetworkAddress,
2120
)
2221
from raiden_libs.marshmallow import ChecksumAddress
22+
from utils import to_checksum_address
2323

2424

2525
@dataclass

src/pathfinding_service/model/token_network.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import networkx as nx
88
import structlog
9-
from eth_utils import to_checksum_address
109
from networkx import DiGraph
1110
from networkx.exception import NetworkXNoPath, NodeNotFound
1211

@@ -34,6 +33,7 @@
3433
TokenAmount,
3534
TokenNetworkAddress,
3635
)
36+
from utils import to_checksum_address
3737

3838
log = structlog.get_logger(__name__)
3939

src/raiden_libs/database.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
from typing import Any, Dict, List
55

66
import structlog
7-
from eth_utils import to_canonical_address, to_checksum_address
7+
from eth_utils import to_canonical_address
88

99
from raiden.utils.typing import Address, BlockNumber, ChainID, TokenNetworkAddress
1010
from raiden_libs.states import BlockchainState
11+
from utils import to_checksum_address
1112

1213
log = structlog.get_logger(__name__)
1314

0 commit comments

Comments
 (0)