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: Shared Staking #209

Merged
merged 2 commits into from
Dec 13, 2024
Merged

feat: Shared Staking #209

merged 2 commits into from
Dec 13, 2024

Conversation

mbreithecker
Copy link
Member

@mbreithecker mbreithecker commented Dec 13, 2024

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a consensus-validator stake mechanism for the protocol.
    • Added slashing parameters to the configuration.
    • New event EventSlash to track slashing incidents.
    • Added new methods for managing validator and delegation rewards.
  • Bug Fixes

    • Resolved issues with pruning errors and RPC request handling.
    • Added test cases for points to ensure accuracy.
  • Deprecations

    • Removed commands for creating stakers, claiming commission rewards, and updating metadata.
    • Eliminated several message types and related functionalities.
  • Documentation

    • Updated the CHANGELOG to reflect new features and bug fixes.
  • Refactor

    • Streamlined integration tests to focus on validator functionality.
    • Updated various methods to use the new StakersKeeper for delegation management.
  • Tests

    • Enhanced test coverage for validator and delegation functionalities.
    • Removed tests related to deprecated staker commands.

Copy link

coderabbitai bot commented Dec 13, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request introduces significant changes across multiple files, primarily focusing on the transition from a staker-based model to a validator-centric approach. Key modifications include the removal of staker-related message types and their associated methods, the introduction of new validator-related functionalities, and updates to the CHANGELOG.md to reflect these changes. Additionally, several test cases have been adapted to align with the new structure, ensuring that the integration and functionality of validators are properly validated. The overall architecture is streamlined, enhancing the management of staking and delegation operations.

Changes

File Change Summary
CHANGELOG.md Updated to include new feature "Shared Staking: Consensus-validator stake is now used for the protocol" and bug fix "Added test case for points."
app/app.go Modified import statement for v2_0 package from variable alias to direct import.
config.yml Reformatted mnemonic phrases for accounts and added slashing parameters under genesis.
proto/kyve/stakers/v1beta1/events.proto Added new message EventSlash, removed EventCreateStaker and EventUpdateMetadata.
proto/kyve/stakers/v1beta1/stakers.proto Introduced new enum SlashType with four values.
proto/kyve/stakers/v1beta1/tx.proto Removed several RPC methods and associated message types related to stakers.
testutil/commands.md Added command-line instructions for interacting with the KYVE blockchain.
testutil/integration/checks.go Refactored integration tests to focus on staker functionality, removing delegation checks.
testutil/integration/integration.go Updated imports and modified KeeperTestSuite struct for validator creation scenarios.
util/bech32.go Introduced functions for converting between Bech32 address formats.
util/coins.go Added function TruncateDecCoins for converting DecCoins to Coins.
util/expected_keepers.go Added new methods to DistributionKeeper and StakingKeeper interfaces.
x/bundles/keeper/abci_protocol_split_test.go Updated test cases to use CreateValidator instead of RunTxStakersSuccess.
x/bundles/keeper/keeper.go Renamed variable distrkeeper to distrKeeper.
x/bundles/keeper/keeper_suite_dropped_bundles_test.go Updated test cases to use CreateValidator and adjusted assertions for outstanding rewards.
x/bundles/keeper/keeper_suite_funding_bundles_test.go Updated test cases to use CreateValidator for stakers.
x/bundles/keeper/keeper_suite_inflation_splitting_test.go Updated test cases to utilize CreateValidator and adjusted assertions for rewards.
x/bundles/keeper/keeper_suite_invalid_bundles_test.go Transitioned to using staking-related types and updated assertions accordingly.
x/bundles/keeper/keeper_suite_points_test.go Updated test cases to use CreateValidator for creating validators.
x/bundles/keeper/keeper_suite_stakers_leave_test.go Updated test cases to use CreateValidator and adjusted assertions for delegation amounts.
x/bundles/keeper/keeper_suite_valid_bundles_test.go Updated test cases to use CreateValidator and adjusted assertions for rewards.
x/bundles/keeper/keeper_suite_zero_delegation_test.go Updated test cases to use CreateValidator and adjusted assertions for delegation amounts.
x/bundles/keeper/logic_bundles.go Updated methods to transition from delegationKeeper to stakerKeeper.
x/bundles/keeper/logic_bundles_test.go Updated test cases to use CreateValidator for creating validators.
x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go Updated test cases to use CreateValidator and adjusted assertions for delegation amounts.
x/bundles/keeper/logic_round_robin.go Updated method to retrieve delegation amount for validators.
x/bundles/keeper/logic_round_robin_test.go Updated test cases to use CreateValidator for creating validators.
x/bundles/keeper/msg_server_claim_uploader_role_test.go Updated test cases to use CreateValidator instead of MsgCreateStaker.
x/bundles/keeper/msg_server_skip_uploader_role_test.go Updated test cases to use CreateValidator for creating stakers.
x/bundles/keeper/msg_server_submit_bundle_proposal_test.go Updated test cases to use CreateValidator for creating stakers.
x/bundles/keeper/msg_server_vote_bundle_proposal_test.go Updated test cases to use CreateValidator for creating stakers.
x/bundles/types/expected_keepers.go Added new methods to the DistrKeeper interface.
x/global/ante_test.go Updated to use fundersTypes.MsgCreateFunder instead of stakersTypes.MsgCreateStaker.
x/global/post_test.go Updated message types in gas refund parameters to use fundersTypes.MsgCreateFunder.
x/pool/keeper/msg_server_disable_pool_test.go Updated test cases to use CreateValidator for creating validators.
x/query/keeper/grpc_account_redelegation_test.go Updated test cases to use CreateValidator for creating validators.
x/query/keeper/grpc_query_can_propose_test.go Updated to use CreateValidator for creating validators.
x/query/keeper/grpc_query_can_validate_test.go Updated to use CreateValidator for creating validators.
x/query/keeper/grpc_query_can_vote_test.go Updated to use CreateValidator for creating validators.
x/query/keeper/grpc_query_pool.go Updated delegation retrieval logic to use stakerKeeper.
x/query/keeper/grpc_query_staker.go Simplified logic for querying stakers.
x/query/keeper/grpc_query_stakers_by_pool.go Updated to check existence of validators instead of stakers.
x/query/keeper/grpc_query_stakers_by_pool_count.go Removed core logic for fetching paginated active stakers.
x/query/keeper/helper.go Updated methods to retrieve staker information from stakerKeeper.
x/query/keeper/keeper.go Adjusted import statements and structure of the Keeper type.
x/stakers/client/cli/tx.go Removed commands for creating stakers and claiming rewards.
x/stakers/client/cli/tx_claim_commission_rewards.go Deleted command definition for claiming commission rewards.
x/stakers/client/cli/tx_create_staker.go Deleted command definition for creating a staker.
x/stakers/client/cli/tx_update_metadata.go Deleted command definition for updating metadata.
x/stakers/genesis.go Removed staker initialization from genesis.
x/stakers/keeper/exported_functions.go Added new functions and modified existing ones for staker management.
x/stakers/keeper/exported_functions_test.go Deleted test suite for governance voting.
x/stakers/keeper/getters_staker.go Removed functions related to staker management and updated logic for validators.
x/stakers/keeper/getters_valaccount.go Updated logic for retrieving poolId from the iterator key.
x/stakers/keeper/keeper.go Updated field declarations and added new methods for hooks.
x/stakers/keeper/logic_commission.go Changed visibility of orderNewCommissionChange method.
x/stakers/keeper/logic_stakers.go Removed commission rewards functionality and updated related methods.
x/stakers/keeper/msg_server_claim_commission_rewards.go Deleted implementation for claiming commission rewards.
x/stakers/keeper/msg_server_claim_commission_rewards_test.go Deleted test suite for claiming commission rewards.
x/stakers/keeper/msg_server_create_staker.go Deleted implementation for creating a staker.
x/stakers/keeper/msg_server_create_staker_test.go Deleted test suite for creating a staker.
x/stakers/keeper/msg_server_join_pool.go Updated logic to verify validators instead of stakers.
x/stakers/keeper/msg_server_join_pool_test.go Updated test cases to reflect new validator-centric logic.
x/stakers/keeper/msg_server_leave_pool_test.go Updated test cases to use CreateValidator for stakers.
x/stakers/keeper/msg_server_update_commission.go Updated to a no-op placeholder.
x/stakers/keeper/msg_server_update_commission_test.go Deleted test suite for updating commission.
x/stakers/keeper/msg_server_update_metadata.go Deleted implementation for updating metadata.
x/stakers/keeper/msg_server_update_metadata_test.go Deleted test suite for updating metadata.
x/stakers/module.go Updated module structure to streamline dependencies.
x/stakers/types/codec.go Removed registration of several message types from codec.
x/stakers/types/errors.go Added new error variable ErrValidatorJailed.
x/stakers/types/message_claim_commission_rewards.go Deleted message type definition for claiming commission rewards.
x/stakers/types/message_create_staker.go Deleted message type definition for creating a staker.
x/stakers/types/message_update_metadata.go Deleted message type definition for updating metadata.

Possibly related PRs

  • fix: added test case for points #207: The changes in this PR involve adding a test case for points, which is directly related to the main PR's updates regarding the addition of a test case for points in the CHANGELOG.md.

Suggested reviewers

  • shifty11

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
🪧 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>, 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 generate docstrings to generate docstrings for this PR. (Experiment)
  • @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 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.

@mbreithecker mbreithecker merged commit 8136608 into main Dec 13, 2024
4 checks passed
@mbreithecker mbreithecker deleted the mbreithecker/shared-staking-3 branch December 13, 2024 09:07
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