-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix for ContractEvent.processLog() #2124
Conversation
What is the issue with # 1 while solving?Consider this code.
This is the output I get
But, what we want in our case is
and my output is:
Hence, what we get is a I hope this justifies the reason for not using # 1 solution. Please let me know if I have gone wrong somewhere. Many thanks! |
Thanks for the PR @smishy05, and for such a detailed justification! I am wrapping up some things on py-evm, but I'll take a look once that's finished. |
Thanks a lot for the reply! By the way, this is the output after running
After running
I am unable to understand why two of the tests failed. It would be great if you could help in this case! |
It could be nice to have it be a property still, so that |
Hi @carver Thanks a lot for the resource. Should I move all the functions of the |
Hi @carver and @kclowes . After considering the advice from @carver , the code looks like this (please let me know if I have made a mistake)
I am still getting the error:
|
@kclowes up to you what you want to do. I'm fine with just leaving the PR as-is. |
Hi @kclowes , please let me know what improvements I need to make in the code so that the PR can be merged. |
Hi @smishy05, I'm sorry I missed this a few months ago. In regards to testing, you'd probably want to add something in |
I think the initial TypeError can be avoided by adding () after Increment:
|
This fix got pulled into #3491. Closing here. |
What was wrong?
Related to Issue #1648
For the python code (
code-1.py
),ContractEvent.processLog()
produced the error :ContractEvents.abi belonging to the subclass (Increment) of the ContractEvents class need to be used and referred to before the Increment object is initialised.
How was it fixed?
By changing every
self.abi
in theContractEvent
class toself._get_event_abi()
(this was the # 2 as mentioned in the issue.)I did try # 1 for solving the issue mentioned in #1648 . So, this is what I did while adding
@property
to.abi
The
__init__
looked like:and my
@property
function looked like:and the
processLog()
remained the same:After using this, I get the following error:
I think if we try to integrate
@property
with this, even then a person will have to create an object ofContractEvent
. Thus, using this solution doesn't seem viable to achieve the target mentioned in #1648. Thus, I used the solution provided in # 2 and replaced all theself.abi
withself._get_event_abi()
inContractEvent
class. Please let me know if I have gone wrong somewhere. (I have elaborated the issue with # 1 using an example in the next comment)In addition to this, I wanted some advice for writing tests. I did go through the documentation. I am not sure about how I should write it. It would be great if you could elaborate a bit on this.
Many thanks!