Skip to content

clear_small_nomination_if_required emits events even if the balance wasn't changed #1950

@antlerminator

Description

@antlerminator

Describe the bug

clear_small_nomination_if_required doesn't verify that the alpha_stake is 0 leading to unnecessary calling of unstake_from_subnet and add_balance_to_coldkey_account which in turn emit StakeRemoved and Deposit events with juz zeroes.

This occurs in all transactions that remove the entire stake.

unstake_all and unstake_all_alpha operations are the most troublesome because they emit WAY more events than they should leading to bloating the chain.

To Reproduce

Perform remove_stake_full_limit operation and check the emitted events.

Expected behavior

clear_small_nomination_if_required should validate that alpha_stake is greater than 0 before proceeding with the unstaking operations.

Screenshots

No response

Environment

N/A

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions