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(node-api): Get proof for execution fee recipient #1831

Merged
merged 9 commits into from
Jul 31, 2024
Merged

Conversation

calbera
Copy link
Contributor

@calbera calbera commented Jul 31, 2024

Also new function added in BeaconVerifier contract to allow verifier.

Summary by CodeRabbit

  • New Features

    • Introduced a new endpoint to retrieve the execution fee recipient associated with a specific block.
    • Added functionality to obtain the execution number from the execution payload.
  • Enhancements

    • Updated the naming and structure of API request and response types for clarity and improved usability.
    • Improved routing paths for fetching block proposer and execution details to enhance readability.
    • Enhanced proof generation and validation processes for execution fee recipient and execution number.
    • Streamlined the mock interface for the BeaconState by removing unnecessary methods.
  • Bug Fixes

    • Clarified logging messages to accurately reflect the data being processed.

Copy link
Contributor

coderabbitai bot commented Jul 31, 2024

Walkthrough

The recent updates enhance blockchain proof handling by introducing a new endpoint for retrieving execution fee recipients and refining existing mechanisms for fetching execution numbers. Key changes include updated request and response types, improved routing paths for clarity, streamlined mock interfaces, and enhanced functionalities for managing execution payloads. These enhancements aim to streamline interactions and improve usability for users engaging with blockchain data.

Changes

Files Change Summary
mod/node-api/handlers/proof/execution_fee_recipient.go New function GetExecutionFeeRecipient retrieves fee recipient from execution payload for a specified block ID.
mod/node-api/handlers/proof/execution_number.go Renamed GetBlockExecution to GetExecutionNumber, updated request and response types for clarity.
mod/node-api/handlers/proof/routes.go Updated HTTP GET routes for fetching block proposer and execution details; added route for execution fee recipient.
mod/node-api/handlers/proof/types/request.go Updated request structures for execution number and block proposer; introduced ExecutionFeeRecipientRequest.
mod/node-api/handlers/proof/types/response.go Renamed response types to match new routes; added new ExecutionFeeRecipientResponse type.
mod/node-api/handlers/proof/types/types.go Enhanced ExecutionPayloadHeader interface with new method GetFeeRecipient() for fee management.
mod/node-api/backend/types.go Removed constraints.SSZRootable from BeaconState interface, simplifying its definition.
mod/node-api/handlers/proof/merkle/beacon_state.go Renamed ProveStateInBlock to ProveBeaconStateInBlock for clarity on its purpose.
mod/node-api/handlers/proof/merkle/block_proposer.go Updated internal function call from ProveStateInBlock(bbh) to ProveBeaconStateInBlock(bbh).
mod/node-api/handlers/proof/merkle/constants.go Renamed constants for clarity; added new constants for execution fee recipient indices.
mod/node-api/handlers/proof/merkle/execution_fee_recipient.go Implemented proof generation for execution fee recipients with verification methods.
mod/node-api/handlers/proof/merkle/execution_number.go Updated function comments and replaced calls to reflect changes in proof generation logic.
mod/node-api/backend/mocks/beacon_state.mock.go Removed HashTreeRoot method and associated mocks, streamlining the mock interface for BeaconState.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API
    participant Handler
    participant DB

    Client->>API: GET /bkit/v1/proof/execution_fee_recipient/{block_id}
    API->>Handler: GetExecutionFeeRecipient(c)
    Handler->>DB: Fetch execution payload for block_id
    DB-->>Handler: Return execution payload
    Handler-->>API: Return ExecutionFeeRecipientResponse
    API-->>Client: Send response with fee recipient details
Loading

🐇 In the land of blocks and fees,
A rabbit hops with joyful glee!
New routes are set, the paths are clear,
Fetching data brings us cheer!
With every change, we dance and play,
Blockchain magic, hip-hooray! 🌟


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.

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

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 78f08cc and ffc1987.

Files selected for processing (6)
  • mod/node-api/handlers/proof/execution_fee_recipient.go (1 hunks)
  • mod/node-api/handlers/proof/execution_number.go (3 hunks)
  • mod/node-api/handlers/proof/routes.go (1 hunks)
  • mod/node-api/handlers/proof/types/request.go (1 hunks)
  • mod/node-api/handlers/proof/types/response.go (3 hunks)
  • mod/node-api/handlers/proof/types/types.go (2 hunks)
