From b2b9ab611837cc693dea0622e5e7cf24fd438ba9 Mon Sep 17 00:00:00 2001 From: Lucio Baglione Date: Mon, 6 Oct 2025 08:51:09 +0200 Subject: [PATCH 1/3] feat: Add gamma param for the calculation of total stake threshold. --- .../scripts/python/proposers_rewards.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/catalyst-toolbox/catalyst-toolbox/scripts/python/proposers_rewards.py b/src/catalyst-toolbox/catalyst-toolbox/scripts/python/proposers_rewards.py index a3dacc0d2e..b4dbc61e30 100755 --- a/src/catalyst-toolbox/catalyst-toolbox/scripts/python/proposers_rewards.py +++ b/src/catalyst-toolbox/catalyst-toolbox/scripts/python/proposers_rewards.py @@ -21,6 +21,7 @@ from rich import print from asyncio import run as aiorun from copy import deepcopy +from fractions import Fraction # VIT servicing station models @@ -584,13 +585,13 @@ def filter_excluded_proposals( def calculate_total_stake_from_block0_configuration( - block0_config: Dict[str, Dict], committee_keys: List[str] + block0_config: Dict[str, Dict], committee_keys: List[str], gamma: Fraction ): funds = ( initial["fund"] for initial in block0_config["initial"] if "fund" in initial ) return sum( - fund["value"] + fund["value"] ** gamma for fund in itertools.chain.from_iterable(funds) if fund["address"] not in [key for key in committee_keys] ) @@ -698,6 +699,12 @@ def save_results(output_path: str, title: str, output_format: OutputFormat, resu def calculate_rewards( output_file: str = typer.Option(...), block0_path: str = typer.Option(...), + gamma: str = typer.Option( + 1, + help=""" + The gamma value applied for the calculation of the total stake threshold. It is applied to every single voting value before the sum is executed. + """ + ), total_stake_threshold: float = typer.Option( 0.01, help=""" @@ -785,7 +792,7 @@ def calculate_rewards( load_json_from_file(committee_keys_path) if committee_keys_path else [] ) total_stake = calculate_total_stake_from_block0_configuration( - block0_config, committee_keys + block0_config, committee_keys, gamma ) # minimum amount of stake needed for a proposal to be accepted total_stake_approval_threshold = float(total_stake_threshold) * float(total_stake) From 1523dbcb4922f6b132aef9871965be24c0cc5676 Mon Sep 17 00:00:00 2001 From: Lucio Baglione Date: Mon, 6 Oct 2025 09:46:13 +0200 Subject: [PATCH 2/3] fix: Adjust default values. --- .../catalyst-toolbox/scripts/python/proposers_rewards.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/catalyst-toolbox/catalyst-toolbox/scripts/python/proposers_rewards.py b/src/catalyst-toolbox/catalyst-toolbox/scripts/python/proposers_rewards.py index b4dbc61e30..c6d81c28bb 100755 --- a/src/catalyst-toolbox/catalyst-toolbox/scripts/python/proposers_rewards.py +++ b/src/catalyst-toolbox/catalyst-toolbox/scripts/python/proposers_rewards.py @@ -72,6 +72,11 @@ class Author(pydantic.BaseModel): email: str user_name: str = pydantic.Field(alias="userName") +# CatGateway models + +class CatalystDocumentProposal(pydantic.BaseModel): + + # Ideascale models class IdeascaleProposal(pydantic.BaseModel): @@ -700,7 +705,7 @@ def calculate_rewards( output_file: str = typer.Option(...), block0_path: str = typer.Option(...), gamma: str = typer.Option( - 1, + "1", help=""" The gamma value applied for the calculation of the total stake threshold. It is applied to every single voting value before the sum is executed. """ @@ -713,7 +718,7 @@ def calculate_rewards( """ ), relative_threshold: float = typer.Option( - 0, + -1, help="This value indicates the relative threshold between Yes/No votes needed by projects to be eligible for funding." ), output_format: OutputFormat = typer.Option("csv", help="Output format"), From e585d239928de867adf7a285443aeb21874445fc Mon Sep 17 00:00:00 2001 From: Lucio Baglione Date: Mon, 6 Oct 2025 09:49:32 +0200 Subject: [PATCH 3/3] chore: Formatting. --- .../catalyst-toolbox/scripts/python/proposers_rewards.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/catalyst-toolbox/catalyst-toolbox/scripts/python/proposers_rewards.py b/src/catalyst-toolbox/catalyst-toolbox/scripts/python/proposers_rewards.py index c6d81c28bb..d3cdcb49d3 100755 --- a/src/catalyst-toolbox/catalyst-toolbox/scripts/python/proposers_rewards.py +++ b/src/catalyst-toolbox/catalyst-toolbox/scripts/python/proposers_rewards.py @@ -72,11 +72,6 @@ class Author(pydantic.BaseModel): email: str user_name: str = pydantic.Field(alias="userName") -# CatGateway models - -class CatalystDocumentProposal(pydantic.BaseModel): - - # Ideascale models class IdeascaleProposal(pydantic.BaseModel):