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

✨ Implement block tags and correct skipBalance #890

Merged
merged 15 commits into from
Feb 12, 2024
Merged

Conversation

roninjin10
Copy link
Collaborator

@roninjin10 roninjin10 commented Jan 27, 2024

Description

Switch from Block to blockTag

Testing

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

Additional Information

Your ENS/address:

Summary by CodeRabbit

  • New Features
    • Introduced new optional parameters createTransaction and blockTag to enhance call execution and state update control.
  • Documentation
    • Updated documentation to reflect changes in parameter names from evm to vm across various functions and procedures.
  • Refactor
    • Renamed parameter evm to vm in multiple handler and procedure functions to align with updated terminology and usage.
  • Tests
    • Adjusted tests to accommodate the new VM object usage and the introduction of createTransaction and blockTag parameters.
  • Chores
    • Updated type annotations and descriptions in documentation to reflect new and updated parameters.

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 Feb 12, 2024 4:44am

Copy link

changeset-bot bot commented Jan 27, 2024

🦋 Changeset detected

Latest commit: 79c5734

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

This PR includes changesets to release 12 packages
Name Type
@tevm/actions-types Minor
@tevm/memory-client Minor
@tevm/http-client Minor
@tevm/predeploys Minor
@tevm/procedures Minor
@tevm/actions Minor
@tevm/viem Minor
@tevm/state Minor
@tevm/zod Minor
tevm Minor
@tevm/server Minor
@tevm/ethers Minor

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

Copy link
Contributor

coderabbitai bot commented Jan 27, 2024

Warning

Rate Limit Exceeded

@roninjin10 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 59 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 66acaf7 and 79c5734.

Walkthrough

The updates bring a consistent renaming from evm to vm across various functions and documentation, reflecting a shift in terminology. Additionally, the BaseCallParams type now includes optional parameters createTransaction and blockTag, enhancing control over transaction creation and call execution. These changes streamline the interface and improve functionality within the Ethereum virtual machine context.

Changes

