Skip to content
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

Event filters by Param not working #248

Closed
bitcoinwarrior1 opened this issue Mar 12, 2020 · 11 comments · Fixed by #250
Closed

Event filters by Param not working #248

bitcoinwarrior1 opened this issue Mar 12, 2020 · 11 comments · Fixed by #250

Comments

@bitcoinwarrior1
Copy link

bitcoinwarrior1 commented Mar 12, 2020

@hakumai-iida
Copy link
Contributor

hakumai-iida commented Mar 17, 2020

It looks like that EventFilter does not work, if the count of "parameterFilters" is 1.
Please fix the codes like below.

/Sources/web3swift/Contract/EventFiltering.swift

// change [0] to [-1]
line 77: var lastNonemptyFilter = -1/* 0 */

// change [!=] to [>=]
line 84: if lastNonemptyFilter >= /* != */ 0 {

Best regards,

@hakumai-iida
Copy link
Contributor

hakumai-iida commented Mar 18, 2020

Also EventFilter does not work, if events have jumping indexed parameters like below.

  event JumpingIndexed( uint val1,
                        uint indexed indexedVal2,  // topics[1]
                        uint val3,
                        uint indexed indexedVal4,  // topics[2]
                        address indexed from       // topics[3]
                      );

Please replace the codes

/Sources/web3swift/Contract/EventFiltering.swift

88:             let input = event!.inputs[i]
89:             if filterValues != nil && !input.indexed {return nil}

with below ones

                // check target "indexed" parameter existing, if filterValues is valid
                if filterValues != nil {
                    var isFound = false
                    var targetIndexedPosition = i
                    for j in 0 ..< event!.inputs.count{
                        if event!.inputs[j].indexed {
                            if targetIndexedPosition == 0 {
                                isFound = true
                                break
                            }
                            targetIndexedPosition -= 1
                        }
                    }
                    
                    if !isFound {return nil}
                }

Best regards,

@bitcoinwarrior1
Copy link
Author

bitcoinwarrior1 commented Mar 18, 2020

Thanks mate, did you want to submit a PR to the authors? I can but you should get the contributor kudos :)

@skywinder
Copy link
Collaborator

Thanks!
Please, make an PR.
I would be glad to support your contribution via our gitcoin grant as well! 👍

@hakumai-iida
Copy link
Contributor

I am glad that your problem was solved.

And I do not have any permision to push a sub-branch for a pull request.
If I can get a permision, I will make a pull request.

Or please make a pull request instead of me, if you can and it's not too much trouble.

Best reagrds,

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 12.0 DAI (12.0 USD @ $1.0/DAI) attached to it as part of the skywinder fund.

@skywinder
Copy link
Collaborator

Everyone can make a pull request. Please, kindly check settings, first you need to for repository. Then push branch to your fork. Then you can make a pull request via website

@hakumai-iida
Copy link
Contributor

hakumai-iida commented Mar 18, 2020

Thank you very much, I will check the setting, and try.

@hakumai-iida hakumai-iida mentioned this issue Mar 19, 2020
@gitcoinbot
Copy link

gitcoinbot commented Mar 19, 2020

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 266 years, 8 months from now.
Please review their action plans below:

1) hakumai-iida has been approved to start work.

Fixed below.

  • EventFiltering does not work, if the count of "parameterFilters" is 1.
  • Also does not work, if events have jumping indexed parameters.

(This is my first time using gitcoin, is that OK?)

Learn more on the Gitcoin Issue Details page.

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 12.0 DAI (12.0 USD @ $1.0/DAI) has been submitted by:

  1. @hakumai-iida

@skywinder please take a look at the submitted work:


@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 12.0 DAI (12.0 USD @ $1.0/DAI) attached to this issue has been approved & issued to @hakumai-iida.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants