From 0a83e30768ab7a4923332a3a1160565c048aea48 Mon Sep 17 00:00:00 2001 From: Edgars Date: Mon, 20 Apr 2026 13:36:51 +0100 Subject: [PATCH 1/2] feat(gltest): add testnet_bradbury to preconfigured networks Register GenLayer Bradbury testnet as a preconfigured network so `gltest --network testnet_bradbury` (or `--chain-type testnet_bradbury`) routes against https://rpc-bradbury.genlayer.com via the chain definition shipped in genlayer-py. - constants.py: add `testnet_bradbury` to PRECONFIGURED_NETWORKS + CHAINS - user.py: import `testnet_bradbury`, add default network entry (no accounts by default, same pattern as testnet_asimov) - types.py: add to chain_map in GeneralConfig.get_chain() - pyproject.toml: bump genlayer-py pin from 0.9.0 to >=0.11.0 (first version that exports testnet_bradbury) - test_plugin.py: update help-output and chain-type assertions --- gltest_cli/config/constants.py | 4 ++-- gltest_cli/config/types.py | 3 ++- gltest_cli/config/user.py | 14 ++++++++++++-- pyproject.toml | 2 +- tests/gltest_cli/config/test_plugin.py | 4 ++-- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/gltest_cli/config/constants.py b/gltest_cli/config/constants.py index bd9197a..d047b76 100644 --- a/gltest_cli/config/constants.py +++ b/gltest_cli/config/constants.py @@ -4,8 +4,8 @@ GLTEST_CONFIG_FILE = "gltest.config.yaml" DEFAULT_NETWORK = "localnet" -PRECONFIGURED_NETWORKS = ["localnet", "studionet", "testnet_asimov"] -CHAINS = ["localnet", "studionet", "testnet_asimov"] +PRECONFIGURED_NETWORKS = ["localnet", "studionet", "testnet_asimov", "testnet_bradbury"] +CHAINS = ["localnet", "studionet", "testnet_asimov", "testnet_bradbury"] DEFAULT_RPC_URL = SIMULATOR_JSON_RPC_URL DEFAULT_ENVIRONMENT = ".env" DEFAULT_CONTRACTS_DIR = Path("contracts") diff --git a/gltest_cli/config/types.py b/gltest_cli/config/types.py index c525d41..3f414a6 100644 --- a/gltest_cli/config/types.py +++ b/gltest_cli/config/types.py @@ -1,7 +1,7 @@ from dataclasses import dataclass, field from pathlib import Path from typing import Dict, List, Optional -from genlayer_py.chains import localnet, studionet, testnet_asimov +from genlayer_py.chains import localnet, studionet, testnet_asimov, testnet_bradbury from genlayer_py.types import GenLayerChain from gltest_cli.config.constants import PRECONFIGURED_NETWORKS from gltest_cli.config.constants import ( @@ -189,6 +189,7 @@ def get_chain(self) -> GenLayerChain: "localnet": localnet, "studionet": studionet, "testnet_asimov": testnet_asimov, + "testnet_bradbury": testnet_bradbury, } chain_type = self.get_chain_type() return chain_map[chain_type] diff --git a/gltest_cli/config/user.py b/gltest_cli/config/user.py index c922aed..2c8beb8 100644 --- a/gltest_cli/config/user.py +++ b/gltest_cli/config/user.py @@ -18,7 +18,7 @@ DEFAULT_LEADER_ONLY, CHAINS, ) -from genlayer_py.chains import localnet, studionet, testnet_asimov +from genlayer_py.chains import localnet, studionet, testnet_asimov, testnet_bradbury from gltest_cli.config.types import UserConfig, NetworkConfigData, PathConfig VALID_ROOT_KEYS = ["networks", "paths", "environment"] @@ -71,6 +71,16 @@ def get_default_user_config() -> UserConfig: default_wait_retries=DEFAULT_WAIT_RETRIES, chain_type="testnet_asimov", ), + "testnet_bradbury": NetworkConfigData( + id=testnet_bradbury.id, + url=testnet_bradbury.rpc_urls["default"]["http"][0], + accounts=None, + from_account=None, + leader_only=DEFAULT_LEADER_ONLY, + default_wait_interval=DEFAULT_WAIT_INTERVAL, + default_wait_retries=DEFAULT_WAIT_RETRIES, + chain_type="testnet_bradbury", + ), } return UserConfig( @@ -176,7 +186,7 @@ def validate_network_config(network_name: str, network_config: dict): raise ValueError(f"network {network_name} must have accounts") if "chain_type" not in network_config: raise ValueError( - f"network {network_name} must have a chain_type. Valid values: localnet, studionet, testnet_asimov" + f"network {network_name} must have a chain_type. Valid values: {', '.join(CHAINS)}" ) diff --git a/pyproject.toml b/pyproject.toml index 3f13660..f7058d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ readme = "README.md" requires-python = ">=3.12" dependencies = [ "pytest", - "genlayer-py==0.9.0", + "genlayer-py>=0.11.0", "colorama>=0.4.6", "pyyaml", "python-dotenv" diff --git a/tests/gltest_cli/config/test_plugin.py b/tests/gltest_cli/config/test_plugin.py index 3ec64c0..a482b79 100644 --- a/tests/gltest_cli/config/test_plugin.py +++ b/tests/gltest_cli/config/test_plugin.py @@ -20,7 +20,7 @@ def test_help_message(pytester): " --leader-only Run contracts in leader-only mode", " --chain-type=CHAIN_TYPE", " Chain type (possible values: localnet, studionet,", - " testnet_asimov)", + " testnet_asimov, testnet_bradbury)", ] ) @@ -346,7 +346,7 @@ def test_chain_type(): assert general_config.plugin_config.chain_type is None # get_chain_type should still work using network config chain_type = general_config.get_chain_type() - assert chain_type in ["localnet", "studionet", "testnet_asimov"] + assert chain_type in ["localnet", "studionet", "testnet_asimov", "testnet_bradbury"] """ ) From 86ae475de2fc862fe4cf1fa994a0c93f460d6dad Mon Sep 17 00:00:00 2001 From: Edgars Date: Mon, 20 Apr 2026 13:43:33 +0100 Subject: [PATCH 2/2] fix(gltest): address CodeRabbit feedback for testnet_bradbury MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - plugin.py: accounts-required guard now covers both testnet_asimov and testnet_bradbury (parity fix — bradbury was silently falling through with no accounts configured) - pyproject.toml: cap genlayer-py to <0.12.0 so transitive upgrades don't silently break gltest - test_plugin.py: add test_network_testnet_bradbury mirroring the existing asimov guard test --- gltest_cli/config/plugin.py | 6 +++--- pyproject.toml | 2 +- tests/gltest_cli/config/test_plugin.py | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/gltest_cli/config/plugin.py b/gltest_cli/config/plugin.py index 35fd838..c723246 100644 --- a/gltest_cli/config/plugin.py +++ b/gltest_cli/config/plugin.py @@ -89,10 +89,10 @@ def pytest_configure(config): ) user_config = get_default_user_config() - # Special handling for testnet_asimov - check if accounts are configured - if network_name == "testnet_asimov": + # Special handling for remote testnets - check if accounts are configured + if network_name in ("testnet_asimov", "testnet_bradbury"): logger.error( - "For testnet_asimov, you need to configure accounts in gltest.config.yaml, see https://docs.genlayer.com/api-references/genlayer-test" + f"For {network_name}, you need to configure accounts in gltest.config.yaml, see https://docs.genlayer.com/api-references/genlayer-test" ) pytest.exit("gltest configuration error") else: diff --git a/pyproject.toml b/pyproject.toml index f7058d3..acdc8bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ readme = "README.md" requires-python = ">=3.12" dependencies = [ "pytest", - "genlayer-py>=0.11.0", + "genlayer-py>=0.11.0,<0.12.0", "colorama>=0.4.6", "pyyaml", "python-dotenv" diff --git a/tests/gltest_cli/config/test_plugin.py b/tests/gltest_cli/config/test_plugin.py index a482b79..75c4d45 100644 --- a/tests/gltest_cli/config/test_plugin.py +++ b/tests/gltest_cli/config/test_plugin.py @@ -129,6 +129,25 @@ def test_network(): assert result.ret != 0 +def test_network_testnet_bradbury(pytester): + pytester.makepyfile( + """ + from gltest_cli.config.general import get_general_config + + def test_network(): + general_config = get_general_config() + assert general_config.get_network_name() == "testnet_bradbury" + """ + ) + + result = pytester.runpytest( + "--network=testnet_bradbury", "--rpc-url=http://test.example.com:9151", "-v" + ) + + # The test should exit with an error code when testnet_bradbury is used without accounts + assert result.ret != 0 + + def test_artifacts_dir(pytester): """Test that artifacts directory CLI parameter works correctly.""" pytester.makepyfile(