Closed kyleboureston closed 2 months ago
Yes, this means that your transaction didn't succeed. I just reviewed the logic and we throw an error, if something goes wrong and return a hash if it succeeds. However, currently, there is no logic to inform you if something happens to the transaction execution in the virtual machine.
I'll think about a better handling here.
I've noticed the problem (transact_and_wait returns nil) when connecting to infura, even when the transaction succeeds. I believe the problem is not wait_for_tx(transact(contract, function, *args, **kwargs))
fails here:
https://github.com/q9f/eth.rb/blob/041aa92e50d59663b410698601dc9c92a6ccb23f/lib/eth/client.rb#L318
but that tx_succeeded? hash
returns false shortly thereafter here:
https://github.com/q9f/eth.rb/blob/041aa92e50d59663b410698601dc9c92a6ccb23f/lib/eth/client.rb#L319
My guess is that the transaction receipt doesn't propagate to the network readers used by infura quickly enough when calling eth_get_transaction_receipt(hash)
here:
https://github.com/q9f/eth.rb/blob/041aa92e50d59663b410698601dc9c92a6ccb23f/lib/eth/client.rb#L366
Writing and then not being able to read right after is a pretty common race condition. Could solve by updating tx_succeeded?(hash)
to retry if tx_receipt["result"].nil? == true
here:
https://github.com/q9f/eth.rb/blob/041aa92e50d59663b410698601dc9c92a6ccb23f/lib/eth/client.rb#L367
If this is something you'd like to see, I'd be happy to submit a PR.
I'll gladly review such a PR, thanks!
Hello,
When submitting transact_and_wait to a remote connect, I get
nil
instead of an error message. Would love a message so I can debug properly!PS: to add, even when I get a Success transaction, I am still getting
nil
Thank you