Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'gasUsed' of undefined #1

Open
johhnsmmith198 opened this issue Feb 12, 2022 · 1 comment
Open

Cannot read property 'gasUsed' of undefined #1

johhnsmmith198 opened this issue Feb 12, 2022 · 1 comment

Comments

@johhnsmmith198
Copy link

johhnsmmith198 commented Feb 12, 2022

truffle version

Truffle v5.4.26 (core: 5.4.26)
Solidity - 0.8.10 (solc-js)
Node v14.16.1
Web3.js v1.5.3

those lines fails in index.js of the truffle-cost lib

  const txResult = await asyncFn;
  // Used gas for Mocha reporter.
  result.gasUsed = txResult.receipt.gasUsed;

My test looks something like this

const truffleCost = require("truffle-cost");

const Serializer = artifacts.require("Serializer");

contract("Serializer", (accounts) => {
  const [deployerAddress, tokenHolderOneAddress, tokenHolderTwoAddress] = accounts;

  it("hexBytesToIntArray", async () => {
    let s = await Serializer.deployed();
    let result = await truffleCost.log(
      s.hexBytesToIntArray.call(web3.utils.fromAscii("08bbe0e25e412fff08bbe0e25e4a0fff08bbe0e25e4a3fff"))
    );
    let expected = [
      new BN("629343835796877311").toString(),
      new BN("629343835797458943").toString(),
      new BN("629343835797471231").toString(),
    ];
    const resultS = result.map((x) => x.toString());
    assert.deepEqual(resultS, expected);
  });
});

any idea why my transaction doesn't have a receipt?
the contract function signature looks like this

    function hexBytesToIntArray(bytes memory s) public pure returns (uint64[] memory) {

Thanks

@NikolaiSch
Copy link

NikolaiSch commented May 6, 2022

@johhnsmmith198 i recommend you use this maintained library, it seems to have a lot more features, and is currently maintained, this hasn't in 3 years

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants