made ETHEREUM_NODE_ADD_TRANSCATION_REVERT_REASON flag work! #160
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.
I was not able to get the revert-reason for the failing transactions in Kafka events, when I looked into the code, then I found that the true flag (value of
ETHEREUM_NODE_ADD_TRANSCATION_REVERT_REASON
) was not even getting propagated from the environment variable.After debugging it thoroughly, and spending ~6 hours I found the fix.
internally
ethereum.nodes[0].addTransactionRevertReason
is being searched in the environment. So, Ideally, the flag should beETHEREUM_NODES_0_ADD_TRANSACTION_REVERT_REASON
(and notETHEREUM_NODE_ADD_TRANSCATION_REVERT_REASON
as mentioned in the official documentation).Still, it didn't work by just changing the environment variable name, Finally, I had to refactor
addTransactionRevertReason
toadd.transaction.revert.reason
for it to work.I have tested it on my local Ganache network and on the Quorum node. It was working like a charm.
Note: You have to make sure that you add this line of code.
web3.eth.handleRevert = true;
before submitting any transaction to the ledger, for this feature to work.