berachain / beacon-kit

A modular framework for building EVM consensus clients ⛵️✨
https://berachain.com
Other
170 stars 122 forks source link

chore(all): Cumulative branch - attempt 2 #2127

Open abi87 opened 1 week ago

abi87 commented 1 week ago
coderabbitai[bot] commented 1 week ago

Walkthrough

This pull request introduces several modifications across various files, primarily focusing on enhancing the handling of consensus blocks and execution payloads. Key changes include the addition of new configuration entries in .mockery.yaml, updates to function signatures in defaults.go and types.go, and the introduction of new methods and fields in the StateProcessor and related structures. Additionally, several dependency updates are made across multiple go.mod files, ensuring compatibility with the latest versions of libraries. The changes collectively aim to streamline and improve the architecture of the codebase.

Changes

File Path Change Summary
.mockery.yaml Added package github.com/berachain/beacon-kit/mod/state-transition/pkg/core with config settings (recursion disabled, expecter enabled, regex filter for ExecutionEngine).
beacond/cmd/defaults.go Updated DefaultComponents function: removed ProvideBlobVerifier, updated parameters for ProvideChainService, ProvideDispatcher, and ProvideServiceRegistry.
beacond/cmd/types.go Removed type aliases ABCIMiddleware and BlobVerifier, added ConsensusBlock, updated ChainService to include *ConsensusBlock.
beacond/go.mod Updated various dependencies, including github.com/gabriel-vasile/mimetype from 1.4.4 to 1.4.6, and others related to cosmos-sdk and golang.org/x/....
build/scripts/testing.mk Updated Docker image name for erigon node from thorax/erigon:latest to erigontech/erigon:latest.
kurtosis/beaconkit-all.yaml Updated erigon image from thorax/erigon:v2.60.1 to erigontech/erigon:v2.60.9.
kurtosis/beaconkit-base-gcp.yaml Updated erigon image from thorax/erigon:v2.60.1 to erigontech/erigon:v2.60.9.
kurtosis/src/nodes/consensus/beacond/node.star Added command-line argument for node API address in start_node command, updated timeout parameters and peer limits based on is_seed flag.
mod/beacon/blockchain/execution_engine.go Changed block processing type from BeaconBlockT to ConsensusBlockT in multiple methods.
mod/beacon/blockchain/payload.go Added nextPayloadTimestamp parameter to several methods, updating logic for payload rebuilding and optimistic payload builds.
mod/beacon/blockchain/process.go Updated methods to process ConsensusBlockT instead of BeaconBlockT.
mod/beacon/blockchain/receive.go Updated methods to process ConsensusBlockT, introduced beaconBlk variable for accessing beacon block properties.
mod/beacon/blockchain/service.go Added ConsensusBlockT type parameter to Service struct, updated method signatures to handle consensus blocks.
mod/beacon/blockchain/types.go Added ConsensusBlock interface with methods for handling beacon blocks and timestamps.
mod/beacon/validator/block_builder.go Updated methods to include slotData and nextPayloadTimestamp for state root computation.
mod/beacon/validator/types.go Added GetNextPayloadTimestamp method to SlotData interface.
mod/chain-spec/pkg/chain/chain_spec.go Added GetValidatorsSetCapSize() method to Spec interface and its implementation.
mod/chain-spec/pkg/chain/data.go Added ValidatorSetCapSize field to SpecData struct.
mod/cli/go.mod Updated dependencies, including github.com/gabriel-vasile/mimetype from v1.4.4 to v1.4.6.
mod/config/pkg/spec/testnet.go Added ValidatorSetCapSize field in the return structure of BaseSpec() function.
mod/consensus-types/pkg/types/payload.go Updated ExecutionPayload struct methods for error handling and initialization.
mod/consensus-types/pkg/types/payload_test.go Added test function for ExecutionPayload JSON marshaling behavior.
mod/consensus-types/pkg/types/validator.go Added ComputeEffectiveBalance function and SetWithdrawableEpoch method to Validator struct.
mod/consensus/go.mod Updated several dependencies, ensuring compatibility with the latest versions.
mod/consensus/pkg/cometbft/service/abci.go Introduced slotData variable for proposals, updated comments.
mod/consensus/pkg/cometbft/service/helpers.go Removed file containing functions related to proposal handling.
mod/consensus/pkg/cometbft/service/middleware/abci.go Updated context type in middleware methods from context.Context to sdk.Context.
mod/consensus/pkg/cometbft/service/middleware/middleware.go Added minPayloadDelay field to ABCIMiddleware struct, updated constructor.
mod/consensus/pkg/types/consensus_block.go Renamed package, added ConsensusBlock type and associated methods.
mod/consensus/pkg/types/slot_data.go Updated field visibility and added nextPayloadTimestamp to SlotData struct.
mod/da/pkg/blob/processor.go Updated Processor struct to use new verifier type.
mod/da/pkg/blob/types.go Removed BlobVerifier interface.
mod/da/pkg/blob/verifier.go Renamed Verifier type and updated method names for consistency.
mod/execution/pkg/client/client.go Enhanced error handling in verifyChainIDAndConnection method.
mod/node-api/engines/echo/vaildator.go Added ValidateValidatorStatus function and updated validation logic.
mod/node-api/engines/go.mod Updated dependencies, including github.com/gabriel-vasile/mimetype from v1.4.4 to v1.4.6.
mod/node-api/server/config.go Updated defaultAddress constant from "0.0.0.0:3500" to "127.0.0.1:3500".
mod/node-core/go.mod Updated various dependencies, ensuring compatibility with the latest versions.
mod/node-core/pkg/components/blobs.go Removed BlobVerifierInput struct and adjusted ProvideBlobProcessor function.
mod/node-core/pkg/components/chain_service.go Updated ProvideChainService function to include ConsensusBlockT.
mod/node-core/pkg/components/dispatcher.go Updated ProvideDispatcher function to include ConsensusBlockT.
mod/node-core/pkg/components/interfaces.go Added ConsensusBlock interface with methods for handling beacon blocks.
mod/node-core/pkg/components/middleware.go Added CmtCfg field to ABCIMiddlewareInput struct.
mod/node-core/pkg/components/service_registry.go Updated ServiceRegistryInput and ProvideServiceRegistry to include ConsensusBlockT.
mod/payload/pkg/builder/payload.go Added early return for disabled payload builder in SendForceHeadFCU method.
mod/primitives/pkg/transition/context.go Added NextPayloadTimestamp field and corresponding getter method to Context struct.
mod/state-transition/go.mod Updated dependency versions for errors and chain-spec.
mod/state-transition/pkg/core/errors.go Added new error variables ErrHitValidatorsSetCap and ErrTooFarInTheFuture.
mod/state-transition/pkg/core/helpers_test.go Introduced types and functions for testing state transitions.
mod/state-transition/pkg/core/mocks/execution_engine.mock.go Added mock implementation for ExecutionEngine type.
mod/state-transition/pkg/core/state/statedb.go Updated ExpectedWithdrawals and DecreaseBalance methods for improved logic.
mod/state-transition/pkg/core/state_processor.go Added processingGenesis field to StateProcessor struct, refactored error handling.
mod/state-transition/pkg/core/state_processor_genesis.go Updated InitializePreminedBeaconStateFromEth1 method to track genesis processing.
mod/state-transition/pkg/core/state_processor_genesis_test.go Added unit tests for state processor functionality within the staking module.
mod/state-transition/pkg/core/state_processor_payload.go Updated methods to include nextPayloadTimestamp for validation.
mod/state-transition/pkg/core/state_processor_staking.go Enhanced deposit processing logic and error handling.
mod/state-transition/pkg/core/state_processor_staking_test.go Introduced unit tests for staking functionality in the state processor.
mod/state-transition/pkg/core/types.go Added GetNextPayloadTimestamp() method to Context interface, defined new Withdrawals interface, and updated ExecutionEngine and Validator interfaces.
testing/e2e/config/config.go Updated defaultExecutionSettings function for erigon client image.
testing/go.mod Updated dependencies, including github.com/gabriel-vasile/mimetype from v1.4.4 to v1.4.6.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant API
    participant Service
    participant Database

    User->>API: Request to process block
    API->>Service: Process block with ConsensusBlock
    Service->>Database: Store block data
    Database-->>Service: Confirmation
    Service-->>API: Block processed successfully
    API-->>User: Response with block status

Possibly related PRs

Suggested reviewers

Poem

🐇 In the land of code where the rabbits play,
New mocks and blocks come out to stay.
With timestamps and payloads, we hop with glee,
Enhancing our world, just wait and see!
So let’s cheer for changes, both big and small,
For in this code garden, we’re having a ball! 🌼✨


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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , 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 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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 23.90805% with 331 lines in your changes missing coverage. Please review.

Project coverage is 26.44%. Comparing base (66bad3e) to head (14913e4). Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
.../consensus/pkg/cometbft/service/middleware/abci.go 0.00% 41 Missing :warning:
mod/state-transition/pkg/core/state_processor.go 37.03% 21 Missing and 13 partials :warning:
mod/beacon/blockchain/receive.go 0.00% 27 Missing :warning:
mod/beacon/validator/block_builder.go 0.00% 21 Missing :warning:
...nsus/pkg/cometbft/service/middleware/middleware.go 0.00% 20 Missing :warning:
...ate-transition/pkg/core/state_processor_staking.go 68.33% 13 Missing and 6 partials :warning:
mod/consensus/pkg/cometbft/service/abci.go 0.00% 17 Missing :warning:
...ate-transition/pkg/core/state_processor_payload.go 0.00% 16 Missing :warning:
mod/beacon/blockchain/payload.go 0.00% 13 Missing :warning:
mod/consensus/pkg/types/slot_data.go 0.00% 12 Missing :warning:
... and 24 more
Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/berachain/beacon-kit/pull/2127/graphs/tree.svg?width=650&height=150&src=pr&token=0l5iJ3ZbzV&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain)](https://app.codecov.io/gh/berachain/beacon-kit/pull/2127?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain) ```diff @@ Coverage Diff @@ ## main #2127 +/- ## ========================================== + Coverage 23.48% 26.44% +2.96% ========================================== Files 357 359 +2 Lines 16064 16217 +153 Branches 12 12 ========================================== + Hits 3772 4288 +516 + Misses 12121 11657 -464 - Partials 171 272 +101 ``` | [Files with missing lines](https://app.codecov.io/gh/berachain/beacon-kit/pull/2127?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain) | Coverage Δ | | |---|---|---| | [mod/config/pkg/spec/testnet.go](https://app.codecov.io/gh/berachain/beacon-kit/pull/2127?src=pr&el=tree&filepath=mod%2Fconfig%2Fpkg%2Fspec%2Ftestnet.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain#diff-bW9kL2NvbmZpZy9wa2cvc3BlYy90ZXN0bmV0Lmdv) | `100.00% <100.00%> (+100.00%)` | :arrow_up: | | [mod/consensus-types/pkg/types/payload.go](https://app.codecov.io/gh/berachain/beacon-kit/pull/2127?src=pr&el=tree&filepath=mod%2Fconsensus-types%2Fpkg%2Ftypes%2Fpayload.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain#diff-bW9kL2NvbnNlbnN1cy10eXBlcy9wa2cvdHlwZXMvcGF5bG9hZC5nbw==) | `92.07% <100.00%> (+0.10%)` | :arrow_up: | | [mod/node-api/server/config.go](https://app.codecov.io/gh/berachain/beacon-kit/pull/2127?src=pr&el=tree&filepath=mod%2Fnode-api%2Fserver%2Fconfig.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain#diff-bW9kL25vZGUtYXBpL3NlcnZlci9jb25maWcuZ28=) | `0.00% <ø> (ø)` | | | [mod/node-core/pkg/components/service\_registry.go](https://app.codecov.io/gh/berachain/beacon-kit/pull/2127?src=pr&el=tree&filepath=mod%2Fnode-core%2Fpkg%2Fcomponents%2Fservice_registry.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain#diff-bW9kL25vZGUtY29yZS9wa2cvY29tcG9uZW50cy9zZXJ2aWNlX3JlZ2lzdHJ5Lmdv) | `0.00% <ø> (ø)` | | | [...tate-transition/pkg/core/state\_processor\_randao.go](https://app.codecov.io/gh/berachain/beacon-kit/pull/2127?src=pr&el=tree&filepath=mod%2Fstate-transition%2Fpkg%2Fcore%2Fstate_processor_randao.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain#diff-bW9kL3N0YXRlLXRyYW5zaXRpb24vcGtnL2NvcmUvc3RhdGVfcHJvY2Vzc29yX3JhbmRhby5nbw==) | `56.33% <100.00%> (+56.33%)` | :arrow_up: | | [mod/cli/pkg/utils/parser/validator.go](https://app.codecov.io/gh/berachain/beacon-kit/pull/2127?src=pr&el=tree&filepath=mod%2Fcli%2Fpkg%2Futils%2Fparser%2Fvalidator.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain#diff-bW9kL2NsaS9wa2cvdXRpbHMvcGFyc2VyL3ZhbGlkYXRvci5nbw==) | `0.00% <0.00%> (ø)` | | | [mod/execution/pkg/client/client.go](https://app.codecov.io/gh/berachain/beacon-kit/pull/2127?src=pr&el=tree&filepath=mod%2Fexecution%2Fpkg%2Fclient%2Fclient.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain#diff-bW9kL2V4ZWN1dGlvbi9wa2cvY2xpZW50L2NsaWVudC5nbw==) | `0.00% <0.00%> (ø)` | | | [mod/node-core/pkg/components/blobs.go](https://app.codecov.io/gh/berachain/beacon-kit/pull/2127?src=pr&el=tree&filepath=mod%2Fnode-core%2Fpkg%2Fcomponents%2Fblobs.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain#diff-bW9kL25vZGUtY29yZS9wa2cvY29tcG9uZW50cy9ibG9icy5nbw==) | `0.00% <0.00%> (ø)` | | | [mod/node-core/pkg/components/chain\_service.go](https://app.codecov.io/gh/berachain/beacon-kit/pull/2127?src=pr&el=tree&filepath=mod%2Fnode-core%2Fpkg%2Fcomponents%2Fchain_service.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain#diff-bW9kL25vZGUtY29yZS9wa2cvY29tcG9uZW50cy9jaGFpbl9zZXJ2aWNlLmdv) | `0.00% <0.00%> (ø)` | | | [mod/node-core/pkg/components/middleware.go](https://app.codecov.io/gh/berachain/beacon-kit/pull/2127?src=pr&el=tree&filepath=mod%2Fnode-core%2Fpkg%2Fcomponents%2Fmiddleware.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain#diff-bW9kL25vZGUtY29yZS9wa2cvY29tcG9uZW50cy9taWRkbGV3YXJlLmdv) | `0.00% <0.00%> (ø)` | | | ... and [29 more](https://app.codecov.io/gh/berachain/beacon-kit/pull/2127?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain) | | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/berachain/beacon-kit/pull/2127/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain)