Skip to content

Commit 0840c41

Browse files
Remove TESTNET2 support (#1185)
* remove testnet2 * satisfy codecov * update migration guide * fix migration guide
1 parent 40a1ee3 commit 0840c41

File tree

7 files changed

+53
-20
lines changed

7 files changed

+53
-20
lines changed

docs/migration_guide.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,34 @@
11
Migration guide
22
===============
33

4+
**********************
5+
0.18.3 Migration guide
6+
**********************
7+
8+
Version 0.18.3 of **starknet.py** comes with support for ...
9+
10+
11+
0.18.3 Targeted versions
12+
------------------------
13+
14+
- Starknet - `0.12.2 <https://community.starknet.io/t/introducing-p2p-authentication-and-mismatch-resolution-in-v0-12-2/97993>`_
15+
- RPC - `0.4.0 <https://github.com/starkware-libs/starknet-specs/releases/tag/v0.4.0>`_
16+
17+
18+
0.18.3 Breaking changes
19+
-----------------------
20+
21+
1. Support for ``TESTNET2`` network has been removed.
22+
23+
24+
|
25+
26+
.. raw:: html
27+
28+
<hr>
29+
30+
|
31+
432
**********************
533
0.18.2 Migration guide
634
**********************

starknet_py/net/account/account.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ async def deploy_account(
464464
465465
Provided address must be first prefunded with enough tokens, otherwise the method will fail.
466466
467-
If using Client for either TESTNET, TESTNET2 or MAINNET, this method will verify if the address balance
467+
If using Client for either TESTNET or MAINNET, this method will verify if the address balance
468468
is high enough to cover deployment costs.
469469
470470
:param address: calculated and prefunded address of the new account.
@@ -517,7 +517,6 @@ async def deploy_account(
517517

518518
if chain in (
519519
StarknetChainId.TESTNET,
520-
StarknetChainId.TESTNET2,
521520
StarknetChainId.MAINNET,
522521
):
523522
balance = await account.get_balance()
@@ -537,7 +536,6 @@ def _default_token_address_for_chain(
537536
) -> str:
538537
if (chain_id or self._chain_id) not in [
539538
StarknetChainId.TESTNET,
540-
StarknetChainId.TESTNET2,
541539
StarknetChainId.MAINNET,
542540
]:
543541
raise ValueError(

starknet_py/net/account/account_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
from starknet_py.net.full_node_client import FullNodeClient
88
from starknet_py.net.gateway_client import GatewayClient
99
from starknet_py.net.models import StarknetChainId, parse_address
10-
from starknet_py.net.networks import MAINNET, TESTNET, TESTNET2
10+
from starknet_py.net.networks import MAINNET, TESTNET
1111
from starknet_py.net.signer.stark_curve_signer import KeyPair, StarkCurveSigner
1212
from starknet_py.tests.e2e.fixtures.constants import MAX_FEE
1313

1414

1515
@pytest.mark.asyncio
16-
@pytest.mark.parametrize("net", (TESTNET, TESTNET2, MAINNET))
16+
@pytest.mark.parametrize("net", (TESTNET, MAINNET))
1717
@pytest.mark.parametrize(
1818
"call_contract",
1919
[

starknet_py/net/models/chains.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import Optional
33

44
from starknet_py.common import int_from_bytes
5-
from starknet_py.net.networks import MAINNET, TESTNET, TESTNET2, Network
5+
from starknet_py.net.networks import MAINNET, TESTNET, Network
66

77

88
class StarknetChainId(IntEnum):
@@ -12,7 +12,6 @@ class StarknetChainId(IntEnum):
1212

1313
MAINNET = int_from_bytes(b"SN_MAIN")
1414
TESTNET = int_from_bytes(b"SN_GOERLI")
15-
TESTNET2 = int_from_bytes(b"SN_GOERLI2")
1615

1716

1817
def chain_from_network(
@@ -21,7 +20,6 @@ def chain_from_network(
2120
mapping = {
2221
MAINNET: StarknetChainId.MAINNET,
2322
TESTNET: StarknetChainId.TESTNET,
24-
TESTNET2: StarknetChainId.TESTNET2,
2523
}
2624

2725
if isinstance(net, str) and net in mapping:

starknet_py/net/networks.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44

55
MAINNET = "mainnet"
66
TESTNET = "testnet"
7-
# TODO (#1178): remove that
8-
TESTNET2 = "testnet2"
9-
10-
# TODO (#1178): remove that
11-
PredefinedNetwork = Literal["mainnet", "testnet", "testnet2"]
7+
PredefinedNetwork = Literal["mainnet", "testnet"]
128

139

1410
class CustomGatewayUrls(TypedDict):
@@ -23,14 +19,11 @@ def net_address_from_net(net: str) -> str:
2319
return {
2420
MAINNET: "https://alpha-mainnet.starknet.io",
2521
TESTNET: "https://alpha4.starknet.io",
26-
# TODO (#1178): remove that
27-
TESTNET2: "https://alpha4-2.starknet.io",
2822
}.get(net, net)
2923

3024

3125
def default_token_address_for_network(net: Network) -> str:
32-
# TODO (#1178): remove that
33-
if net not in [TESTNET, TESTNET2, MAINNET]:
26+
if net not in [TESTNET, MAINNET]:
3427
raise ValueError(
3528
"Argument token_address must be specified when using a custom net address"
3629
)

starknet_py/tests/e2e/client/gateway_test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
TransactionStatusResponse,
1616
)
1717
from starknet_py.net.gateway_client import GatewayClient
18-
from starknet_py.net.networks import MAINNET, TESTNET, TESTNET2, CustomGatewayUrls
18+
from starknet_py.net.networks import MAINNET, TESTNET, CustomGatewayUrls
1919

2020

2121
@pytest.mark.asyncio
@@ -110,8 +110,6 @@ def test_gateway_client_warn_deprecation():
110110
"net, net_address",
111111
(
112112
(TESTNET, "https://alpha4.starknet.io"),
113-
# TODO (#1178): remove that
114-
(TESTNET2, "https://alpha4-2.starknet.io"),
115113
(MAINNET, "https://alpha-mainnet.starknet.io"),
116114
),
117115
)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
1+
import pytest
2+
3+
from starknet_py.constants import FEE_CONTRACT_ADDRESS
14
from starknet_py.net.full_node_client import _is_valid_eth_address
5+
from starknet_py.net.networks import default_token_address_for_network
26

37

48
def test_is_valid_eth_address():
59
assert _is_valid_eth_address("0x333333f332a06ECB5D20D35da44ba07986D6E203")
610
assert not _is_valid_eth_address("0x1")
711
assert not _is_valid_eth_address("123")
12+
13+
14+
def test_default_token_address_for_network():
15+
res = default_token_address_for_network("mainnet")
16+
assert res == FEE_CONTRACT_ADDRESS
17+
18+
res = default_token_address_for_network("testnet")
19+
assert res == FEE_CONTRACT_ADDRESS
20+
21+
with pytest.raises(
22+
ValueError,
23+
match="Argument token_address must be specified when using a custom net address",
24+
):
25+
_ = default_token_address_for_network("")

0 commit comments

Comments
 (0)