Additional comments not posted (17)
mod/node-api/handlers/proof/types/request.go (3)

26-26: LGTM!

The comment update for the BlockProposerRequest structure to reflect the new endpoint format /proof/block_proposer/{block_id} is clear and consistent.


31-35: LGTM!

The renaming of BlockExecutionRequest to ExecutionNumberRequest and the comment update to reflect the new endpoint /proof/execution_number/{block_id} enhance clarity and specificity.


37-39: LGTM!

The introduction of the ExecutionFeeRecipientRequest structure with the endpoint /proof/execution_fee_recipient/{block_id} expands the API's capabilities effectively.

mod/node-api/handlers/proof/routes.go (3)

37-37: LGTM!

The path update for fetching the block proposer to eth/v1/proof/block_proposer/:block_id enhances readability and aligns with common naming conventions.


42-44: LGTM!

The path update for fetching block execution details to eth/v1/proof/execution_number/:block_id provides a clearer indication of the type of information being retrieved.


46-48: LGTM!

The introduction of the route eth/v1/proof/execution_fee_recipient/:block_id expands the API's capabilities effectively.

mod/node-api/handlers/proof/execution_number.go (1)

Line range hint 29-62:
LGTM!

The renaming of GetBlockExecution to GetExecutionNumber and the updates to internal elements improve clarity and specificity. The function handles errors appropriately and logs relevant information.

mod/node-api/handlers/proof/execution_fee_recipient.go (3)

1-21: LGTM!

The license information and package declaration are correct.


23-27: LGTM!

The import statements are necessary for the functionality of the GetExecutionFeeRecipient function.


29-67: LGTM!

The function GetExecutionFeeRecipient is well-structured and handles errors appropriately.

mod/node-api/handlers/proof/types/types.go (3)

Line range hint 1-22:
LGTM!

The license information and package declaration are correct.


24-27: LGTM!

The import statements are necessary for the functionality of the interfaces defined in the file.


67-70: LGTM!

The enhancement to the ExecutionPayloadHeader interface is necessary for retrieving the fee recipient address from the execution payload header.

mod/node-api/handlers/proof/types/response.go (4)

Line range hint 1-22:
LGTM!

The license information and package declaration are correct.


24-25: LGTM!

The import statements are necessary for the functionality of the response types defined in the file.


51-53: LGTM!

The renaming of the response type from BlockExecutionResponse to ExecutionNumberResponse enhances the semantic clarity.


69-85: LGTM!

The new response type ExecutionFeeRecipientResponse is necessary for providing detailed information regarding execution fee recipients associated with specific blockchain blocks.

mod/node-api/handlers/proof/execution_fee_recipient.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jul 31, 2024

Codecov Report

Attention: Patch coverage is 1.92308% with 102 lines in your changes missing coverage. Please review.

Project coverage is 23.91%. Comparing base (f6f3f66) to head (473f9de).

Files Patch % Lines
...i/handlers/proof/merkle/execution_fee_recipient.go 0.00% 50 Missing ⚠️
...node-api/handlers/proof/execution_fee_recipient.go 0.00% 28 Missing ⚠️
mod/node-api/handlers/proof/routes.go 0.00% 8 Missing ⚠️
contracts/src/eip4788/BeaconVerifier.sol 0.00% 7 Missing ⚠️
mod/node-api/handlers/proof/execution_number.go 0.00% 4 Missing ⚠️
...node-api/handlers/proof/merkle/execution_number.go 0.00% 3 Missing ⚠️
mod/node-api/handlers/proof/merkle/beacon_state.go 0.00% 1 Missing ⚠️
...d/node-api/handlers/proof/merkle/block_proposer.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1831      +/-   ##
==========================================
- Coverage   24.11%   23.91%   -0.20%     
==========================================
  Files         323      325       +2     
  Lines       13906    13980      +74     
  Branches       19       18       -1     
==========================================
- Hits         3354     3344      -10     
- Misses      10437    10521      +84     
  Partials      115      115              
