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

Revert "chore(types): Remove NewFromSSZ" #1909

Merged
merged 2 commits into from
Aug 16, 2024
Merged

Conversation

calbera
Copy link
Contributor

@calbera calbera commented Aug 16, 2024

Reverts #1898

Summary by CodeRabbit

  • New Features

    • Enhanced handling of execution payloads with improved error management in GetLatestExecutionPayloadHeader and SetLatestExecutionPayloadHeader methods.
    • Added functionality for creating BeaconBlock and ExecutionPayloadHeader instances directly from SSZ serialized data.
    • Introduced new constants for index names to improve code clarity.
  • Bug Fixes

    • Improved error handling in the Prune method of KVStore, allowing continued processing even when individual block removals fail.
  • Documentation

    • Added comments in methods to clarify behavior and improve maintainability.
  • Refactor

    • Streamlined codec handling and initialization processes, enhancing clarity and performance throughout the codebase.

Copy link
Contributor

coderabbitai bot commented Aug 16, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The recent changes enhance the handling of execution payloads and beacon blocks within the KVStore and related structures. Key modifications include improved error handling, the introduction of new methods for creating instances from SSZ data, and better management of codec types. These adjustments streamline the control flow, ensuring that the system is more robust and maintainable while facilitating compatibility with evolving data formats.

Changes

File(s) Change Summary
examples/berad/pkg/storage/eth1.go, mod/storage/pkg/beacondb/eth1.go Enhanced GetLatestExecutionPayloadHeader and SetLatestExecutionPayloadHeader methods in KVStore to improve error handling and update active fork versions consistently.
examples/berad/pkg/storage/kvstore.go, mod/storage/pkg/beacondb/kvstore.go Updated ExecutionPayloadHeaderT interface with methods for creating from SSZ and retrieving versions. Added new fields in KVStore for latest execution payload version and updated codec type for better compatibility.
mod/consensus-types/pkg/types/block.go, mod/storage/pkg/block/types.go Refactored BeaconBlock struct methods to simplify creation and management of blocks, introducing a method for creating from SSZ data and enhancing error handling related to fork versions.
mod/consensus-types/pkg/types/payload_header.go, mod/storage/pkg/encoding/ssz.go Added NewFromSSZ methods for deserialization of payload headers and other structures from SSZ bytes, improving the usability and robustness of the encoding/decoding process.
mod/runtime/pkg/*, mod/primitives/pkg/* Various adjustments to middleware and p2p components to streamline variable declarations and enhance the structure of handlers, focusing on improved readability without altering functionality.
mod/storage/pkg/block/store.go, mod/storage/pkg/block/index.go Removed redundant methods and introduced constants for index names, enhancing clarity and maintainability in block management. Integrated error handling directly into pruning logic.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant KVStore
    participant PayloadHeader

    User->>KVStore: Request latest execution payload header
    KVStore->>PayloadHeader: Retrieve latest version
    PayloadHeader-->>KVStore: Return header and version
    KVStore-->>User: Return execution payload header

    User->>KVStore: Set latest execution payload header
    KVStore->>PayloadHeader: Set version and update active fork
    PayloadHeader-->>KVStore: Confirm set
    KVStore-->>User: Confirm header set
Loading

🐇 In fields of green, I hop with glee,
New changes sprout, as bright as can be!
With payloads and blocks, all tidy and neat,
A code garden blooms, oh what a treat!
Let's dance through the code, with joy in our hearts,
For every new feature, a fresh work of art! 🌼✨


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 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.

@ocnc ocnc enabled auto-merge (squash) August 16, 2024 20:48
Copy link

codecov bot commented Aug 16, 2024

Codecov Report

Attention: Patch coverage is 28.43137% with 73 lines in your changes missing coverage. Please review.

Project coverage is 21.53%. Comparing base (1ab3392) to head (1fa44b4).
Report is 1 commits behind head on main.

Files Patch % Lines
mod/storage/pkg/block/store.go 0.00% 15 Missing ⚠️
examples/berad/pkg/storage/eth1.go 0.00% 12 Missing ⚠️
mod/storage/pkg/beacondb/eth1.go 0.00% 12 Missing ⚠️
examples/berad/pkg/storage/kvstore.go 0.00% 9 Missing ⚠️
mod/storage/pkg/beacondb/kvstore.go 0.00% 8 Missing ⚠️
mod/runtime/pkg/p2p/noop.go 0.00% 3 Missing ⚠️
mod/runtime/pkg/p2p/noop_blob.go 0.00% 3 Missing ⚠️
mod/consensus-types/pkg/types/block.go 92.59% 2 Missing ⚠️
mod/runtime/pkg/cosmos/baseapp/abci.go 0.00% 2 Missing ⚠️
mod/runtime/pkg/middleware/middleware.go 0.00% 2 Missing ⚠️
... and 4 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1909      +/-   ##
==========================================
+ Coverage   21.51%   21.53%   +0.01%     
==========================================
  Files         349      349              
  Lines       15914    15954      +40     
  Branches       21       21              
==========================================
+ Hits         3424     3435      +11     
- Misses      12374    12403      +29     
  Partials      116      116              
Files Coverage Δ
mod/consensus-types/pkg/types/payload_header.go 96.01% <100.00%> (+0.01%) ⬆️
mod/primitives/pkg/encoding/ssz/schema/id.go 33.33% <ø> (ø)
mod/storage/pkg/block/index.go 0.00% <ø> (ø)
mod/node-core/pkg/components/store.go 0.00% <0.00%> (ø)
mod/runtime/pkg/encoding/encoding.go 0.00% <0.00%> (ø)
mod/storage/pkg/encoding/ssz.go 0.00% <0.00%> (ø)
mod/consensus-types/pkg/types/block.go 92.72% <92.59%> (-1.16%) ⬇️
mod/runtime/pkg/cosmos/baseapp/abci.go 0.00% <0.00%> (ø)
mod/runtime/pkg/middleware/middleware.go 0.00% <0.00%> (ø)
mod/runtime/pkg/p2p/noop_block.go 0.00% <0.00%> (ø)
... and 7 more

@ocnc ocnc merged commit be1e04b into main Aug 16, 2024
16 checks passed
@ocnc ocnc deleted the revert-1898-test-unmarshalssz branch August 16, 2024 20:54
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.

2 participants