Skip to content

feat: add enabled/blacklist fields to tokens#913

Merged
toteki merged 33 commits intomainfrom
adam/unsupported-assets
May 19, 2022
Merged

feat: add enabled/blacklist fields to tokens#913
toteki merged 33 commits intomainfrom
adam/unsupported-assets

Conversation

@toteki
Copy link
Copy Markdown
Contributor

@toteki toteki commented May 15, 2022

Description

Adds various options for disabling borrow, lend, and oracle price calculations of asset types.

Prevents token registry update from EVER removing base denoms from token registry. Therefore:

  • Gov updates only need to include the tokens they're actually adding/changing.
  • Removing tokens intentionally can be done by disabling borrowing/lending, or setting the Blacklist field depending on the situation. Their metadata and params remain in the token registry.

Also adds validation to SetRegisteredToken

closes: #869
closes: #724


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added appropriate labels to the PR
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@toteki toteki added this to the Calypso milestone May 15, 2022
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 16, 2022

Codecov Report

Merging #913 (bf88e68) into main (fba208c) will increase coverage by 0.02%.
The diff coverage is 58.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #913      +/-   ##
==========================================
+ Coverage   50.87%   50.90%   +0.02%     
==========================================
  Files          64       64              
  Lines        9451     9479      +28     
==========================================
+ Hits         4808     4825      +17     
- Misses       4397     4401       +4     
- Partials      246      253       +7     
Impacted Files Coverage Δ
x/leverage/keeper/genesis.go 2.15% <0.00%> (ø)
x/leverage/keeper/interest.go 78.16% <0.00%> (-4.32%) ⬇️
x/leverage/keeper/reserves.go 78.94% <ø> (+2.99%) ⬆️
x/leverage/keeper/token.go 61.73% <55.55%> (+1.34%) ⬆️
x/leverage/keeper/keeper.go 45.88% <57.14%> (-0.75%) ⬇️
x/leverage/keeper/oracle.go 67.07% <66.66%> (-2.16%) ⬇️
x/leverage/client/tests/suite.go 100.00% <100.00%> (ø)
x/leverage/gov_handler.go 100.00% <100.00%> (+20.00%) ⬆️
x/leverage/types/token.go 42.85% <100.00%> (+9.52%) ⬆️
... and 4 more

@toteki toteki marked this pull request as ready for review May 16, 2022 03:21
@toteki toteki requested review from a team as code owners May 16, 2022 03:21
Copy link
Copy Markdown
Contributor

@RafilxTenfen RafilxTenfen left a comment

Choose a reason for hiding this comment

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

LGTM

toteki and others added 3 commits May 16, 2022 07:33
Co-authored-by: Rafael Tenfen <rafaeltenfen.rt@gmail.com>
// or withdrawn, but not liquidated. A blacklisted token must have enable_lend
// and enable_borrow set to false. Such tokens can be safely removed from the
// by the oracle and price feeder as well.
bool blacklist = 14;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

how about renaming to disabled?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Runs the risk of being interpreted as just a combination of the other two being disabled.

This is more serious in that it also forces the value of the coin to zero in all calculations, which would have all kinds of consequences - we might look for a name that communicates that, but blacklist at least shows the severity.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In #913 (comment) I was thinking to remove this field.

What it would take to unblackist an asset?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Technically, only a governance proposal with the blacklisted field set back to false.

In reality, it seems unlikely that an accepted asset could become so nasty we have to blacklist it, but then recover to a point where we need to reverse the decision.

Copy link
Copy Markdown
Collaborator

@adamewozniak adamewozniak left a comment

Choose a reason for hiding this comment

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

left a few suggestions 🥳

toteki and others added 4 commits May 16, 2022 15:22
Co-authored-by: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com>
Co-authored-by: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@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. Pending proto comments update

toteki and others added 2 commits May 19, 2022 12:33
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
@toteki toteki merged commit 3150329 into main May 19, 2022
@toteki toteki deleted the adam/unsupported-assets branch May 19, 2022 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

x/leverage: Lack of token validation on setRegisteredToken ( RV #18 ) x/leverage: accepted -> unaccepted assets behavior

5 participants