Skip to content

Commit 0f26571

Browse files
authored
Merge pull request #268 from input-output-hk/rm_shelley_protocol
refactor: remove protocol handling from ClusterLib
2 parents 7dbff57 + 1768a2c commit 0f26571

File tree

6 files changed

+1
-26
lines changed

6 files changed

+1
-26
lines changed

cardano_clusterlib/clusterlib.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from cardano_clusterlib.consts import MAINNET_MAGIC
1313
from cardano_clusterlib.consts import MultiSigTypeArgs
1414
from cardano_clusterlib.consts import MultiSlotTypeArgs
15-
from cardano_clusterlib.consts import Protocols
1615
from cardano_clusterlib.consts import SLOTS_OFFSETS
1716
from cardano_clusterlib.consts import ScriptTypes
1817
from cardano_clusterlib.consts import Votes

cardano_clusterlib/clusterlib_helpers.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,6 @@ def _find_conway_genesis_json(clusterlib_obj: "itp.ClusterLib") -> pl.Path:
6262
return genesis_json
6363

6464

65-
def _check_protocol(clusterlib_obj: "itp.ClusterLib") -> None:
66-
"""Check that the cluster is running with the expected protocol."""
67-
try:
68-
clusterlib_obj.create_pparams_file()
69-
except exceptions.CLIError as exc:
70-
if "SingleEraInfo" not in str(exc):
71-
raise
72-
msg = f"The cluster is running with protocol different from '{clusterlib_obj.protocol}'."
73-
raise exceptions.CLIError(msg) from exc
74-
75-
7665
def _check_files_exist(*out_files: itp.FileType, clusterlib_obj: "itp.ClusterLib") -> None:
7766
"""Check that the output files don't already exist.
7867

cardano_clusterlib/clusterlib_klass.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ class ClusterLib:
4848
def __init__(
4949
self,
5050
state_dir: itp.FileType,
51-
protocol: str = consts.Protocols.CARDANO,
5251
slots_offset: int = 0,
5352
socket_path: itp.FileType = "",
5453
command_era: str = consts.CommandEras.LATEST,
@@ -64,7 +63,6 @@ def __init__(
6463
self.cli_coverage: dict = {}
6564
self._rand_str = helpers.get_rand_str(4)
6665
self._cli_log = ""
67-
self.protocol = protocol
6866
self.era_in_use = (
6967
consts.Eras.__members__.get(command_era.upper()) or consts.Eras["DEFAULT"]
7068
).name.lower()
@@ -129,8 +127,6 @@ def __init__(
129127
self._governance_group: tp.Optional[governance_group.GovernanceGroup] = None
130128
self._conway_gov_group: tp.Optional[conway_gov_group.ConwayGovGroup] = None
131129

132-
clusterlib_helpers._check_protocol(clusterlib_obj=self)
133-
134130
def set_socket_path(self, socket_path: tp.Optional[itp.FileType]) -> None:
135131
"""Set a path to socket file for communication with the node."""
136132
if not socket_path:
@@ -435,6 +431,4 @@ def time_from_epoch_start(self, tip: tp.Optional[dict] = None) -> float:
435431
return float(self.epoch_length_sec - s_to_epoch_stop)
436432

437433
def __repr__(self) -> str:
438-
return (
439-
f"<{self.__class__.__name__}: protocol={self.protocol}, command_era={self.command_era}>"
440-
)
434+
return f"<{self.__class__.__name__}: command_era={self.command_era}>"

cardano_clusterlib/consts.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ class CommandEras:
3030
LATEST: tp.Final[str] = "latest"
3131

3232

33-
class Protocols:
34-
CARDANO: tp.Final[str] = "cardano"
35-
SHELLEY: tp.Final[str] = "shelley"
36-
37-
3833
class Eras(enum.Enum):
3934
BYRON: int = 1
4035
SHELLEY: int = 2

cardano_clusterlib/query_group.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def query_cli(
3535
*cli_args,
3636
*self._clusterlib_obj.magic_args,
3737
*self._clusterlib_obj.socket_args,
38-
f"--{self._clusterlib_obj.protocol}-mode",
3938
*cli_sub_args,
4039
]
4140
).stdout

cardano_clusterlib/transaction_group.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,6 @@ def submit_tx_bare(self, tx_file: itp.FileType) -> None:
11331133
*self._clusterlib_obj.socket_args,
11341134
"--tx-file",
11351135
str(tx_file),
1136-
f"--{self._clusterlib_obj.protocol}-mode",
11371136
]
11381137
)
11391138

0 commit comments

Comments
 (0)