@@ -242,7 +242,6 @@ describe('StakingAllocation Contract', () => {
242242 expect ( da0 ) . to . eq ( etherParse ( '14000' ) ) ;
243243 expect ( da1 ) . to . eq ( etherParse ( '1000' ) ) ;
244244
245-
246245 await expect (
247246 stakingAllocation . connect ( runner0 ) . addAllocation ( deploymentIds [ 1 ] , runner0 . address , etherParse ( '5001' ) )
248247 ) . to . be . revertedWith ( 'SAL03' ) ;
@@ -257,7 +256,6 @@ describe('StakingAllocation Contract', () => {
257256 await checkAllocation ( runner1 , etherParse ( '9000' ) , etherParse ( '10000' ) , true , false ) ;
258257 await timeTravel ( 10 ) ;
259258
260-
261259 await stakingAllocation
262260 . connect ( runner1 )
263261 . removeAllocation ( deploymentIds [ 0 ] , runner1 . address , etherParse ( '500' ) ) ;
@@ -268,14 +266,17 @@ describe('StakingAllocation Contract', () => {
268266 await checkAllocation ( runner1 , etherParse ( '9000' ) , etherParse ( '9000' ) , false , true ) ;
269267
270268 await expect (
271- stakingAllocation . connect ( runner1 ) . moveAllocation ( deploymentIds [ 0 ] , deploymentIds [ 0 ] , runner1 . address , etherParse ( '1000' ) )
269+ stakingAllocation
270+ . connect ( runner1 )
271+ . moveAllocation ( deploymentIds [ 0 ] , deploymentIds [ 0 ] , runner1 . address , etherParse ( '1000' ) )
272272 ) . to . revertedWith ( 'SAL07' ) ;
273273
274274 await expect (
275- stakingAllocation . connect ( runner1 ) . moveAllocation ( deploymentIds [ 0 ] , deploymentIds [ 1 ] , runner1 . address , etherParse ( '1199000' ) )
275+ stakingAllocation
276+ . connect ( runner1 )
277+ . moveAllocation ( deploymentIds [ 0 ] , deploymentIds [ 1 ] , runner1 . address , etherParse ( '1199000' ) )
276278 ) . to . revertedWith ( 'SAL04' ) ;
277279
278-
279280 await stakingAllocation
280281 . connect ( runner1 )
281282 . moveAllocation ( deploymentIds [ 0 ] , deploymentIds [ 1 ] , runner1 . address , etherParse ( '1000' ) ) ;
@@ -292,10 +293,7 @@ describe('StakingAllocation Contract', () => {
292293 expect ( await stakingAllocation . allocatedTokens ( runner1 . address , deploymentIds [ 0 ] ) ) . to . eq (
293294 etherParse ( '9000' )
294295 ) ;
295- expect ( await stakingAllocation . allocatedTokens ( runner1 . address , deploymentIds [ 1 ] ) ) . to . eq (
296- etherParse ( '0' )
297- ) ;
298-
296+ expect ( await stakingAllocation . allocatedTokens ( runner1 . address , deploymentIds [ 1 ] ) ) . to . eq ( etherParse ( '0' ) ) ;
299297 } ) ;
300298
301299 it ( 'add allocation to a stopped project' , async ( ) => {
@@ -310,7 +308,6 @@ describe('StakingAllocation Contract', () => {
310308
311309 await stakingAllocation . connect ( runner0 ) . addAllocation ( deploymentId0 , runner0 . address , etherParse ( '5000' ) ) ;
312310 await checkAllocation ( runner0 , etherParse ( '10000' ) , etherParse ( '5000' ) , false , false ) ;
313-
314311 } ) ;
315312
316313 it ( 'over-allocate and recover' , async ( ) => {
@@ -351,6 +348,21 @@ describe('StakingAllocation Contract', () => {
351348 ) . to . revertedWith ( 'SAL03' ) ;
352349 } ) ;
353350
351+ it ( 'blocks move allocation when runner is over-allocated' , async ( ) => {
352+ await stakingAllocation
353+ . connect ( runner0 )
354+ . addAllocation ( deploymentIds [ 0 ] , runner0 . address , etherParse ( '10000' ) ) ;
355+
356+ await stakingManager . connect ( runner0 ) . unstake ( runner0 . address , etherParse ( '1000' ) ) ;
357+ await applyStaking ( runner0 , runner0 ) ;
358+
359+ await expect (
360+ stakingAllocation
361+ . connect ( runner0 )
362+ . moveAllocation ( deploymentIds [ 0 ] , deploymentIds [ 1 ] , runner0 . address , etherParse ( '1000' ) )
363+ ) . to . be . revertedWith ( 'SAL03' ) ;
364+ } ) ;
365+
354366 it ( 'remove allocation when stop service' , async ( ) => {
355367 await checkAllocation ( runner0 , etherParse ( '10000' ) , 0 , false , false ) ;
356368 await stakingManager . connect ( runner0 ) . stake ( runner0 . address , etherParse ( '10000' ) ) ;
0 commit comments