From 4786beaf6d87ae3b3cccec6426e62fb9bced3e28 Mon Sep 17 00:00:00 2001 From: Alexandr Tarelkin Date: Mon, 13 Feb 2023 23:46:11 +0300 Subject: [PATCH] fix tests awaits --- test/0.4.24/lido.test.js | 10 +++++----- test/0.4.24/staking-limit.test.js | 6 +++--- test/0.8.9/lido-exec-layer-rewards-vault.js | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/test/0.4.24/lido.test.js b/test/0.4.24/lido.test.js index a1b63befc..f5a951102 100644 --- a/test/0.4.24/lido.test.js +++ b/test/0.4.24/lido.test.js @@ -217,11 +217,11 @@ contract('Lido', ([appManager, , , , , , , , , , , , user1, user2, user3, nobody }) it('reverts if lido locator address is ZERO', async () => { - assertRevert(app.finalizeUpgrade_v2(ZERO_ADDRESS, eip712StETH.address), 'LIDO_LOCATOR_ZERO_ADDRESS') + await assertRevert(app.finalizeUpgrade_v2(ZERO_ADDRESS, eip712StETH.address), 'LIDO_LOCATOR_ZERO_ADDRESS') }) it('reverts if eip712StETH address is ZERO', async () => { - assertRevert(app.finalizeUpgrade_v2(lidoLocator.address, ZERO_ADDRESS), 'EIP712_STETH_ZERO_ADDRESS') + await assertRevert(app.finalizeUpgrade_v2(lidoLocator.address, ZERO_ADDRESS), 'EIP712_STETH_ZERO_ADDRESS') }) }) @@ -435,14 +435,14 @@ contract('Lido', ([appManager, , , , , , , , , , , , user1, user2, user3, nobody await app.setELRewardsWithdrawalLimit(initialValue, { from: voting }) // unable to receive execution layer rewards from arbitrary account - assertRevert(app.receiveELRewards({ from: user1, value: ETH(1) }), 'EXECUTION_LAYER_REAWARDS_VAULT_ONLY') + await assertRevert(app.receiveELRewards({ from: user1, value: ETH(1) }), 'EXECUTION_LAYER_REWARDS_VAULT_ONLY') }) }) }) describe('receiveELRewards()', async () => { it('unable to receive eth from arbitrary account', async () => { - assertRevert(app.receiveELRewards({ from: nobody, value: ETH(1) }), 'EXECUTION_LAYER_REAWARDS_VAULT_ONLY') + await assertRevert(app.receiveELRewards({ from: nobody, value: ETH(1) }), 'EXECUTION_LAYER_REWARDS_VAULT_ONLY') }) it('event work', async () => { @@ -461,7 +461,7 @@ contract('Lido', ([appManager, , , , , , , , , , , , user1, user2, user3, nobody describe('receiveStakingRouterRemainder()', async () => { it('unable to receive eth from arbitrary account', async () => { - assertRevert(app.receiveStakingRouterDepositRemainder({ from: nobody, value: ETH(1) })) + await assertRevert(app.receiveStakingRouterDepositRemainder({ from: nobody, value: ETH(1) })) }) it('event work', async () => { diff --git a/test/0.4.24/staking-limit.test.js b/test/0.4.24/staking-limit.test.js index 5cebf5e70..45a697cd9 100644 --- a/test/0.4.24/staking-limit.test.js +++ b/test/0.4.24/staking-limit.test.js @@ -108,18 +108,18 @@ contract('StakingLimits', ([account1]) => { maxStakeLimit = 5 maxStakeLimitGrowthBlocks = 6 - assertRevert(limits.setStakingLimit(slot, maxStakeLimit, maxStakeLimitGrowthBlocks), 'TOO_LARGE_LIMIT_INCREASE') + await assertRevert(limits.setStakingLimit(slot, maxStakeLimit, maxStakeLimitGrowthBlocks), 'TOO_LARGE_LIMIT_INCREASE') }) it('stake limit reverts on large values', async () => { let maxStakeLimit = toBN(2).pow(toBN(96)) let maxStakeLimitIncreasePerBlock = 1 const slot = await limits.setStorageStakeLimitStruct(0, 0, 0, 0) - assertRevert(limits.setStakingLimit(slot, maxStakeLimit, maxStakeLimitIncreasePerBlock), 'TOO_LARGE_MAX_STAKE_LIMIT') + await assertRevert(limits.setStakingLimit(slot, maxStakeLimit, maxStakeLimitIncreasePerBlock), 'TOO_LARGE_MAX_STAKE_LIMIT') maxStakeLimit = toBN(2).mul(toBN(10).pow(toBN(18))) maxStakeLimitIncreasePerBlock = toBN(10) - assertRevert(limits.setStakingLimit(slot, maxStakeLimit, maxStakeLimitIncreasePerBlock), `TOO_SMALL_LIMIT_INCREASE`) + await assertRevert(limits.setStakingLimit(slot, maxStakeLimit, maxStakeLimitIncreasePerBlock), `TOO_SMALL_LIMIT_INCREASE`) }) it('check update calculate stake limit with different blocks', async () => { diff --git a/test/0.8.9/lido-exec-layer-rewards-vault.js b/test/0.8.9/lido-exec-layer-rewards-vault.js index 480a69e91..033560c5a 100644 --- a/test/0.8.9/lido-exec-layer-rewards-vault.js +++ b/test/0.8.9/lido-exec-layer-rewards-vault.js @@ -83,11 +83,11 @@ contract('LidoExecutionLayerRewardsVault', ([deployer, anotherAccount]) => { }) it(`can't recover zero ERC20 amount`, async () => { - assertRevert(elRewardsVault.recoverERC20(mockERC20Token.address, bn(0)), `ZERO_RECOVERY_AMOUNT`) + await assertRevert(elRewardsVault.recoverERC20(mockERC20Token.address, bn(0)), `ZERO_RECOVERY_AMOUNT`) }) it(`can't recover zero-address ERC20`, async () => { - assertRevert(elRewardsVault.recoverERC20(ZERO_ADDRESS, bn(10))) + await assertRevert(elRewardsVault.recoverERC20(ZERO_ADDRESS, bn(10))) }) it(`can't recover stETH by recoverERC20`, async () => { @@ -138,11 +138,11 @@ contract('LidoExecutionLayerRewardsVault', ([deployer, anotherAccount]) => { }) // balance is zero already, have to be reverted - assertRevert(elRewardsVault.recoverERC20(mockERC20Token.address, bn(1), { from: deployer }), `ERC20: transfer amount exceeds balance`) + await assertRevert(elRewardsVault.recoverERC20(mockERC20Token.address, bn(1), { from: deployer }), `ERC20: transfer amount exceeds balance`) }) it(`can't recover zero-address ERC721(NFT)`, async () => { - assertRevert(elRewardsVault.recoverERC721(ZERO_ADDRESS, 0)) + await assertRevert(elRewardsVault.recoverERC721(ZERO_ADDRESS, 0)) }) it(`recover some accidentally sent NFTs`, async () => { @@ -160,7 +160,7 @@ contract('LidoExecutionLayerRewardsVault', ([deployer, anotherAccount]) => { assertEvent(receiptNfc2, `ERC721Recovered`, { expectedArgs: { requestedBy: anotherAccount, token: mockNFT.address, tokenId: nft2 } }) // but nft1 recovery should revert - assertRevert(elRewardsVault.recoverERC721(mockNFT.address, nft1), `ERC721: transfer caller is not owner nor approved`) + await assertRevert(elRewardsVault.recoverERC721(mockNFT.address, nft1), `ERC721: transfer caller is not owner nor approved`) // send nft1 to elRewardsVault and recover it await mockNFT.transferFrom(anotherAccount, elRewardsVault.address, nft1, { from: anotherAccount })