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

📝 Feat: Add tutorial #829

Closed
wants to merge 7 commits into from
Closed

📝 Feat: Add tutorial #829

wants to merge 7 commits into from

Conversation

roninjin10
Copy link
Collaborator

@roninjin10 roninjin10 commented Jan 18, 2024

Description

Add a bunch of more docs

Testing

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

Additional Information

Your ENS/address:

Summary by CodeRabbit

  • New Features

    • Introduced Quick Start and Advanced Tutorial guides for Tevm, including JavaScript and TypeScript examples.
    • Launched detailed documentation for Tevm account and block handling, including JSON-RPC requests and responses.
    • Provided new reference material for Tevm contract interaction and management.
    • Created a table of contents for easy navigation of the TEVM API documentation.
    • Released createTevm documentation for setting up local EVM instances.
    • Introduced typed error definitions for Tevm and generic log information objects.
  • Documentation

    • Expanded Tevm API introduction to cover core concepts and remote client communication.
    • Added helper types for JSON-RPC request and response creation.
    • Documented a set of procedures for interacting with the EVM.
    • Detailed script execution functionality within TEVM.
    • Outlined new debugging and tracing functionalities for EVM transactions and calls.
    • Documented type declarations for transaction-related objects in Tevm.

Copy link

vercel bot commented Jan 18, 2024

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

Name Status Preview Comments Updated (UTC)
evmts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 18, 2024 1:14am

Copy link

changeset-bot bot commented Jan 18, 2024

⚠️ No Changeset found

Latest commit: e3b0919

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 18, 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 23 minutes and 25 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 64a7076 and e3b0919.

Walkthrough

The recent updates to the Tevm documentation reflect a significant enhancement and reorganization of content. The changes include the introduction of new guides, tutorials, and reference materials that clarify the usage of Tevm, its features, and its API. The modifications aim to improve the user experience for both beginners and advanced users, with a focus on JavaScript and TypeScript examples, account and contract management, and a deeper dive into Tevm's advanced functionalities.

Changes

File Path Change Summary
.../quick-start.md
.../tutorial.md
Reorganized code snippets, added comments, and expanded examples for JavaScript and TypeScript.
.../why.md
.../introduction.md
New files explaining the purpose, functionality, and usage of Tevm with a live demo and API overview.
.../account.md
.../block.md
.../call.md
.../contract.md
.../createTevm.md
.../errors.md
.../logs.md
.../script.md
.../tevm.md
.../trace.md
.../transaction.md
Introduced new reference files detailing types and procedures for account and contract management, EVM interactions, error handling, logging, scripting, tracing, and transactions.
.../contents.md
.../misc.md
.../procedures.temp.md
Added new contents for easy reference, helper types for JSON-RPC requests and responses, and a set of procedures for EVM operations.

🐇✨
In the warren of code, a change takes its shape,
Docs reformed, with no escape.
Tevm's guides now gleam so bright,
A rabbit's joy on this docu-night. 🌙📜✨

(\__/) ||
(•ㅅ•) ||
/   づ

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
Copy link
Collaborator Author

roninjin10 commented Jan 18, 2024

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

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

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 64a7076 and 7216834.
Files selected for processing (19)
  • apps/tevm/src/content/docs/guides/quick-start.md (11 hunks)
  • apps/tevm/src/content/docs/guides/tutorial.md (1 hunks)
  • apps/tevm/src/content/docs/guides/why.md (1 hunks)
  • apps/tevm/src/content/docs/reference/account.md (1 hunks)
  • apps/tevm/src/content/docs/reference/anvil.md (1 hunks)
  • apps/tevm/src/content/docs/reference/block.md (1 hunks)
  • apps/tevm/src/content/docs/reference/call.md (1 hunks)
  • apps/tevm/src/content/docs/reference/contents.md (1 hunks)
  • apps/tevm/src/content/docs/reference/contract.md (1 hunks)
  • apps/tevm/src/content/docs/reference/createTevm.md (1 hunks)
  • apps/tevm/src/content/docs/reference/errors.md (1 hunks)
  • apps/tevm/src/content/docs/reference/introduction.md (1 hunks)
  • apps/tevm/src/content/docs/reference/logs.md (1 hunks)
  • apps/tevm/src/content/docs/reference/misc.md (1 hunks)
  • apps/tevm/src/content/docs/reference/procedures.temp.md (1 hunks)
  • apps/tevm/src/content/docs/reference/script.md (1 hunks)
  • apps/tevm/src/content/docs/reference/tevm.md (1 hunks)
  • apps/tevm/src/content/docs/reference/trace.md (1 hunks)
  • apps/tevm/src/content/docs/reference/transaction.md (1 hunks)
