From f2fb67a9b85a74a1eec21672ed8582bdaf7b7636 Mon Sep 17 00:00:00 2001 From: Omar Khan Date: Wed, 15 May 2024 16:52:47 -0400 Subject: [PATCH 01/10] remove Hooks faucet --- tests/integration/sugar/test_wallet.py | 66 ------------------------ tests/unit/asyn/wallet/test_wallet.py | 9 ---- xrpl/asyncio/wallet/wallet_generation.py | 5 -- 3 files changed, 80 deletions(-) diff --git a/tests/integration/sugar/test_wallet.py b/tests/integration/sugar/test_wallet.py index 0716c0e80..997f92072 100644 --- a/tests/integration/sugar/test_wallet.py +++ b/tests/integration/sugar/test_wallet.py @@ -1,5 +1,4 @@ import asyncio -import time from threading import Thread from tests.integration.integration_test_case import IntegrationTestCase @@ -13,8 +12,6 @@ from xrpl.wallet import generate_faucet_wallet as sync_generate_faucet_wallet from xrpl.wallet.main import Wallet -time_of_last_hooks_faucet_call = 0 - def sync_generate_faucet_wallet_and_fund_again( self, client, faucet_host=None, usage_context="integration_test" @@ -160,69 +157,6 @@ async def _parallel_test_generate_faucet_wallet_devnet_async_websockets(self): ) as client: await generate_faucet_wallet_and_fund_again(self, client) - async def _parallel_test_generate_faucet_wallet_hooks_v3_testnet_async_websockets( - self, - ): - async with AsyncWebsocketClient( - "wss://hooks-testnet-v3.xrpl-labs.com" - ) as client: - global time_of_last_hooks_faucet_call - # Wait at least 10 seconds since last call to hooks v3 testnet faucet - time_since_last_hooks_call = time.time() - time_of_last_hooks_faucet_call - if time_since_last_hooks_call < 10: - time.sleep(11 - time_since_last_hooks_call) - - wallet = await generate_faucet_wallet( - client, usage_context="integration_test" - ) - time_of_last_hooks_faucet_call = time.time() - - result = await client.request( - AccountInfo( - account=wallet.address, - ), - ) - balance = int(result.result["account_data"]["Balance"]) - self.assertTrue(balance > 0) - - # Named different from test_generate_faucet_wallet_hooks_v3_testnet_async_websockets - # so the test runs far from each other since hooks v3 testnet faucet - # requires 10 seconds between calls - async def test_fund_given_wallet_hooks_v3_testnet_async_websockets(self): - async with AsyncWebsocketClient( - "wss://hooks-testnet-v3.xrpl-labs.com" - ) as client: - global time_of_last_hooks_faucet_call - wallet = Wallet.create() - time_since_last_hooks_call = time.time() - time_of_last_hooks_faucet_call - if time_since_last_hooks_call < 10: - time.sleep(11 - time_since_last_hooks_call) - time_of_last_hooks_faucet_call = time.time() - await generate_faucet_wallet(client, wallet) - result = await client.request( - AccountInfo( - account=wallet.address, - ), - ) - balance = int(result.result["account_data"]["Balance"]) - - # Wait at least 10 seconds since last call to hooks v3 testnet faucet - time_since_last_hooks_call = time.time() - time_of_last_hooks_faucet_call - if time_since_last_hooks_call < 10: - time.sleep(11 - time_since_last_hooks_call) - time_of_last_hooks_faucet_call = time.time() - - new_wallet = await generate_faucet_wallet( - client, wallet, usage_context="integration_test" - ) - new_result = await client.request( - AccountInfo( - account=new_wallet.address, - ), - ) - new_balance = int(new_result.result["account_data"]["Balance"]) - self.assertTrue(new_balance > balance) - def test_wallet_get_xaddress(self): wallet = Wallet.create() expected = classic_address_to_xaddress(wallet.address, None, False) diff --git a/tests/unit/asyn/wallet/test_wallet.py b/tests/unit/asyn/wallet/test_wallet.py index f94a2be5b..71ff4a342 100644 --- a/tests/unit/asyn/wallet/test_wallet.py +++ b/tests/unit/asyn/wallet/test_wallet.py @@ -2,7 +2,6 @@ from xrpl.asyncio.wallet.wallet_generation import ( _DEV_FAUCET_URL, - _HOOKS_V3_TEST_FAUCET_URL, _TEST_FAUCET_URL, get_faucet_url, process_faucet_host_url, @@ -42,14 +41,6 @@ def test_get_faucet_wallet_test(self): self.assertEqual(get_faucet_url(json_client_url), expected_faucet) self.assertEqual(get_faucet_url(ws_client_url), expected_faucet) - def test_get_faucet_wallet_hooks_v3_test(self): - json_client_url = "https://hooks-testnet-v3.xrpl-labs.com" - ws_client_url = "wss://hooks-testnet-v3.xrpl-labs.com" - expected_faucet = _HOOKS_V3_TEST_FAUCET_URL - - self.assertEqual(get_faucet_url(json_client_url), expected_faucet) - self.assertEqual(get_faucet_url(ws_client_url), expected_faucet) - class TestProcessFaucetHostURL(TestCase): """Test process_faucet_host_url.""" diff --git a/xrpl/asyncio/wallet/wallet_generation.py b/xrpl/asyncio/wallet/wallet_generation.py index 042f8cc07..08cb36418 100644 --- a/xrpl/asyncio/wallet/wallet_generation.py +++ b/xrpl/asyncio/wallet/wallet_generation.py @@ -13,9 +13,6 @@ _TEST_FAUCET_URL: Final[str] = "https://faucet.altnet.rippletest.net/accounts" _DEV_FAUCET_URL: Final[str] = "https://faucet.devnet.rippletest.net/accounts" -_HOOKS_V3_TEST_FAUCET_URL: Final[ - str -] = "https://hooks-testnet-v3.xrpl-labs.com/accounts" _TIMEOUT_SECONDS: Final[int] = 40 @@ -170,8 +167,6 @@ def get_faucet_url(url: str, faucet_host: Optional[str] = None) -> str: """ if faucet_host is not None: return process_faucet_host_url(faucet_host) - if "hooks-testnet-v3" in url: # hooks v3 testnet - return _HOOKS_V3_TEST_FAUCET_URL if "altnet" in url or "testnet" in url: # testnet return _TEST_FAUCET_URL if "sidechain-net2" in url: # sidechain issuing chain devnet From e5d889fec53791f9a4fa54ed0e72d75b5b4bbf9e Mon Sep 17 00:00:00 2001 From: Omar Khan Date: Wed, 15 May 2024 16:57:33 -0400 Subject: [PATCH 02/10] update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e05640313..91b4090a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Construction of Wallet throws an "Invalid Seed" error, if the secret is not decode-able. - Rectify the incorrect usage of a transaction flag name: Update `TF_NO_DIRECT_RIPPLE` to `TF_NO_RIPPLE_DIRECT` - Add the missing `AMMDeposit` Flag `TF_TWO_ASSET_IF_EMPTY` +- Remove Hooks faucet since it's now on the Xahau testnet. ## [2.5.0] - 2023-11-30 From af422dcf3128c2d671e6f1fd54f72f9339a1eade Mon Sep 17 00:00:00 2001 From: Omar Khan Date: Wed, 15 May 2024 17:00:37 -0400 Subject: [PATCH 03/10] add it to Removed section in CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91b4090a9..34d4a8bb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Construction of Wallet throws an "Invalid Seed" error, if the secret is not decode-able. - Rectify the incorrect usage of a transaction flag name: Update `TF_NO_DIRECT_RIPPLE` to `TF_NO_RIPPLE_DIRECT` - Add the missing `AMMDeposit` Flag `TF_TWO_ASSET_IF_EMPTY` + +### Removed: - Remove Hooks faucet since it's now on the Xahau testnet. ## [2.5.0] - 2023-11-30 From 72c5b36a1c197b54f8ffb6370ccbdc40f9f44986 Mon Sep 17 00:00:00 2001 From: Omar Khan Date: Wed, 15 May 2024 17:05:33 -0400 Subject: [PATCH 04/10] replace hooks testnet with alt --- tests/integration/sugar/test_network_id.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/sugar/test_network_id.py b/tests/integration/sugar/test_network_id.py index 064053031..8c3fa38ee 100644 --- a/tests/integration/sugar/test_network_id.py +++ b/tests/integration/sugar/test_network_id.py @@ -14,7 +14,7 @@ class TestNetworkID(TestCase): # Autofill should override tx networkID for network with ID > 1024 # and build_version from 1.11.0 or later. def test_networkid_override(self): - with WebsocketClient("wss://hooks-testnet-v3.xrpl-labs.com") as client: + with WebsocketClient("wss://s.altnet.rippletest.net:51233") as client: wallet = generate_faucet_wallet(client, debug=True) tx = AccountSet( account=wallet.classic_address, From bf8b0f1909c919f3d0dd99514b84c23d4cb6f8ed Mon Sep 17 00:00:00 2001 From: Omar Khan Date: Wed, 15 May 2024 17:09:48 -0400 Subject: [PATCH 05/10] remove module using Hooks faucet --- tests/integration/sugar/test_network_id.py | 26 ---------------------- 1 file changed, 26 deletions(-) delete mode 100644 tests/integration/sugar/test_network_id.py diff --git a/tests/integration/sugar/test_network_id.py b/tests/integration/sugar/test_network_id.py deleted file mode 100644 index 8c3fa38ee..000000000 --- a/tests/integration/sugar/test_network_id.py +++ /dev/null @@ -1,26 +0,0 @@ -from unittest import TestCase - -from xrpl.asyncio.transaction.main import _RESTRICTED_NETWORKS -from xrpl.clients import WebsocketClient -from xrpl.models.transactions import AccountSet -from xrpl.transaction import autofill -from xrpl.wallet.wallet_generation import generate_faucet_wallet - -_FEE = "0.00001" - - -# TODO: move to test_transaction and use the standard integration test setup -class TestNetworkID(TestCase): - # Autofill should override tx networkID for network with ID > 1024 - # and build_version from 1.11.0 or later. - def test_networkid_override(self): - with WebsocketClient("wss://s.altnet.rippletest.net:51233") as client: - wallet = generate_faucet_wallet(client, debug=True) - tx = AccountSet( - account=wallet.classic_address, - fee=_FEE, - domain="www.example.com", - ) - tx_autofilled = autofill(tx, client) - self.assertGreaterEqual(client.network_id, _RESTRICTED_NETWORKS) - self.assertEqual(tx_autofilled.network_id, client.network_id) From 2ce539ff3c17b1f1a0f8d9c1f052e193db806313 Mon Sep 17 00:00:00 2001 From: Omar Khan Date: Wed, 15 May 2024 17:24:45 -0400 Subject: [PATCH 06/10] Revert "remove module using Hooks faucet" This reverts commit bf8b0f1909c919f3d0dd99514b84c23d4cb6f8ed. --- tests/integration/sugar/test_network_id.py | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/integration/sugar/test_network_id.py diff --git a/tests/integration/sugar/test_network_id.py b/tests/integration/sugar/test_network_id.py new file mode 100644 index 000000000..8c3fa38ee --- /dev/null +++ b/tests/integration/sugar/test_network_id.py @@ -0,0 +1,26 @@ +from unittest import TestCase + +from xrpl.asyncio.transaction.main import _RESTRICTED_NETWORKS +from xrpl.clients import WebsocketClient +from xrpl.models.transactions import AccountSet +from xrpl.transaction import autofill +from xrpl.wallet.wallet_generation import generate_faucet_wallet + +_FEE = "0.00001" + + +# TODO: move to test_transaction and use the standard integration test setup +class TestNetworkID(TestCase): + # Autofill should override tx networkID for network with ID > 1024 + # and build_version from 1.11.0 or later. + def test_networkid_override(self): + with WebsocketClient("wss://s.altnet.rippletest.net:51233") as client: + wallet = generate_faucet_wallet(client, debug=True) + tx = AccountSet( + account=wallet.classic_address, + fee=_FEE, + domain="www.example.com", + ) + tx_autofilled = autofill(tx, client) + self.assertGreaterEqual(client.network_id, _RESTRICTED_NETWORKS) + self.assertEqual(tx_autofilled.network_id, client.network_id) From 49a17ff6b4bcb6bc629356611d9fff63a07af7d7 Mon Sep 17 00:00:00 2001 From: Omar Khan Date: Wed, 15 May 2024 17:28:36 -0400 Subject: [PATCH 07/10] use sidechain network in test_network_id --- tests/integration/sugar/test_network_id.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/integration/sugar/test_network_id.py b/tests/integration/sugar/test_network_id.py index 8c3fa38ee..cdd820313 100644 --- a/tests/integration/sugar/test_network_id.py +++ b/tests/integration/sugar/test_network_id.py @@ -4,7 +4,6 @@ from xrpl.clients import WebsocketClient from xrpl.models.transactions import AccountSet from xrpl.transaction import autofill -from xrpl.wallet.wallet_generation import generate_faucet_wallet _FEE = "0.00001" @@ -14,10 +13,9 @@ class TestNetworkID(TestCase): # Autofill should override tx networkID for network with ID > 1024 # and build_version from 1.11.0 or later. def test_networkid_override(self): - with WebsocketClient("wss://s.altnet.rippletest.net:51233") as client: - wallet = generate_faucet_wallet(client, debug=True) + with WebsocketClient("sidechain-net2.devnet.rippletest.net") as client: tx = AccountSet( - account=wallet.classic_address, + account="rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", fee=_FEE, domain="www.example.com", ) From 10eaee5a17d49044bba726a413dfbf31a5d09e78 Mon Sep 17 00:00:00 2001 From: Omar Khan Date: Wed, 15 May 2024 17:34:53 -0400 Subject: [PATCH 08/10] add missing wss: and port --- tests/integration/sugar/test_network_id.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integration/sugar/test_network_id.py b/tests/integration/sugar/test_network_id.py index cdd820313..eea57ab51 100644 --- a/tests/integration/sugar/test_network_id.py +++ b/tests/integration/sugar/test_network_id.py @@ -13,7 +13,9 @@ class TestNetworkID(TestCase): # Autofill should override tx networkID for network with ID > 1024 # and build_version from 1.11.0 or later. def test_networkid_override(self): - with WebsocketClient("sidechain-net2.devnet.rippletest.net") as client: + with WebsocketClient( + "wss://sidechain-net2.devnet.rippletest.net:51233" + ) as client: tx = AccountSet( account="rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", fee=_FEE, From ed9ef8f2e8fbad0d4924e63eb0b3d37250867e51 Mon Sep 17 00:00:00 2001 From: Omar Khan Date: Wed, 15 May 2024 17:49:58 -0400 Subject: [PATCH 09/10] use hooks testnet for testing network id --- tests/integration/sugar/test_network_id.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/sugar/test_network_id.py b/tests/integration/sugar/test_network_id.py index eea57ab51..ecf583455 100644 --- a/tests/integration/sugar/test_network_id.py +++ b/tests/integration/sugar/test_network_id.py @@ -14,7 +14,7 @@ class TestNetworkID(TestCase): # and build_version from 1.11.0 or later. def test_networkid_override(self): with WebsocketClient( - "wss://sidechain-net2.devnet.rippletest.net:51233" + "wss://hooks-testnet-v3.xrpl-labs.com" ) as client: tx = AccountSet( account="rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", From 92e8405d1efe4285e1424633cb23b27f96012bf7 Mon Sep 17 00:00:00 2001 From: Omar Khan Date: Wed, 15 May 2024 17:58:14 -0400 Subject: [PATCH 10/10] lint fix --- tests/integration/sugar/test_network_id.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/integration/sugar/test_network_id.py b/tests/integration/sugar/test_network_id.py index ecf583455..b91ca8264 100644 --- a/tests/integration/sugar/test_network_id.py +++ b/tests/integration/sugar/test_network_id.py @@ -13,9 +13,7 @@ class TestNetworkID(TestCase): # Autofill should override tx networkID for network with ID > 1024 # and build_version from 1.11.0 or later. def test_networkid_override(self): - with WebsocketClient( - "wss://hooks-testnet-v3.xrpl-labs.com" - ) as client: + with WebsocketClient("wss://hooks-testnet-v3.xrpl-labs.com") as client: tx = AccountSet( account="rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", fee=_FEE,