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 downtime detector module #3688

Merged
merged 21 commits into from
Dec 14, 2022
Merged

Add downtime detector module #3688

merged 21 commits into from
Dec 14, 2022

Conversation

ValarDragon
Copy link
Member

@ValarDragon ValarDragon commented Dec 11, 2022

Cref #3603

What is the purpose of the change

Adds downtime detector module.

  • Remaining elements at time of PR open
    • Tests
      • Keeper methods
      • CLI
      • Query
      • types
    • app.go wiring

Brief Changelog

Testing and Verifying

TODO

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes? (yes / no)
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md? (yes / no)
  • How is the feature or change documented? (not applicable / specification (x/<module>/spec/) / Osmosis docs repo / not documented)

@ValarDragon ValarDragon added the V:state/breaking State machine breaking PR label Dec 11, 2022
@ValarDragon ValarDragon changed the title Dev/downtime detector Add downtime detector module Dec 11, 2022
@github-actions github-actions bot added C:app-wiring Changes to the app folder C:CLI labels Dec 11, 2022
@ValarDragon ValarDragon marked this pull request as ready for review December 12, 2022 18:04
@czarcas7ic czarcas7ic self-requested a review December 12, 2022 18:31
@@ -374,7 +374,7 @@ func (s *KeeperTestHelper) BuildTx(
// StateNotAltered validates that app state is not altered. Fails if it is.
func (s *KeeperTestHelper) StateNotAltered() {
oldState := s.App.ExportState(s.Ctx)
s.Commit()
s.App.Commit()
Copy link
Member Author

Choose a reason for hiding this comment

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

This was needed to fix "QueryStateAltered" tests, because Commit would start a new block, which would cause a state write from downtime detector.

app/keepers/modules.go Outdated Show resolved Hide resolved
go.mod Show resolved Hide resolved
k.StoreLastBlockTime(ctx, curTime)
}

func (k *Keeper) saveDowntimeUpdates(ctx sdk.Context, downtime time.Duration) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we get a gdoc here?

&types.EstimateSuperfluidDelegatedAmountByValidatorDenomResponse{},
},
// need to adapt s.val.String() to have an intermediate account,
// else the response is nil and theres a panic internally.
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 related to the downtime detector?

Copy link
Member Author

Choose a reason for hiding this comment

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

