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: skip invalid logs #326

Merged
merged 3 commits into from
Apr 7, 2023
Merged

fix: skip invalid logs #326

merged 3 commits into from
Apr 7, 2023

Conversation

jxom
Copy link
Member

@jxom jxom commented Apr 7, 2023

Fixes #323.

  • Skips event logs that do not conform to the given ABI filter
  • Adds better error messaging for when ABI decoding data size is too short
  • Adds better error messaging for when there is a mismatch between non-indexed arguments in the event ABI

@changeset-bot
Copy link

changeset-bot bot commented Apr 7, 2023

🦋 Changeset detected

Latest commit: 285b943

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Apr 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
viem ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 7, 2023 1:12am
viem-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 7, 2023 1:12am

@pr-codex
Copy link

pr-codex bot commented Apr 7, 2023

Tldr

This PR fixes an issue where filtered logs that do not conform to the provided ABI would cause getLogs, getFilterLogs or getFilterChanges to throw. These logs are now skipped.

Detailed summary

  • A new file ERC20InvalidTransferEvent.sol is added.
  • A new function deployErc20InvalidTransferEvent() is added in utils.ts.
  • The getFilterChanges() and getFilterLogs() functions in getFilterChanges.ts and getFilterLogs.ts respectively, have been modified to skip logs which do not conform to the provided ABI.
  • Tests are added for the new contract and for skipping invalid logs.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 7, 2023

Size Change: +364 B (+1%)

Total Size: 57 kB

Filename Size Change
dist/abi.js 257 B +1 B (0%)
dist/accounts/index.js 1.37 kB +3 B (0%)
dist/chains.js 2.03 kB -1 B (0%)
dist/chunk-6PP4CMLN.js 0 B -43 kB (removed) 🏆
dist/chunk-I2RHOQQS.js 0 B -415 B (removed) 🏆
dist/contract.js 438 B -1 B (0%)
dist/ens.js 339 B +2 B (+1%)
dist/ethers.js 755 B +2 B (0%)
dist/index.js 5.54 kB +1 B (0%)
dist/utils/index.js 1.2 kB +6 B (+1%)
dist/wallet.js 294 B +1 B (0%)
dist/chunk-DT4KSXZC.js 416 B +416 B (new file) 🆕
dist/chunk-QITZHDNP.js 43.3 kB +43.3 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
dist/public.js 456 B
dist/test.js 506 B
dist/window.js 67 B

compressed-size-action

@codecov
Copy link

codecov bot commented Apr 7, 2023

Codecov Report

Merging #326 (285b943) into main (cfa1224) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##             main     #326    +/-   ##
========================================
  Coverage   99.86%   99.86%            
========================================
  Files         263      263            
  Lines       16899    17015   +116     
  Branches     1805     1819    +14     
========================================
+ Hits        16876    16992   +116     
  Misses         21       21            
  Partials        2        2            
