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

fix: filter topics relying on arguments type #1480

Merged
merged 11 commits into from
Nov 7, 2024

Conversation

freemanzMrojo
Copy link
Member

@freemanzMrojo freemanzMrojo commented Nov 6, 2024

Description

The error happened because we were passing non-indexed parameters as parameters to encode. Since we were passing, in this order, undefined and the appId values, when checking the RewardDistributed event the appId value was interpreted as the second indexed parameter in that event, receiver, which is an address:

inputs: [
                {
                    indexed: false,
                    internalType: 'uint256',
                    name: 'amount',
                    type: 'uint256'
                },
                {
                    indexed: true,
                    internalType: 'bytes32',
                    name: 'appId',
                    type: 'bytes32'
                },
                {
                    indexed: true,
                    internalType: 'address',
                    name: 'receiver',
                    type: 'address'
                },

Due to this feature in viem we can just pass the type directly to encode filter topics, so appId gets directly to the encoding method without the need of further parsing.

Closes #1479

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Enabled tests for EVEarn in the pipeline, + the rest of the SDK test suite.

Test Configuration:

  • Node.js Version: 20.17.0
  • Yarn Version: 1.22.19

Checklist:

  • My code follows the coding standards of this project
  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • New and existing integration tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have not added any vulnerable dependencies to my code

Copy link

github-actions bot commented Nov 6, 2024

Test Coverage

Summary

Lines Statements Branches Functions
Coverage: 99%
98.99% (4334/4378) 97.61% (1390/1424) 99% (891/900)
Title Tests Skipped Failures Errors Time
core 810 0 💤 0 ❌ 0 🔥 2m 21s ⏱️
network 726 0 💤 0 ❌ 0 🔥 4m 50s ⏱️
errors 42 0 💤 0 ❌ 0 🔥 17.669s ⏱️
logging 3 0 💤 0 ❌ 0 🔥 18.624s ⏱️
hardhat-plugin 19 0 💤 0 ❌ 0 🔥 1m 2s ⏱️
aws-kms-adapter 23 0 💤 0 ❌ 0 🔥 1m 27s ⏱️
ethers-adapter 5 0 💤 0 ❌ 0 🔥 1m 12s ⏱️
rpc-proxy 37 0 💤 0 ❌ 0 🔥 1m 4s ⏱️

@freemanzMrojo freemanzMrojo changed the title [DRAFT] Fix/1479 filter topics fix: filter topics relying on arguments type Nov 6, 2024
@freemanzMrojo freemanzMrojo marked this pull request as ready for review November 6, 2024 15:27
@freemanzMrojo freemanzMrojo requested a review from a team as a code owner November 6, 2024 15:27
@freemanzMrojo freemanzMrojo force-pushed the fix/1479-filter-topics branch from ac0e6a0 to b1793b5 Compare November 6, 2024 16:14
@freemanzMrojo freemanzMrojo merged commit c29efb3 into main Nov 7, 2024
24 checks passed
@freemanzMrojo freemanzMrojo deleted the fix/1479-filter-topics branch November 7, 2024 11:42
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 this pull request may close these issues.

[BUG] - Encoding issue of FilterTopics in ABIEvent class
2 participants