Only insofar as I had to change the func (s *KeeperTestHelper) StateNotAltered() { line in apptesting because it was designed incorrectly (as triggered by this module). But fixing that, led to showing this superfluid test was designed with an error as well.

@nicolaslara
Copy link
Contributor

did an initial pass for this. Mostly looks good. My only concerns are the sdk upgrade and superfluid query test removal being bundled into this PR, other than that is just nits or questions

Copy link
Member

@czarcas7ic czarcas7ic left a comment

Choose a reason for hiding this comment

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

Minor comments 👍

@@ -175,6 +179,7 @@ func orderBeginBlockers(allModuleNames []string) []string {
// IBChost came after staking, before superfluid.
// TODO: Come back and delete this line after testing the base change.
ord.Sequence(stakingtypes.ModuleName, ibchost.ModuleName, superfluidtypes.ModuleName)
// We leave downtime-detector un-constrained.
Copy link
Member

Choose a reason for hiding this comment

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

What do we mean by un-constrained here?

Copy link
Member Author

Choose a reason for hiding this comment

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

It can go anywhere in the sequence of begin block runs

x/downtime-detector/genesis.go Outdated Show resolved Hide resolved
x/downtime-detector/genesis.go Show resolved Hide resolved
Comment on lines 12 to 15
ModuleName = "downtime-detector"
StoreKey = ModuleName
RouterKey = ModuleName
// must be alphanumeric
RouterKey = "downtimedetector"
Copy link
Member

Choose a reason for hiding this comment

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

I think we made concentratedliquidity just not use the "-" in the module name to prevent the diff here, might prevent some confusion down the road.

Copy link
Member Author

Choose a reason for hiding this comment

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

good idea

x/downtime-detector/types/keys.go Show resolved Hide resolved
@ValarDragon ValarDragon merged commit 68bae6b into main Dec 14, 2022
@ValarDragon ValarDragon deleted the dev/downtime_detector branch December 14, 2022 17:34
czarcas7ic added a commit that referenced this pull request Jan 4, 2023
* WIP

* Switch to enum

* Remove params query

* Add query

* Add wiring, add import/export test

* Start begin block test

* Finish keeper tests

* Add CLI

* Wire downtime detector CLI + queries

* more module wiring

* add types test

* Fix state alteration test

* Fix superfluid test

* Add stargate whitelist support

* Apply code comment

* Rename folder

* Add requested godoc

* Update x/downtime-detector/genesis.go

Co-authored-by: Adam Tucker <adam@osmosis.team>

* Apply adam suggestion for having a `-`

* move genesis test to own file

Co-authored-by: Adam Tucker <adam@osmosis.team>
czarcas7ic added a commit that referenced this pull request Jan 5, 2023
…14 (#3925)

* Upgrade IBC to v4.2.0 (#3838)

* initial changes to migrate to ibc v4

* added checksum to proposal

* begin and end block are now being called inside nextBlock

* added changelog

* linked pr on changelog

* remove local replace

* using error acks from osmoutils

* osmoutils tagged

* go sum

* added checksum

* feat(x/twap): modify cli to add geometric option (#3812)

* feat(x/twap): geometric twap code gen query boilerplate

* revert cli change

* query gen

* wire up API

* test

* fix

* fixes

* cli

* lint

* refactor via flag

* refactor

* refactor

* fixes

* lint

* add arithmetic twap alias

* Make wasm hooks importable (#3850)

* moved ibc-hooks to its own go.mod

* updated ibc hooks version

* go sum

* add ics23 patch into x/ibc-hooks

* Fix wasm import version conflict

* Update x/ibc-hooks to osmoutils v0.0.2

* Update versions

Co-authored-by: Dev Ojha <dojha@berkeley.edu>

* refactor(x/twap): handle spot price error case in the context of geometric twap (#3845)

* refactor(x/twap): handle spot price error case

* supporting test cases

* table-driven log tests

* test(x/twap): add randomized geometric twap test on a balancer pool (#3844)

* test(x/twap): add randomized test with a balancer pool

* comments

* multiplicative tolerance, fewer retries and larger initial supply range

* Basic geometric twap e2e test (#3835)

* feat(x/twap): geometric twap code gen query boilerplate

* revert cli change

* query gen

* wire up API

* test

* fix

* fixes

* add geometric queries

* create pool.json

* add test

* resolve conflict

* fix: swap uosmo in

* fix problem with wallet creation

* updates

* simplify and add comments

* Update tests/e2e/e2e_test.go

* Update tests/e2e/e2e_test.go

* Update tests/e2e/configurer/chain/queries.go

Co-authored-by: Adam Tucker <adam@osmosis.team>

* Update tests/e2e/configurer/chain/queries.go

Co-authored-by: Adam Tucker <adam@osmosis.team>

* Update tests/e2e/e2e_test.go

Co-authored-by: Adam Tucker <adam@osmosis.team>

* Update tests/e2e/e2e_test.go

Co-authored-by: Adam Tucker <adam@osmosis.team>

* Update tests/e2e/e2e_test.go

Co-authored-by: Adam Tucker <adam@osmosis.team>

* Update tests/e2e/e2e_test.go

Co-authored-by: Adam Tucker <adam@osmosis.team>

Co-authored-by: Roman <ackhtariev@gmail.com>
Co-authored-by: Roman <roman@osmosis.team>
Co-authored-by: Adam Tucker <adam@osmosis.team>

* feat(x/twap): whitelist GeometricTwap and GeometricTwapToNow (#3852)

* feat(x/twap): GeometricTwap and GeometricTwapToNow queries added to Stargate whitelist

* update docs

* fix(scripts): proto gen for osmoutils (#3854)

* fix(scripts): proto gen for osmoutils

* Update scripts/protocgen.sh

* fix(scripts): proto gen osmoutils path (#3859)

* added packet timeouts to wasm hooks (#3862)

* add negative to cli (#3888)

* Making osmoutils compile on chains that don't use our SDK fork (#3899)

* making osmoutils compile on chains that don't use osmosis' fork of the cosmos sdk

* updated imports for e2e tests

* go fumpt

* updated version everywhere

* added changelog entry

* remove deprecation from arithmetic & geometric twap to now query (#3917)

* Add types & boilerplate for the Downtime detector module (#3609)

Sub-component of #3603

Adds types for the thin module intended for downtime detection

- Add downtime detection module types

No tests added

  - Does this pull request introduce a new feature or user-facing behavior changes? somewhat
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? yes
  - How is the feature or change documented? In its spec

* Add downtime detector module (#3688)

* WIP

* Switch to enum

* Remove params query

* Add query

* Add wiring, add import/export test

* Start begin block test

* Finish keeper tests

* Add CLI

* Wire downtime detector CLI + queries

* more module wiring

* add types test

* Fix state alteration test

* Fix superfluid test

* Add stargate whitelist support

* Apply code comment

* Rename folder

* Add requested godoc

* Update x/downtime-detector/genesis.go

Co-authored-by: Adam Tucker <adam@osmosis.team>

* Apply adam suggestion for having a `-`

* move genesis test to own file

Co-authored-by: Adam Tucker <adam@osmosis.team>

* Initial by hand fixes

* feat(osmomath): Exp2 function (#3708)

* feat(osmomath): exp2 function

* export exp2

* changelog

* refactor ErrTolerance to use Dec instead of Int for additive tolerance

* Update osmomath/exp2.go

* Update osmomath/exp2.go

* Update osmomath/exp2.go

* Update osmomath/exp2_test.go

* Update osmomath/exp2_test.go

* do bit shift instead of multiplication

* godoc about error bounds

* comment about bit shift equivalency

* merge conflict

* improve godoc

* typo

* remove TODOs - confirmed obsolete

* Runge's phenomenon comment

* [x/TWAP] Expose a geometric TWAP API  (#3529)

* refactored twap api.go for geometric TWAP

* added barebon docs

* romans feedback

* new

* fix

* nichola feedback

* final roman comments

* fix twap by hand

* change to gamm

* fix balancer test

* bump to v14 upgrade

* e2e fix

* add remaining diff from main to ibc-rate-limit

* update contracts test

* osmomath: `AddMut` and `QuoMut` (#3779)

* mut add

* test add mut

* quo  mut

* test quo mut/ remove want from test struct

* refactor exp

* change mutatives code

* change

* not allocaing

* exp change to quomut

* remove file

* refactor quo

* refactor ad

* refactor tests

* Modify CHANGELOG

* Whitelist EstimateSwapExactAmountOut (#3693)

* whitelist EstimateSwapExactAmountOut

* doc: changelog

* updated rate limit contract

* Fix rust checks (#3576)

* added cargo.lock

* added Cargo.lock as an artifact

* added new bytecode with lock file

Co-authored-by: Nicolas Lara <nicolaslara@gmail.com>
Co-authored-by: Roman <roman@osmosis.team>
Co-authored-by: Dev Ojha <dojha@berkeley.edu>
Co-authored-by: Hieu Vu <72878483+hieuvubk@users.noreply.github.com>
Co-authored-by: Roman <ackhtariev@gmail.com>
Co-authored-by: Supanat <supanat.ptk@gmail.com>
Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Sishir Giri <sis1001@berkeley.edu>
Co-authored-by: Ruslan Akhtariev <46343690+RusAkh@users.noreply.github.com>
Co-authored-by: mattverse <mattpark1028@gmail.com>
Co-authored-by: ByeongSu Hong <frostornge@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:app-wiring Changes to the app folder C:CLI C:x/superfluid V:state/breaking State machine breaking PR
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants