-
Notifications
You must be signed in to change notification settings - Fork 8
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
[Application] Auto-undelegation of unstaked gateways #692
Conversation
WalkthroughThe updates introduce functionality for handling Changes
Sequence DiagramsUnstaking a Gateway and Auto-UndelegationsequenceDiagram
participant User
participant Gateway
participant Keeper
participant EventManager
User ->> Gateway: Unstake Gateway
Gateway ->> EventManager: Emit GatewayUnstaked Event
Gateway ->> Keeper: Call EndBlockerAutoUndelegateFromUnstakedGateways
Keeper ->> Keeper: getUnstakeGatewayEvents
Keeper ->> EventManager: Emit Unstaking and Undelegation Events
Keeper ->> User: Confirm Undelegation
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
x/gateway/types/event.pb.go
is excluded by!**/*.pb.go
Files selected for processing (7)
- api/poktroll/gateway/event.pulsar.go (1 hunks)
- proto/poktroll/gateway/event.proto (1 hunks)
- x/application/keeper/auto_undelegate.go (1 hunks)
- x/application/keeper/msg_server_undelegate_from_gateway.go (1 hunks)
- x/application/keeper/msg_server_undelegate_from_gateway_test.go (2 hunks)
- x/application/module/abci.go (1 hunks)
- x/gateway/keeper/msg_server_unstake_gateway.go (1 hunks)
Additional comments not posted (4)
x/application/keeper/msg_server_undelegate_from_gateway.go (2)
55-55
: Variable Rename for ClarityThe variable
currentBlock
has been renamed tocurrentHeight
for better clarity. This change does not affect the logic.
57-57
: Variable Rename for ClarityThe variable
currentBlock
has been renamed tocurrentHeight
for better clarity. This change does not affect the logic.x/application/keeper/msg_server_undelegate_from_gateway_test.go (1)
463-497
: Comprehensive Test for Unstaked Gateway UndelegationThe test function
TestMsgServer_UndelegateFromGateway_UndelegateFromUnstakedGateway
is comprehensive and covers various scenarios of setting up the application, delegating to a gateway, unstaking the gateway, and verifying the undelegation logic.api/poktroll/gateway/event.pulsar.go (1)
1-25
: Addition ofGatewayUnstaked
Struct and MethodsThe
GatewayUnstaked
struct and its methods for protocol buffer operations are correctly implemented. These methods include resetting, string representation, proto message, descriptor, and getting the address.
There was a problem hiding this 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: CHILL
Files ignored due to path filters (1)
x/gateway/types/event.pb.go
is excluded by!**/*.pb.go
Files selected for processing (3)
- api/poktroll/gateway/event.pulsar.go (1 hunks)
- proto/poktroll/gateway/event.proto (1 hunks)
- x/application/module/abci.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- api/poktroll/gateway/event.pulsar.go
- proto/poktroll/gateway/event.proto
Additional comments not posted (1)
x/application/module/abci.go (1)
11-13
: Handle and log errors instead of returningnil
.Returning
nil
on error can mask issues and make debugging difficult. Log the error and return it instead.- return err + k.Logger().Error("Failed to auto-undelegate from unstaked gateways", "error", err) + return err
// TODO_BLOCKER: Gateway unstaking should be delayed until the current block's | ||
// session end height to align with the application's pending undelegations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
x/application/keeper/msg_server_undelegate_from_gateway_test.go
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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: CHILL
Files ignored due to path filters (1)
x/gateway/types/event.pb.go
is excluded by!**/*.pb.go
Files selected for processing (5)
- api/poktroll/gateway/event.pulsar.go (1 hunks)
- proto/poktroll/gateway/event.proto (1 hunks)
- x/application/keeper/auto_undelegate.go (1 hunks)
- x/application/keeper/msg_server_undelegate_from_gateway_test.go (2 hunks)
- x/gateway/keeper/msg_server_unstake_gateway.go (1 hunks)
Files skipped from review as they are similar to previous changes (5)
- api/poktroll/gateway/event.pulsar.go
- proto/poktroll/gateway/event.proto
- x/application/keeper/auto_undelegate.go
- x/application/keeper/msg_server_undelegate_from_gateway_test.go
- x/gateway/keeper/msg_server_unstake_gateway.go
The CI will now also run the e2e tests on devnet, which increases the time it takes to complete all CI checks. You may need to run GCP workloads (requires changing the namespace to 692) |
…ation-overserviced * pokt/main: [TODO] Blockers @okdas (#674) [TODO_BLOCKER] chore: Remove stale TODO_BLOCKERs (#694) [TODO] refactor: query expiring claims w/ index (#671) [TODOs] `grace_period_end_offset_blocks` validation & cleanup (#667) [Testing] add account balance coverage to account settlement (#670) [Application] Auto-undelegation of unstaked gateways (#692) [RelayMiner] Fix LeanClient mutiple suppliers support (#662)
…-root * pokt/main: [TODO] Blockers @okdas (#674) [TODO_BLOCKER] chore: Remove stale TODO_BLOCKERs (#694) [TODO] refactor: query expiring claims w/ index (#671) [TODOs] `grace_period_end_offset_blocks` validation & cleanup (#667) [Testing] add account balance coverage to account settlement (#670) [Application] Auto-undelegation of unstaked gateways (#692) [RelayMiner] Fix LeanClient mutiple suppliers support (#662)
Summary
Support
Application
auto-undelegation when aGateway
unstakes.GatewayUnstaked
event.GatewayUnstaked
event to update the applicaiton's delegation state.Most of the LOCs are pulsar and pb files
Issue
Applications need to update their delegation state when a gateway they delegated to has unstaked.
Type of change
Select one or more:
Testing
Documentation changes (only if making doc changes)
make docusaurus_start
; only needed if you make doc changesLocal Testing (only if making code changes)
make go_develop_and_test
make test_e2e
PR Testing (only if making code changes)
devnet-test-e2e
label to the PR.make trigger_ci
if you want to re-trigger tests without any code changesSanity Checklist
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores
GatewayUnstaked
events for better event handling and logging.