Files Coverage Δ
contracts/src/eip4788/SSZ.sol 30.30% <100.00%> (-12.26%) ⬇️
mod/node-api/handlers/proof/block_proposer.go 0.00% <ø> (ø)
mod/node-api/handlers/proof/merkle/beacon_state.go 0.00% <0.00%> (ø)
...d/node-api/handlers/proof/merkle/block_proposer.go 0.00% <0.00%> (ø)
...node-api/handlers/proof/merkle/execution_number.go 0.00% <0.00%> (ø)
mod/node-api/handlers/proof/execution_number.go 0.00% <0.00%> (ø)
contracts/src/eip4788/BeaconVerifier.sol 0.00% <0.00%> (ø)
mod/node-api/handlers/proof/routes.go 0.00% <0.00%> (ø)
...node-api/handlers/proof/execution_fee_recipient.go 0.00% <0.00%> (ø)
...i/handlers/proof/merkle/execution_fee_recipient.go 0.00% <0.00%> (ø)

@itsdevbear itsdevbear enabled auto-merge (squash) July 31, 2024 18:25
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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between ffc1987 and 85c7079.

Files selected for processing (11)
  • contracts/src/eip4788/interfaces/IBeaconVerifier.sol (1 hunks)
  • mod/node-api/backend/types.go (1 hunks)
  • mod/node-api/handlers/proof/execution_fee_recipient.go (1 hunks)
  • mod/node-api/handlers/proof/execution_number.go (3 hunks)
  • mod/node-api/handlers/proof/merkle/beacon_state.go (1 hunks)
  • mod/node-api/handlers/proof/merkle/block_proposer.go (1 hunks)
  • mod/node-api/handlers/proof/merkle/constants.go (1 hunks)
  • mod/node-api/handlers/proof/merkle/execution_fee_recipient.go (1 hunks)
  • mod/node-api/handlers/proof/merkle/execution_number.go (4 hunks)
  • mod/node-api/handlers/proof/routes.go (1 hunks)
  • mod/node-api/handlers/proof/types/types.go (4 hunks)
Additional comments not posted (28)
mod/node-api/handlers/proof/routes.go (3)

37-39: LGTM!

The route bkit/v1/proof/block_proposer/:block_id aligns with the new naming convention and improves clarity.


42-44: LGTM!

The route bkit/v1/proof/execution_number/:block_id aligns with the new naming convention and improves clarity. The handler h.GetExecutionNumber is appropriately updated.


46-48: LGTM!

The new route bkit/v1/proof/execution_fee_recipient/:block_id expands the API functionality by allowing retrieval of the execution fee recipient. The handler h.GetExecutionFeeRecipient is appropriately introduced.

mod/node-api/handlers/proof/merkle/beacon_state.go (1)

28-32: LGTM!

The function name ProveBeaconStateInBlock improves clarity by explicitly indicating its purpose related to the beacon state. The updated signature enhances readability and maintains the underlying logic.

contracts/src/eip4788/interfaces/IBeaconVerifier.sol (1)

3-3: LGTM!

The removal of the SSZ module import suggests a shift in dependencies, likely indicating that the functionality provided by SSZ is no longer required within the context of this interface. The overall structure of the interface remains intact.

mod/node-api/handlers/proof/execution_number.go (5)

29-31: Update function comments to reflect new functionality.

The comments accurately describe the updated functionality of the function.


34-34: Function signature update is appropriate.

The function signature has been updated to GetExecutionNumber, which aligns with the new focus on execution numbers.


35-35: Update request validation type.

The request validation now uses types.ExecutionNumberRequest, which is appropriate for the updated functionality.


48-48: Update logging statement.

The logging statement has been updated to "Generating execution block number proof," which aligns with the new functionality.


Line range hint 62-67:
Update response type.

The response type has been updated to types.ExecutionNumberResponse, which is appropriate for the updated functionality.

mod/node-api/handlers/proof/execution_fee_recipient.go (5)

29-31: Function comments are clear and descriptive.

The comments accurately describe the functionality of the function.


34-34: Function signature is appropriate.

The function signature is clear and follows the pattern used in the codebase.


35-37: Request validation is appropriate.

The request validation uses types.ExecutionFeeRecipientRequest, which matches the functionality of the function.


48-48: Logging statement is clear and informative.

The logging statement "Generating execution fee recipient proof" accurately describes the action being taken.


62-67: Response type is appropriate.

The response type types.ExecutionFeeRecipientResponse matches the functionality of the function.

mod/node-api/handlers/proof/types/types.go (2)

24-27: New imports are appropriate.

The new imports fastssz and gethprimitives are necessary for the updated functionality.


