diff --git a/scripts/vote_2024_11_26.py b/scripts/vote_2024_11_26.py index ef88875e..0b917cc1 100644 --- a/scripts/vote_2024_11_26.py +++ b/scripts/vote_2024_11_26.py @@ -69,8 +69,8 @@ def start_vote(tx_params: Dict[str, str], silent: bool) -> bool | list[int | Tra tmc_registry = interface.AllowedRecipientRegistry("0x1a7cFA9EFB4D5BfFDE87B0FaEb1fC65d653868C0") NO_registry = contracts.node_operators_registry - SimplyStaking_id = 16 - SimplyStaking_new_reward_address = "0x1EC3Cbe8fb1D8019092500CcA2111C158a35bC82" + simply_staking_id = 16 + simply_staking_new_reward_address = "0x1EC3Cbe8fb1D8019092500CcA2111C158a35bC82" vote_desc_items, call_script_items = zip( # @@ -134,8 +134,8 @@ def start_vote(tx_params: Dict[str, str], silent: bool) -> bool | list[int | Tra agent_forward( [ encode_set_node_operator_reward_address( - SimplyStaking_id, - SimplyStaking_new_reward_address, + simply_staking_id, + simply_staking_new_reward_address, NO_registry ), ] diff --git a/tests/test_2024_11_26.py b/tests/test_2024_11_26.py index 92c34a96..1482c8ab 100644 --- a/tests/test_2024_11_26.py +++ b/tests/test_2024_11_26.py @@ -33,16 +33,16 @@ def test_vote(helpers, accounts, vote_ids_from_env, stranger): atc_multisig_acc = accounts.at("0x9B1cebF7616f2BC73b47D226f90b01a7c9F86956", force=True) atc_trusted_caller_acc = atc_multisig_acc atc_top_up_evm_script_factory = interface.TopUpAllowedRecipients("0x1843Bc35d1fD15AbE1913b9f72852a79457C42Ab") - atcBudgetLimitAfterExpected = 7_000_000 * 10**18 - atcSpendLimitAfterExpected = 5_500_000 * 10**18 + atc_budget_limit_after_expected = 7_000_000 * 10**18 + atc_spend_limit_after_expected = 5_500_000 * 10**18 # Item 2 pml_allowed_recipients_registry = interface.AllowedRecipientRegistry("0xDFfCD3BF14796a62a804c1B16F877Cf7120379dB") pml_multisig_acc = accounts.at("0x17F6b2C738a63a8D3A113a228cfd0b373244633D", force=True) pml_trusted_caller_acc = pml_multisig_acc pml_top_up_evm_script_factory = interface.TopUpAllowedRecipients("0x92a27C4e5e35cFEa112ACaB53851Ec70e2D99a8D") - pmlBudgetLimitAfterExpected = 4_000_000 * 10**18 - pmlSpendLimitAfterExpected = 3_000_000 * 10**18 + pml_budget_limit_after_expected = 4_000_000 * 10**18 + pml_spend_limit_after_expected = 3_000_000 * 10**18 # Item 3, 4 tmc_allowed_recipients_registry = interface.AllowedRecipientRegistry("0x1a7cFA9EFB4D5BfFDE87B0FaEb1fC65d653868C0") @@ -51,8 +51,8 @@ def test_vote(helpers, accounts, vote_ids_from_env, stranger): tmc_top_up_evm_script_factory = interface.TopUpAllowedRecipients("0x6e04aED774B7c89BB43721AcDD7D03C872a51B69") stETH_token = interface.ERC20("0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84") stonks_steth_contract = accounts.at("0x3e2D251275A92a8169A3B17A2C49016e2de492a7", force=True) - tmcBudgetAfterExpected = 12_000 * 10**18 - tmcNewSpentAmountExpected = 0 + tmc_budget_after_expected = 12_000 * 10**18 + tmc_new_spent_amount_expected = 0 # Item 5 # NO's data indexes @@ -62,37 +62,37 @@ def test_vote(helpers, accounts, vote_ids_from_env, stranger): stakingLimitIndex = 3 stoppedValidatorsIndex = 4 # Simply Staking params - SimplyStakingId = 16 - SimplyStakingName = "Simply Staking" - SimplyStakingOldRewardAddress = "0xFEf3C7aa6956D03dbad8959c59155c4A465DCacd" - SimplyStakingNewRewardAddress = "0x1EC3Cbe8fb1D8019092500CcA2111C158a35bC82" + simply_staking_id = 16 + simply_staking_name = "Simply Staking" + simply_staking_old_reward_address = "0xFEf3C7aa6956D03dbad8959c59155c4A465DCacd" + simply_staking_new_reward_address = "0x1EC3Cbe8fb1D8019092500CcA2111C158a35bC82" # Item 1 - atcBudgetLimitBefore, atcPeriodDurationMonthsBefore = interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).getLimitParameters() - assert atcBudgetLimitBefore == 1_500_000 * 10 ** 18 - assert atcPeriodDurationMonthsBefore == 3 + atc_budget_limit_before, atc_period_duration_months_before = interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).getLimitParameters() + assert atc_budget_limit_before == 1_500_000 * 10 ** 18 + assert atc_period_duration_months_before == 3 assert 0 == interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).spendableBalance() # Item 2 - pmlBudgetLimitBefore, pmlPeriodDurationMonthsBefore = interface.AllowedRecipientRegistry(pml_allowed_recipients_registry).getLimitParameters() - assert pmlBudgetLimitBefore == 6_000_000 * 10 ** 18 - assert pmlPeriodDurationMonthsBefore == 3 + pml_budget_limit_before, pml_period_duration_months_before = interface.AllowedRecipientRegistry(pml_allowed_recipients_registry).getLimitParameters() + assert pml_budget_limit_before == 6_000_000 * 10 ** 18 + assert pml_period_duration_months_before == 3 assert 5_000_000 * 10**18 == interface.AllowedRecipientRegistry(pml_allowed_recipients_registry).spendableBalance() # Item 3 - tmcBudgetLimitBefore, tmcPeriodDurationMonthsBefore = interface.AllowedRecipientRegistry(tmc_allowed_recipients_registry).getLimitParameters() - assert tmcBudgetLimitBefore == 9_000 * 10 ** 18 - assert tmcPeriodDurationMonthsBefore == 6 + tmc_budget_limit_before, tmc_period_duration_months_before = interface.AllowedRecipientRegistry(tmc_allowed_recipients_registry).getLimitParameters() + assert tmc_budget_limit_before == 9_000 * 10 ** 18 + assert tmc_period_duration_months_before == 6 # Item 4 - alreadySpentAmountBefore, spendableBalanceInPeriodBefore, periodStartTimestampBefore, periodEndTimestampBefore = tmc_allowed_recipients_registry.getPeriodState() - assert alreadySpentAmountBefore > 0 + already_spent_amount_before, _, _, _ = tmc_allowed_recipients_registry.getPeriodState() + assert already_spent_amount_before > 0 # Item 5 - SimplyStakingDataBefore = nor.getNodeOperator(SimplyStakingId, True) - assert SimplyStakingOldRewardAddress == SimplyStakingDataBefore[rewardAddressIndex] - assert SimplyStakingName == SimplyStakingDataBefore[nameIndex] + simply_staking_data_before = nor.getNodeOperator(simply_staking_id, True) + assert simply_staking_old_reward_address == simply_staking_data_before[rewardAddressIndex] + assert simply_staking_name == simply_staking_data_before[nameIndex] # START VOTE @@ -106,16 +106,16 @@ def test_vote(helpers, accounts, vote_ids_from_env, stranger): # Item 1 - atcBudgetLimitAfter, atcPeriodDurationMonthsAfter = interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).getLimitParameters() + atc_budget_limit_after, atc_period_duration_months_after = interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).getLimitParameters() atc_spend_limit_after = interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).getPeriodState()[1] - atcSpendableBalanceAfter = interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).spendableBalance() - assert atcBudgetLimitAfter == atcBudgetLimitAfterExpected - assert atcPeriodDurationMonthsAfter == 3 - assert atc_spend_limit_after == atcSpendLimitAfterExpected - assert interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).isUnderSpendableBalance(atcSpendableBalanceAfter, 3) - assert atcSpendableBalanceAfter == atcSpendLimitAfterExpected + atc_spendable_balance_after = interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).spendableBalance() + assert atc_budget_limit_after == atc_budget_limit_after_expected + assert atc_period_duration_months_after == 3 + assert atc_spend_limit_after == atc_spend_limit_after_expected + assert interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).isUnderSpendableBalance(atc_spendable_balance_after, 3) + assert atc_spendable_balance_after == atc_spend_limit_after_expected limit_test(easy_track, - int(atcSpendableBalanceAfter / (10**18)) * 10**6, + int(atc_spendable_balance_after / (10**18)) * 10**6, atc_trusted_caller_acc, atc_top_up_evm_script_factory, atc_multisig_acc, @@ -125,14 +125,14 @@ def test_vote(helpers, accounts, vote_ids_from_env, stranger): ) # Item 2 - pmlBudgetLimitAfter, pmlPeriodDurationMonthsAfter = interface.AllowedRecipientRegistry(pml_allowed_recipients_registry).getLimitParameters() + pml_budget_limit_after, pml_period_duration_months_after = interface.AllowedRecipientRegistry(pml_allowed_recipients_registry).getLimitParameters() pml_spend_limit_after = interface.AllowedRecipientRegistry(pml_allowed_recipients_registry).getPeriodState()[1] pmlSpendableBalanceAfter = interface.AllowedRecipientRegistry(pml_allowed_recipients_registry).spendableBalance() - assert pmlBudgetLimitAfter == pmlBudgetLimitAfterExpected - assert pmlPeriodDurationMonthsAfter == 3 - assert pml_spend_limit_after == pmlSpendLimitAfterExpected + assert pml_budget_limit_after == pml_budget_limit_after_expected + assert pml_period_duration_months_after == 3 + assert pml_spend_limit_after == pml_spend_limit_after_expected assert interface.AllowedRecipientRegistry(pml_allowed_recipients_registry).isUnderSpendableBalance(pmlSpendableBalanceAfter, 3) - assert pmlSpendableBalanceAfter == pmlSpendLimitAfterExpected + assert pmlSpendableBalanceAfter == pml_spend_limit_after_expected limit_test(easy_track, int(pmlSpendableBalanceAfter / (10**18)) * 10**6, pml_trusted_caller_acc, @@ -144,17 +144,17 @@ def test_vote(helpers, accounts, vote_ids_from_env, stranger): ) # Item 3 - tmcBudgetLimitAfter, tmcPeriodDurationMonthsAfter = interface.AllowedRecipientRegistry(tmc_allowed_recipients_registry).getLimitParameters() - assert tmcBudgetLimitAfter == tmcBudgetAfterExpected - assert tmcPeriodDurationMonthsAfter == 6 + tmc_budget_limit_after, tmc_period_duration_months_after = interface.AllowedRecipientRegistry(tmc_allowed_recipients_registry).getLimitParameters() + assert tmc_budget_limit_after == tmc_budget_after_expected + assert tmc_period_duration_months_after == 6 # Item 4 - alreadySpentAmountAfter = tmc_allowed_recipients_registry.getPeriodState()[0] - assert alreadySpentAmountAfter == tmcNewSpentAmountExpected - tmcSpendableBalanceAfter = interface.AllowedRecipientRegistry(tmc_allowed_recipients_registry).spendableBalance() - assert tmcSpendableBalanceAfter == tmcBudgetAfterExpected + already_spent_amount_after = tmc_allowed_recipients_registry.getPeriodState()[0] + assert already_spent_amount_after == tmc_new_spent_amount_expected + tmc_spendable_balance_after = interface.AllowedRecipientRegistry(tmc_allowed_recipients_registry).spendableBalance() + assert tmc_spendable_balance_after == tmc_budget_after_expected limit_test(easy_track, - tmcSpendableBalanceAfter, + tmc_spendable_balance_after, tmc_trusted_caller, tmc_top_up_evm_script_factory, stonks_steth_contract, @@ -164,12 +164,12 @@ def test_vote(helpers, accounts, vote_ids_from_env, stranger): ) # Item 5 - SimplyStakingDataAfter = nor.getNodeOperator(SimplyStakingId, True) - assert SimplyStakingNewRewardAddress == SimplyStakingDataAfter[rewardAddressIndex] - assert SimplyStakingDataBefore[nameIndex] == SimplyStakingDataAfter[nameIndex] - assert SimplyStakingDataBefore[activeIndex] == SimplyStakingDataAfter[activeIndex] - assert SimplyStakingDataBefore[stakingLimitIndex] == SimplyStakingDataAfter[stakingLimitIndex] - assert SimplyStakingDataBefore[stoppedValidatorsIndex] == SimplyStakingDataAfter[stoppedValidatorsIndex] + simply_staking_data_after = nor.getNodeOperator(simply_staking_id, True) + assert simply_staking_new_reward_address == simply_staking_data_after[rewardAddressIndex] + assert simply_staking_data_before[nameIndex] == simply_staking_data_after[nameIndex] + assert simply_staking_data_before[activeIndex] == simply_staking_data_after[activeIndex] + assert simply_staking_data_before[stakingLimitIndex] == simply_staking_data_after[stakingLimitIndex] + assert simply_staking_data_before[stoppedValidatorsIndex] == simply_staking_data_after[stoppedValidatorsIndex] # events @@ -178,31 +178,31 @@ def test_vote(helpers, accounts, vote_ids_from_env, stranger): validate_set_limit_parameter_event( evs[0], - limit=atcBudgetLimitAfterExpected, + limit=atc_budget_limit_after_expected, period_duration_month=3, period_start_timestamp=1727740800, ) validate_set_limit_parameter_event( evs[1], - limit=pmlBudgetLimitAfterExpected, + limit=pml_budget_limit_after_expected, period_duration_month=3, period_start_timestamp=1727740800, ) validate_set_limit_parameter_event( evs[2], - limit=tmcBudgetAfterExpected, + limit=tmc_budget_after_expected, period_duration_month=6, period_start_timestamp=1719792000, ) validate_set_spent_amount_event( evs[3], - new_spent_amount=tmcNewSpentAmountExpected, + new_spent_amount=tmc_new_spent_amount_expected, ) validate_node_operator_reward_address_set_event( evs[4], NodeOperatorRewardAddressSetItem( - nodeOperatorId=SimplyStakingId, - reward_address=SimplyStakingNewRewardAddress + nodeOperatorId=simply_staking_id, + reward_address=simply_staking_new_reward_address ) )