-
Notifications
You must be signed in to change notification settings - Fork 4
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
[analyzer] return default message if no revert reason specified #650
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, looks good!
Let's follow our belated New Year's resolution though: unit tests.
They don't need to be big, but we should get into the habit more. You can use white-box tests: For example, evm_abi_backfill_test.go
will start with package evmabibackfill
and can exercise the private parseTxErr directly.
We have a few ABIs lying around already if you need them for testing, e.g. the erc20 one.
I'm surprised there are no regression test changes. Actually, of the last 10_000_000 runtime txs, none reverted with "reverted: "
🤔 . But there are some interesting ones (only those rows preserved below)
select *, count(*) cnt from (select error_message from chain.runtime_transactions limit 10000000) x where error_message like 'reverted%' group by 1 order by cnt desc;
error_message | cnt
-------------------------------------------------------------------------------------+-------
reverted: unknown | 99353
reverted: no revert reason | 725
reverted: - | 62
"reverted: unknown" is also the most common of all revert reasons. Maybe the "unknown" is an artifact of our own parsing? Please check what the unit tests return if your code diff is not in place, I'm curious. Hm or maybe it's from the olden runtimes that tried to decode the revert reason themselves, always assuming the ABI is Error(string)
. When I look at modern txs, I see no instances of that revert reason.
My guess is that the other two "non-reasons" in the table above are manual strings by smart contract authors.
Oh haha I see we do have a unit test for extract.go already, and it's failing in CI because it wants a |
Good call; I'll add unit tests to the abi analyzer!
Looks like the
|
5a55f5a
to
ac20012
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the added tests! I was trying to request just a test for what this PR fixes (= parsing of reverted:
), but of course this is even nicer :). I see the reverted:
test is still TODO but that should be easy now that you have all the infrastructure set up in the new file.
No good deed goes unpuninshed, so with more tests, I have more feedback/tips. Nothing major though, and thanks again!
ac20012
to
0c61d8a
Compare
update runtime analyzer unit test avoid panic in event of abi event mismatch standardize/cleanup [abi analyzer] add unit tests [abi analyzer] address comment lint simplify tests
0c61d8a
to
436e867
Compare
Per discussion on slack, we want to return a more human-friendly default error message if no transaction revert reason is provided.
Note:
reverted:
. It does not handle the case where the error message is entirely empty, since this should never occur (staging mainnet has no instances of a failed tx with a rawErrMessage of""
)Testing: