From d9b4ff8584223486ebff76abfd458fb886052ce3 Mon Sep 17 00:00:00 2001 From: Andrea Franz Date: Thu, 23 Apr 2020 13:42:08 +0200 Subject: [PATCH] minAt NOW to avoid failing in next test files --- contracts/RedeemUtil.sol | 6 +++--- test/contract_spec.js | 3 ++- test/nft_contract_spec.js | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/contracts/RedeemUtil.sol b/contracts/RedeemUtil.sol index 980a9e6..f17eccd 100644 --- a/contracts/RedeemUtil.sol +++ b/contracts/RedeemUtil.sol @@ -33,8 +33,8 @@ library RedeemUtil { require(_redeem.blockNumber >= (block.number - _maxTxDelayInBlocks), "transaction too old"); require(_redeem.blockHash == blockhash(_redeem.blockNumber), "invalid block hash"); - require(block.timestamp < _expirationTime, "expired gift"); - require(block.timestamp > _startTime, "reedeming not yet started"); + require(block.timestamp < _expirationTime, "expired gift"); + require(block.timestamp > _startTime, "reedeming not yet started"); } function hashRedeem(Redeem memory _redeem) internal pure returns (bytes32) { @@ -79,4 +79,4 @@ library RedeemUtil { bytes32 codeHash = keccak256(abi.encodePacked(_redeem.code)); require(codeHash == _code, "invalid code"); } -} \ No newline at end of file +} diff --git a/test/contract_spec.js b/test/contract_spec.js index 00bd6b5..7804263 100644 --- a/test/contract_spec.js +++ b/test/contract_spec.js @@ -361,7 +361,7 @@ contract("GiftBucket", function () { } catch (e) { assert.match(e.message, /invalid block hash/); } - }); + }); it("can redeem before expiration date", async function() { const block = await web3.eth.getBlock("latest"); @@ -398,5 +398,6 @@ contract("GiftBucket", function () { it("shop can kill contract after expirationTime", async function() { await mineAt(EXPIRATION_TIME); await testKill(); + await mineAt(NOW); }); }); diff --git a/test/nft_contract_spec.js b/test/nft_contract_spec.js index 2f1d0cf..96207fd 100644 --- a/test/nft_contract_spec.js +++ b/test/nft_contract_spec.js @@ -205,7 +205,7 @@ contract("NFTBucket", function () { assert.match(e.message, /only the NFT/); } - }); + }); async function testRedeem(receiver, recipient, signer, relayer, redeemCode, blockNumber, blockHash) { let gift = await NFTBucket.methods.gifts(recipient).call(); @@ -295,7 +295,7 @@ contract("NFTBucket", function () { } catch (e) { assert.match(e.message, /invalid block hash/); } - }); + }); it("can redeem before expiration date", async function() { const block = await web3.eth.getBlock("latest"); @@ -322,5 +322,6 @@ contract("NFTBucket", function () { it("shop can kill contract after expirationTime", async function() { await mineAt(EXPIRATION_TIME); await testKill(); + await mineAt(NOW); }); });