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: x/metoken end block functions #2167

Merged
merged 21 commits into from
Jul 27, 2023
Merged

feat: x/metoken end block functions #2167

merged 21 commits into from
Jul 27, 2023

Conversation

kosegor
Copy link
Contributor

@kosegor kosegor commented Jul 26, 2023

This PR contains:

  • Interest claiming during the end_block
  • Reserves rebalancing during the end_block
  • Integ tests for both

@kosegor kosegor requested a review from a team as a code owner July 26, 2023 00:24
x/metoken/module/abci.go Fixed Show fixed Hide fixed
x/metoken/module/abci.go Fixed Show fixed Hide fixed
// todo: add interest claiming
func EndBlocker(k keeper.Keeper) []abci.ValidatorUpdate {
util.Panic(k.ClaimInterest())
util.Panic(k.RebalanceReserves())

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

path flow from Begin/EndBlock to a panic call
// todo: add interest claiming
func EndBlocker(k keeper.Keeper) []abci.ValidatorUpdate {
util.Panic(k.ClaimInterest())
util.Panic(k.RebalanceReserves())

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call
x/metoken/keeper/redeem.go Outdated Show resolved Hide resolved
x/metoken/keeper/redeem.go Outdated Show resolved Hide resolved
kosegor and others added 3 commits July 26, 2023 11:55
Co-authored-by: Adam Moser <63419657+toteki@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Jul 26, 2023

Codecov Report

Merging #2167 (57d7f1c) into main (7f05ad4) will decrease coverage by 5.95%.
Report is 155 commits behind head on main.
The diff coverage is 81.17%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2167      +/-   ##
==========================================
- Coverage   75.38%   69.44%   -5.95%     
==========================================
  Files         100      150      +50     
  Lines        8025    11470    +3445     
==========================================
+ Hits         6050     7965    +1915     
- Misses       1589     2966    +1377     
- Partials      386      539     +153     
Files Changed Coverage Δ
ante/spam_prevention.go 75.92% <ø> (ø)
x/incentive/codec.go 47.82% <ø> (+9.89%) ⬆️
x/incentive/keeper/invariants.go 0.00% <0.00%> (ø)
x/incentive/keeper/unbonding.go 80.45% <ø> (ø)
x/incentive/keeper/update.go 52.11% <ø> (ø)
x/incentive/keys.go 100.00% <ø> (ø)
x/incentive/msgs.go 77.41% <ø> (-0.81%) ⬇️
x/incentive/params.go 89.28% <ø> (-10.72%) ⬇️
x/leverage/client/tests/suite.go 100.00% <ø> (ø)
x/leverage/client/tests/tests.go 100.00% <ø> (ø)
... and 54 more

... and 56 files with indirect coverage changes

Copy link
Member

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

Please double check all errors which are going to EndBlocker. We should avoid possible panics

x/metoken/index.go Show resolved Hide resolved
x/metoken/keeper/balance.go Outdated Show resolved Hide resolved
x/metoken/keeper/interest.go Outdated Show resolved Hide resolved
x/metoken/keeper/interest.go Outdated Show resolved Hide resolved
x/metoken/keeper/interest.go Outdated Show resolved Hide resolved
x/metoken/keeper/intest/interest_test.go Show resolved Hide resolved
x/metoken/keeper/intest/interest_test.go Outdated Show resolved Hide resolved
x/metoken/keeper/intest/interest_test.go Outdated Show resolved Hide resolved
x/metoken/keeper/intest/interest_test.go Outdated Show resolved Hide resolved
x/metoken/keeper/intest/interest_test.go Outdated Show resolved Hide resolved
// todo: add reserves re-balancing
// todo: add interest claiming
func EndBlocker(k keeper.Keeper) []abci.ValidatorUpdate {
util.Panic(k.ClaimLeverageInterest())

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

path flow from Begin/EndBlock to a panic call
// todo: add reserves re-balancing
// todo: add interest claiming
func EndBlocker(k keeper.Keeper) []abci.ValidatorUpdate {
util.Panic(k.ClaimLeverageInterest())

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call
kosegor and others added 3 commits July 26, 2023 17:48
* add module-based supply and withdraw to leverage module

* cl++

* change return order

* godoc++ and function order

* mocks

* mocks

---------

Co-authored-by: Egor Kostetskiy <kosegor@gmail.com>
@kosegor kosegor requested a review from a team as a code owner July 27, 2023 13:44
Copy link
Member

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

lgtm, few small things to resolve only

@kosegor kosegor added this pull request to the merge queue Jul 27, 2023
Merged via the queue into main with commit 70e8310 Jul 27, 2023
@kosegor kosegor deleted the egor/metoken-end-block branch July 27, 2023 16:18
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.

3 participants