diff --git a/contracts/staking/stakeManager/StakeManager.sol b/contracts/staking/stakeManager/StakeManager.sol index f11909521..dd4382f2f 100644 --- a/contracts/staking/stakeManager/StakeManager.sol +++ b/contracts/staking/stakeManager/StakeManager.sol @@ -523,7 +523,8 @@ contract StakeManager is uint256 toValidatorId, uint256 amount ) public { - require(fromValidatorId < 8 && toValidatorId > 7, "Invalid migration"); + // allow to move to any non-foundation node + require(toValidatorId > 7, "Invalid migration"); IValidatorShare(validators[fromValidatorId].contractAddress).migrateOut(msg.sender, amount); IValidatorShare(validators[toValidatorId].contractAddress).migrateIn(msg.sender, amount); } @@ -1118,7 +1119,6 @@ contract StakeManager is } _removeSigner(validators[validatorId].signer); - _liquidateRewards(validatorId, validator); uint256 targetEpoch = exitEpoch <= currentEpoch ? 0 : exitEpoch; diff --git a/test/units/staking/stakeManager/StakeManager.test.js b/test/units/staking/stakeManager/StakeManager.test.js index 963597e84..53e54801f 100644 --- a/test/units/staking/stakeManager/StakeManager.test.js +++ b/test/units/staking/stakeManager/StakeManager.test.js @@ -2500,8 +2500,8 @@ contract('StakeManager', async function(accounts) { }) }) - describe('when Chad migrates from non-matic validator', function() { - const aliceId = '9' + describe('when Chad migrates to foundation validator', function() { + const foundationNodeId = '2' const bobId = '8' const delegator = wallets[1].getChecksumAddressString() @@ -2511,14 +2511,14 @@ contract('StakeManager', async function(accounts) { await this.stakeToken.approve(this.stakeManager.address, delegationAmount, { from: delegator }) - const aliceValidator = await this.stakeManager.validators(aliceId) - const aliceContract = await ValidatorShare.at(aliceValidator.contractAddress) - await buyVoucher(aliceContract, delegationAmount, delegator) + const nonFoundationValidator = await this.stakeManager.validators(bobId) + const nonFoundationContract = await ValidatorShare.at(nonFoundationValidator.contractAddress) + await buyVoucher(nonFoundationContract, delegationAmount, delegator) }) it('Migration should fail', async function() { await expectRevert( - this.stakeManager.migrateDelegation(aliceId, bobId, migrationAmount, { from: delegator }), + this.stakeManager.migrateDelegation(bobId, foundationNodeId, migrationAmount, { from: delegator }), 'Invalid migration') }) })