rollmint icon indicating copy to clipboard operation
rollmint copied to clipboard

feat: enable valset update

Open vuong177 opened this issue 1 year ago • 1 comments

Overview

Re-enable ABCI update valset.

Summary by CodeRabbit

  • New Features

    • Enhanced block management and state update mechanisms to handle validator sets more effectively.
    • Improved initialization of state from genesis documents with comprehensive validator configurations.
  • Bug Fixes

    • Adjusted state update logic to correctly manage last, current, and next validator sets, ensuring more reliable block validation and execution.
  • Documentation

    • Updated comments and documentation for clearer understanding of the changes related to validators in state management.
  • Refactor

    • Streamlined handling of validator updates across various components to enhance performance and maintainability.
  • Tests

    • Expanded testing to cover new validator initialization and state update scenarios, ensuring robustness and correctness.

vuong177 avatar May 05 '24 18:05 vuong177

[!NOTE]

Reviews paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Walkthrough

The updates to block/manager.go focus on enhancing validation logic by renaming variables, removing unneeded structures, and refining functions related to validator handling. Changes in node/full_node_test.go adjust the node creation process to include genesis and genesisValidatorKey parameters for better persistence and initialization.

Changes

Files Change Summary
block/manager.go Renamed error variable, modified functions for validator handling, removed validatorSet, updated logic
node/full_node_test.go Added parameters genesis and genesisValidatorKey in createAggregatorWithPersistence

Sequence Diagrams

Validator Handling Before and After Changes

Before Changes

sequenceDiagram
    participant Client
    participant Manager
    participant ValidatorSet
    participant State

    Client ->> Manager: Initialize Manager
    Manager ->> ValidatorSet: Access validators from validatorSet
    ValidatorSet -->> Manager: Return validators
    Manager ->> Manager: Check if proposer
    Manager ->> State: Publish block with validators
    State -->> Manager: Update state with validators

After Changes

sequenceDiagram
    participant Client
    participant Manager
    participant State

    Client ->> Manager: Initialize Manager
    Manager ->> State: Access validators from state
    State -->> Manager: Return validators
    Manager ->> Manager: Check if proposer
    Manager ->> State: Publish block and handle validators
    State -->> Manager: Update state with validators

Poem

In the land of code where structures shift,
Our dear Manager got a nifty lift.
Validators now dance in state’s sweet embrace,
Proposers too find their rightful place.
Genesis keys in tests for all to see,
Block's logic shines, as clear as can be.
Celebrate we shall, with code so bright,
A job well done, from morning to 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 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @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.
  • 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.

coderabbitai[bot] avatar May 05 '24 18:05 coderabbitai[bot]

@vuong177 when you are ready to move this out of draft, can you also please link an issue or provide more context for this change?

MSevey avatar May 08 '24 15:05 MSevey

Codecov Report

Attention: Patch coverage is 48.23529% with 132 lines in your changes missing coverage. Please review.

Project coverage is 42.11%. Comparing base (c9d8467) to head (bbfaf4d). Report is 135 commits behind head on main.

Files Patch % Lines
types/pb/rollkit/state.pb.go 55.27% 44 Missing and 28 partials :warning:
block/manager.go 13.33% 26 Missing :warning:
types/state.go 0.00% 14 Missing :warning:
types/serialization.go 47.82% 6 Missing and 6 partials :warning:
state/executor.go 70.37% 6 Missing and 2 partials :warning:

:exclamation: There is a different number of reports uploaded between BASE (c9d8467) and HEAD (bbfaf4d). Click for more details.

HEAD has 1 upload less than BASE | Flag | BASE (c9d8467) | HEAD (bbfaf4d) | |------|------|------| ||2|1|
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1658      +/-   ##
==========================================
- Coverage   50.23%   42.11%   -8.12%     
==========================================
  Files          52       76      +24     
  Lines        6762    10088    +3326     
==========================================
+ Hits         3397     4249     +852     
- Misses       3024     5120    +2096     
- Partials      341      719     +378     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 09 '24 05:05 codecov[bot]

@vuong177 when you are ready to move this out of draft, can you also please link an issue or provide more context for this change?

sure, I'll create a issue for more details.

vuong177 avatar May 14 '24 09:05 vuong177

@Manav-Aggarwal

In general my main question that maybe @gupadhyaya can help with too is how this will work with the current limitation of rollkit only supporting a single sequencer model.

I think we should verify the validator set after applying the update. Similar to the rollkit-sdk, only one validator is allowed at a time.

vuong177 avatar May 22 '24 06:05 vuong177

@MSevey @gupadhyaya I have added TestChangeValSet to test the valset change.

vuong177 avatar May 30 '24 06:05 vuong177

@coderabbitai resolve

MSevey avatar Jun 24 '24 15:06 MSevey

@coderabbitai ignore

MSevey avatar Jun 24 '24 15:06 MSevey

Actions performed

Comments resolved.

coderabbitai[bot] avatar Jun 24 '24 15:06 coderabbitai[bot]

@coderabbitai ignore

Actions performed

Reviews paused.

coderabbitai[bot] avatar Jun 24 '24 15:06 coderabbitai[bot]

Please fix the golangci lint error.

You should just need to run make fmt

MSevey avatar Jun 24 '24 16:06 MSevey