Skip to content

Commit

Permalink
Rename vault_exiting_validators_limit_bps to os_token_vaults_exit_lim…
Browse files Browse the repository at this point in the history
…it_bps (#128)

* Rename vault_exiting_validators_limit_bps to os_token_vaults_exit_limit_bps

* Add items to gitignore

* poetry update

* Fix pylint

* Review fix
  • Loading branch information
evgeny-stakewise authored Nov 22, 2024
1 parent 016639d commit e5e71e4
Show file tree
Hide file tree
Showing 8 changed files with 1,371 additions and 1,199 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ dist
.idea
local.env
*.env
.python-version
.vscode
.history
.DS_Store
.coverage
2,545 changes: 1,355 additions & 1,190 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sw-utils"
version = "v0.6.31"
version = "v0.6.32"
description = "StakeWise Python utils"
authors = ["StakeWise Labs <[email protected]>"]
license = "GPL-3.0-or-later"
Expand Down
2 changes: 1 addition & 1 deletion sw_utils/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def set_retry_timeout(self, retry_timeout: int) -> None:
self.retry_timeout = retry_timeout


# pylint: disable-next=too-many-arguments
# pylint: disable-next=too-many-arguments,too-many-positional-arguments
def get_execution_client(
endpoints: list[str],
is_poa: bool = False,
Expand Down
2 changes: 1 addition & 1 deletion sw_utils/ipfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ async def _iter_pins(self) -> AsyncIterator[dict]:
page_number += 1
total_pages = pin_results['totalPages']

# pylint: disable-next=too-many-arguments
# pylint: disable-next=too-many-arguments,too-many-positional-arguments
async def _call(
self,
http_method: str,
Expand Down
6 changes: 4 additions & 2 deletions sw_utils/protocol_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def build_protocol_config(
if validators_threshold and exit_signature_recover_threshold > validators_threshold:
raise ValueError('Invalid exit signature threshold')

vault_exiting_validators_limit_bps = config_data.get('vault_exiting_validators_limit_bps') or 0
# default exit limit bps is 100%
os_token_vaults_exit_limit_bps = config_data.get('os_token_vaults_exit_limit_bps') or 10_000

os_token_vaults = [Web3.to_checksum_address(v) for v in config_data.get('os_token_vaults', [])]

return ProtocolConfig(
Expand All @@ -49,6 +51,6 @@ def build_protocol_config(
exit_signature_epoch=config_data['exit_signature_epoch'],
signature_validity_period=config_data['signature_validity_period'],
until_force_exit_epochs=config_data['until_force_exit_epochs'],
vault_exiting_validators_limit_bps=vault_exiting_validators_limit_bps,
os_token_vaults_exit_limit_bps=os_token_vaults_exit_limit_bps,
os_token_vaults=os_token_vaults,
)
4 changes: 2 additions & 2 deletions sw_utils/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_mocked_protocol_config(
inactive_validator_balance: Wei = Web3.to_wei(31.75, 'ether'),
validator_min_active_epochs: int = 2250, # 10 days
vault_fee_max_bps: int = 1500, # 15%
vault_exiting_validators_limit_bps: int = 0,
os_token_vaults_exit_limit_bps: int = 10_000, # 100%
os_token_vaults: list[str] | None = None,
) -> ProtocolConfig:
return ProtocolConfig(
Expand All @@ -91,6 +91,6 @@ def get_mocked_protocol_config(
until_force_exit_epochs=until_force_exit_epochs,
rewards_threshold=rewards_threshold,
validators_threshold=validators_threshold,
vault_exiting_validators_limit_bps=vault_exiting_validators_limit_bps,
os_token_vaults_exit_limit_bps=os_token_vaults_exit_limit_bps,
os_token_vaults=os_token_vaults or [],
)
4 changes: 2 additions & 2 deletions sw_utils/typings.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ class ProtocolConfig:

exit_signature_recover_threshold: int

# Max exiting validators bps for genesis vault.
# Max exiting validators bps for os-token vaults.
# Zero value means limit is not set.
vault_exiting_validators_limit_bps: int
os_token_vaults_exit_limit_bps: int

# List of vaults used to determine osToken reward rate
os_token_vaults: list[ChecksumAddress]
Expand Down

0 comments on commit e5e71e4

Please sign in to comment.