66-68: New method GetFeeRecipient() is appropriate.

The new method GetFeeRecipient() in the ExecutionPayloadHeader interface is necessary for retrieving the fee recipient address.

mod/node-api/handlers/proof/merkle/constants.go (4)

47-49: LGTM! Improved clarity by renaming the constant.

The renaming from ExecutionPayloadNumberGIndexDenebState to ExecutionNumberGIndexDenebState enhances clarity by specifying that the constant pertains to the execution number.


51-54: LGTM! Improved clarity by renaming the constant.

The renaming from ExecutionPayloadNumberGIndexDenebBlock to ExecutionNumberGIndexDenebBlock enhances clarity by specifying that the constant pertains to the execution number.


56-59: LGTM! New constant is well-defined.

The new constant ExecutionFeeRecipientGIndexDenebState is well-defined and follows the existing naming conventions.


61-64: LGTM! New constant is well-defined.

The new constant ExecutionFeeRecipientGIndexDenebBlock is well-defined and follows the existing naming conventions.

mod/node-api/handlers/proof/merkle/execution_number.go (3)

53-53: LGTM! Improved specificity in function call.

The function call has been updated from ProveStateInBlock to ProveBeaconStateInBlock, enhancing the specificity and aligning with the function's intent.


91-91: LGTM! Improved clarity with renamed constant.

The constant reference has been updated from ExecutionPayloadNumberGIndexDenebState to ExecutionNumberGIndexDenebState, enhancing clarity.


115-115: LGTM! Improved clarity with renamed constant.

The constant reference has been updated from ExecutionPayloadNumberGIndexDenebBlock to ExecutionNumberGIndexDenebBlock, enhancing clarity.

mod/node-api/handlers/proof/merkle/block_proposer.go (1)

56-56: LGTM! Improved specificity in function call.

The function call has been updated from ProveStateInBlock to ProveBeaconStateInBlock, enhancing the specificity and aligning with the function's intent.

mod/node-api/handlers/proof/merkle/execution_fee_recipient.go (2)

75-105: LGTM!

The code changes are approved.


35-69: LGTM! But verify the nolint directive.

The code changes are approved.

However, ensure that the nolint directive is necessary and does not suppress any critical linting issues.

mod/node-api/backend/types.go (1)

Line range hint 48-59:
Verify the impact of removing constraints.SSZRootable.

The removal of the constraints.SSZRootable interface might impact components relying on its functionality.

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

Outside diff range comments (2)
contracts/src/eip4788/BeaconVerifier.sol (2)

Line range hint 186-210: LGTM! Consider adding inline comments.

The function proveExecutionNumberInBeaconBlock correctly verifies the block number in the latest execution payload header in the beacon state in the beacon block. Adding inline comments would improve readability.


Line range hint 153-185: LGTM! Consider adding inline comments.

The function proveValidatorPubkeyInBeaconBlock correctly verifies the validator pubkey in the registry of beacon state. Adding inline comments would improve readability.

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 85c7079 and 3028820.

Files selected for processing (9)
  • contracts/src/eip4788/BeaconVerifier.sol (6 hunks)
  • contracts/src/eip4788/SSZ.sol (3 hunks)
  • contracts/src/eip4788/interfaces/IBeaconVerifier.sol (4 hunks)
  • contracts/test/eip4788/SSZ.t.sol (1 hunks)
  • mod/node-api/handlers/proof/merkle/constants.go (2 hunks)
  • mod/node-api/handlers/proof/merkle/execution_fee_recipient.go (1 hunks)
  • mod/node-api/handlers/proof/merkle/execution_number.go (5 hunks)
  • mod/node-api/handlers/proof/types/response.go (3 hunks)
  • mod/node-api/handlers/proof/types/types.go (4 hunks)
Additional comments not posted (24)
contracts/test/eip4788/SSZ.t.sol (2)

29-39: LGTM! Verify the correctness of expected values.

The addition of the test_addressHashTreeRoot function is approved. Ensure that the expected values for the hash tree roots are correct.

Verification successful

Let's correct the script to find and search within Solidity files.


Let's search for the expected hash values within the function test_addressHashTreeRoot to verify their correctness.


Let's modify the script to include more lines of context around the found instances to capture the exact expected values.


Verify the correctness of expected values