Files not summarized due to errors (1)
  • apps/tevm/src/content/docs/reference/anvil.md: Error: Message exceeds token limit
Files skipped from review due to trivial changes (3)
  • apps/tevm/src/content/docs/reference/contents.md
  • apps/tevm/src/content/docs/reference/misc.md
  • apps/tevm/src/content/docs/reference/transaction.md
Additional comments: 107
apps/tevm/src/content/docs/reference/logs.md (1)
  • 1-17: The file logs.md provides a type declaration for a generic log information object. The link to the definition is correctly pointing to the source code in the repository, which is good for maintainability and traceability.
apps/tevm/src/content/docs/reference/block.md (1)
  • 1-21: The file block.md correctly documents the Block type with a comprehensive table of properties and their types, including optional properties. The link to the definition in the source code is provided, which is a good practice.
apps/tevm/src/content/docs/guides/tutorial.md (4)
  • 2-3: The title and description of the tutorial have been updated to reflect the new content focus, which is now an "Advanced tutorial" rather than an "Example Guide". This change aligns with the PR's objective to enhance documentation.
  • 6-14: The introduction section sets the stage for the advanced tutorial, providing context and recommending prerequisites. This is a good practice for guiding the user through the learning process.
  • 16-34: The setup instructions are clear and concise, providing step-by-step guidance for the user. The inclusion of code snippets helps users understand exactly what commands to run and what code to write.
  • 45-51: The placeholder for the tic tac toe contract is present, but the actual contract code is not included. This might be intentional, but it's worth verifying if the contract code should be part of the tutorial.
apps/tevm/src/content/docs/reference/introduction.md (4)
  • 1-22: The introduction to the Tevm API is well-structured, providing an overview of the key concepts and functionalities. The example code snippet is a good addition for users to understand how to create an instance of Tevm.
  • 24-42: The explanation of Procedures and Actions within the Tevm API is clear and informative. The code snippets provided are helpful for users to understand how to interact with the API.
  • 45-75: The section on Actions provides a good explanation of their purpose and usage within the Tevm system. The example code snippet demonstrates how to use an action to modify an account, which is practical and useful.
  • 77-94: The section on Action creators is informative, explaining how they enhance maintainability and provide a streamlined way of executing contract and script actions. The example code snippet is a good demonstration of their usage.
apps/tevm/src/content/docs/guides/why.md (4)
  • 1-22: The file why.md provides a rationale for the existence of Tevm imports and the problems they solve. The comparison to bundlers in JavaScript is apt and helps users understand the value proposition of Tevm.
  • 24-27: The explanation of how Tevm simplifies the developer experience by integrating configuration into the build tooling is clear and highlights the benefits of using Tevm.
  • 29-43: The section on language server support addresses common problems developers face and how Tevm solves them. This is valuable information that can help users understand the practical benefits of Tevm in their workflow.
  • 45-51: The discussion on the modular design of Tevm and its interoperability with other tooling is informative. It positions Tevm as a versatile tool that can fit into various development workflows.
apps/tevm/src/content/docs/reference/account.md (1)
  • 1-23: The file account.md provides type declarations and handler definitions for account-related procedures in Tevm. The links to the source code are included, which is good for maintainability.
apps/tevm/src/content/docs/reference/script.md (1)
  • 1-19: The file script.md documents the ScriptError type and provides an example of handling errors. The link to the source code is correctly included.
apps/tevm/src/content/docs/reference/contract.md (1)
  • 1-18: The file contract.md documents the ContractError type and provides an example of handling errors. The link to the source code is correctly included.
