@@ -400,7 +400,7 @@ describe('Staking::Delegation', () => {
400400        await  shouldDelegate ( delegator2 ,  toGRT ( '5000' ) ) 
401401      } ) 
402402
403-       it ( 'should delegate a high number  of tokens' ,  async  function  ( )  { 
403+       it ( 'should delegate a high amount  of tokens' ,  async  function  ( )  { 
404404        await  shouldDelegate ( delegator ,  toGRT ( '100' ) ) 
405405        await  shouldDelegate ( delegator ,  toGRT ( '1000000000000000000' ) ) 
406406      } ) 
@@ -416,9 +416,10 @@ describe('Staking::Delegation', () => {
416416          await  shouldDelegate ( delegator ,  toGRT ( '10000000' ) ) 
417417        } ) 
418418
419-         it ( 'should  delegate and burn  delegation deposit tax (100%)' ,  async  function  ( )  { 
419+         it ( 'reject  delegate with  delegation deposit tax (100%)' ,  async  function  ( )  { 
420420          await  staking . setDelegationTaxPercentage ( 1000000 ) 
421-           await  shouldDelegate ( delegator ,  toGRT ( '10000000' ) ) 
421+           const  tx  =  staking . connect ( delegator . signer ) . delegate ( indexer . address ,  toGRT ( '10000000' ) ) 
422+           await  expect ( tx ) . revertedWith ( '!shares' ) 
422423        } ) 
423424      } ) 
424425    } ) 
@@ -649,5 +650,25 @@ describe('Staking::Delegation', () => {
649650      const  afterDelegationPool  =  await  staking . delegationPools ( indexer . address ) 
650651      expect ( afterDelegationPool . tokens ) . eq ( beforeDelegationPool . tokens . add ( delegationFees ) ) 
651652    } ) 
653+ 
654+     it ( 'revert if it cannot assign the smallest amount of shares' ,  async  function  ( )  { 
655+       // Init the delegation pool 
656+       await  shouldDelegate ( delegator ,  tokensToDelegate ) 
657+ 
658+       // Collect funds thru full allocation cycle 
659+       await  staking . connect ( governor . signer ) . setDelegationRatio ( 10 ) 
660+       await  staking . connect ( indexer . signer ) . setDelegationParameters ( 0 ,  0 ,  0 ) 
661+       await  setupAllocation ( tokensToAllocate ) 
662+       await  staking . connect ( assetHolder . signer ) . collect ( tokensToCollect ,  allocationID ) 
663+       await  advanceToNextEpoch ( epochManager ) 
664+       await  staking . connect ( indexer . signer ) . closeAllocation ( allocationID ,  poi ) 
665+       await  advanceToNextEpoch ( epochManager ) 
666+       await  staking . connect ( indexer . signer ) . claim ( allocationID ,  true ) 
667+ 
668+       // Delegate with such small amount of tokens (1 wei) that we do not have enough precision 
669+       // to even assign 1 wei of shares 
670+       const  tx  =  staking . connect ( delegator . signer ) . delegate ( indexer . address ,  toBN ( 1 ) ) 
671+       await  expect ( tx ) . revertedWith ( '!shares' ) 
672+     } ) 
652673  } ) 
653674} ) 
0 commit comments