The expected values in the test_addressHashTreeRoot function appear to be correct based on the provided addresses:

  • The first expected value correctly concatenates hex"1234567890ABCDEF" with 24 zero bytes.

  • The second expected value is a valid 32-byte hex string.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of expected values in the new test function.

# Test: Search for the expected values in the new test function. Expect: Correct values.
rg --type solidity -A 5 $'test_addressHashTreeRoot'

Length of output: 83


Script:

#!/bin/bash
# Description: Verify the correctness of expected values in the new test function.

# Find all Solidity files and search for the test function `test_addressHashTreeRoot`.
fd -e sol -x rg 'test_addressHashTreeRoot' {}

Length of output: 101


Script:

#!/bin/bash
# Description: Verify the correctness of expected values in the new test function.

# Find all Solidity files and search for the expected hash values within the function `test_addressHashTreeRoot`.
fd -e sol -x rg 'bytes32 expected =' {}

Length of output: 151


Script:

#!/bin/bash
# Description: Verify the correctness of expected values in the new test function.

# Find all Solidity files and search for the expected hash values within the function `test_addressHashTreeRoot`, including more context lines.
fd -e sol -x rg 'bytes32 expected =' -A 3 {}

Length of output: 818


16-25: LGTM! Verify the correctness of expected values.

The changes to the test_uint64HashTreeRoot function are approved. Ensure that the expected values for the hash tree roots are correct.

mod/node-api/handlers/proof/types/types.go (2)

64-66: LGTM! Verify the usage of the new method.

The addition of the GetFeeRecipient method to the ExecutionPayloadHeader interface is approved. Ensure that the method is used correctly throughout the codebase.

Verification successful

The GetFeeRecipient method is correctly integrated and utilized across the codebase.

The method GetFeeRecipient is found in multiple files, including method definitions, function calls, and test cases, indicating it is well-integrated and utilized in various contexts. Ensure that it continues to be used correctly in future updates.

  • mod/state-transition/pkg/core/types.go
  • mod/payload/pkg/builder/types.go
  • mod/node-api/handlers/proof/execution_fee_recipient.go
  • mod/node-api/handlers/proof/types/types.go
  • mod/payload/pkg/builder/payload.go
  • mod/execution/pkg/engine/types.go
  • mod/engine-primitives/pkg/engine-primitives/requests_test.go
  • mod/engine-primitives/pkg/engine-primitives/requests.go
  • mod/consensus-types/pkg/types/payload_header_test.go
  • mod/consensus-types/pkg/types/payload_header.go
  • mod/consensus-types/pkg/types/genesis_test.go
  • mod/consensus-types/pkg/types/payload.go
  • mod/consensus-types/pkg/types/payload_test.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new `GetFeeRecipient` method.

# Test: Search for the usage of the new method. Expect: Correct usage.
rg --type go -A 5 $'GetFeeRecipient'

Length of output: 10265


Line range hint 24-38:
LGTM! Verify the impact of removing the constraint.

The removal of the constraints.SSZMarshallableRootable constraint from the BeaconState interface is approved. Ensure that this change does not negatively impact the functionality.

mod/node-api/handlers/proof/merkle/constants.go (4)

47-49: LGTM! The renaming clarifies the semantic relevance.

The renaming of the constant ExecutionPayloadNumberGIndexDenebState to ExecutionNumberGIndexDenebState is approved.


51-55: LGTM! The renaming clarifies the semantic relevance.

The renaming of the constant ExecutionPayloadNumberGIndexDenebBlock to ExecutionNumberGIndexDenebBlock is approved.


57-60: LGTM! The addition enhances the module's capability.

The addition of the constant ExecutionFeeRecipientGIndexDenebState is approved.


62-66: LGTM! The addition enhances the module's capability.

The addition of the constant ExecutionFeeRecipientGIndexDenebBlock is approved.

contracts/src/eip4788/interfaces/IBeaconVerifier.sol (4)

14-16: LGTM! New event declaration is consistent.

The new event ExecutionFeeRecipientGIndexChanged follows the pattern of existing events and provides necessary information.


29-32: LGTM! New function declaration is consistent.

The new function executionFeeRecipientGIndex follows the pattern of existing getter functions and provides necessary information.


72-83: LGTM! New function declaration is consistent.

The new function verifyCoinbase follows the pattern of existing verification functions and provides necessary information.


34-36: LGTM! Visibility modifier improves clarity.

The addition of the external visibility modifier to the function getParentBeaconBlockRootAt improves clarity and consistency.

mod/node-api/handlers/proof/types/response.go (3)

31-32: LGTM! Updated endpoint path improves clarity.

The updated endpoint path for BlockProposerResponse improves clarity and consistency.


50-52: LGTM! Renaming and updated endpoint path improve clarity.

The renaming of BlockExecutionResponse to ExecutionNumberResponse and the updated endpoint path improve clarity and specificity.


68-86: LGTM! New type declaration is consistent.

The new type ExecutionFeeRecipientResponse follows the pattern of existing response types and provides necessary information.

mod/node-api/handlers/proof/merkle/execution_number.go (3)

54-54: LGTM! Updated function call improves clarity.

The updated call to ProveBeaconStateInBlock in the function ProveExecutionNumberInBlock improves clarity and consistency.


92-92: LGTM! Updated index improves clarity and correctness.

The updated index ExecutionNumberGIndexDenebState in the function ProveExecutionNumberInState improves clarity and correctness.


116-116: LGTM! Updated index improves clarity and correctness.

The updated index ExecutionNumberGIndexDenebBlock in the function verifyExecutionNumberInBlock improves clarity and correctness.

contracts/src/eip4788/SSZ.sol (5)

35-41: LGTM!

The function uint64HashTreeRoot correctly converts a uint64 value to a little-endian format and returns its hash tree root.


43-49: LGTM!

The function addressHashTreeRoot correctly converts an address to a bytes32 representation using the first 20 bytes.


Line range hint 50-68: LGTM!

The function toLittleEndian correctly converts a uint256 value to a little-endian format using bitwise operations.


Line range hint 69-130: LGTM!

The function verifyProof correctly verifies a Merkle proof against a given root and leaf using inline assembly for efficiency.


Line range hint 7-34: LGTM!

The function validatorPubkeyHashTreeRoot correctly calculates the hash tree root of a validator's public key using inline assembly to call the SHA256 precompile.

contracts/src/eip4788/BeaconVerifier.sol (1)

68-76: LGTM!

The function setExecutionFeeRecipientGIndex correctly allows the contract owner to update the executionFeeRecipientGIndex and uses the onlyOwner modifier to restrict access.

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 3028820 and 1b51c09.

Files selected for processing (1)
  • mod/node-api/backend/mocks/beacon_state.mock.go (1 hunks)
Additional comments not posted (6)
mod/node-api/backend/mocks/beacon_state.mock.go (6)

Line range hint 20-20:
Verify the impact of removing RunAndReturn in BeaconState_HashTreeRoot_Call.

The RunAndReturn method in BeaconState_HashTreeRoot_Call has been removed. Ensure that any existing tests or code that rely on this method are updated accordingly.

Verification successful

No impact found from removing RunAndReturn in BeaconState_HashTreeRoot_Call.

The RunAndReturn method in BeaconState_HashTreeRoot_Call has been removed, and there are no references to BeaconState_HashTreeRoot_Call in the codebase. This indicates that the removal does not affect existing tests or code.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of removing `RunAndReturn` method in `BeaconState_HashTreeRoot_Call`.

# Test: Search for the usage of `RunAndReturn` in `BeaconState_HashTreeRoot_Call`. Expect: No occurrences of the old method.
rg --type go -A 5 'BeaconState_HashTreeRoot_Call.*RunAndReturn'

Length of output: 65


Script:

#!/bin/bash
# Description: Verify the impact of removing `RunAndReturn` method in `BeaconState_HashTreeRoot_Call`.

# Test: Search for any references to `BeaconState_HashTreeRoot_Call` in the codebase.
rg --type go 'BeaconState_HashTreeRoot_Call'

Length of output: 44


Line range hint 16-16:
Verify the impact of removing BeaconState_HashTreeRoot_Call.

The type BeaconState_HashTreeRoot_Call has been removed. Ensure that any existing tests or code that rely on this type are updated accordingly.

Verification successful

Verification successful: No issues found.

The type BeaconState_HashTreeRoot_Call has been removed and there are no references to it in the codebase, including comments or documentation. This indicates that its removal does not impact any existing tests or code.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of removing `BeaconState_HashTreeRoot_Call` type.

