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 bug in zod validators #889

Merged
merged 1 commit into from
Jan 27, 2024
Merged

Conversation

roninjin10
Copy link
Collaborator

@roninjin10 roninjin10 commented Jan 27, 2024

Description

Testing

Explain the quality checks that have been done on the code changes

Additional Information

Your ENS/address:

Summary by CodeRabbit

  • Refactor
    • Improved formatting of type annotations in the tevmViemExtension function for better readability.
    • Enhanced the createMemoryClient function to conditionally include the withdrawals property, aligning with EIP 4895 activation.
    • Refactored ethCallProcedure for enhanced readability without altering its logic.

Copy link

vercel bot commented Jan 27, 2024

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

Name Status Preview Comments Updated (UTC)
tevm-monorepo-tevm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 27, 2024 6:15pm

Copy link

changeset-bot bot commented Jan 27, 2024

⚠️ No Changeset found

Latest commit: ec93a3f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link
Contributor

coderabbitai bot commented Jan 27, 2024

Walkthrough

The recent updates involve formatting adjustments in type annotations within a specific function, conditional logic enhancement in a memory client related to an Ethereum Improvement Proposal (EIP), and a refactoring effort aimed at improving readability in procedure handling. These changes collectively enhance code clarity, compatibility, and maintainability without altering the underlying functionality.

Changes

File Path Change Summary
.../viem/src/tevmViemExtension.js Modified type annotation formatting in tevmViemExtension function.
.../memory-client/src/createMemoryClient.js Updated to conditionally include withdrawals property based on EIP 4895 activation.
.../procedures/src/eth/ethCallProcedure.js Refactored for readability; logic remains unchanged.

🐰✨
Changes here, changes there, code refined everywhere,
Type annotations neat, with spaces quite petite,
EIP dances in, with logic to begin,
Readability's king, as the rabbit does sing. 🎶
🌟🐇

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@roninjin10 roninjin10 force-pushed the actions-tyypes-consistency branch from 1fee319 to e5210f8 Compare January 27, 2024 15:47
@roninjin10 roninjin10 force-pushed the actions-tyypes-consistency branch from e5210f8 to c333bf7 Compare January 27, 2024 15:56
@roninjin10 roninjin10 force-pushed the actions-tyypes-consistency branch from c333bf7 to c2d7451 Compare January 27, 2024 16:04
@roninjin10 roninjin10 force-pushed the actions-tyypes-consistency branch from c2d7451 to f2d2820 Compare January 27, 2024 17:16
@roninjin10 roninjin10 force-pushed the actions-tyypes-consistency branch from f2d2820 to 9455c63 Compare January 27, 2024 17:37
Base automatically changed from add_eth_call_action to main January 27, 2024 17:44
@roninjin10 roninjin10 changed the title ♻️ Update actions types to consistent api 🐛 Fix bug in zod validators Jan 27, 2024
✅ Fix build:

♻️ Regenerate
@roninjin10 roninjin10 force-pushed the actions-tyypes-consistency branch from 9455c63 to ec93a3f Compare January 27, 2024 17:48
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2bd52ba and ec93a3f.
Files selected for processing (3)
  • extensions/viem/src/tevmViemExtension.js (5 hunks)
  • packages/memory-client/src/createMemoryClient.js (1 hunks)
  • packages/procedures/src/eth/ethCallProcedure.js (1 hunks)
Files skipped from review due to trivial changes (2)
  • extensions/viem/src/tevmViemExtension.js
  • packages/procedures/src/eth/ethCallProcedure.js
Additional comments: 6
packages/memory-client/src/createMemoryClient.js (6)
  • 103-105: The conditional inclusion of the withdrawals property based on the activation of EIP 4895 is correctly implemented. However, ensure that the WithdrawalData type is correctly imported and used here, as missing imports can lead to runtime errors.
  • 100-108: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1-1]

The imports at the top of the file are comprehensive, covering various utilities and classes needed for the createMemoryClient function. Ensure that all imported modules are used within the file to avoid unnecessary imports that can increase bundle size.

  • 100-108: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [28-28]

The use of BigInt for chainId is appropriate given the potential size of chain IDs. However, ensure that all consuming code of chainId correctly handles BigInt values, as mixing BigInt with other numeric types without explicit conversion can lead to errors.

  • 100-108: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [67-67]

The initialization of genesisState as an empty object is correct. However, if there's any default state that should be included in the genesis block, consider populating this object accordingly to avoid potential issues with uninitialized state.

  • 100-108: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [82-82]

The creation of the WrappedEvm instance is well-handled, with options allowing for customization of the EVM's behavior. Ensure that all options (allowUnlimitedContractSize, customPrecompiles, profiler) are thoroughly documented and tested, especially since they can significantly affect the EVM's execution.

  • 108-108: The handling of options.customPredeploys is a good feature, allowing for pre-deployment of contracts. Ensure that error handling is in place for the asynchronous operations within Promise.all, as failures in contract pre-deployment can lead to a partially initialized state.

Comment on lines 100 to 108
header: common.genesis(),
...(common.isActivatedEIP(4895)
? {
withdrawals:
withdrawals:
/** @type {Array<import('@ethereumjs/util').WithdrawalData>}*/ ([]),
}
}
: {}),
},
{ common, setHardfork: false, skipConsensusFormatValidation: true },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [9-9]

The documentation for the createMemoryClient function is well-written, providing a clear example of how to use the function. Consider adding more details about the parameters accepted by the function and the structure of the returned MemoryClient object for improved clarity.


📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [33-33]

The TODO comment about using the tevm/jsonrpc package instead of viem indicates a future improvement. It's important to track this as a task in your project management tool to ensure it doesn't get overlooked.

Would you like me to open a GitHub issue to track the replacement of viem with tevm/jsonrpc?

@roninjin10 roninjin10 merged commit 6079202 into main Jan 27, 2024
19 of 20 checks passed
@roninjin10 roninjin10 deleted the actions-tyypes-consistency branch January 27, 2024 17:56
@roninjin10 roninjin10 mentioned this pull request Feb 12, 2024
1 task
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.

1 participant