@@ -36,8 +36,8 @@ class ClusterLib:
3636 Attributes:
3737 state_dir: A directory with cluster state files (keys, config files, logs, ...).
3838 protocol: A cluster protocol - full cardano mode by default.
39- slots_offset: Difference in slots between cluster's start era and current era
40- (e.g. Byron->Mary )
39+ slots_offset: Difference in slots between cluster's start era and Shelley era
40+ (Byron vs Shelley )
4141 socket_path: A path to socket file for communication with the node. This overrides the
4242 `CARDANO_NODE_SOCKET_PATH` environment variable.
4343 command_era: An era used for CLI commands, by default same as the latest network Era.
@@ -48,7 +48,7 @@ class ClusterLib:
4848 def __init__ (
4949 self ,
5050 state_dir : itp .FileType ,
51- slots_offset : int = 0 ,
51+ slots_offset : tp . Optional [ int ] = None ,
5252 socket_path : itp .FileType = "" ,
5353 command_era : str = consts .CommandEras .LATEST ,
5454 ):
@@ -95,7 +95,8 @@ def __init__(
9595 else :
9696 self .magic_args = ["--testnet-magic" , str (self .network_magic )]
9797
98- self .slots_offset = slots_offset or consts .SLOTS_OFFSETS .get (self .network_magic ) or 0
98+ self ._slots_offset = slots_offset if slots_offset is not None else None
99+
99100 self .ttl_length = 1000
100101 # TODO: proper calculation based on `utxoCostPerWord` needed
101102 self ._min_change_value = 1800_000
@@ -153,6 +154,13 @@ def cli_version(self) -> version.Version:
153154 self ._cli_version = version .parse (version_str )
154155 return self ._cli_version
155156
157+ @property
158+ def slots_offset (self ) -> int :
159+ """Get offset of slots from Byron era vs current configuration."""
160+ if self ._slots_offset is None :
161+ self ._slots_offset = clusterlib_helpers .get_slots_offset (clusterlib_obj = self )
162+ return self ._slots_offset
163+
156164 @property
157165 def g_transaction (self ) -> transaction_group .TransactionGroup :
158166 """Transaction group."""
0 commit comments