Skip to content

Commit ebf1d24

Browse files
committed
Merge master into xrpl-py-2.0
2 parents e24adfd + 5f6dceb commit ebf1d24

File tree

10 files changed

+82
-46
lines changed

10 files changed

+82
-46
lines changed

.github/workflows/integration_test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ on:
99
jobs:
1010
integration-test:
1111
name: Integration test
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-latest
1313
timeout-minutes: 30
1414
strategy:
1515
matrix:
16-
# we have to use 3.7.1 to get around openssl issues
17-
python-version: ['3.7.1', '3.8', '3.9', '3.10', '3.11']
16+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
1817

1918
services:
2019
rippled:

.github/workflows/unit_test.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
lint-and-type-check:
1111
name: Lint and type-check
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-latest
1313

1414
env:
1515
PYTHON_VERSION: "3.11"
@@ -52,11 +52,10 @@ jobs:
5252
5353
unit-test:
5454
name: Unit test
55-
runs-on: ubuntu-20.04
55+
runs-on: ubuntu-latest
5656
strategy:
5757
matrix:
58-
# we have to use 3.7.1 to get around openssl issues
59-
python-version: ['3.7.1', '3.8', '3.9', '3.10', '3.11']
58+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
6059

6160
steps:
6261
- name: Checkout code

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@
88
"mypy.runUsingActiveInterpreter": true,
99
"cSpell.words": [
1010
"addresscodec",
11+
"aiounittest",
12+
"altnet",
1113
"asyncio",
1214
"binarycodec",
1315
"nftoken",
16+
"rippletest",
17+
"ripplex",
1418
"xaddress"
1519
],
1620
}

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
on_rtd = os.environ.get("READTHEDOCS") == "True"
5252

5353
if not on_rtd: # only import and set the theme if we're building docs locally
54-
import sphinx_rtd_theme
54+
import sphinx_rtd_theme # type: ignore
5555

5656
html_theme = "sphinx_rtd_theme"
5757
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

poetry.lock

Lines changed: 56 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ websockets = [
4141
]
4242
Deprecated = "^1.2.13"
4343
types-Deprecated = "^1.2.9"
44+
pycryptodome = "^3.16.0"
4445

4546
[tool.poetry.dev-dependencies]
4647
flake8 = "^3.8.4"
@@ -58,8 +59,8 @@ aiounittest = "^1.4.0"
5859
coverage = "^6.5.0"
5960
Jinja2 = "^3.1.2"
6061
MarkupSafe = "2.1.1"
61-
Sphinx = "^5.1.1"
62-
poethepoet = "^0.16.2"
62+
Sphinx = "^5.3.0"
63+
poethepoet = "^0.16.5"
6364

6465
[tool.isort]
6566
# Make sure that isort's settings line up with black

tests/integration/integration_test_case.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
try:
22
from unittest import IsolatedAsyncioTestCase
33
except ImportError:
4-
from aiounittest import AsyncTestCase as IsolatedAsyncioTestCase
4+
from aiounittest import AsyncTestCase as IsolatedAsyncioTestCase # type: ignore
55

66
from tests.integration.it_utils import WEBSOCKET_CLIENT, WEBSOCKET_TESTNET_CLIENT
77

tests/integration/it_utils.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import inspect
55
from threading import Timer as ThreadingTimer
66
from time import sleep
7+
from typing import cast
78

89
import xrpl # noqa: F401 - needed for sync tests
910
from xrpl.asyncio.clients import AsyncJsonRpcClient, AsyncWebsocketClient
@@ -28,7 +29,7 @@
2829
WEBSOCKET_URL = "ws://127.0.0.1:6006"
2930

3031
JSON_TESTNET_URL = "https://s.altnet.rippletest.net:51234"
31-
WEBSOCKET_TESTNET_URL = "wss://s.altnet.rippletest.net"
32+
WEBSOCKET_TESTNET_URL = "wss://s.altnet.rippletest.net:51233"
3233

3334
JSON_RPC_CLIENT = JsonRpcClient(JSON_RPC_URL)
3435
ASYNC_JSON_RPC_CLIENT = AsyncJsonRpcClient(JSON_RPC_URL)
@@ -90,7 +91,8 @@ def __init__(
9091
delay: float = LEDGER_ACCEPT_TIME,
9192
request: Request = LEDGER_ACCEPT_REQUEST,
9293
):
93-
self._timer = ThreadingTimer(delay, client.request, (request,)).start()
94+
self._timer = ThreadingTimer(delay, client.request, (request,))
95+
self._timer.start()
9496

9597
def cancel(self):
9698
self._timer.cancel()
@@ -122,7 +124,7 @@ async def fund_wallet(
122124
def submit_transaction(
123125
transaction: Transaction,
124126
wallet: Wallet,
125-
client: Client = JSON_RPC_CLIENT,
127+
client: SyncClient = JSON_RPC_CLIENT,
126128
check_fee: bool = True,
127129
) -> Response:
128130
"""Signs and submits a transaction to the XRPL."""
@@ -188,12 +190,12 @@ async def accept_ledger_async(
188190
AsyncTestTimer(client, delay)
189191

190192

191-
def _choose_client(use_json_client: bool) -> Client:
192-
return _CLIENTS[(False, use_json_client, False)]
193+
def _choose_client(use_json_client: bool) -> SyncClient:
194+
return cast(SyncClient, _CLIENTS[(False, use_json_client, False)])
193195

194196

195-
def _choose_client_async(use_json_client: bool) -> Client:
196-
return _CLIENTS[(True, use_json_client, False)]
197+
def _choose_client_async(use_json_client: bool) -> AsyncClient:
198+
return cast(AsyncClient, _CLIENTS[(True, use_json_client, False)])
197199

198200

199201
def _get_client(is_async: bool, is_json: bool, is_testnet: bool) -> Client:

xrpl/core/keypairs/__init__.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
Low-level functions for creating and using cryptographic keys with the XRP
33
Ledger.
44
"""
5-
from hashlib import algorithms_available
6-
75
from xrpl.core.keypairs.exceptions import XRPLKeypairsException
86
from xrpl.core.keypairs.main import (
97
derive_classic_address,
@@ -13,11 +11,6 @@
1311
sign,
1412
)
1513

16-
assert (
17-
"ripemd160" in algorithms_available
18-
), """Your OpenSSL implementation does not include the RIPEMD160 algorithm,
19-
which is required by XRPL"""
20-
2114
__all__ = [
2215
"derive_classic_address",
2316
"derive_keypair",

xrpl/core/keypairs/helpers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""Miscellaneous functions that are private to xrpl.core.keypairs."""
22
import hashlib
33

4+
import Crypto.Hash.RIPEMD160 as RIPEMD160
5+
46

57
def sha512_first_half(message: bytes) -> bytes:
68
"""
@@ -28,4 +30,4 @@ def get_account_id(public_key: bytes) -> bytes:
2830
The account ID for the given public key.
2931
"""
3032
sha_hash = hashlib.sha256(public_key).digest()
31-
return hashlib.new("ripemd160", sha_hash).digest()
33+
return bytes(RIPEMD160.new(sha_hash).digest())

0 commit comments

Comments
 (0)