Skip to content

Add rate limit on staking transactions#287

Merged
sam0x17 merged 12 commits intodevelopmentfrom
add_rate_limit_on_staking_transactions
Apr 4, 2024
Merged

Add rate limit on staking transactions#287
sam0x17 merged 12 commits intodevelopmentfrom
add_rate_limit_on_staking_transactions

Conversation

@JohnReedV
Copy link
Contributor

This PR adds a rate limit to staking & unstaking transactions.

@JohnReedV JohnReedV marked this pull request as ready for review March 26, 2024 23:39
@unconst unconst changed the base branch from main to development March 27, 2024 17:04
@JohnReedV JohnReedV requested a review from sam0x17 March 28, 2024 16:13
Copy link
Contributor

@sam0x17 sam0x17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, though we do have to be very careful about these state changes in validate, but I think for the purpose of preventing spam it is necessary

@JohnReedV
Copy link
Contributor Author

JohnReedV commented Apr 2, 2024

The reason for changing the state during validation is to prevent spamming of the pool.

If set_stakes_this_interval_for_hotkey() were called at execution or in pre_dispatch(), a staker could potentially submit multiple staking transactions to the pool before the first transaction is executed and the state updated.

Though the additional checks at execution would prevent these subsequent staking transactions from completing, the primary aim of the PR is to prevent such spamming.

Edit: I was wrong. The small time window paired with the financial cost to the staker should be sufficient in preventing pool spam before the stake is executed.

@JohnReedV JohnReedV requested a review from sam0x17 April 3, 2024 01:52
@sam0x17 sam0x17 merged commit a014285 into development Apr 4, 2024
@sam0x17 sam0x17 deleted the add_rate_limit_on_staking_transactions branch April 4, 2024 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants