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

(Bug) Failed to check for transaction receipt #472

Closed
vbaranov opened this issue Jan 9, 2018 · 4 comments
Closed

(Bug) Failed to check for transaction receipt #472

vbaranov opened this issue Jan 9, 2018 · 4 comments

Comments

@vbaranov
Copy link
Collaborator

vbaranov commented Jan 9, 2018

If you are reporting a problem with ICO Wizard, please include the following information:

Which network did you use? (Mainnet, Kovan, Rinkeby, etc.)

Mainnet

If you were able to create it, what is the URL of your crowdsale?

I wasn't able to create the crowdsale. ICO Wizard failed on the 2nd transaction. But the transaction is successfully mined later: https://etherscan.io/tx/0xeceac5957cd7d57826f21e0b9f6c462617efa99363a135586f7dc46c95777341.

The same error was happening before this PR #465 is merged too. So, it isn't provoked by it.

Do you have screenshots showing the problem?

2018-01-09 19 32 43

Root problem web3/web3.js#1255
Relates to #471

Do you see errors in the dev console? If yes, please include a screenshot

(To open the dev console in Google Chrome, press F12, or go to View -> Developer -> Developer Tools, and open the Console tab)

wizard.poa.network-1515514258309.log


@rstormsf
Copy link

rstormsf commented Jan 9, 2018

How do u get private key from user?

This issue is not related to root problem mentined above, because in ICO-wizard there is no sendSignedTx call, as well as having direct access to raw private key.
The root problem is hidden somewhere else, I don't think it's web3 problem. Lets investigate more into the root cause.

@vbaranov Can you show us where is the code reference in wizard where you actually send Tx and waiting for receipt?

@rstormsf
Copy link

rstormsf commented Jan 9, 2018

Can it be that you are calling callback on receipt outside of IF block from CheckTxMined
https://github.com/poanetwork/ico-wizard/blob/3bbf54996a463f04d685291a9f9316c910c9f016/src/utils/blockchainHelpers.js#L251

export function checkTxMined(web3, txhash, cb) {
  web3.eth.getTransactionReceipt(txhash, function(err, receipt) {
    if (receipt)
      console.log(receipt);
    cb(receipt);
  });
}

to

export function checkTxMined(web3, txhash, cb) {
  web3.eth.getTransactionReceipt(txhash, function(err, receipt) {
    if (receipt){
    console.log(receipt);
    cb(receipt);
}

  });
}

also, you are not checking for errors here:

https://github.com/poanetwork/ico-wizard/blob/3bbf54996a463f04d685291a9f9316c910c9f016/src/utils/blockchainHelpers.js#L152

you are only expecting a receipt, this is anti-pattern

@vbaranov
Copy link
Collaborator Author

vbaranov commented Jan 9, 2018

Thank you for valuable comments!
There are some ways to refactor here. I'll take a deep look. @fernandomg @fvictorio if you'll have some suggestions here, please, share too.

@fernandomg
Copy link
Contributor

I share the idea of refactor (progressively), and I think is a must to fix all the anti-patterns in the code.

Anyway, yesterday I tested without using the checkTxMined, and listening the promiEvent receipt; but got a Gateway timeout.

So today I rolled back, and used the same code that's in master, and it failed due to intrinsic gas too low, when trying to deploy PricingStrategy contract (this is the 3rd tx).

Log:
localhost-1515597586385.log

Sucessful tx:
https://etherscan.io/tx/0xdb25e621f6750901de8f3ac6f3414d16621e71816e0966f16eb8bc3bddcdd491
https://etherscan.io/tx/0x1e9922ee9648ec2b50eeba0c9d11dcc1878bb44aed095837d0aee636b1cda01a

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

No branches or pull requests

4 participants