Skip to content

Commit 0fe05d4

Browse files
committed
Update tests for removing ReportTimestampOutOfRange
1 parent 3508f1a commit 0fe05d4

File tree

2 files changed

+5
-42
lines changed

2 files changed

+5
-42
lines changed

contracts/MedianOracle.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ contract MedianOracle is OwnableUpgradeable, IOracle {
3434

3535
event ProviderAdded(address provider);
3636
event ProviderRemoved(address provider);
37-
event ReportTimestampOutOfRange(address provider);
37+
// Deprecated: event ReportTimestampOutOfRange(address provider);
3838
event ProviderReportPushed(address indexed provider, uint256 payload, uint256 timestamp);
3939

4040
// The number of seconds after which the report is deemed expired.

test/unit/MedianOracle.ts

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,7 @@ describe('MedianOracle:getData', async function () {
324324
await oracle.connect(A).pushReport(BigNumber.from('1053200000000000000'))
325325
await increaseTime(10)
326326
})
327-
328-
it('should emit ReportTimestampOutOfRange message', async function () {
329-
await expect(oracle.getData())
330-
.to.emit(oracle, 'ReportTimestampOutOfRange')
331-
.withArgs(await C.getAddress())
332-
})
327+
333328
it('should calculate the exchange rate', async function () {
334329
await expect(callerContract.getData())
335330
.to.emit(callerContract, 'ReturnValueUInt256Bool')
@@ -355,12 +350,7 @@ describe('MedianOracle:getData', async function () {
355350
await increaseTime(10)
356351
await oracle.connect(B).pushReport(BigNumber.from('1041000000000000000'))
357352
})
358-
359-
it('should emit ReportTimestampOutOfRange message', async function () {
360-
await expect(oracle.getData())
361-
.to.emit(oracle, 'ReportTimestampOutOfRange')
362-
.withArgs(await B.getAddress())
363-
})
353+
364354
it('should calculate the exchange rate', async function () {
365355
await expect(callerContract.getData())
366356
.to.emit(callerContract, 'ReturnValueUInt256Bool')
@@ -389,12 +379,7 @@ describe('MedianOracle:getData', async function () {
389379
await increaseTime(10)
390380
await oracle.connect(B).pushReport(BigNumber.from('1041000000000000000'))
391381
})
392-
393-
it('should emit ReportTimestampOutOfRange message', async function () {
394-
await expect(oracle.getData())
395-
.to.emit(oracle, 'ReportTimestampOutOfRange')
396-
.withArgs(await B.getAddress())
397-
})
382+
398383
it('should not have a valid result', async function () {
399384
await expect(callerContract.getData())
400385
.to.emit(callerContract, 'ReturnValueUInt256Bool')
@@ -417,19 +402,7 @@ describe('MedianOracle:getData', async function () {
417402

418403
await increaseTime(61)
419404
})
420-
421-
it('should emit 2 ReportTimestampOutOfRange messages', async function () {
422-
const tx = await oracle.getData()
423-
const txReceipt = await tx.wait()
424-
const txEvents = txReceipt.events?.filter((x: any) => {
425-
return x.event == 'ReportTimestampOutOfRange'
426-
})
427-
expect(txEvents.length).to.equal(2)
428-
const eventA = txEvents[0]
429-
expect(eventA.args.provider).to.equal(await A.getAddress())
430-
const eventB = txEvents[1]
431-
expect(eventB.args.provider).to.equal(await B.getAddress())
432-
})
405+
433406
it('should return false and 0', async function () {
434407
await expect(callerContract.getData())
435408
.to.emit(callerContract, 'ReturnValueUInt256Bool')
@@ -451,11 +424,6 @@ describe('MedianOracle:getData', async function () {
451424
})
452425

453426
describe('when recent is too recent and past is too old', function () {
454-
it('should emit ReportTimestampOutOfRange message', async function () {
455-
await expect(oracle.getData())
456-
.to.emit(oracle, 'ReportTimestampOutOfRange')
457-
.withArgs(await A.getAddress())
458-
})
459427
it('should fail', async function () {
460428
await expect(callerContract.getData())
461429
.to.emit(callerContract, 'ReturnValueUInt256Bool')
@@ -478,11 +446,6 @@ describe('MedianOracle:getData', async function () {
478446
})
479447

480448
describe('when recent is too recent and past is too recent', function () {
481-
it('should emit ReportTimestampOutOfRange message', async function () {
482-
await expect(oracle.getData())
483-
.to.emit(oracle, 'ReportTimestampOutOfRange')
484-
.withArgs(await A.getAddress())
485-
})
486449
it('should fail', async function () {
487450
await expect(callerContract.getData())
488451
.to.emit(callerContract, 'ReturnValueUInt256Bool')

0 commit comments

Comments
 (0)