diff --git a/.ci-config/rippled.cfg b/.ci-config/rippled.cfg index b6b907c8d..3e5e2d66a 100644 --- a/.ci-config/rippled.cfg +++ b/.ci-config/rippled.cfg @@ -113,7 +113,6 @@ validators.txt # Devnet amendments as of June 28th, 2023 NegativeUNL fixRemoveNFTokenAutoTrustLine -NonFungibleTokensV1 CheckCashMakesTrustLine fixRmSmallIncreasedQOffers fixSTAmountCanonicalize @@ -156,10 +155,8 @@ fix1512 fix1373 MultiSign Checks -NonFungibleTokensV1_1 # 1.10.0 Amendments DisallowIncoming -fixNonFungibleTokensV1_2 fixTrustLinesToSelf fixUniversalNumber ImmediateOfferKilled @@ -170,7 +167,6 @@ ExpandedSignerList AMM Clawback fixReducedOffersV1 -fixNFTokenRemint # 2.0.0 Amendments XChainBridge DID @@ -202,7 +198,6 @@ PermissionedDomains SingleAssetVault fixFrozenLPTokenTransfer fixInvalidTxFlags -PermissionDelegation PermissionedDEX Batch TokenEscrow diff --git a/tests/integration/it_utils.py b/tests/integration/it_utils.py index 8652f19f5..e76a89978 100644 --- a/tests/integration/it_utils.py +++ b/tests/integration/it_utils.py @@ -19,7 +19,7 @@ from xrpl.models.amounts.issued_currency_amount import IssuedCurrencyAmount from xrpl.models.currencies.issued_currency import IssuedCurrency from xrpl.models.currencies.xrp import XRP -from xrpl.models.requests import Ledger +from xrpl.models.requests import Feature, Ledger from xrpl.models.requests.account_objects import AccountObjects, AccountObjectType from xrpl.models.transactions import MPTokenAuthorize, MPTokenIssuanceCreate from xrpl.models.transactions.account_set import AccountSet, AccountSetAsfFlag @@ -636,3 +636,61 @@ def create_mpt_token_and_authorize_source( sign_and_reliable_submission(payment_tx, issuer, client=client) return mpt_issuance_id + + +async def is_amendment_enabled_async( + client: AsyncClient, + amendment_name: str, +) -> bool: + """ + Check if a specific amendment is enabled on the XRPL server. + + Args: + client: The async client to use for the request. + amendment_name: The name of the amendment to check. + + Returns: + True if the amendment is enabled, False otherwise. + """ + try: + response = await client.request(Feature()) + if response.is_successful() and "features" in response.result: + features = response.result["features"] + for feature_id, feature_data in features.items(): + if ( + isinstance(feature_data, dict) + and feature_data.get("name") == amendment_name + ): + return feature_data.get("enabled", False) + return False + except Exception: + return False + + +def is_amendment_enabled( + client: SyncClient, + amendment_name: str, +) -> bool: + """ + Check if a specific amendment is enabled on the XRPL server. + + Args: + client: The sync client to use for the request. + amendment_name: The name of the amendment to check. + + Returns: + True if the amendment is enabled, False otherwise. + """ + try: + response = client.request(Feature()) + if response.is_successful() and "features" in response.result: + features = response.result["features"] + for feature_id, feature_data in features.items(): + if ( + isinstance(feature_data, dict) + and feature_data.get("name") == amendment_name + ): + return feature_data.get("enabled", False) + return False + except Exception: + return False diff --git a/tests/integration/transactions/test_delegate_set.py b/tests/integration/transactions/test_delegate_set.py index 5e87c5e13..edc145689 100644 --- a/tests/integration/transactions/test_delegate_set.py +++ b/tests/integration/transactions/test_delegate_set.py @@ -1,6 +1,7 @@ from tests.integration.integration_test_case import IntegrationTestCase from tests.integration.it_utils import ( fund_wallet_async, + is_amendment_enabled_async, sign_and_reliable_submission_async, test_async_and_sync, ) @@ -22,6 +23,14 @@ class TestDelegateSet(IntegrationTestCase): @test_async_and_sync(globals()) async def test_delegation_with_no_permission(self, client): + # Check if PermissionDelegation amendment is enabled + is_enabled = await is_amendment_enabled_async(client, "PermissionDelegation") + if not is_enabled: + self.skipTest( + "Skipping DelegateSet test: PermissionDelegation amendment " + "is not enabled on the server" + ) + # Note: Using WALLET, DESTINATION accounts could pollute the test results alice = Wallet.create() await fund_wallet_async(alice) @@ -48,6 +57,14 @@ async def test_delegation_with_no_permission(self, client): @test_async_and_sync(globals()) async def test_delegate_set_workflow(self, client): + # Check if PermissionDelegation amendment is enabled + is_enabled = await is_amendment_enabled_async(client, "PermissionDelegation") + if not is_enabled: + self.skipTest( + "Skipping DelegateSet test: PermissionDelegation amendment " + "is not enabled on the server" + ) + # Note: Using WALLET, DESTINATION accounts could pollute the test results alice = Wallet.create() await fund_wallet_async(alice) @@ -122,6 +139,14 @@ async def test_delegate_set_workflow(self, client): @test_async_and_sync(globals()) async def test_fetch_delegate_account_objects(self, client): + # Check if PermissionDelegation amendment is enabled + is_enabled = await is_amendment_enabled_async(client, "PermissionDelegation") + if not is_enabled: + self.skipTest( + "Skipping DelegateSet test: PermissionDelegation amendment " + "is not enabled on the server" + ) + # Note: Using WALLET, DESTINATION accounts could pollute the test results alice = Wallet.create() await fund_wallet_async(alice)