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: normalize AbiFallback.inputs type between abitype and zod #203

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mathieu-bour
Copy link
Contributor

@mathieu-bour mathieu-bour commented Oct 14, 2023

Description

This PR aligns the following AbiFallback.inputs type between Zod schema and abitype

type Left = AbiFallback['inputs']; // readonly []
type Right = z.infer<typeof AbiFallbackSchema>['inputs']; // never[]

After:

type Left = AbiFallback['inputs']; // readonly never[]
type Right = z.infer<typeof AbiFallbackSchema>['inputs']; readonly never[]

Additional Information

Before submitting this issue, please make sure you do the following.

  • Read the contributing guide
  • Added documentation related to the changes made.
  • Added or updated tests (and snapshots) related to the changes made.

PR-Codex overview

Focus of the PR:

This PR focuses on normalizing the AbiFallback.inputs type and zod.

Detailed summary:

  • Normalize AbiFallback.inputs type and zod
  • Update packages/abitype/src/abi.ts to use readonly never[] instead of readonly [] for AbiFallback.inputs
  • Update packages/abitype/src/zod.ts to use z.tuple([]).readonly().optional() for AbiFallback.inputs
  • Add AbiFallback and AbiFunction to packages/abitype/src/zod.test-d.ts
  • Update imports in packages/abitype/src/zod.test-d.ts
  • Add tests for AbiFunction and AbiFallback in packages/abitype/src/zod.test-d.ts

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@changeset-bot
Copy link

changeset-bot bot commented Oct 14, 2023

🦋 Changeset detected

Latest commit: d5dadf7

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

This PR includes changesets to release 1 package
Name Type
abitype Patch

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 Oct 14, 2023

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

Name Status Preview Comments Updated (UTC)
abitype ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 14, 2023 8:26am

@commit-lint
Copy link

commit-lint bot commented Oct 14, 2023

Bug Fixes

  • normalize AbiFallback.inputs type and zod (d5dadf7)

Contributors

mathieu-bour

Commit-Lint commands

You can trigger Commit-Lint actions by commenting on this PR:

  • @Commit-Lint merge patch will merge dependabot PR on "patch" versions (X.X.Y - Y change)
  • @Commit-Lint merge minor will merge dependabot PR on "minor" versions (X.Y.Y - Y change)
  • @Commit-Lint merge major will merge dependabot PR on "major" versions (Y.Y.Y - Y change)
  • @Commit-Lint merge disable will desactivate merge dependabot PR
  • @Commit-Lint review will approve dependabot PR
  • @Commit-Lint stop review will stop approve dependabot PR

@codecov
Copy link

codecov bot commented Oct 14, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (32cf12d) 99.83% compared to head (d5dadf7) 99.83%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #203   +/-   ##
=======================================
  Coverage   99.83%   99.83%           
=======================================
  Files          26       26           
  Lines        6082     6082           
  Branches      195      195           
=======================================
  Hits         6072     6072           
  Misses          8        8           
  Partials        2        2           
Files Coverage Δ
packages/abitype/src/zod.ts 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Raiden1411
Copy link
Collaborator

I've tested the ABI output of the fallback function on every major solidity compiler and the ABI JSON output does not have the inputs property. I think instead of normalizing the type between TS and Zod we should remove this property all together. I also believe that Vyper doesn't support fallback functions.

@mathieu-bour
Copy link
Contributor Author

So you mean completely removing AbiFallback['input']?

@Raiden1411
Copy link
Collaborator

If @tmm agrees I would say so

@mathieu-bour
Copy link
Contributor Author

@Raiden1411 @tmm just wanted to know your opinion about removing fallback from fallback function

@tmm tmm force-pushed the main branch 4 times, most recently from 6b36159 to c706a9a Compare May 23, 2024 21:55
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.

None yet

2 participants