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(block-body): Add Deneb+ #1728

Merged
merged 1 commit into from
Jul 8, 2024
Merged

feat(block-body): Add Deneb+ #1728

merged 1 commit into from
Jul 8, 2024

Conversation

ocnc
Copy link
Contributor

@ocnc ocnc commented Jul 8, 2024

Incremental PRs.

This PR adds the body that will* be used

Summary by CodeRabbit

  • New Features

    • Introduced AttestationData type to represent attestation data, enhancing data structure support.
    • Added BeaconBlockBodyDenebPlus type for representing beacon block bodies in the Deneb chain.
    • Added SlashingInfo type to manage slashing information for validators.
  • Improvements

    • Enhanced SSZ marshaling, unmarshaling, size calculation, hashing, and proof tree generation for the new data structures.

@ocnc ocnc requested a review from itsdevbear as a code owner July 8, 2024 21:26
Copy link
Contributor

coderabbitai bot commented Jul 8, 2024

Walkthrough

The recent changes introduce significant additions to the types package, including new structures to handle attestation data, beacon block bodies specific to the Deneb chain, and slashing information. These changes are accompanied by methods for serialization, deserialization, size calculation, cryptographic hashing, and tree generation. This lays the groundwork for detailed handling and validation of blockchain data within the Deneb ecosystem.

Changes

File Path Change Summary
mod/consensus-types/pkg/types/attestation_data.go Added AttestationData struct with associated methods for SSZ marshaling, size, hash tree root, and tree generation.
mod/consensus-types/pkg/types/body_denebplus.go Introduced BeaconBlockBodyDenebPlus struct with various methods to manage execution payload, attestations, slashing info, and KZG commitments, including SSZ and hash tree operations.
mod/consensus-types/pkg/types/slashing_info.go Added SlashingInfo struct with methods for SSZ marshaling, size, hash tree root, and tree generation.
mod/consensus-types/pkg/types/body_denebplus.ssz.go Implemented SSZ-related functionality for BeaconBlockBodyDenebPlus, including marshaling, size, hash tree root, and tree generation methods.

Poem

In fields of code where bytes do bloom,
Attestations and Deneb's loom,
Slashing info, roots so tight,
Hashing trees under the moonlight.
With SSZ spells and cryptic themes,
Blockchain flows in binary streams.


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.

@ocnc ocnc changed the title feat(block-body): Add Deneb++ feat(block-body): Add Deneb+ Jul 8, 2024
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.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 06c39d7 and b78d21e.

Files selected for processing (6)
  • mod/consensus-types/pkg/types/attestation_data.go (1 hunks)
  • mod/consensus-types/pkg/types/attestation_data.ssz.go (1 hunks)
  • mod/consensus-types/pkg/types/body_denebplus.go (1 hunks)
  • mod/consensus-types/pkg/types/body_denebplus.ssz.go (1 hunks)
  • mod/consensus-types/pkg/types/slashing_info.go (1 hunks)
  • mod/consensus-types/pkg/types/slashing_info.ssz.go (1 hunks)
Additional comments not posted (18)
mod/consensus-types/pkg/types/slashing_info.go (1)

28-35: LGTM!

The SlashingInfo struct is well-defined with appropriate comments. The go:generate directive is correctly set up for generating SSZ-related code.

mod/consensus-types/pkg/types/attestation_data.go (1)

30-39: LGTM!

The AttestationData struct is well-defined with appropriate comments. The go:generate directive is correctly set up for generating SSZ-related code.

mod/consensus-types/pkg/types/slashing_info.ssz.go (1)

1-73: LGTM!

The generated SSZ-related code for the SlashingInfo struct is well-structured and consistent with the SSZ specifications.

mod/consensus-types/pkg/types/attestation_data.ssz.go (1)

1-82: LGTM!

The generated SSZ-related code for the AttestationData struct is well-structured and consistent with the SSZ specifications.

mod/consensus-types/pkg/types/body_denebplus.go (7)

54-57: LGTM!

The IsNil method correctly checks if the BeaconBlockBodyDenebPlus instance is nil.


59-64: LGTM!

The GetExecutionPayload method correctly returns the ExecutionPayload of the BeaconBlockBodyDenebPlus.


66-77: LGTM!

The SetExecutionData method correctly sets the ExecutionPayload after performing a type assertion.


79-84: LGTM!

The GetBlobKzgCommitments method correctly returns the BlobKzgCommitments of the BeaconBlockBodyDenebPlus.


86-92: LGTM!

The SetBlobKzgCommitments method correctly sets the BlobKzgCommitments of the BeaconBlockBodyDenebPlus.


94-126: LGTM! Consider removing the commented line.

The GetTopLevelRoots method correctly calculates and returns the top-level roots. The commented line about KZG commitments not being needed can be removed for clarity.


128-131: LGTM!

The Length method correctly returns the number of fields in the BeaconBlockBodyDenebPlus struct.

mod/consensus-types/pkg/types/body_denebplus.ssz.go (7)

11-14: LGTM!

The MarshalSSZ method correctly marshals the BeaconBlockBodyDenebPlus object using SSZ.


16-105: LGTM!

The MarshalSSZTo method correctly marshals the BeaconBlockBodyDenebPlus object to a target array.


107-239: LGTM!

The UnmarshalSSZ method correctly unmarshals the BeaconBlockBodyDenebPlus object from a byte buffer.


241-264: LGTM!

The SizeSSZ method correctly calculates and returns the SSZ encoded size for the BeaconBlockBodyDenebPlus object.


266-269: LGTM!

The HashTreeRoot method correctly hashes the BeaconBlockBodyDenebPlus object using SSZ.


271-358: LGTM!

The HashTreeRootWith method correctly hashes the BeaconBlockBodyDenebPlus object with a hasher using SSZ.


360-363: LGTM!

The GetTree method correctly hashes the BeaconBlockBodyDenebPlus object and returns the proof tree using SSZ.

Copy link

codecov bot commented Jul 8, 2024

Codecov Report

Attention: Patch coverage is 0% with 43 lines in your changes missing coverage. Please review.

Project coverage is 24.91%. Comparing base (06c39d7) to head (b78d21e).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1728      +/-   ##
==========================================
- Coverage   25.00%   24.91%   -0.10%     
==========================================
  Files         276      277       +1     
  Lines       11892    11935      +43     
  Branches       18       18              
==========================================
  Hits         2974     2974              
- Misses       8798     8841      +43     
  Partials      120      120              
Files Coverage Δ
mod/consensus-types/pkg/types/body_denebplus.go 0.00% <0.00%> (ø)

@ocnc ocnc merged commit cc74677 into main Jul 8, 2024
18 checks passed
@ocnc ocnc deleted the ocnc/denebplus-body branch July 8, 2024 21:50
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