berachain / beacon-kit

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

feat(berad): Bera minting every block with withdrawal to BGT contract #2129

Closed calbera closed 5 days ago

calbera commented 1 week ago

Summary by CodeRabbit

coderabbitai[bot] commented 1 week ago

Walkthrough

The changes in this pull request introduce a new field, MaxBeraMintAmount, to the BeraChainSpec struct in the chainspec package, specifying the maximum amount of BERA minted per block. Modifications are also made to the state_processor_staking.go file, focusing on the processing of deposits and withdrawals, including changes to the ExpectedWithdrawals function's signature and improved error handling. Additionally, new methods and fields related to the BGT contract are added to the Spec interface and SpecData struct.

Changes

File Path Change Summary
examples/berad/pkg/chain-spec/berachain.go Added field MaxBeraMintAmount uint64 \mapstructure:"max-bera-mint-amount"`toBeraChainSpec` struct.
mod/chain-spec/pkg/chain/chain_spec.go Added methods BGTContractAddress() [20]byte and MaxBeraMintAmount() uint64 to Spec interface and chainSpec struct.
mod/chain-spec/pkg/chain/data.go Added fields BGTContractAddress [20]byte \mapstructure:"bgt-contract-address"`andMaxBeraMintAmount uint64toSpecData` struct.
examples/berad/pkg/state-transition/state_processor_staking.go Updated ExpectedWithdrawals function signature and improved error handling; added comments for future TODOs in processWithdrawals and applyDeposit.
mod/state-transition/pkg/core/state/statedb.go Enhanced ExpectedWithdrawals method to include minting withdrawals and updated UpdateSlashingAtIndex for error handling.

Possibly related PRs

Suggested labels

Ready for Review, Merge me daddy

Suggested reviewers

Poem

In the fields where BERA grows,
A minting tale the rabbit knows.
With deposits and withdrawals in play,
New fields sprout in a bright array.
Hop along, let changes flow,
In the chain's embrace, we joyfully sow! 🐇✨


🪧 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

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 40.42%. Comparing base (6a1664a) to head (a6b55db). Report is 3 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/berachain/beacon-kit/pull/2129/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/2129?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain) ```diff @@ Coverage Diff @@ ## main #2129 +/- ## =========================================== + Coverage 26.24% 40.42% +14.17% =========================================== Files 360 4 -356 Lines 16241 47 -16194 Branches 12 12 =========================================== - Hits 4263 19 -4244 + Misses 11709 28 -11681 + Partials 269 0 -269 ``` [see 356 files with indirect coverage changes](https://app.codecov.io/gh/berachain/beacon-kit/pull/2129/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=berachain)