esaulpaugh / headlong

High-performance Contract ABI and RLP for Ethereum
Apache License 2.0
76 stars 20 forks source link

type is "receive"; functions of this type must define name as "receive" #40

Closed hawkaa closed 2 years ago

hawkaa commented 2 years ago

Hi @esaulpaugh ,

Thank you for a great library!

The library requires "receive" ABI types to have name set to "receive". As far as I can tell, this is normally not a part of the ABI (example).

What this means is that if I use the ABIJSON module to parse ABIs, I get errors for the "receive" events, even though they look legit.

I'm curious what's the motivation behind this check and whether we could discuss ways of opting out of it?

Best, Håkon

esaulpaugh commented 2 years ago

I may have written this code prior to solidity 0.6.0 becoming finalized, and certainly before widespread use.

At the time I understood the documentation to mean that the name of the receive function was receive and that ABI json did not omit non-null fields. From your example it appears that at least one of these is not the case today. I wish the documentation was clearer.

In any case, I have added a commit https://github.com/esaulpaugh/headlong/commit/e4553a61f13c0b957269d219bf0df3e2e0f3459c which will allow the name field for receive types to be unspecified (implicitly null) or null (explicitly).

hawkaa commented 2 years ago

Thanks a ton! What a quick turn-around time! Would you happen to know when you create a new release so I can update the library and remove my hack?

esaulpaugh commented 2 years ago

I was planning on releasing soon anyway. I will try to release within a day or two.

esaulpaugh commented 2 years ago

New release: https://github.com/esaulpaugh/headlong/releases/tag/v6.2.0

hawkaa commented 2 years ago

🙇🏻‍♂️