Impacted Files Coverage Δ
src/actions/public/getFilterChanges.ts 100.00% <100.00%> (ø)
src/actions/public/getFilterLogs.ts 100.00% <100.00%> (ø)
src/actions/public/getLogs.ts 100.00% <100.00%> (ø)
src/errors/abi.ts 100.00% <100.00%> (ø)
src/errors/index.ts 100.00% <100.00%> (ø)
src/utils/abi/decodeAbiParameters.ts 100.00% <100.00%> (ø)
src/utils/abi/decodeEventLog.ts 99.24% <100.00%> (+0.07%) ⬆️
src/utils/abi/formatAbiItem.ts 100.00% <100.00%> (ø)
src/utils/abi/index.ts 100.00% <100.00%> (ø)
src/utils/index.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@jxom jxom merged commit c83616a into main Apr 7, 2023
@jxom jxom deleted the jxom/skip-invalid-logs branch April 7, 2023 01:38
@github-actions github-actions bot mentioned this pull request Apr 7, 2023
jxom added a commit that referenced this pull request Apr 7, 2023
* fix: make `GetValue` return `{ value?: never }` for contract functions that are not payable (#310)

fix: GetValue type

* Version Packages (#311)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* refactor: use `@adraffy/ens-normalize` for ENS normalization (#313)

* refactor: use @adraffy/ens-normalize for ENS normalization

* docs: update

* Version Packages (#315)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: `transports` property type on `FallbackTransport` (#317)

* Version Packages (#318)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: migrate to nodenext module resolution

* chore: fix type imports

* chore: use `bundler` module resolution for playgrounds so that path aliases are simpler

* fix: ethers adapter signTransaction properties (#322)

* fix: ethers adapter

* test: boost coverage

* Version Packages (#324)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: skip invalid logs (#326)

* fix: skip invalid logs

* chore: format

* chore: changeset

* Version Packages (#327)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* feat: tweaked error inheritence for `UserRejectedRequestError` & `SwitchChainError` (#328)

* feat: tweaked error inheritence for `UserRejectedRequestError` & `SwitchChainError`

* chore: format

* chore: switch to tsc

* chore: apply rome formatting & linting changes

* chore: bump to typescript v5

* chore: remove tsup config

* chore: improve build step

* chore: add comment to version.ts

* chore: fix imports

* chore: add changeset

* chore: fix type imports

* chore: ignore tsbuildinfo

* fix: type issues

* chore: Contains -> Or

* chore: format

* chore: format

---------

Co-authored-by: jxom <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: awkweb <[email protected]>
jxom added a commit that referenced this pull request Apr 7, 2023
* fix: make `GetValue` return `{ value?: never }` for contract functions that are not payable (#310)

fix: GetValue type

* Version Packages (#311)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* refactor: use `@adraffy/ens-normalize` for ENS normalization (#313)

* refactor: use @adraffy/ens-normalize for ENS normalization

* docs: update

* Version Packages (#315)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: `transports` property type on `FallbackTransport` (#317)

* Version Packages (#318)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: migrate to nodenext module resolution

* chore: fix type imports

* chore: use `bundler` module resolution for playgrounds so that path aliases are simpler

* fix: ethers adapter signTransaction properties (#322)

* fix: ethers adapter

* test: boost coverage

* Version Packages (#324)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: skip invalid logs (#326)

* fix: skip invalid logs

* chore: format

* chore: changeset

* Version Packages (#327)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* feat: tweaked error inheritence for `UserRejectedRequestError` & `SwitchChainError` (#328)

* feat: tweaked error inheritence for `UserRejectedRequestError` & `SwitchChainError`

* chore: format

* chore: switch to tsc

* chore: apply rome formatting & linting changes

* chore: bump to typescript v5

* chore: remove tsup config

* chore: improve build step

* chore: add comment to version.ts

* chore: fix imports

* chore: add changeset

* chore: fix type imports

* chore: ignore tsbuildinfo

* fix: type issues

* chore: Contains -> Or

* chore: format

* chore: format

---------

Co-authored-by: jxom <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: awkweb <[email protected]>
jxom added a commit that referenced this pull request Apr 7, 2023
* chore: switch to tsc

* chore: apply rome formatting & linting changes

* chore: bump to typescript v5

* chore: remove tsup config

* chore: improve build step

* chore: add comment to version.ts

* chore: fix imports

* chore: add changeset

* chore: revert uts46 import changes

* chore: fix type imports

* chore: ignore tsbuildinfo

* fix: type issues

* chore: Contains -> Or

* chore: format

* chore: switch to nodenext module resolution (#309)

* fix: make `GetValue` return `{ value?: never }` for contract functions that are not payable (#310)

fix: GetValue type

* Version Packages (#311)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* refactor: use `@adraffy/ens-normalize` for ENS normalization (#313)

* refactor: use @adraffy/ens-normalize for ENS normalization

* docs: update

* Version Packages (#315)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: `transports` property type on `FallbackTransport` (#317)

* Version Packages (#318)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: migrate to nodenext module resolution

* chore: fix type imports

* chore: use `bundler` module resolution for playgrounds so that path aliases are simpler

* fix: ethers adapter signTransaction properties (#322)

* fix: ethers adapter

* test: boost coverage

* Version Packages (#324)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: skip invalid logs (#326)

* fix: skip invalid logs

* chore: format

* chore: changeset

* Version Packages (#327)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* feat: tweaked error inheritence for `UserRejectedRequestError` & `SwitchChainError` (#328)

* feat: tweaked error inheritence for `UserRejectedRequestError` & `SwitchChainError`

* chore: format

* chore: switch to tsc

* chore: apply rome formatting & linting changes

* chore: bump to typescript v5

* chore: remove tsup config

* chore: improve build step

* chore: add comment to version.ts

* chore: fix imports

* chore: add changeset

* chore: fix type imports

* chore: ignore tsbuildinfo

* fix: type issues

* chore: Contains -> Or

* chore: format

* chore: format

---------

Co-authored-by: jxom <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: awkweb <[email protected]>

* Delete eleven-donkeys-lay.md

* Delete jsconfig.json

* Update cuddly-candles-begin.md

---------

Co-authored-by: Sebastian Lorenz <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: awkweb <[email protected]>
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: Slice starting at offset "32" is out-of-bounds (size: 32).
2 participants