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

Getting stuck when different events with the same signature issued in a single tx #2933

Closed
aliaksandr-adzinets opened this issue Jul 9, 2019 · 2 comments
Labels
1.x 1.0 related issues 2.x 2.0 related issues Needs Clarification Requires additional input

Comments

@aliaksandr-adzinets
Copy link

aliaksandr-adzinets commented Jul 9, 2019

Description

I have two contracts:

contract ERC20 {

    event Transfer(address indexed from, address indexed to, uint256 value);

    function transferFrom(address from, address to, uint256 value) public returns (bool) {
        emit Transfer(from, to, value);
    }
}

and

contract ERC721 {

    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    function transferFrom(address from, address to, uint256 tokenId) public {
        emit Transfer(from, to, tokenId);
    }
}

Then, there is a third contract which calls both ERC20 and ERC721 contracts within a single transaction, so that both issue their Transfer events within the tx.

contract Main {

    function main(
      address addrERC20, address addrERC721, 
      address from, address to, 
      uint256 value, uint256 tokenId) {

        ERC20(addrERC20).transferFrom(from, to, value);
        ERC721(addrERC721).transferFrom(from, to, tokenId);
    }
}

The problem is that such a tx gets stuck and then fails due to timeout.

Making the event names different fixes the issue.

E.g.,

contract ERC20 {
    event Transfer(address indexed from, address indexed to, uint256 value);
}

and

contract ERC721 {
    event Transfer721(address indexed from, address indexed to, uint256 indexed tokenId);
}

works just fine.

There is a related but closed issue: #2542

Expected behavior

Different events with the same name and signature issued within a single transaction should work as fine as any other different events issued within a single transaction.

Actual behavior

(as reported by Truffle/Mocha):

Error: Timeout of 300000ms exceeded. For async tests and hooks, ensure "done()" is called;
if returning a Promise, ensure it resolves. (/path/to/my/test.js)

Versions

  • web3.js: 1.0.0-beta.55
  • nodejs: v10.16.0
  • ethereum node: Ganache CLI v6.4.4 (ganache-core: 2.5.6)
@nivida nivida added 1.x 1.0 related issues 2.x 2.0 related issues Needs Clarification Requires additional input labels Jul 9, 2019
@aliaksandr-adzinets
Copy link
Author

I re-tested on all version from 1.0.0-beta.49 to 1.0.0-beta.55. This issue was fixed in 1.0.0-beta.51 and is not present in higher versions.

The timeout might be because I tried to use multiple Web3 instances in a Truffle test, the first one is the Truffle's embedded web3, and the second one is a project-level web3@latest.

@knightlands
Copy link

I have absolutely same error on 1.2.4. Please take a look at it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues 2.x 2.0 related issues Needs Clarification Requires additional input
Projects
None yet
Development

No branches or pull requests

3 participants