File Path Change Summary
.../@tevm/actions-types/type-aliases/BaseCallParams.md
.../actions-types/src/params/BaseCallParams.ts
packages/zod/src/params/zBaseCallParams.js
packages/zod/src/params/zBaseCallParams.spec.ts
Introduced optional parameters createTransaction and blockTag to BaseCallParams.
.../@tevm/actions/functions/*.md
.../actions/docs/functions/*.md
.../actions/src/eth/*.js
.../actions/src/eth/*.spec.ts
.../actions/src/tevm/*.js
.../actions/src/tevm/*.spec.ts
.../memory-client/src/createMemoryClient.js
Renamed parameter evm to vm across various handler and function files. Updated function signatures and documentation accordingly.
.../@tevm/procedures/functions/*.md
.../procedures/src/eth/*.js
.../procedures/src/requestProcedure.spec.ts
.../procedures/src/tevm/*.js
Updated the parameter name from evm to vm in procedure files and documentation. Aligned function signatures with implementation changes.

Poem

In the gridiron's glow, under stadium lights agleam,

Chiefs and 49ers chase their Super Bowl dream.

🏈 Amidst the clash, a rabbit hops into view,

Coding with changes, fresh and anew.

From evm to vm, the dance of names,

Like players on the field in spirited games.

Let victory's cheer echo through the night,

As changes unfold, shining bright. 🌙✨

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
@roninjin10 roninjin10 force-pushed the actions-tyypes-consistency branch from 9455c63 to ec93a3f Compare January 27, 2024 17:48
@roninjin10 roninjin10 force-pushed the block_tag_type_fix branch 2 times, most recently from b935986 to e56c8a7 Compare January 27, 2024 17:56
Base automatically changed from actions-tyypes-consistency to main January 27, 2024 17:56
@roninjin10 roninjin10 force-pushed the block_tag_type_fix branch 2 times, most recently from f044923 to 587b03c Compare February 10, 2024 21:06
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: 10

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5a6be5f and 587b03c.
Files selected for processing (34)
  • docs/src/content/docs/reference/@tevm/actions-types/type-aliases/BaseCallParams.md (1 hunks)
  • docs/src/content/docs/reference/@tevm/actions/functions/callHandler.md (1 hunks)
  • docs/src/content/docs/reference/@tevm/actions/functions/contractHandler.md (1 hunks)
  • docs/src/content/docs/reference/@tevm/actions/functions/ethCallHandler.md (1 hunks)
  • docs/src/content/docs/reference/@tevm/actions/functions/scriptHandler.md (1 hunks)
  • docs/src/content/docs/reference/@tevm/procedures/functions/callProcedure.md (1 hunks)
  • docs/src/content/docs/reference/@tevm/procedures/functions/contractProcedure.md (1 hunks)
  • docs/src/content/docs/reference/@tevm/procedures/functions/scriptProcedure.md (1 hunks)
  • packages/actions-types/docs/type-aliases/BaseCallParams.md (1 hunks)
  • packages/actions-types/src/params/BaseCallParams.ts (1 hunks)
  • packages/actions/docs/functions/callHandler.md (1 hunks)
  • packages/actions/docs/functions/contractHandler.md (1 hunks)
  • packages/actions/docs/functions/ethCallHandler.md (1 hunks)
  • packages/actions/docs/functions/scriptHandler.md (1 hunks)
  • packages/actions/src/eth/ethCallHandler.js (1 hunks)
  • packages/actions/src/eth/ethCallHandler.spec.ts (4 hunks)
  • packages/actions/src/tevm/callHandler.js (2 hunks)
  • packages/actions/src/tevm/callHandler.spec.ts (7 hunks)
  • packages/actions/src/tevm/callHandlerOpts.js (2 hunks)
  • packages/actions/src/tevm/contractHandler.js (5 hunks)
  • packages/actions/src/tevm/contractHandler.spec.ts (14 hunks)
  • packages/actions/src/tevm/scriptHandler.js (3 hunks)
  • packages/actions/src/tevm/scriptHandler.spec.ts (7 hunks)
  • packages/memory-client/src/createMemoryClient.js (1 hunks)
  • packages/procedures/docs/functions/callProcedure.md (1 hunks)
  • packages/procedures/docs/functions/contractProcedure.md (1 hunks)
  • packages/procedures/docs/functions/scriptProcedure.md (1 hunks)
  • packages/procedures/src/eth/ethCallProcedure.js (1 hunks)
  • packages/procedures/src/requestProcedure.spec.ts (5 hunks)
  • packages/procedures/src/tevm/callProcedure.js (1 hunks)
  • packages/procedures/src/tevm/scriptProcedure.js (1 hunks)
  • packages/zod/src/params/zBaseCallParams.js (1 hunks)
  • packages/zod/src/params/zBaseCallParams.spec.ts (1 hunks)
  • tevm/docs/actions-types/type-aliases/BaseCallParams.md (1 hunks)
Additional comments: 79
packages/actions/src/eth/ethCallHandler.js (3)
  • 4-4: Parameter type changed from EVM to VM to align with the updated import.
  • 10-12: Introduced createTransaction and skipBalance parameters in the call handler options.
  • 12-12: Error handling logic correctly throws the first error if any are present in the response.
packages/zod/src/params/zBaseCallParams.spec.ts (1)
  • 12-13: Added tests for new properties skipBalance and createTransaction in zBaseCallParams.
packages/actions/docs/functions/ethCallHandler.md (2)
  • 9-9: Updated parameter name in function signature from evm to vm.
  • 13-13: Parameter description updated to reflect the change to VM.
docs/src/content/docs/reference/@tevm/actions/functions/ethCallHandler.md (2)
  • 8-8: Updated parameter name in function signature from evm to vm.
  • 12-12: Parameter description updated to reflect the change to VM.
packages/actions/docs/functions/callHandler.md (2)
  • 9-9: Updated parameter name in function signature from evm to vm.
  • 15-15: Parameter description updated to reflect the change to VM.
docs/src/content/docs/reference/@tevm/actions/functions/callHandler.md (2)
  • 8-8: Updated parameter name in function signature from evm to vm.
  • 14-14: Parameter description updated to reflect the change to VM.
packages/actions/docs/functions/scriptHandler.md (2)
  • 9-9: Updated parameter name in function signature from evm to vm.
  • 15-15: Parameter description updated to reflect the change to VM.
docs/src/content/docs/reference/@tevm/actions/functions/scriptHandler.md (2)
  • 8-8: Updated parameter name in function signature from evm to vm.
  • 14-14: Parameter description updated to reflect the change to VM.
packages/actions/docs/functions/contractHandler.md (2)
  • 9-9: Updated parameter name in function signature from evm to vm.
  • 15-15: Parameter description updated to reflect the change to VM.
packages/procedures/docs/functions/callProcedure.md (2)
  • 9-9: Updated parameter name in function signature from evm to vm.
  • 15-15: Parameter description updated to reflect the change to VM.
docs/src/content/docs/reference/@tevm/actions/functions/contractHandler.md (2)
  • 8-8: Updated parameter name in function signature from evm to vm.
  • 14-14: Parameter description updated to reflect the change to VM.
packages/procedures/docs/functions/scriptProcedure.md (2)
  • 9-9: Updated parameter name in function signature from evm to vm.
  • 15-15: Parameter description updated to reflect the change to VM.
docs/src/content/docs/reference/@tevm/procedures/functions/callProcedure.md (2)
  • 8-12: Updated parameter name in function signature from evm to vm and corrected the link to the type alias.
  • 18-18: Parameter description updated to reflect the change to VM.
packages/procedures/docs/functions/contractProcedure.md (2)
  • 9-9: Updated parameter name in function signature from evm to vm.
  • 17-17: Parameter description updated to reflect the change to VM.
docs/src/content/docs/reference/@tevm/procedures/functions/scriptProcedure.md (2)
  • 8-12: Updated parameter name in function signature from evm to vm and corrected the link to the type alias.
  • 18-18: Parameter description updated to reflect the change to VM.
docs/src/content/docs/reference/@tevm/procedures/functions/contractProcedure.md (2)
  • 8-12: Updated parameter name in function signature from evm to vm and corrected the link to the type alias.
  • 20-20: Parameter description updated to reflect the change to VM.
packages/procedures/src/eth/ethCallProcedure.js (2)
  • 5-5: Parameter type changed from EVM to VM to align with the updated import.
  • 11-11: Correctly passes the vm parameter to the callProcedure function.
packages/actions/src/tevm/callHandler.js (3)
  • 7-7: Parameter type changed from EVM to VM to align with the updated import.
  • 16-16: Correctly creates a shallow copy of the VM when createTransaction is false.
  • 17-33: Error handling logic correctly captures and returns unexpected errors.
packages/actions/src/tevm/callHandlerOpts.js (2)
  • 5-5: Introduced typedef EthRunCallParams for clarity in handling EVM call options.
  • 46-48: Correctly sets skipBalance to true if no caller is provided, handling a specific case for call execution.
packages/zod/src/params/zBaseCallParams.js (2)
  • 7-12: Added new field createTransaction with a boolean type and an optional flag, including a description.
  • 17-17: Updated description for skipBalance to clarify its purpose.
packages/actions-types/src/params/BaseCallParams.ts (1)
  • 7-13: Added new properties createTransaction and blockTag to the BaseCallParams type, providing more control over transaction handling and specifying the block number or tag for call execution.
packages/actions-types/docs/type-aliases/BaseCallParams.md (1)
  • 34-39: Added new optional parameter createTransaction to the function signature, including a description.
tevm/docs/actions-types/type-aliases/BaseCallParams.md (1)
  • 34-39: Added new optional parameter createTransaction to the function signature, including a description.
packages/procedures/src/tevm/scriptProcedure.js (1)
  • 6-7: Parameter evm has been correctly renamed to vm to reflect the usage of Ethereumjs VM.
packages/memory-client/src/createMemoryClient.js (2)
  • 205-210: The parameters passed to processRequest, scriptHandler, callHandler, and contractHandler have been correctly updated to use vm instead of evm.
  • 216-216: The ethCallHandler correctly receives vm as its parameter, aligning with the changes made throughout the file.
packages/actions/src/eth/ethCallHandler.spec.ts (5)
  • 5-5: The import of VM from @ethereumjs/vm is correctly added to support the creation of vm instances in the tests.
  • 298-298: The creation of vm using VM.create({ evm }) is correct, aligning with the updated usage of vm in the test cases.
  • 310-310: The replacement of evm with vm in the ethCallHandler call is correctly implemented, ensuring consistency with the updated parameter naming.
  • 326-326: The creation of vm for the second test case is consistent with the changes made throughout the file, correctly using VM.create({ evm }).
  • 330-330: The replacement of evm with vm in the second ethCallHandler call is correctly implemented, aligning with the updated parameter naming.
packages/actions/src/tevm/callHandler.spec.ts (5)
  • 5-5: Import of VM from @ethereumjs/vm is correctly added to support the new testing scenarios.
  • 310-310: Usage of callHandler with vm object is correct, aligning with the new approach to use VM instead of EVM.
  • 336-337: Introduction of createTransaction and skipBalance parameters in callHandler call is aligned with PR objectives to provide more control over transaction handling.
  • 367-367: Correct usage of callHandler to simulate a contract call that should fail, demonstrating the enhanced testing capabilities.
  • 401-401: Modification to evm.runCall for testing the handling of unexpected errors is a good test case addition.
packages/actions/src/tevm/scriptHandler.spec.ts (7)
  • 3-3: Import of VM from @ethereumjs/vm is correctly added to support the new testing scenarios.
  • 296-296: Instantiation of VM using await VM.create() is correct and aligns with the expected usage pattern for the VM object.
  • 317-317: Correct usage of await VM.create() in parameter validation test case.
  • 344-344: Correct instantiation of VM for testing passing in data.
  • 368-368: Correct instantiation of VM for testing invalid function data.
  • 393-393: Correct usage of scriptHandler with the vm object to test event decoding failure handling.
  • 404-404: Correct instantiation of VM for testing a call that reverts.
packages/actions/src/tevm/contractHandler.spec.ts (12)
  • 296-296: Line 296 introduces a new VM instance creation with an evm object passed as a parameter. This change aligns with the PR's objective to transition from EVM to VM. However, ensure that the VM.create method is correctly implemented to accept an EVM instance as its parameter, as this is not a standard pattern in @ethereumjs/vm.
  • 308-308: Line 308 uses the newly created vm instance for contract handling. This change is consistent with the PR's objective. However, verify that the contractHandler function has been updated to accept and correctly utilize the VM instance instead of the EVM instance.
  • 329-329: Line 329 repeats the VM instance creation pattern seen earlier. As before, ensure that the VM.create method's usage is correct and that the contractHandler function is compatible with the VM instance.
  • 342-342: Line 342 uses the vm instance in a contract call that is expected to fail. This test case is important for verifying error handling with the new VM instance. Ensure that the contractHandler function properly handles and returns errors when using the VM instance.
  • 369-369: Line 369 shows another instance of VM creation. Consistency in VM instance creation across tests is good, but again, verify the correctness of this pattern and the compatibility of the contractHandler function with the VM instance.
  • 372-372: Line 372 demonstrates handling a contract not existing using the vm instance. This test case is crucial for ensuring that the system correctly handles scenarios where contracts are not found. Verify that the contractHandler function's logic correctly identifies and handles non-existent contracts with the VM instance.
  • 396-396: Line 396, like previous instances, creates a VM instance. This pattern is consistent throughout the file. Ensure the VM.create method's usage is correct and that the contractHandler function is fully compatible with the VM instance.
  • 411-411: Line 411 tests the handling of unexpected errors during contract calls with the vm instance. This is critical for ensuring robust error handling. Verify that the contractHandler function correctly catches and handles unexpected errors when using the VM instance.
  • 434-434: Line 434 shows the VM instance creation for testing invalid contract params. This consistency in VM usage across tests is good. Ensure the VM.create method's usage is correct and that the contractHandler function properly handles invalid parameters with the VM instance.
  • 445-445: Line 445 tests the handling of invalid contract parameters using the vm instance. This is important for ensuring that the system correctly identifies and reports errors related to invalid parameters. Verify that the contractHandler function's logic correctly handles invalid parameters with the VM instance.
  • 473-473: Line 473 introduces a VM instance for testing the decoding of function data. This test case is important for ensuring that the system can handle scenarios where function data cannot be decoded. Verify that the contractHandler function correctly handles decoding issues with the VM instance.
  • 504-504: Line 504 shows the VM instance creation for testing encodable function data. Consistency in VM usage across tests is good. Ensure the VM.create method's usage is correct and that the contractHandler function properly handles scenarios where function data is not encodable with the VM instance.
packages/procedures/src/requestProcedure.spec.ts (3)
  • 409-409: The instantiation of VM with await VM.create({ evm }) inside the test case for tevm_call is correct, ensuring that a fresh VM instance is used for each test. This approach is consistent with best practices for isolation in testing.
  • 453-453: The instantiation of VM with await VM.create({ evm }) inside the error handling test case for tevm_call is correct, ensuring that a fresh VM instance is used for each test. This approach is consistent with best practices for isolation in testing.
  • 551-553: The instantiation of VM with await VM.create({ evm }) inside the test case for handling unexpected errors in tevm_script is correct, ensuring that a fresh VM instance is used for each test. This approach is consistent with best practices for isolation in testing.

@@ -480,7 +480,7 @@ describe('requestProcedure', () => {
describe('tevm_script', async () => {
it('should work', async () => {
expect(
await scriptProcedure(new EVM({}))({
await scriptProcedure(await VM.create())({
Copy link
Contributor

Choose a reason for hiding this comment

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

The instantiation of VM with await VM.create() inside the test case for tevm_script is correct, ensuring that a fresh VM instance is used for each test. However, the {} parameter passed to VM.create() is unnecessary and can be omitted for clarity.

- await VM.create({})
+ await VM.create()

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
await scriptProcedure(await VM.create())({
await scriptProcedure(await VM.create())({

const caller = `0x${'69'.repeat(20)}` as const
expect(
await scriptProcedure(evm)({
await scriptProcedure(await VM.create({}))({
Copy link
Contributor

Choose a reason for hiding this comment

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

The instantiation of VM with await VM.create({}) inside the error handling test case for tevm_script is correct, ensuring that a fresh VM instance is used for each test. However, the {} parameter passed to VM.create() is unnecessary and can be omitted for clarity.

- await VM.create({})
+ await VM.create()

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
await scriptProcedure(await VM.create({}))({
await scriptProcedure(await VM.create())({

@@ -294,6 +295,7 @@ const ERC20_ABI = [
describe('callHandler', () => {
it('should execute a contract call', async () => {
const evm = new EVM({})
const vm = await VM.create({ evm })
Copy link
Contributor

Choose a reason for hiding this comment

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

Instantiation of VM using VM.create({ evm }) is incorrect. The VM.create method does not accept an evm object as a parameter.

- const vm = await VM.create({ evm })
+ const vm = await VM.create()

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
const vm = await VM.create({ evm })
const vm = await VM.create()

@@ -327,10 +329,12 @@

it('should be able to send value', async () => {
const evm = new EVM({})
const vm = await VM.create({ evm })
Copy link
Contributor

Choose a reason for hiding this comment

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

The same issue as previously mentioned regarding VM.create({ evm }) is present here.

Refer to the earlier comment for the fix.

@@ -347,6 +351,7 @@

it('should handle errors returned during contract call', async () => {
const evm = new EVM({})
const vm = await VM.create({ evm })
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, incorrect instantiation of VM with VM.create({ evm }).

Refer to the earlier comment for the fix.

@@ -388,11 +393,12 @@

it('should handle the EVM unexpectedly throwing', async () => {
const evm = new EVM({})
const vm = await VM.create({ evm })
Copy link
Contributor

Choose a reason for hiding this comment

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

Incorrect VM.create({ evm }) instantiation is repeated.

Refer to the earlier comment for the fix.

@@ -387,8 +388,9 @@ describe('scriptHandler', () => {
},
}
}
const vm = await VM.create({ evm })
Copy link
Contributor

Choose a reason for hiding this comment

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

Incorrect instantiation of VM with { evm } parameter, similar to the issue identified in callHandler.spec.ts.

- const vm = await VM.create({ evm })
+ const vm = await VM.create()

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
const vm = await VM.create({ evm })
const vm = await VM.create()

/**
* @type {import('@tevm/actions-types').ScriptResult}
*/
let res
try {
res = await scriptHandler(evm)({
res = await scriptHandler(vm)({
Copy link
Contributor

Choose a reason for hiding this comment

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

The spread operator is used twice for request.params.deployedBytecode and request.params.gas, leading to redundant code.

- ...(request.params.deployedBytecode ? { deployedBytecode: request.params.deployedBytecode } : {}),
- ...(request.params.gas ? { gas: hexToBigInt(request.params.gas) } : {}),

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
res = await scriptHandler(vm)({
res = await scriptHandler(vm)({

The handling of abi, functionName, and args with type any and setting them to undefined is not ideal. Consider refining the approach to ensure type safety and clarity.


Duplicate handling of gasPrice and gas parameters. Remove the duplicate entries to clean up the code.

- ...(request.params.gasPrice ? { gasPrice: hexToBigInt(request.params.gasPrice) } : {}),
- ...(request.params.gas ? { gas: hexToBigInt(request.params.gas) } : {}),

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
res = await scriptHandler(vm)({
res = await scriptHandler(vm)({

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: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 36968f0 and 66acaf7.
Files selected for processing (34)
  • docs/src/content/docs/reference/@tevm/actions-types/type-aliases/BaseCallParams.md (1 hunks)
  • docs/src/content/docs/reference/@tevm/actions/functions/callHandler.md (1 hunks)
  • docs/src/content/docs/reference/@tevm/actions/functions/contractHandler.md (1 hunks)
  • docs/src/content/docs/reference/@tevm/actions/functions/ethCallHandler.md (1 hunks)
  • docs/src/content/docs/reference/@tevm/actions/functions/scriptHandler.md (1 hunks)
  • docs/src/content/docs/reference/@tevm/procedures/functions/callProcedure.md (1 hunks)
  • docs/src/content/docs/reference/@tevm/procedures/functions/contractProcedure.md (1 hunks)
  • docs/src/content/docs/reference/@tevm/procedures/functions/scriptProcedure.md (1 hunks)
  • packages/actions-types/docs/type-aliases/BaseCallParams.md (1 hunks)
  • packages/actions-types/src/params/BaseCallParams.ts (1 hunks)
  • packages/actions/docs/functions/callHandler.md (1 hunks)
  • packages/actions/docs/functions/contractHandler.md (1 hunks)
  • packages/actions/docs/functions/ethCallHandler.md (1 hunks)
  • packages/actions/docs/functions/scriptHandler.md (1 hunks)
  • packages/actions/src/eth/ethCallHandler.js (1 hunks)
  • packages/actions/src/eth/ethCallHandler.spec.ts (4 hunks)
  • packages/actions/src/tevm/callHandler.js (2 hunks)
  • packages/actions/src/tevm/callHandler.spec.ts (7 hunks)
  • packages/actions/src/tevm/callHandlerOpts.js (2 hunks)
  • packages/actions/src/tevm/contractHandler.js (5 hunks)
  • packages/actions/src/tevm/contractHandler.spec.ts (14 hunks)
  • packages/actions/src/tevm/scriptHandler.js (3 hunks)
  • packages/actions/src/tevm/scriptHandler.spec.ts (7 hunks)
  • packages/memory-client/src/createMemoryClient.js (2 hunks)
  • packages/procedures/docs/functions/callProcedure.md (1 hunks)
  • packages/procedures/docs/functions/contractProcedure.md (1 hunks)
  • packages/procedures/docs/functions/scriptProcedure.md (1 hunks)
  • packages/procedures/src/eth/ethCallProcedure.js (1 hunks)
  • packages/procedures/src/requestProcedure.spec.ts (5 hunks)
  • packages/procedures/src/tevm/callProcedure.js (1 hunks)
  • packages/procedures/src/tevm/scriptProcedure.js (1 hunks)
  • packages/zod/src/params/zBaseCallParams.js (1 hunks)
  • packages/zod/src/params/zBaseCallParams.spec.ts (1 hunks)
  • tevm/docs/actions-types/type-aliases/BaseCallParams.md (1 hunks)
Files skipped from review as they are similar to previous changes (34)
  • docs/src/content/docs/reference/@tevm/actions-types/type-aliases/BaseCallParams.md
  • docs/src/content/docs/reference/@tevm/actions/functions/callHandler.md
  • docs/src/content/docs/reference/@tevm/actions/functions/contractHandler.md
  • docs/src/content/docs/reference/@tevm/actions/functions/ethCallHandler.md
  • docs/src/content/docs/reference/@tevm/actions/functions/scriptHandler.md
  • docs/src/content/docs/reference/@tevm/procedures/functions/callProcedure.md
  • docs/src/content/docs/reference/@tevm/procedures/functions/contractProcedure.md
  • docs/src/content/docs/reference/@tevm/procedures/functions/scriptProcedure.md
  • packages/actions-types/docs/type-aliases/BaseCallParams.md
  • packages/actions-types/src/params/BaseCallParams.ts
  • packages/actions/docs/functions/callHandler.md
  • packages/actions/docs/functions/contractHandler.md
  • packages/actions/docs/functions/ethCallHandler.md
  • packages/actions/docs/functions/scriptHandler.md
  • packages/actions/src/eth/ethCallHandler.js
  • packages/actions/src/eth/ethCallHandler.spec.ts
  • packages/actions/src/tevm/callHandler.js
  • packages/actions/src/tevm/callHandler.spec.ts
  • packages/actions/src/tevm/callHandlerOpts.js
  • packages/actions/src/tevm/contractHandler.js
  • packages/actions/src/tevm/contractHandler.spec.ts
  • packages/actions/src/tevm/scriptHandler.js
  • packages/actions/src/tevm/scriptHandler.spec.ts
  • packages/memory-client/src/createMemoryClient.js
  • packages/procedures/docs/functions/callProcedure.md
  • packages/procedures/docs/functions/contractProcedure.md
  • packages/procedures/docs/functions/scriptProcedure.md
  • packages/procedures/src/eth/ethCallProcedure.js
  • packages/procedures/src/requestProcedure.spec.ts
  • packages/procedures/src/tevm/callProcedure.js
  • packages/procedures/src/tevm/scriptProcedure.js
  • packages/zod/src/params/zBaseCallParams.js
  • packages/zod/src/params/zBaseCallParams.spec.ts
  • tevm/docs/actions-types/type-aliases/BaseCallParams.md

@roninjin10 roninjin10 merged commit 64db695 into main Feb 12, 2024
11 checks passed
@roninjin10 roninjin10 deleted the block_tag_type_fix branch February 12, 2024 04:55
@github-actions github-actions bot mentioned this pull request Feb 12, 2024
roninjin10 pushed a commit that referenced this pull request Feb 12, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @tevm/[email protected]

### Minor Changes

- [#890](#890)
[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)
Thanks [@roninjin10](https://github.com/roninjin10)! - Updated tevm call
actions to not modify the state by default unless createTransaction:
true is set

## @tevm/[email protected]

### Minor Changes

- [#890](#890)
[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)
Thanks [@roninjin10](https://github.com/roninjin10)! - Updated tevm call
actions to not modify the state by default unless createTransaction:
true is set

### Patch Changes

- Updated dependencies
\[[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)]:
    -   @tevm/[email protected]

## @tevm/[email protected]

### Minor Changes

- [#890](#890)
[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)
Thanks [@roninjin10](https://github.com/roninjin10)! - Updated tevm call
actions to not modify the state by default unless createTransaction:
true is set

## @tevm/[email protected]

### Minor Changes

- [#890](#890)
[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)
Thanks [@roninjin10](https://github.com/roninjin10)! - Updated tevm call
actions to not modify the state by default unless createTransaction:
true is set

### Patch Changes

- Updated dependencies
\[[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)]:
    -   @tevm/[email protected]

## @tevm/[email protected]

### Minor Changes

- [#890](#890)
[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)
Thanks [@roninjin10](https://github.com/roninjin10)! - Updated tevm call
actions to not modify the state by default unless createTransaction:
true is set

### Patch Changes

- Updated dependencies
\[[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Minor Changes

- [#890](#890)
[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)
Thanks [@roninjin10](https://github.com/roninjin10)! - Updated tevm call
actions to not modify the state by default unless createTransaction:
true is set

## @tevm/[email protected]

### Minor Changes

- [#890](#890)
[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)
Thanks [@roninjin10](https://github.com/roninjin10)! - Updated tevm call
actions to not modify the state by default unless createTransaction:
true is set

### Patch Changes

- Updated dependencies
\[[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)]:
    -   @tevm/[email protected]

## @tevm/[email protected]

### Minor Changes

- [#890](#890)
[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)
Thanks [@roninjin10](https://github.com/roninjin10)! - Updated tevm call
actions to not modify the state by default unless createTransaction:
true is set

- [#891](#891)
[`7453edc4231d597179cc9bb117bc5df488b99c51`](7453edc)
Thanks [@roninjin10](https://github.com/roninjin10)! - Moved state dump
and state load to generateCannonicalGenesis and dumpCanonicalGenesis
methods on state classes

### Patch Changes

- [#890](#890)
[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed bug with
state normal mode not shallow copying correctly

## @tevm/[email protected]

### Minor Changes

- [#890](#890)
[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)
Thanks [@roninjin10](https://github.com/roninjin10)! - Updated tevm call
actions to not modify the state by default unless createTransaction:
true is set

## [email protected]

### Minor Changes

- [#890](#890)
[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)
Thanks [@roninjin10](https://github.com/roninjin10)! - Updated tevm call
actions to not modify the state by default unless createTransaction:
true is set

### Patch Changes

- Updated dependencies
\[[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695),
[`7453edc4231d597179cc9bb117bc5df488b99c51`](7453edc),
[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`64db695b4bf00b1e06909b960e9a498e520f1d73`](64db695)]:
    -   @tevm/[email protected]

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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