@@ -204,7 +204,7 @@ contract('Lido pushBeacon', ([appManager, voting, user1, user2, user3, nobody])
204
204
assertBn ( await app . totalRewards ( ) , ETH ( 1 ) )
205
205
} )
206
206
207
- it ( 'report BcnValidators:3 = revert' , async ( ) => {
207
+ it ( 'report BcnValidators:3 = revert with REPORTED_MORE_DEPOSITED ' , async ( ) => {
208
208
await assertRevert ( oracle . reportBeacon ( 110 , 3 , ETH ( 65 ) , { from : user2 } ) , 'REPORTED_MORE_DEPOSITED' )
209
209
checkStat ( { depositedValidators : 2 , beaconValidators : 1 , beaconBalance : ETH ( 30 ) } )
210
210
assertBn ( await app . getBufferedEther ( ) , ETH ( 5 ) )
@@ -213,4 +213,27 @@ contract('Lido pushBeacon', ([appManager, voting, user1, user2, user3, nobody])
213
213
assertBn ( await app . totalRewards ( ) , 0 )
214
214
} )
215
215
} )
216
+
217
+ context ( 'with depositedVals=5, beaconVals=4, bcnBal=1, bufferedEth=0' , async ( ) => {
218
+ beforeEach ( async function ( ) {
219
+ await app . setDepositedValidators ( 5 )
220
+ await app . setBeaconBalance ( ETH ( 1 ) )
221
+ await app . setBufferedEther ( { from : user1 , value : ETH ( 0 ) } )
222
+ await app . setBeaconValidators ( 4 )
223
+ } )
224
+
225
+ // See LIP-1 for explanation
226
+ // https://github.com/lidofinance/lido-improvement-proposals/blob/develop/LIPS/lip-1.md
227
+ it ( 'report decreased BcnValidators:3 = revert with REPORTED_LESS_VALIDATORS' , async ( ) => {
228
+ await assertRevert ( oracle . reportBeacon ( 123 , 3 , ETH ( 1 ) , { from : user2 } ) , 'REPORTED_LESS_VALIDATORS' )
229
+ await assertRevert ( oracle . reportBeacon ( 321 , 2 , ETH ( 10 ) , { from : user2 } ) , 'REPORTED_LESS_VALIDATORS' )
230
+ await assertRevert ( oracle . reportBeacon ( 12345 , 1 , ETH ( 123 ) , { from : user2 } ) , 'REPORTED_LESS_VALIDATORS' )
231
+ // values stay intact
232
+ checkStat ( { depositedValidators : 5 , beaconValidators : 4 , beaconBalance : ETH ( 1 ) } )
233
+ assertBn ( await app . getBufferedEther ( ) , ETH ( 0 ) )
234
+ assertBn ( await app . getTotalPooledEther ( ) , ETH ( 33 ) )
235
+ assert . equal ( await app . distributeRewardsCalled ( ) , false )
236
+ assertBn ( await app . totalRewards ( ) , 0 )
237
+ } )
238
+ } )
216
239
} )
0 commit comments