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

feat!: simplify penalty handling logic #9

Merged
merged 9 commits into from
Jul 21, 2023

Commits on Jul 20, 2023

  1. wip: simplify penalty logic

    when insurance is under 5.75% of chunk size, then un-delegate it.
    now we can make sure that during unbonding or re-delegation period, there must be no case where un-pairing insurance cannot cover penalty.
    
    remainings:
    * fix broken tests
    * remove re-delegation info's deletable and amt field
    * add tcs for new logics.
    zsystm committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    2449a35 View commit details
    Browse the repository at this point in the history
  2. handle decimal penalty and fix broken tests

    when calc penaltyAmt, must check shares value based on amt.
    zsystm committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    ae843ab View commit details
    Browse the repository at this point in the history
  3. update re-delegation info

    Those fields are introduced to cover the situation where unpairing ins at previous epoch cannot cover the penalty during re-delegation period.
    But now we check paired ins with IsEnoughToCoverSlash so we don't need PenaltyAmt and Deletable anymore. Because that scenario will not happen.
    zsystm committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    ed61848 View commit details
    Browse the repository at this point in the history

Commits on Jul 21, 2023

  1. apply feedbacks

    * panic when validator is invalid (this must not happen)
    * remove empty branch
    * fix wrong calc in IsEnoughToCoverSlash
    
    feedbacks:
    * #9 (comment)
    * #9 (comment)
    zsystm committed Jul 21, 2023
    Configuration menu
    Copy the full SHA
    57fee4b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    77b34f6 View commit details
    Browse the repository at this point in the history
  3. remove un-reached checking logic and un-necessary comments

    by adding IsEnoughToCoverSlash function, the edge cases we were previously worried about are gone.
    (unpairing ins at previous epoch cannot cover the penalty during re-delegation period).
    
    so comments and checking logics for that edge should be deleted as now.
    zsystm committed Jul 21, 2023
    Configuration menu
    Copy the full SHA
    792742c View commit details
    Browse the repository at this point in the history
  4. update spec related with this pr

    updated spec related with this pr
    
    remove tc created during test locally
    
    change function name of mustDelegate
    mustDelegatePenaltyAmt is more readable and meaningful
    zsystm committed Jul 21, 2023
    Configuration menu
    Copy the full SHA
    1031455 View commit details
    Browse the repository at this point in the history
  5. Update lintk in x/liquidstaking/spec/02_state.md

    Co-authored-by: dongsam <dongsamb@gmail.com>
    zsystm and dongsam authored Jul 21, 2023
    Configuration menu
    Copy the full SHA
    b26a8a1 View commit details
    Browse the repository at this point in the history
  6. Update link in x/liquidstaking/spec/02_state.md

    Co-authored-by: dongsam <dongsamb@gmail.com>
    zsystm and dongsam authored Jul 21, 2023
    Configuration menu
    Copy the full SHA
    88d24ad View commit details
    Browse the repository at this point in the history