Skip to content

ethSendTransaction doesn't wait for the transaction to be mined #1312

@colltoaction

Description

@colltoaction

🎉 Description

I'm running your test suite against the RSKj 0.5.0 node and found an issue with some tests.

  • 🐛 This is a bug report.

💻 Environment

  • OpenZeppelin master branch (commit 6c4c898)
  • RSK 0.5.0 regtest network
  • npx truffle test --network rsk with my node listening at localhost:4444

📝 Details

Let's take for example the BreakInvariantBounty tests. The it can set reward test fails because sendReward returns immediately, before the block including the transaction is mined. The balance of this.bounty.address hasn't been updated yet and the check fails.

🔢 Code To Reproduce Issue

I ran the test code against the RSK node and it failed consistently.

I also verified that both of these changes make the test pass:

it('can set reward', async function () {
  await sendReward(owner, this.bounty.address, reward);
  await advanceBlock();
  const balance = await ethGetBalance(this.bounty.address);
  balance.should.be.bignumber.equal(reward);
});
it('can set reward', async function () {
  await transactionMined(await sendReward(owner, this.bounty.address, reward));
  const balance = await ethGetBalance(this.bounty.address);
  balance.should.be.bignumber.equal(reward);
});

I could send a PR if you want, let me know.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew contracts, functions, or helpers.testsTest suite and helpers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions