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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.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.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 inhandlers
, 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
orufixed
orfunction
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, .