apps/tevm/src/content/docs/reference/tevm.md (2)
  • 1-39: The file tevm.md provides a comprehensive overview of the Tevm type, including its properties and methods. The example code snippet is practical and demonstrates how to create and use a Tevm instance.
  • 90-120: The type declaration for Tevm is detailed, listing all the handlers and their respective links to the documentation. The implementation details are also provided, which is good for understanding how Tevm is structured.
apps/tevm/src/content/docs/reference/call.md (1)
  • 1-9: The file call.md documents the BaseCallError type and provides a comprehensive list of errors that can be returned by call-based procedures. The link to the source code is correctly included.
apps/tevm/src/content/docs/reference/createTevm.md (11)
  • 4-4: The description of TEVM is clear and concise.
  • 6-8: The type alias Tevm is well-documented, explaining the request method and actions API.
  • 10-24: The type declaration table is well-structured and provides direct links to the type definitions.
  • 26-28: The links to the definition and implementation of Tevm are helpful for maintainability and understanding the codebase.
  • 39-41: The TevmEVMErrorMessage type alias is comprehensive and covers a wide range of EVM errors.
  • 49-53: The TevmJsonRpcRequest type alias is correctly defined and encompasses various JSON-RPC request types.
  • 62-70: The TevmJsonRpcRequestHandler type alias is generic and seems to be correctly typed to handle various JSON-RPC requests.
  • 97-111: The CreateEVMOptions type declaration is clear and provides options for creating a Tevm instance with optional parameters for customization.
  • 133-144: The ForkOptions type declaration is clear, providing options for fetching state that isn't available locally.
  • 152-154: The Tevm type alias is well-documented, explaining the properties of a local EVM instance.
  • 193-207: The createTevm function is well-documented with an example provided, which is good for developer experience.
apps/tevm/src/content/docs/reference/trace.md (16)
  • 1-3: The DebugTraceCallHandler type alias is correctly defined and documented.
  • 25-29: The DebugTraceCallJsonRpcRequest type alias is correctly defined and documented.
  • 37-39: The DebugTraceCallJsonRpcResponse type alias is correctly defined and documented.
  • 49-51: The DebugTraceCallParams type alias is correctly defined and documented.
  • 67-69: The DebugTraceCallProcedure type alias is correctly defined and documented.
  • 93-95: The DebugTraceCallResult type alias is correctly defined and documented.
  • 112-114: The DebugTraceTransactionHandler type alias is correctly defined and documented.
  • 136-138: The DebugTraceTransactionJsonRpcRequest type alias is correctly defined and documented.
  • 148-150: The DebugTraceTransactionJsonRpcResponse type alias is correctly defined and documented.
  • 160-162: The DebugTraceTransactionParams type alias is correctly defined and documented.
  • 172-174: The DebugTraceTransactionProcedure type alias is correctly defined and documented.
  • 198-200: The DebugTraceTransactionResult type alias is correctly defined and documented.
  • 208-210: The TraceCall type alias is correctly defined and documented.
  • 232-234: The TraceParams type alias is correctly defined and documented, including an example for the timeout parameter.
  • 252-254: The TraceResult type alias is correctly defined and documented.
  • 276-278: The TraceType type alias is correctly defined and documented.
apps/tevm/src/content/docs/guides/quick-start.md (12)
  • 8-9: The introduction to the guide is clear and sets the context for the reader.
  • 14-14: The command provided for initializing a project with Tevm CLI is correct and useful for quick setup.
  • 72-74: The import statement and usage of createTevm are correct and follow the updated API.
  • 90-97: The example usage of eth.getBalance is correct and demonstrates the use of Tevm actions effectively.
  • 105-121: The example usage of setAccount and getAccount actions is correct and demonstrates additional functionality provided by Tevm.
  • 140-146: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [143-150]

The example usage of vm.contract is correct but requires a valid contract address and ABI to be fully functional.

  • 201-209: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [204-215]

The instructions for scripting with Tevm are clear and provide a step-by-step guide for running Solidity code.

  • 240-240: The refactoring example using TevmContracts is correct and demonstrates a more streamlined approach.
  • 251-257: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [254-264]

The explanation of the build process with Tevm tooling is clear and highlights the benefits of using direct Solidity imports.

  • 283-285: The configuration for Bun to recognize Solidity files is correct and well-explained.
  • 320-342: The example of using external contracts via npm installation is correct and demonstrates how to interact with common contract implementations.
  • 347-349: The summary is encouraging and provides guidance for further exploration of Tevm's capabilities.
apps/tevm/src/content/docs/reference/errors.md (9)
  • 3-3: The file errors.md provides a comprehensive list of typed errors used by Tevm. This is a good practice as it centralizes error definitions and makes them easier to manage and reference throughout the project.
  • 5-10: The documentation for TypedError is clear and provides a good explanation of the purpose and structure of a typed error in Tevm. Including the _tag property for internal use is a good practice for future-proofing error handling.
  • 12-17: The type parameters TName and TMeta are well-documented. It's important to ensure that wherever TypedError is used, the type parameters are correctly specified to maintain type safety.
  • 19-26: The type declaration is consistent with the documentation provided above it. The optional meta field is a good design choice, allowing for additional error context without requiring it.
  • 28-30: The link to the definition of TypedError in the source code is a helpful addition for developers looking to understand the implementation details or contribute to the project.
  • 34-44: UnexpectedError is well-named and its purpose is clearly documented. It's important that this error is indeed never thrown, as stated, and that proper error handling is in place to prevent it.
  • 46-61: The AccountError type is a union of several error types, which is a good use of TypeScript's type system to represent multiple possible errors from account-related procedures. The example provided is practical and demonstrates how to handle these errors.
  • 69-77: Each specific error type, such as InvalidAddressError, InvalidBalanceError, etc., extends from TypedError, maintaining consistency and reusability of the error handling system.
  • 335-341: The TevmEVMErrorMessage type is a union of string literals representing possible EVM error messages. This is a good practice as it allows for type-safe handling of known EVM error messages.
apps/tevm/src/content/docs/reference/procedures.temp.md (12)
  • 1-5: The table of contents and the structure of the procedures.temp.md file provide a clear overview of the available classes and functions, which is beneficial for developers navigating the documentation.
  • 37-55: The accountHandler function is well-documented, with clear parameters and return type. The link to the source code is also provided, which is helpful.
  • 59-77: The accountProcedure function follows the same pattern as accountHandler, with clear documentation and a source code link. It's important that the actual implementation matches this documentation.
  • 81-97: The blockNumberHandler and blockNumberProcedure functions are similarly well-documented. Consistency in documentation style across different handlers and procedures is good for maintainability.
  • 121-139: The callHandler and callProcedure functions are documented following the established pattern. It's important to ensure that the actual code for these handlers and procedures is as clear and well-structured as the documentation suggests.
  • 205-223: The contractHandler function is documented to create a handler for contract params. The explanation that it is a wrapper around a call for the JSON-RPC interface is useful for understanding its purpose.
  • 227-247: The contractProcedure function's documentation indicates that it overloads the call procedure. This reuse of functionality is efficient, but it's important to ensure that it doesn't introduce any unexpected behavior or limitations for contract-specific operations.
  • 251-269: The gasPriceHandler and gasPriceProcedure functions are documented with parameters and return types. The inclusion of forkUrl in the options suggests that these handlers can work with forked blockchain states, which is a flexible design.
  • 295-313: The getBalanceHandler and getBalanceProcedure functions are documented with an emphasis on the options parameter, which includes forkUrl and stateManager. This is consistent with the other handlers and procedures.
  • 339-357: The getCodeHandler and getCodeProcedure functions follow the established documentation pattern. The parameters and return types are clear, and the source code links are provided.
  • 383-401: The getStorageAtHandler and getStorageAtProcedure functions are well-documented. The options parameter is consistent with other handlers, allowing for configuration based on the state manager and fork URL.
  • 463-481: The scriptHandler and scriptProcedure functions are documented consistently with the rest of the handlers and procedures. The source code links are provided, which is helpful for developers.
apps/tevm/src/content/docs/reference/anvil.md (27)
  • 3-3: The type declaration for AnvilDropTransactionHandler is clear and links to the type parameters and return type. The link to the source code is provided, which is good for maintainability.
  • 25-29: The description for AnvilDropTransactionJsonRpcRequest is succinct and to the point, explaining the purpose of the JSON-RPC request.
  • 447-447: The type for AnvilLoadStateParams is defined as an Object with a state property. Ensure that the Record type used here is the most appropriate for the intended use case.
Verification successful

The search results have provided the necessary information to verify the review comment. The AnvilLoadStateParams type is indeed defined with a state property that uses a Record<Hex, Hex> type. This confirms that the use of Record is appropriate for the intended use case, as it is used to represent a mapping from hexadecimal strings to hexadecimal strings, which is a common pattern for representing state in blockchain-related contexts.

Based on the provided information, the review comment questioning the appropriateness of the Record type for AnvilLoadStateParams is addressed, and the use of Record<Hex, Hex> is verified as consistent with the intended use case.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the Record type is used consistently for similar parameters across the project.
rg "Record<Hex, Hex>" --type md

Length of output: 33



Script:

#!/bin/bash
# Broaden the search to find any usage of the `Record` type in markdown files.
rg "Record<" --type md

# Additionally, search for the definition of `AnvilLoadStateParams` to understand its structure.
rg "AnvilLoadStateParams" --type md

Length of output: 2718



Script:

#!/bin/bash
# Attempt to find the detailed structure of AnvilLoadStateParams within markdown files.
rg "AnvilLoadStateParams" --type md -A 10

Length of output: 10981

* 651-663: The `AnvilResetParams` type includes optional properties within a nested `fork` object. Ensure that the optional chaining is handled correctly wherever this type is used. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity. * 651-663: The `AnvilResetParams` type includes a nested `fork` object with optional properties. This is a good use of nested types for clarity.

apps/tevm/src/content/docs/reference/procedures.temp.md Outdated Show resolved Hide resolved
Comment on lines +427 to +459
### requestProcedure

▸ **requestProcedure**(`vm`): `TevmJsonRpcRequestHandler`

Handles a single tevm json rpc request
Infers return type from request

#### Parameters

| Name | Type |
| :------ | :------ |
| `vm` | `VM` |

#### Returns

`TevmJsonRpcRequestHandler`

**`Example`**

```typescript
const res = await requestProcedure(evm)({
jsonrpc: '2.0',
id: '1',
method: 'tevm_call',
params: {
to: '0x000000000'
}
})
```

#### Defined in

[vm/procedures/src/requestProcedure.js:31](https://github.com/evmts/tevm-monorepo/blob/main/vm/procedures/src/requestProcedure.js#L31)
Copy link
Contributor

Choose a reason for hiding this comment

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

The requestProcedure function is documented with an example, which is helpful. However, the documentation should clarify what TevmJsonRpcRequestHandler is and how it should be used, as it's not immediately clear from the context.

Please provide more details on the TevmJsonRpcRequestHandler return type to clarify its usage and purpose.

Comment on lines +118 to +125
### CustomPrecompile

Ƭ **CustomPrecompile**: `Exclude`\<`Exclude`\<`ConstructorArgument`\<`EVM`\>, `undefined`\>[``"customPrecompiles"``], `undefined`\>[`number`]

TODO This should be publically exported from ethereumjs but isn't
Typing this by hand is tedious so we are using some typescript inference to get it
do a pr to export this from ethereumjs and then replace this with an import
TODO this should be modified to take a hex address rather than an ethjs address to be consistent with rest of Tevm
Copy link
Contributor

Choose a reason for hiding this comment

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

The CustomPrecompile type alias has TODO comments that should be addressed to improve the codebase. It suggests making a PR to export this from ethereumjs and modifying it to take a hex address.

Would you like me to open a GitHub issue to track the task of exporting CustomPrecompile from ethereumjs and modifying it to take a hex address?

Comment on lines +53 to +74
5. Now hook it up in single player mode

Let's get this tic tac toe game running in single player mode.

- Make a tevm instance

```solidity tevm
import {createTevm} from 'tevm'

export const tevm = createTevm()
```

- use your tevm instance in react

```typescript App.tsx
import {tevm} from './tevm.js'
import {type Board, TicTacToe} from '@tevm/tutorial'

export const App = () => {
const board: Board = [[], [], []]
return <TicTacToe board={board} />
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The search results indicate that the implementation details for single-player mode are not provided elsewhere in the documentation. The reviewer's comment appears to be valid, as users might expect a complete tutorial but the actual implementation details for setting up the game in single-player mode are not shown.

Analysis chain

The instructions for hooking up the game in single-player mode are provided, but the actual implementation details are not shown. This could be confusing for users who are expecting a complete tutorial.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify if the implementation details for single-player mode are included elsewhere in the documentation
rg --type md "single player mode"

Length of output: 231



Script:

#!/bin/bash
# Search for filenames that might be related to the tic tac toe game or Tevm instance setup
fd --type f --extension tsx --extension js "ticTacToe|tevm"

Length of output: 190


Script:

#!/bin/bash
# Search for code snippets within markdown files that might relate to the tic tac toe game or Tevm instance setup
rg --type md -A 10 "TicTacToe|createTevm"

Length of output: 24055

Comment on lines +54 to +56
## Just try it

The best way to see if Tevm can help your workflow is to try it out! Try our [live demo](todo.link) to play with Tevm without needing to install or download anything.
Copy link
Contributor

Choose a reason for hiding this comment

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

The encouragement to try out Tevm with a live demo is a good call to action. However, the link to the live demo is a placeholder (todo.link). This needs to be updated with the actual link.

- Try our [live demo](todo.link) to play with Tevm without needing to install or download anything.
+ Try our [live demo](https://actual-link-to-demo) to play with Tevm without needing to install or download anything.

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
## Just try it
The best way to see if Tevm can help your workflow is to try it out! Try our [live demo](todo.link) to play with Tevm without needing to install or download anything.
## Just try it
The best way to see if Tevm can help your workflow is to try it out! Try our [live demo](https://actual-link-to-demo) to play with Tevm without needing to install or download anything.

apps/tevm/src/content/docs/reference/tevm.md Outdated Show resolved Hide resolved
apps/tevm/src/content/docs/reference/anvil.md Outdated Show resolved Hide resolved
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 7216834 and abdcb07.
Files selected for processing (1)
  • apps/tevm/src/content/docs/reference/anvil.md (1 hunks)
Files not summarized due to errors (1)
  • apps/tevm/src/content/docs/reference/anvil.md: Error: Message exceeds token limit


Ƭ **AnvilImpersonateAccountParams**: `Object`

Params fro `anvil_impersonateAccount` handler
Copy link
Contributor

Choose a reason for hiding this comment

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

The previously mentioned typo in the description for AnvilImpersonateAccountParams has not been corrected.

- Params fro `anvil_impersonateAccount` handler
+ Params for `anvil_impersonateAccount` handler

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
Params fro `anvil_impersonateAccount` handler
Params for `anvil_impersonateAccount` handler

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

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between abdcb07 and 31edb8e.
Files selected for processing (2)
  • apps/tevm/src/content/docs/reference/anvil.md (1 hunks)
  • apps/tevm/src/content/docs/reference/tevm.md (1 hunks)
Files not summarized due to errors (1)
  • apps/tevm/src/content/docs/reference/anvil.md: Error: Message exceeds token limit
Files skipped from review as they are similar to previous changes (1)
  • apps/tevm/src/content/docs/reference/tevm.md


### AnvilDumpStateParams

Ƭ **AnvilDumpStateParams**: {} \| `undefined` \| `never`
Copy link
Contributor

Choose a reason for hiding this comment

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

The type for AnvilDumpStateParams is still defined as {} or undefined or never. This was previously flagged as potentially overly complex. If there has been no change in the requirements that necessitates this complexity, it should be simplified.

Consider simplifying the type definition for clarity unless there's a specific reason for this complexity.

Will Cory and others added 7 commits January 17, 2024 17:10
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[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