Skip to content

Conversation

@web3rover
Copy link
Contributor

Description

Resolves #

Checklist

  • I have updated the documentation to account for the changes in the code.
  • If I added new functionality, I added tests covering it.
  • If I fixed a bug, I added a test preventing this bug from silently reappearing again.
  • My contribution follows Venus contribution guidelines.

@web3rover web3rover self-assigned this Nov 13, 2025
@web3rover web3rover requested a review from fred-venus November 13, 2025 14:49
@GitGuru7 GitGuru7 self-requested a review November 14, 2025 07:46
Copy link
Contributor

@GitGuru7 GitGuru7 left a comment

Choose a reason for hiding this comment

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

Overall LGTM! Left a couple of nitpicks please let me know if they make sense to you.

Comment on lines 224 to 225
for (uint256 j = 0; j < markets.length; j++) {
if (markets[j] == market) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand this is to avoid a revert in _removePoolMarket if the market is not already listed in eMode. I would prefer using a simple check like if (_poolMarkets[index].isListed) similar to what we have in _removePoolMarket instead of looping over all poolMarkets.

Copy link
Contributor

@fred-venus fred-venus Nov 17, 2025

Choose a reason for hiding this comment

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

agree, let's avoid looping here which could waste ton of gas

PoolMarketId.wrap(bytes32((uint256(poolId) << 160) | uint160(vToken)));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed


require(_market.collateralFactorMantissa == 0, "collateral factor is not 0");

_market.isListed = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: We currently don’t allow adding a market to a pool that isn’t listed in the Core Pool. It might be better to set _market.isListed = false after removing it from all pools (delisting from eMode). Functionally it doesn’t change behavior, but it aligns the logic more clearly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed


const receipt = await comptroller.connect(customer).unlistMarket(unlistToken.address);
expect(receipt).to.emit(unitroller, "MarketUnlisted");
expect(receipt).to.emit(unitroller, "PoolMarketRemoved");
Copy link
Contributor

Choose a reason for hiding this comment

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

I see we already added an event check in the test. Could we also include a simple test to verify that an unlisted market is no longer present in any eMode pool ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@fred-venus
Copy link
Contributor

Also, pls ask them to audit this part as well

@github-actions
Copy link

Code Coverage

Package Line Rate Branch Rate Health
contracts 100% 100%
contracts.Admin 88% 41%
contracts.Comptroller 100% 90%
contracts.Comptroller.Diamond 95% 66%
contracts.Comptroller.Diamond.facets 81% 68%
contracts.Comptroller.Diamond.interfaces 100% 100%
contracts.Comptroller.Types 100% 100%
contracts.Comptroller.legacy 100% 100%
contracts.Comptroller.legacy.Diamond 0% 0%
contracts.Comptroller.legacy.Diamond.facets 0% 0%
contracts.Comptroller.legacy.Diamond.interfaces 100% 100%
contracts.DelegateBorrowers 100% 89%
contracts.FlashLoan.interfaces 100% 100%
contracts.Governance 68% 45%
contracts.InterestRateModels 74% 59%
contracts.Lens 41% 34%
contracts.Liquidator 83% 60%
contracts.Oracle 100% 100%
contracts.PegStability 88% 84%
contracts.Swap 87% 57%
contracts.Swap.interfaces 100% 100%
contracts.Swap.lib 81% 53%
contracts.Tokens 100% 100%
contracts.Tokens.Prime 96% 72%
contracts.Tokens.Prime.Interfaces 100% 100%
contracts.Tokens.Prime.libs 90% 76%
contracts.Tokens.VAI 82% 53%
contracts.Tokens.VRT 20% 9%
contracts.Tokens.VTokens 65% 49%
contracts.Tokens.VTokens.legacy 0% 0%
contracts.Tokens.VTokens.legacy.Utils 0% 0%
contracts.Tokens.XVS 19% 8%
contracts.Tokens.test 100% 100%
contracts.Utils 51% 31%
contracts.VAIVault 50% 45%
contracts.VRTVault 49% 36%
contracts.XVSVault 63% 50%
contracts.external 100% 100%
contracts.lib 89% 71%
Summary 56% (3625 / 6503) 42% (1364 / 3256)

@fred-venus fred-venus force-pushed the develop branch 6 times, most recently from f8786ac to d1378e1 Compare December 12, 2025 09:03
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.

4 participants