-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
getPastEvents() causes an error if an event has a function as argument #2826
Comments
Thanks for opening this issue! Does this error still occur in the latest version of Web3? |
I'm having some trouble trying to test this manually without Truffle (I'm getting errors from |
By the way, it seems that attempting to decode indexed parameters of reference type (which as we know cannot actually be decoded) can also crash the event decoder. Also worth accounting for, I think. |
What could possibly be the use case for passing an external function into an event? I'm genuinely curious. |
I have a similar problem when trying to call a contract method which expect a function type/pointer as parameter. See https://ethereum.stackexchange.com/questions/78080/how-do-i-pass-a-function-pointer-to-a-contract-method-from-a-unit-test for a code example. To see the error, this code is sufficent:
where Is there a way to manually encode the whole function call? Or does that mean I can no longer unit test my code? |
Having same issue with |
@nivida Does my comment above contain the clarification you asked for? |
@digulla Yep, thanks!:) |
Description
The
getPastEvents()
function inweb3.eth.Contract
will cause an error if one of the events has afunction external
as an argument. (I assume the same problem is present in other similar functions as well.) While I realize it might not be practical at the moment to decode such values, especially as currently you're relying on another package to do the decoding for you, having it cause an error in the whole function is inconvenient because it means one can't get at any of the other events, or, for that matter, the other properties of this event. In short, the error should be localized.Expected behavior
Instead of causing an error, the function should return as normal, but the
returnValues
entry for that parameter should beundefined
ornull
or some other way of indicating an error, rather than having the entire function error.Actual behavior
An error occurs. In my case, doing this from within
truffle console
, I got the following:Steps to reproduce the behavior
function external
parameter. E.g.:run
.)web3.eth.Contract
object for it, and then call that object'sgetPastEvents
method. (Although in my case I was usingtruffle console
and relied on the object created byEventsTest.deployed()
.)Error Logs
See above.
Versions
The text was updated successfully, but these errors were encountered: