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

add inner bounds #938

Merged
merged 14 commits into from
Sep 18, 2023
Merged

add inner bounds #938

merged 14 commits into from
Sep 18, 2023

Conversation

asalzmann
Copy link
Contributor

@asalzmann asalzmann commented Sep 17, 2023

summary
add inner bounds

tests

  • unittests
  • dockernet
    • verify bounds are set upon registration
    • verify hz halts if the inner bound is crossed
➜  stride git:(tight-bounds) ✗ stridedl q stakeibc show-host-zone GAIA       
host_zone:
...
  last_redemption_rate: "1.000000000000000000"
  max_inner_redemption_rate: "1.500000000000000000"
  max_redemption_rate: "1.500000000000000000"
  min_inner_redemption_rate: "0.900000000000000000"
  min_redemption_rate: "0.900000000000000000"
  redemption_rate: "1.000000000000000000"

update bounds

$STRIDE_MAIN_CMD tx stakeibc set-redemption-rate-bounds GAIA 1 1.4 --from $STRIDE_ADMIN_ACCT -y | TRIM_TX

and query them

  max_inner_redemption_rate: "1.400000000000000000"
  max_redemption_rate: "1.500000000000000000"
  min_inner_redemption_rate: "1.000000000000000000"
  min_redemption_rate: "0.900000000000000000"

try setting from the wrong account

$STRIDE_MAIN_CMD tx stakeibc set-redemption-rate-bounds GAIA 1.1 1.3 --from val1 -y | TRIM_TX

and the error

➜  stride git:(tight-bounds) ✗ bash dockernet/scripts/set_bound.sh
Error: invalid creator address (stride1uk4ze0x4nvh4fk0xm4jdud58eqn4yxhrt52vv7): invalid address
Usage:
  strided tx stakeibc set-redemption-rate-bounds [chainid] [min-bound] [max-bound] [flags]

Flags:

Set tight bound and observe halt

$STRIDE_MAIN_CMD tx stakeibc set-redemption-rate-bounds GAIA 1 1.000001 --from $STRIDE_ADMIN_ACCT -y | TRIM_TX

halt

dockernet-stride1-1  | 2:11AM ERR IsRedemptionRateWithinSafetyBounds check failed 1.001028241739306108 is outside inner safety bounds [1.000000000000000000, 1.000001000000000000] module=x/stakeibc
dockernet-stride1-1  | 2:11AM ERR [INVARIANT BROKEN!!!] GAIA's RR is 1.001028241739306108. ERR: IsRedemptionRateWithinSafetyBounds check failed 1.001028241739306108 is outside inner safety bounds [1.000000000000000000, 1.000001000000000000]: redemption rate outside safety bounds module=x/stakeibc

@asalzmann asalzmann changed the title boilerplate tight bounds Sep 17, 2023
@asalzmann asalzmann force-pushed the tight-bounds branch 2 times, most recently from 0d3ed29 to 6158058 Compare September 17, 2023 23:10
@asalzmann asalzmann changed the base branch from ica-undelegate-callback-fix to main September 17, 2023 23:11
@asalzmann asalzmann changed the title tight bounds add inner bounds Sep 17, 2023
x/stakeibc/client/cli/tx_update_tight_bounds.go Outdated Show resolved Hide resolved
x/stakeibc/keeper/msg_server_update_tight_bounds.go Outdated Show resolved Hide resolved
x/stakeibc/keeper/msg_server_update_tight_bounds.go Outdated Show resolved Hide resolved
x/stakeibc/keeper/keeper.go Show resolved Hide resolved
HostDenom: Atom,
IbcDenom: IbcAtom,
RedemptionRate: sdk.NewDec(1.0),
MinRedemptionRate: sdk.NewDec(9).Quo(sdk.NewDec(10)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: it's a bit easier to read if you create these with MustNewDecFromStr

s.App.StakeibcKeeper.SetHostZone(s.Ctx, hostZone)

defaultMsg := stakeibctypes.MsgUpdateInnerRedemptionRateBounds{
// TODO: does this need to be the admin address?
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think so cause I don't think validate basic is run when you call the msg server function directly

@asalzmann asalzmann added the A:automerge Automatically merge PR once checks pass label Sep 18, 2023
@mergify mergify bot merged commit ce7fb02 into main Sep 18, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once checks pass C:CLI C:proto C:stakeibc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants