Skip to content

Remove deprecated start_rpc and stop_rpc from w3.geth.admin module #2731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions docs/web3.geth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,6 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und

>>> web3.geth.admin.start_http()
True


.. py:method:: start_rpc()

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.admin.start_http()`


.. py:method:: start_ws(host='localhost', port=8546, cors="", apis="eth,net,web3")
Expand Down Expand Up @@ -160,12 +154,6 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und
True


.. py:method:: stop_rpc()

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.admin.stop_http()`


.. py:method:: stop_ws()

* Delegates to ``admin_stopWS`` RPC Method
Expand Down
1 change: 1 addition & 0 deletions newsfragments/2731.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove already-deprecated ``start_rpc`` and ``stop_rpc`` from the ``w3.geth.admin`` module.
11 changes: 0 additions & 11 deletions tests/integration/go_ethereum/test_goethereum_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ def test_admin_start_stop_ws(self, w3: "Web3") -> None:
pytest.xfail(reason="Only one WS endpoint is allowed to be active at any time")
super().test_admin_start_stop_ws(w3)

def test_admin_start_stop_rpc(self, w3: "Web3") -> None:
# This test causes all tests after it to fail on CI if it's allowed to run
pytest.xfail(reason="Only one RPC endpoint is allowed to be active at any time")
super().test_admin_start_stop_rpc(w3)


class TestGoEthereumEthModuleTest(GoEthereumEthModuleTest):
pass
Expand Down Expand Up @@ -187,12 +182,6 @@ async def test_admin_start_stop_ws(self, w3: "Web3") -> None:
pytest.xfail(reason="Only one WS endpoint is allowed to be active at any time")
await super().test_admin_start_stop_ws(w3)

@pytest.mark.asyncio
async def test_admin_start_stop_rpc(self, w3: "Web3") -> None:
# This test causes all tests after it to fail on CI if it's allowed to run
pytest.xfail(reason="Only one RPC endpoint is allowed to be active at any time")
await super().test_admin_start_stop_rpc(w3)


class TestGoEthereumAsyncNetModuleTest(GoEthereumAsyncNetModuleTest):
pass
Expand Down
5 changes: 0 additions & 5 deletions tests/integration/go_ethereum/test_goethereum_ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ def test_admin_start_stop_ws(self, w3: "Web3") -> None:
pytest.xfail(reason="Only one WS endpoint is allowed to be active at any time")
super().test_admin_start_stop_ws(w3)

def test_admin_start_stop_rpc(self, w3: "Web3") -> None:
# This test causes all tests after it to fail on CI if it's allowed to run
pytest.xfail(reason="Only one RPC endpoint is allowed to be active at any time")
super().test_admin_start_stop_rpc(w3)


class TestGoEthereumEthModuleTest(GoEthereumEthModuleTest):
pass
Expand Down
6 changes: 0 additions & 6 deletions tests/integration/go_ethereum/test_goethereum_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@ def test_admin_start_stop_ws(self, w3: "Web3") -> None:
)
super().test_admin_start_stop_ws(w3)

def test_admin_start_stop_rpc(self, w3: "Web3") -> None:
pytest.xfail(
reason="This test inconsistently causes all tests after it on CI to fail if it's allowed to run" # noqa: E501
)
super().test_admin_start_stop_rpc(w3)


class TestGoEthereumEthModuleTest(GoEthereumEthModuleTest):
pass
Expand Down
9 changes: 1 addition & 8 deletions web3/_utils/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
RPC,
)
from web3.method import (
DeprecatedMethod,
Method,
default_root_munger,
)
Expand All @@ -26,7 +25,7 @@


def admin_start_params_munger(
module: Module,
_module: Module,
host: str = "localhost",
port: int = 8546,
cors: str = "",
Expand Down Expand Up @@ -92,9 +91,3 @@ def __call__(
RPC.admin_stopWS,
is_property=True,
)

#
# Deprecated Methods
#
start_rpc = DeprecatedMethod(start_http, "start_rpc", "start_http")
stop_rpc = DeprecatedMethod(stop_http, "stop_rpc", "stop_http")
23 changes: 0 additions & 23 deletions web3/_utils/module_testing/go_ethereum_admin_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@ def test_admin_start_stop_http(self, w3: "Web3") -> None:
start = w3.geth.admin.start_http()
assert start is True

def test_admin_start_stop_rpc(self, w3: "Web3") -> None:
with pytest.warns(DeprecationWarning, match="deprecated in favor of stop_http"):
stop = w3.geth.admin.stop_rpc()
assert stop is True

with pytest.warns(
DeprecationWarning, match="deprecated in favor of start_http"
):
start = w3.geth.admin.start_rpc()
assert start is True

def test_admin_start_stop_ws(self, w3: "Web3") -> None:
stop = w3.geth.admin.stop_ws()
assert stop is True
Expand Down Expand Up @@ -107,18 +96,6 @@ async def test_admin_start_stop_http(self, w3: "Web3") -> None:
start = await w3.geth.admin.start_http() # type: ignore
assert start is True

@pytest.mark.asyncio
async def test_admin_start_stop_rpc(self, w3: "Web3") -> None:
with pytest.warns(DeprecationWarning, match="deprecated in favor of stop_http"):
stop = await w3.geth.admin.stop_rpc()
assert stop is True

with pytest.warns(
DeprecationWarning, match="deprecated in favor of start_http"
):
start = await w3.geth.admin.start_rpc()
assert start is True

@pytest.mark.asyncio
async def test_admin_start_stop_ws(self, w3: "Web3") -> None:
stop = await w3.geth.admin.stop_ws() # type: ignore
Expand Down
38 changes: 1 addition & 37 deletions web3/geth.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,10 @@
node_info,
peers,
start_http,
start_rpc,
start_ws,
stop_http,
stop_rpc,
stop_ws,
)
from web3._utils.decorators import (
deprecated_for,
)
from web3._utils.miner import (
make_dag,
set_etherbase,
Expand Down Expand Up @@ -223,9 +218,6 @@ class BaseGethAdmin(Module):
_start_ws = start_ws
_stop_http = stop_http
_stop_ws = stop_ws
# deprecated
_start_rpc = start_rpc
_stop_rpc = stop_rpc


class GethAdmin(BaseGethAdmin):
Expand Down Expand Up @@ -262,25 +254,11 @@ def start_ws(
return self._start_ws(host, port, cors, apis)

def stop_http(self) -> bool:
return self._stop_rpc()
return self._stop_http()

def stop_ws(self) -> bool:
return self._stop_ws()

@deprecated_for("start_http")
def start_rpc(
self,
host: str = "localhost",
port: int = 8546,
cors: str = "",
apis: str = "eth,net,web3",
) -> bool:
return self._start_rpc(host, port, cors, apis)

@deprecated_for("stop_http")
def stop_rpc(self) -> bool:
return self._stop_rpc()


class AsyncGethAdmin(BaseGethAdmin):
is_async = True
Expand Down Expand Up @@ -321,20 +299,6 @@ async def stop_http(self) -> Awaitable[bool]:
async def stop_ws(self) -> Awaitable[bool]:
return await self._stop_ws() # type: ignore

@deprecated_for("start_http")
async def start_rpc(
self,
host: str = "localhost",
port: int = 8546,
cors: str = "",
apis: str = "eth,net,web3",
) -> Awaitable[bool]:
return await self._start_rpc(host, port, cors, apis)

@deprecated_for("stop_http")
async def stop_rpc(self) -> Awaitable[bool]:
return await self._stop_rpc()


class GethMiner(Module):
"""
Expand Down
3 changes: 0 additions & 3 deletions web3/providers/eth_tester/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,6 @@ def personal_send_transaction(eth_tester: "EthereumTester", params: Any) -> HexS
"start_ws": not_implemented,
"stop_http": not_implemented,
"stop_ws": not_implemented,
# deprecated
"start_rpc": not_implemented,
"stop_rpc": not_implemented,
},
"debug": {
"backtraceAt": not_implemented,
Expand Down