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

fix: correctly handle errors from transaction decoder #5341

Merged
merged 1 commit into from
Mar 28, 2023

Conversation

jeffsmale90
Copy link
Contributor

@jeffsmale90 jeffsmale90 commented Mar 23, 2023

In some cases, when decoding a transaction, Ganache UI will throw an error, with the message Cannot read property 'stack' of undefined.

Specifically, the transaction must call a function that is not defined in the contract artifacts. This can be reproduced by defining and calling a fallback function.

This change fixes the issue, by correctly handling errors from the decoder. This means that if the above conditions are met, the decoded transaction promise resolves to undefined, which causes the caller to render the raw data.

See #5332 for a similar fix for decoding events.

Fixes: #5331
Fixes: #5328
Fixes: #5326
Fixes: #5323
Fixes: #5294
Fixes: #5278
Fixes: #5268
Fixes: #5227
Fixes: #5247
Fixes: #5207
Fixes: #5167
Fixes: #5158
Fixes: #5194
Fixes: #5277
Fixes: #5133
Fixes: #5055
Fixes: #5054
Fixes: #5048
Fixes: #3496
Fixes: #5175
Fixes: #4267
Fixes: #4277
Fixes: #4204
Fixes: #4049
Fixes: #3953
Fixes: #3874
Fixes: #3849
Fixes: #3714
Fixes: #3514
Fixes: #3486
Fixes: #4976
Fixes: #3450
Fixes: #3338
Fixes: #3307
Fixes: #3239
Fixes: #3261
Fixes: #3148
Fixes: #3112
Fixes: #3083
Fixes: #2988
Fixes: #2910
Fixes: #2907
Fixes: #2898
Fixes: #2859
Fixes: #2787
Fixes: #2777
Fixes: #2772
Fixes: #2722
Fixes: #2504
Fixes: #2395
Fixes: #2292
Fixes: #2171
Fixes: #2143
Fixes: #2016
Fixes: #1973
Fixes: #1939
Fixes: #1902
Fixes: #1766
Fixes: #4955
Fixes: #4502
Fixes: #4484
Fixes: #4474
Fixes: #4908
Fixes: #4917
Fixes: #4346
Fixes: #4155
Fixes: #4118
Fixes: #4095
Fixes: #4894
Fixes: #3999
Fixes: #3982
Fixes: #3976
Fixes: #3925
Fixes: #3922
Fixes: #3885
Fixes: #3873
Fixes: #3872
Fixes: #3814
Fixes: #3793
Fixes: #3778
Fixes: #3760
Fixes: #3744
Fixes: #4880
Fixes: #3688
Fixes: #3698
Fixes: #4878
Fixes: #3581
Fixes: #3513
Fixes: #3502
Fixes: #3503
Fixes: #3467
Fixes: #4875
Fixes: #3386
Fixes: #3363
Fixes: #3332
Fixes: #3284
Fixes: #4865
Fixes: #3211
Fixes: #3142
Fixes: #2927
Fixes: #2603
Fixes: #1802
Fixes: #2691
Fixes: #2537
Fixes: #2377
Fixes: #2350
Fixes: #2333
Fixes: #2315
Fixes: #1964
Fixes: #1795
Fixes: #4829
Fixes: #4975
Fixes: #4963
Fixes: #4737
Fixes: #4726
Fixes: #4718
Fixes: #4721
Fixes: #4714
Fixes: #4687
Fixes: #4686
Fixes: #4676
Fixes: #4665
Fixes: #4920
Fixes: #4650
Fixes: #4645
Fixes: #4634
Fixes: #4624
Fixes: #4565
Fixes: #4519
Fixes: #4514
Fixes: #4515
Fixes: #4510
Fixes: #4504
Fixes: #4497
Fixes: #4889
Fixes: #4886
Fixes: #4449
Fixes: #4882
Fixes: #4883
Fixes: #4396
Fixes: #4393
Fixes: #4332
Fixes: #4299
Fixes: #4285
Fixes: #3812
Fixes: #3626
Fixes: #3585
Fixes: #3546
Fixes: #3547
Fixes: #3510
Fixes: #2812
Fixes: #2754
Fixes: #2708
Fixes: #4781
Fixes: #2621
Fixes: #2382
Fixes: #2352
Fixes: #2122
Fixes: #2034
Fixes: #1927
Fixes: #4738
Fixes: #4705
Fixes: #4666
Fixes: #4653
Fixes: #4618
Fixes: #4593
Fixes: #4583
Fixes: #4567
Fixes: #3902
Fixes: #3853
Fixes: #3805
Fixes: #2183
Fixes: #1969
Fixes: #1958
Fixes: #5060
Fixes: #2966
Fixes: #2164
Fixes: #4555
Fixes: #4297
Fixes: #5089
Fixes: #3700
Fixes: #3540
Fixes: #2378
Fixes: #2104
Fixes: #4338
Fixes: #1424
Fixes: #4793

…esolve the promise with undefined, causing the caller to use the raw log object.
@jeffsmale90 jeffsmale90 changed the title Correctly decode transaction objects fix: correctly handle errors from transaction decoder Mar 23, 2023
Copy link
Member

@davidmurdoch davidmurdoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test and validated! Great find!

Copy link

@Dawidowak Dawidowak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.