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

Drawdown control w/ user-defined Severity & Penalty Levels #162

Merged
merged 4 commits into from
Oct 14, 2022

Conversation

wilhempujar
Copy link
Contributor

@wilhempujar wilhempujar commented Oct 10, 2022

This patch provides an alternate, user-defined reward calculation approach vs the default deviation formula that we use in the SLO registry.

It allows the contract creator to define severity levels, and their respective penalties.
If the SLI is equal or greater than the value of a severity level severity[i], then penalty[i] becomes the deviation.

N.B. In DSLA v2.0, deviation = reward.

In a Parametric Staking SLA, this gives the contract creator a way to control the drawdown of the liquidity pool based on the price increase of the underlying asset.

For the DSLA token initial configuration:

  • Severity 1: Any increase under 100% = 1% deviation
  • Severity 2: An increase of 100%+ = 10% deviation
  • Severity 3: An increase of 250%+ = 25% deviation

25% is also the protocol-level cap on rewards.

The DTK needs to be updated accordingly (I'm on it).

}
}

if (deviation == 0) {
Copy link

Choose a reason for hiding this comment

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

If I have created two arrays of penalty / severity but for some reason at one time the deviation is equal to 0.
I will fall back to the previous formula and my custom penalty won't be respected.

I think we need to replace this with a check of presence / length of penalty / severity arrays

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the deviation equals 0, meaning penalty[i] = 0, we can assume that's what the user wants imho. It makes a nice fallback to the default behaviour, when using custom severities.

Copy link

Choose a reason for hiding this comment

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

Are we sure that the deviation will stay at zero after the fallback to default formula, as this formula is based on the SLO / SLI delta?

Copy link

@Axel-CH Axel-CH left a comment

Choose a reason for hiding this comment

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

Great changes that will enable more customization on SLA outcome, need to update tests with new createSLA params

@wilhempujar
Copy link
Contributor Author

Great changes that will enable more customization on SLA outcome, need to update tests with new createSLA params

Tests updated / Passing ☑️

LFG?

@Axel-CH
Copy link

Axel-CH commented Oct 11, 2022

Specific tests for user defined severity & penalty levels should be added imo, beside that great work. LGTM 👍

}
}

if (deviation == 0) {
Copy link

Choose a reason for hiding this comment

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

Are we sure that the deviation will stay at zero after the fallback to default formula, as this formula is based on the SLO / SLI delta?

@wilhempujar wilhempujar merged commit bcfe10e into develop Oct 14, 2022
@wilhempujar wilhempujar deleted the fix/severity-penalty-levels branch October 14, 2022 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants