Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Bug fix: Make receipts work properly with --stacktrace #3816

Merged
merged 3 commits into from
Feb 19, 2021

Conversation

haltman-at
Copy link
Contributor

@haltman-at haltman-at commented Feb 19, 2021

This PR addresses #3817, fixing an issue raised by @JasperTimm on Spectrum. When --stacktrace was used with Truffle test, contract.method() wouldn't return a receipt in the proper format. There are two reasons for this, one recent and one preexisting.

  1. The recent one: You know that translateReceipt function I added to translate receipts from ethers format to web3 format? Yeah, I forgot to ever actually invoke it! Oops. Now it's there. That said, on its own this wouldn't fix the problem, and actually has little to do with the particular problem that @JasperTimm was running into.

  2. The preexisting one, and the main problem: Once we got a receipt back from sendTransactionManual, we had nothing to convert it to the Truffle format. Normally that's handled in handlers, but since --stacktrace is on, those aren't set up like normal. So, instead I changed the code after the receipt is returned to manually invoke the handler, rather than resolving the promievent with the receipt like I had before. This requires a hack in the handler so that it doesn't attempt to remove a listener when invoked in this manual way, but it works...

Note that if decoding events throws (due to a fixed or ufixed or function event), this can actually result in sort-of messed-up stacktraces... I say "sort of" because the only effect is that, if the transaction was successful, it will yield a "improper return (may b be a self-destruct)" message. This is a rare case, and I didn't see any easy way to prevent it, so I didn't bother. Maybe someone will report a problem eventually, but, until then, .

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

Successfully merging this pull request may close these issues.

2 participants