Skip to content

Commit

Permalink
remove itChecksMainChainlinkOracleRevert
Browse files Browse the repository at this point in the history
  • Loading branch information
tbrent committed Nov 6, 2024
1 parent 17dd84b commit e27d272
Show file tree
Hide file tree
Showing 26 changed files with 20 additions and 51 deletions.
1 change: 0 additions & 1 deletion test/plugins/individual-collateral/aave-v3/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ export const makeTests = (defaultCollateralOpts: CollateralParams, altParams: Al
itChecksRefPerTokDefault: it,
itHasRevenueHiding: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
itIsPricedByPeg: true,
chainlinkDefaultAnswer: 1e8,
itChecksPriceChanges: it,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ all.forEach((curr: AeroStablePoolEnumeration) => {
itChecksRefPerTokDefault: it.skip,
itChecksPriceChanges: it.skip,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it.skip,
itHasRevenueHiding: it.skip,
resetFork,
collateralName: curr.testName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ const opts = {
itChecksPriceChanges: it,
itHasRevenueHiding: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
resetFork,
collateralName: 'AnkrStakedETH',
chainlinkDefaultAnswer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ const opts = {
itChecksPriceChanges: it,
itHasRevenueHiding: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
resetFork,
collateralName: 'CBEthCollateral',
chainlinkDefaultAnswer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ const opts = {
itChecksPriceChanges: it,
itHasRevenueHiding: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
resetFork,
collateralName: 'CBEthCollateralL2',
chainlinkDefaultAnswer,
Expand Down
44 changes: 20 additions & 24 deletions test/plugins/individual-collateral/collateralTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export default function fn<X extends CollateralFixtureContext>(
itChecksRefPerTokDefault,
itChecksPriceChanges,
itChecksNonZeroDefaultThreshold,
itChecksMainChainlinkOracleRevert,
itHasRevenueHiding,
itIsPricedByPeg,
itHasOracleRefPerTok,
Expand Down Expand Up @@ -401,32 +400,29 @@ export default function fn<X extends CollateralFixtureContext>(
) // within 1-part-in-1-thousand
})

itChecksMainChainlinkOracleRevert(
'reverts if Chainlink feed reverts or runs out of gas, maintains status',
async () => {
const InvalidMockV3AggregatorFactory = await ethers.getContractFactory(
'InvalidMockV3Aggregator'
)
const invalidChainlinkFeed = <InvalidMockV3Aggregator>(
await InvalidMockV3AggregatorFactory.deploy(8, chainlinkDefaultAnswer)
)
it('reverts if Chainlink feed reverts or runs out of gas, maintains status', async () => {
const InvalidMockV3AggregatorFactory = await ethers.getContractFactory(
'InvalidMockV3Aggregator'
)
const invalidChainlinkFeed = <InvalidMockV3Aggregator>(
await InvalidMockV3AggregatorFactory.deploy(8, chainlinkDefaultAnswer)
)

const invalidCollateral = await deployCollateral({
erc20: ctx.tok.address,
chainlinkFeed: invalidChainlinkFeed.address,
})
const invalidCollateral = await deployCollateral({
erc20: ctx.tok.address,
chainlinkFeed: invalidChainlinkFeed.address,
})

// Reverting with no reason
await invalidChainlinkFeed.setSimplyRevert(true)
await expect(invalidCollateral.refresh()).to.be.revertedWithoutReason()
expect(await invalidCollateral.status()).to.equal(CollateralStatus.SOUND)
// Reverting with no reason
await invalidChainlinkFeed.setSimplyRevert(true)
await expect(invalidCollateral.refresh()).to.be.revertedWithoutReason()
expect(await invalidCollateral.status()).to.equal(CollateralStatus.SOUND)

// Runnning out of gas (same error)
await invalidChainlinkFeed.setSimplyRevert(false)
await expect(invalidCollateral.refresh()).to.be.revertedWithoutReason()
expect(await invalidCollateral.status()).to.equal(CollateralStatus.SOUND)
}
)
// Runnning out of gas (same error)
await invalidChainlinkFeed.setSimplyRevert(false)
await expect(invalidCollateral.refresh()).to.be.revertedWithoutReason()
expect(await invalidCollateral.status()).to.equal(CollateralStatus.SOUND)
})

it('decays price over priceTimeout period', async () => {
await collateral.refresh()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ allTests.forEach((curr: CTokenV3Enumeration) => {
itChecksRefPerTokDefault: it.skip, // implemented in this file
itChecksPriceChanges: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it.skip, // implemented in this file
itIsPricedByPeg: true,
resetFork: getResetFork(getForkBlock(curr.tokenName)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ const opts = {
itChecksRefPerTokDefault: it,
itChecksPriceChanges: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it.skip,
resetFork,
collateralName: 'SDaiCollateral',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ const opts = {
itChecksRefPerTokDefault: it,
itChecksPriceChanges: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it,
collateralName: 'USDe Fiat Collateral',
chainlinkDefaultAnswer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ const opts = {
itChecksRefPerTokDefault: it,
itChecksPriceChanges: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it,
resetFork,
collateralName: 'Stader ETHx',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ all.forEach((curr: FTokenEnumeration) => {
itChecksRefPerTokDefault: it,
itChecksPriceChanges: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it,
resetFork,
collateralName: curr.testName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ const opts = {
itChecksPriceChanges: it,
itHasRevenueHiding: it.skip, // implemented in this file
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
resetFork,
collateralName: 'SFraxEthCollateral',
chainlinkDefaultAnswer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ const opts = {
itChecksTargetPerRefDefault: it,
itChecksTargetPerRefDefaultUp: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
itChecksRefPerTokDefault: it,
itChecksPriceChanges: it,
itHasRevenueHiding: it.skip,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ const opts = {
itChecksRefPerTokDefault: it,
itChecksPriceChanges: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it,
resetFork: getResetFork(FORK_BLOCK_BASE),
collateralName: 'L2LidoStakedETH',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ const opts = {
itChecksRefPerTokDefault: it,
itChecksPriceChanges: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it,
resetFork,
collateralName: 'LidoStakedETH',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ const makeFiatCollateralTestSuite = (
itChecksRefPerTokDefault: it,
itChecksPriceChanges: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it,
resetFork: getResetFork(FORK_BLOCK),
targetNetwork: defaultCollateralOpts.forkNetwork,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ const makeFiatCollateralTestSuite = (
itChecksRefPerTokDefault: it,
itChecksPriceChanges: it,
itChecksNonZeroDefaultThreshold: it.skip,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it,
resetFork: getResetFork(FORK_BLOCK),
targetNetwork: defaultCollateralOpts.forkNetwork,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ const makeAaveFiatCollateralTestSuite = (
itChecksRefPerTokDefault: it,
itChecksPriceChanges: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it,
resetFork: getResetFork(FORK_BLOCK),
collateralName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ const makeAaveNonFiatCollateralTestSuite = (
itChecksRefPerTokDefault: it,
itChecksPriceChanges: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it,
itIsPricedByPeg: true,
resetFork: getResetFork(FORK_BLOCK),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ const opts = {
itChecksRefPerTokDefault: it,
itChecksPriceChanges: it,
itChecksNonZeroDefaultThreshold: it.skip,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it,
resetFork: getResetFork(FORK_BLOCK),
collateralName: 'MorphoAAVEV2SelfReferentialCollateral - WETH',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ const opts = {
itChecksRefPerTokDefault: it,
itChecksPriceChanges: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it.skip, // implemented in this file
collateralName: 'USDM Collateral',
chainlinkDefaultAnswer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,6 @@ const opts = {
itChecksRefPerTokDefault: it.skip, // implemented in this file
itChecksPriceChanges: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it.skip, // implemented in this file
resetFork,
collateralName: 'ApxETH',
Expand Down
3 changes: 0 additions & 3 deletions test/plugins/individual-collateral/pluginTestTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ export interface CollateralTestSuiteFixtures<T extends CollateralFixtureContext>
// toggle on or off: tests that check that defaultThreshold is not zero
itChecksNonZeroDefaultThreshold: Mocha.TestFunction | Mocha.PendingTestFunction

// toggle on or off: tests that check when the main chainlink feed reverts (not always used)
itChecksMainChainlinkOracleRevert: Mocha.TestFunction | Mocha.PendingTestFunction

// does the peg price matter for the results of tryPrice()?
itIsPricedByPeg?: boolean

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ const opts = {
itChecksRefPerTokDefault: it,
itChecksPriceChanges: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it,
resetFork,
collateralName: 'RocketPoolETH',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ export const stableOpts = {
itChecksTargetPerRefDefaultUp: it,
itChecksRefPerTokDefault: it,
itChecksNonZeroDefaultThreshold: it,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it,
itIsPricedByPeg: true,
chainlinkDefaultAnswer: 1e8,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ tests.forEach((test: CurveFiatTest) => {
itChecksTargetPerRefDefault: it,
itChecksTargetPerRefDefaultUp: it,
itChecksRefPerTokDefault: it,
itChecksMainChainlinkOracleRevert: it,
itHasRevenueHiding: it,
itClaimsRewards: it.skip,
isMetapool: false,
Expand Down

0 comments on commit e27d272

Please sign in to comment.