# Test: Search for the usage of `BeaconState_HashTreeRoot_Call`. Expect: No occurrences of the old type.
rg --type go -A 5 'BeaconState_HashTreeRoot_Call'

Length of output: 49


Script:

#!/bin/bash
# Description: Verify if there are any references to `BeaconState_HashTreeRoot_Call` in comments or documentation.

# Search for any references to `BeaconState_HashTreeRoot_Call` in Go comments.
rg --type go -A 5 '//.*BeaconState_HashTreeRoot_Call'

# Search for any references to `BeaconState_HashTreeRoot_Call` in markdown files.
rg --type md 'BeaconState_HashTreeRoot_Call'

Length of output: 100


Line range hint 17-17:
Verify the impact of removing HashTreeRoot in BeaconState_Expecter.

The HashTreeRoot method in BeaconState_Expecter has been removed. Ensure that any existing tests or code that rely on this method are updated accordingly.


Line range hint 15-15:
Verify the impact of removing HashTreeRoot.

The HashTreeRoot method has been removed from the BeaconState structure. Ensure that any existing tests or code that rely on this method are updated accordingly.


Line range hint 19-19:
Verify the impact of removing Return in BeaconState_HashTreeRoot_Call.

The Return method in BeaconState_HashTreeRoot_Call has been removed. Ensure that any existing tests or code that rely on this method are updated accordingly.

Verification successful

The removal of the Return method in BeaconState_HashTreeRoot_Call does not impact the current codebase. No references to BeaconState_HashTreeRoot_Call were found, indicating that it is not used in the existing code or tests.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of removing `Return` method in `BeaconState_HashTreeRoot_Call`.

# Test: Search for the usage of `Return` in `BeaconState_HashTreeRoot_Call`. Expect: No occurrences of the old method.
rg --type go -A 5 'BeaconState_HashTreeRoot_Call.*Return'

Length of output: 59


Script:

#!/bin/bash
# Description: Verify the broader impact of removing `Return` method in `BeaconState_HashTreeRoot_Call`.

# Test: Search for all references to `BeaconState_HashTreeRoot_Call` in the codebase.
rg --type go 'BeaconState_HashTreeRoot_Call'

Length of output: 44


Script:

#!/bin/bash
# Description: Verify the broader impact of removing `Return` method by checking references to `BeaconState_HashTreeRoot_Call` class/struct.

# Test: Search for any references to `BeaconState_HashTreeRoot_Call` class/struct in the codebase.
rg --type go 'BeaconState_HashTreeRoot_Call'

Length of output: 44


Line range hint 18-18:
Verify the impact of removing Run in BeaconState_HashTreeRoot_Call.

The Run method in BeaconState_HashTreeRoot_Call has been removed. Ensure that any existing tests or code that rely on this method are updated accordingly.

Verification successful

Verify the impact of removing Run in BeaconState_HashTreeRoot_Call.

The Run method in BeaconState_HashTreeRoot_Call has been removed, and there are no references to this method elsewhere in the codebase. Therefore, its removal does not impact any existing code or tests.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of removing `Run` method in `BeaconState_HashTreeRoot_Call`.

# Test: Search for the usage of `Run` in `BeaconState_HashTreeRoot_Call`. Expect: No occurrences of the old method.
rg --type go -A 5 'BeaconState_HashTreeRoot_Call.*Run'

Length of output: 56


Script:

#!/bin/bash
# Description: Verify the impact of removing `Run` method in `BeaconState_HashTreeRoot_Call`.

# Test 1: Search for any usage of `Run` method in the codebase.
rg --type go 'Run('

# Test 2: Search for any references to `BeaconState_HashTreeRoot_Call` in the codebase.
rg --type go 'BeaconState_HashTreeRoot_Call'

Length of output: 125


Script:

#!/bin/bash
# Description: Verify the impact of removing `Run` method in `BeaconState_HashTreeRoot_Call`.

# Test 1: Search for any usage of `Run` method in the codebase with corrected regex pattern.
rg --type go 'Run\('

# Test 2: Search for any references to `BeaconState_HashTreeRoot_Call` in the codebase.
rg --type go 'BeaconState_HashTreeRoot_Call'

Length of output: 42340

@itsdevbear itsdevbear merged commit f427600 into main Jul 31, 2024
18 checks passed
@itsdevbear itsdevbear deleted the proof-coinbase branch July 31, 2024 20:15
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