Skip to content

Truffle test - Error: revert - no transaction hash given #5774

Discussion options

You must be logged in to vote

@krellsebastian, you can set the gas parameter when interacting with your
contract? For example, look at this test, which fails if msg.sender is
not accounts[0].

Edit: add gist

Test

contract("Solid", function (accounts) {
  it("should get the value", async function () {
    const s = await Solid.deployed();
    // If you specify the gas parameter, ethEstimate gas
    // won't be called and the failed transaction will be recorded.
    // Specify the gas parameter here --vvvvvvvvvvvv
    await s.inc(1, {from: accounts[1], gas: 0xfffff}),
    // fails because owner is accounts[0]

    assert.equal(
      await s.value(),
      14,
      "oops"
    );
  });

Contract

// SPDX-License-Identifier…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@krellsebastian
Comment options

Answer selected by krellsebastian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants