Skip to content

Add chainstate and account services #4488

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

Open
wants to merge 11 commits into
base: multi-move-vm
Choose a base branch
from

Conversation

simonjiao
Copy link
Collaborator

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Other information

Copy link

coderabbitai bot commented Apr 28, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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 testing code 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@simonjiao simonjiao requested review from welbon and Copilot and removed request for jolestar April 28, 2025 10:53
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request introduces new state and account service implementations along with associated event handling for on‐chain state updates and account management. Key changes include:

  • Adding ChainStateService in vm2/service/state with methods for state lookups, proofs, and time adjustments.
  • Adding AccountService and AccountEventService in vm2/service/account to manage account creation, default account repair, and event notifications.
  • Updating configuration files, node registration logic, and Cargo manifests to support the new services.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vm2/service/state/src/service.rs Introduces ChainStateService with state lookup and proof APIs
vm2/service/account/src/service.rs Implements AccountService for account management features
vm2/service/account/src/account_events.rs Adds AccountEventService for handling contract event notifications
node/src/node.rs Updates service registrations to include new state/account services
config/src/account_vault_config.rs Adds a new method to generate a modified vault directory path
Other Cargo.toml files Adjust dependencies, versions, and workspace member lists
commons/utils/src/mpsc.rs Refactors mpsc functions to use the .inspect() method

@simonjiao simonjiao changed the title Add state account services Add chainstate and account services Apr 28, 2025
@simonjiao simonjiao requested a review from sanlee42 as a code owner April 28, 2025 11:06
@simonjiao simonjiao requested a review from Copilot April 28, 2025 11:08
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds new chain state and account services while updating related modules and configuration files to support the new VM2 architecture. Key changes include:

  • Implementation of ChainStateService and associated state management functions.
  • Introduction of AccountService and AccountEventService with related account message types.
  • Updates to node registration, pubsub handling, and Cargo.toml manifests to include the new services.

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
vm2/service/state/src/service.rs Implements the ChainStateService and its internal state management logic.
vm2/service/state/src/lib.rs Exposes the ChainStateService.
vm2/service/state/Cargo.toml Adds dependencies and package configuration for the chain state service.
vm2/service/account/src/service.rs Implements the AccountService with default account handling and basic account operations.
vm2/service/account/src/message.rs Introduces message types for account-related events.
vm2/service/account/src/lib.rs Exposes the account service-related modules.
vm2/service/account/src/account_events.rs Provides an AccountEventService for handling contract events (e.g. accepted tokens).
vm2/service/account/Cargo.toml Adds dependencies and package configuration for the account service.
rpc/server/src/module/pubsub.rs Updates pubsub subscriptions to include a new ContractEventNotification variant.
node/src/node.rs Registers the new chain state and account services (including aliased variants) in the node.
node/Cargo.toml Updates dependencies and workspace members to incorporate the new VM2 services.
config/src/account_vault_config.rs Adds a new method to derive a secondary directory (“dir2”) for account configuration.
commons/utils/src/mpsc.rs Refactors channel send and receive logic using the new .inspect API.
chain/chain-notify/src/message.rs and src/lib.rs Updates notification messages and event handling to support new ContractEventNotification variants.
Cargo.toml Updates workspace configuration to include new service modules and dependency revisions.
Comments suppressed due to low confidence (2)

vm2/service/state/src/service.rs:161

  • [nitpick] The struct name 'Inner' is ambiguous; consider renaming it to a more descriptive name, such as 'ChainStateInner', to improve code clarity.
pub struct Inner {

node/src/node.rs:54

  • [nitpick] The use of numeric suffixes (e.g. AccountEventService2) may lead to ambiguity; consider using more descriptive names (e.g. Vm2AccountEventService) to clarify the service's purpose.
use starcoin_vm2_account_service::{ AccountEventService as AccountEventService2, AccountService as AccountService2, AccountStorage as AccountStorage2,};

@simonjiao simonjiao force-pushed the add-state-account-services branch from 7ab5567 to 257273e Compare April 29, 2025 05:30
@simonjiao simonjiao force-pushed the add-state-account-services branch from 257273e to 92c6808 Compare April 29, 2025 05:41
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