@@ -2128,11 +2128,11 @@ contract('StakeManager', async function(accounts) {
21282128 prepareToTest ( )
21292129 testConfirmAuctionBidForNewValidator ( )
21302130 } )
2131- describe ( 'when 1000 dynasties has passed' , function ( ) {
2131+ describe ( 'when 10 dynasties has passed' , function ( ) {
21322132 prepareToTest ( )
21332133 before ( async function ( ) {
21342134 const currentDynasty = await this . stakeManager . dynasty ( )
2135- await this . stakeManager . advanceEpoch ( currentDynasty . mul ( new BN ( '1000 ' ) ) )
2135+ await this . stakeManager . advanceEpoch ( currentDynasty . mul ( new BN ( '10 ' ) ) )
21362136 } )
21372137
21382138 testConfirmAuctionBidForNewValidator ( )
@@ -2178,10 +2178,10 @@ contract('StakeManager', async function(accounts) {
21782178 } )
21792179 } )
21802180
2181- describe ( 'when 1000 dynasties has passed' , function ( ) {
2181+ describe ( 'when 10 dynasties has passed' , function ( ) {
21822182 beforeEach ( async function ( ) {
21832183 const currentDynasty = await this . stakeManager . dynasty ( )
2184- await this . stakeManager . advanceEpoch ( currentDynasty . mul ( new BN ( '1000 ' ) ) )
2184+ await this . stakeManager . advanceEpoch ( currentDynasty . mul ( new BN ( '10 ' ) ) )
21852185 } )
21862186
21872187 it ( 'reverts' , async function ( ) {
@@ -2378,6 +2378,41 @@ contract('StakeManager', async function(accounts) {
23782378 }
23792379 }
23802380
2381+ describe ( 'when Chad moves stake to unstaked validator' , function ( ) {
2382+ const aliceId = '2'
2383+ const bobId = '8'
2384+ const delegator = wallets [ 9 ] . getChecksumAddressString ( )
2385+
2386+ before ( prepareForTest )
2387+ before ( async function ( ) {
2388+ await this . stakeManager . updateDynastyValue ( 1 )
2389+ await this . stakeToken . mint ( delegator , delegationAmount )
2390+ await this . stakeToken . approve ( this . stakeManager . address , delegationAmount , {
2391+ from : delegator
2392+ } )
2393+
2394+ {
2395+ // stake towards Alice validator
2396+ const validator = await this . stakeManager . validators ( aliceId )
2397+ const validatorContract = await ValidatorShare . at ( validator . contractAddress )
2398+
2399+ await buyVoucher ( validatorContract , delegationAmount , delegator )
2400+ }
2401+
2402+ // unstake Bob validator
2403+
2404+ {
2405+ await this . stakeManager . unstake ( bobId , { from : initialStakers [ 7 ] . getChecksumAddressString ( ) } )
2406+ await this . stakeManager . advanceEpoch ( 100 )
2407+ await this . stakeManager . unstakeClaim ( bobId , { from : initialStakers [ 7 ] . getChecksumAddressString ( ) } )
2408+ }
2409+ } )
2410+
2411+ it ( 'reverts' , async function ( ) {
2412+ await expectRevert ( this . stakeManager . migrateDelegation ( aliceId , bobId , migrationAmount , { from : delegator } ) , 'locked' )
2413+ } )
2414+ } )
2415+
23812416 describe ( 'when Chad moves stake from unstaked validator' , function ( ) {
23822417 const aliceId = '2'
23832418 const bobId = '8'
0 commit comments