Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce rate limits in decrease take #626

Closed
wants to merge 4 commits into from

Conversation

gztensor
Copy link
Contributor

@gztensor gztensor commented Jul 11, 2024

Description

  • Take cannot be increased right away after decreasing
  • Rate limits are enforced in decrease_take extrinsic

Related Issue(s)

n/a

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Other (please describe):

Breaking Change

n/a

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have run cargo fmt and cargo clippy to ensure my code is formatted and linted correctly
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Screenshots (if applicable)

n/a

Additional Notes

n/a

@gztensor gztensor changed the title Set take setting block in decrease take Enforce rate limits in decrease take Jul 11, 2024
@@ -155,9 +155,22 @@ impl<T: Config> Pallet<T> {
let min_take = MinTake::<T>::get();
ensure!(take >= min_take, Error::<T>::DelegateTakeTooLow);

// Enforce the rate limit (independently on do_add_stake rate limits)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Enforce the rate limit (independently on do_add_stake rate limits)
// Enforce the rate limit (independent of do_add_stake rate limits)


// Test rate-limiting on decrease_take
#[test]
fn test_rate_limits_enforced_on_decrease_take() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the expected behaviour? imo, one should be able to decrease without rate limit, but not increase until after the rate limit since the last change (increase or decrease)

@unconst unconst closed this Jul 23, 2024
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.

6 participants