-
Notifications
You must be signed in to change notification settings - Fork 168
[ENG-1305] Create new governance message for account level transfer #3244
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds a governance-authority msg and RPC to transfer coins between two x/bank accounts: proto, TypeScript codegen, Go message type and validation, keeper and msgServer logic, BankKeeper interface update, tests, mocks, metrics, and message registrations. Changes
Sequence DiagramsequenceDiagram
participant CLI as Client
participant MS as MsgServer
participant K as Keeper
participant BK as BankKeeper
CLI->>MS: SendFromAccountToAccount(msg)
rect rgb(230,240,255)
note right of MS: authority check
MS->>MS: verify authority
end
MS->>K: SendFromAccountToAccount(msg)
rect rgb(230,240,255)
note right of K: message validation & address conversion
K->>K: msg.ValidateBasic()
K->>K: Bech32 → AccAddress (sender, recipient)
end
K->>BK: SendCoins(sender, recipient, coin)
BK-->>K: result
K-->>MS: result (ok / err)
rect rgb(230,240,255)
note right of MS: telemetry update, respond
MS->>MS: update metrics
end
MS-->>CLI: MsgSendFromAccountToAccountResponse / Error
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
.github/workflows/indexer-build-and-push-dev-staging.yml(1 hunks).github/workflows/protocol-build-and-push-snapshot.yml(1 hunks).github/workflows/protocol-build-and-push.yml(1 hunks)protocol/app/msgs/internal_msgs_test.go(1 hunks)protocol/x/sending/keeper/transfer_test.go(1 hunks)protocol/x/sending/module_test.go(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- .github/workflows/protocol-build-and-push.yml
🚧 Files skipped from review as they are similar to previous changes (1)
- protocol/app/msgs/internal_msgs_test.go
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: hwray
Repo: dydxprotocol/v4-chain PR: 2551
File: protocol/x/subaccounts/keeper/subaccount.go:852-865
Timestamp: 2024-11-15T16:00:11.304Z
Learning: The function `GetCrossInsuranceFundBalance` in `protocol/x/subaccounts/keeper/subaccount.go` already existed and was just moved in this PR; changes to its error handling may be out of scope.
Learnt from: hwray
Repo: dydxprotocol/v4-chain PR: 2551
File: protocol/x/clob/types/expected_keepers.go:86-90
Timestamp: 2024-11-15T16:17:29.092Z
Learning: The function `GetCrossInsuranceFundBalance` in `protocol/x/clob/types/expected_keepers.go` already existed and was just moved in this PR; changes to its error handling may be out of scope.
Learnt from: hwray
Repo: dydxprotocol/v4-chain PR: 2551
File: protocol/x/subaccounts/keeper/subaccount.go:833-850
Timestamp: 2024-11-15T15:59:28.095Z
Learning: The function `GetInsuranceFundBalance` in `protocol/x/subaccounts/keeper/subaccount.go` already existed and was just moved in this PR; changes to its error handling may be out of scope.
📚 Learning: 2025-05-24T00:45:00.519Z
Learnt from: anmolagrawal345
Repo: dydxprotocol/v4-chain PR: 2837
File: proto/dydxprotocol/clob/order.proto:4-4
Timestamp: 2025-05-24T00:45:00.519Z
Learning: In the dydxprotocol/v4-chain repository, cosmos_proto dependencies are managed through buf.yaml configuration rather than being physically present in the repository. The import "cosmos_proto/cosmos.proto" is a standard pattern used across 28+ proto files for cosmos address annotations like (cosmos_proto.scalar) = "cosmos.AddressString".
Applied to files:
protocol/x/sending/module_test.go
📚 Learning: 2024-11-15T16:00:11.304Z
Learnt from: hwray
Repo: dydxprotocol/v4-chain PR: 2551
File: protocol/x/subaccounts/keeper/subaccount.go:852-865
Timestamp: 2024-11-15T16:00:11.304Z
Learning: The function `GetCrossInsuranceFundBalance` in `protocol/x/subaccounts/keeper/subaccount.go` already existed and was just moved in this PR; changes to its error handling may be out of scope.
Applied to files:
protocol/x/sending/keeper/transfer_test.go
📚 Learning: 2024-11-15T15:59:28.095Z
Learnt from: hwray
Repo: dydxprotocol/v4-chain PR: 2551
File: protocol/x/subaccounts/keeper/subaccount.go:833-850
Timestamp: 2024-11-15T15:59:28.095Z
Learning: The function `GetInsuranceFundBalance` in `protocol/x/subaccounts/keeper/subaccount.go` already existed and was just moved in this PR; changes to its error handling may be out of scope.
Applied to files:
protocol/x/sending/keeper/transfer_test.go
📚 Learning: 2024-11-15T16:17:29.092Z
Learnt from: hwray
Repo: dydxprotocol/v4-chain PR: 2551
File: protocol/x/clob/types/expected_keepers.go:86-90
Timestamp: 2024-11-15T16:17:29.092Z
Learning: The function `GetCrossInsuranceFundBalance` in `protocol/x/clob/types/expected_keepers.go` already existed and was just moved in this PR; changes to its error handling may be out of scope.
Applied to files:
protocol/x/sending/keeper/transfer_test.go
🧬 Code graph analysis (1)
protocol/x/sending/keeper/transfer_test.go (5)
protocol/testutil/constants/addresses.go (2)
AliceAccAddress(10-10)BobAccAddress(11-11)protocol/testutil/keeper/sending.go (1)
SendingKeepers(40-44)protocol/x/sending/types/expected_keepers.go (1)
BankKeeper(78-92)protocol/x/subaccounts/types/expected_keepers.go (1)
BankKeeper(88-104)protocol/lib/module_addresses.go (1)
GovModuleAddress(10-10)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (55)
- GitHub Check: test-coverage-upload
- GitHub Check: test-race
- GitHub Check: unit-end-to-end-and-integration
- GitHub Check: check-bc-breaking
- GitHub Check: format
- GitHub Check: v4-proto-js-gen
- GitHub Check: protocol-gen
- GitHub Check: v4-proto-py-gen
- GitHub Check: indexer-gen
- GitHub Check: check-sample-pregenesis-up-to-date
- GitHub Check: benchmark
- GitHub Check: build
- GitHub Check: golangci-lint
- GitHub Check: build-and-push-mainnet
- GitHub Check: build-and-push-testnet
- GitHub Check: container-tests
- GitHub Check: (Dev) Build and Push ECS Services / call-build-and-push-vulcan / (vulcan) Build and Push
- GitHub Check: (Staging) Build and Push ECS Services / call-build-and-push-vulcan / (vulcan) Build and Push
- GitHub Check: (Staging) Build and Push ECS Services / call-build-and-push-ecs-service-ender / (ender) Build and Push
- GitHub Check: (Staging) Build and Push ECS Services / call-build-and-push-auxo-lambda / (auxo) Build and Push Lambda
- GitHub Check: (Staging) Build and Push ECS Services / call-build-and-push-bazooka-lambda / (bazooka) Build and Push Lambda
- GitHub Check: (Staging) Build and Push ECS Services / call-build-and-push-ecs-service-comlink / (comlink) Build and Push
- GitHub Check: (Dev4) Build and Push ECS Services / call-build-and-push-vulcan / (vulcan) Build and Push
- GitHub Check: (Staging) Build and Push ECS Services / call-build-and-push-ecs-service-roundtable / (roundtable) Build and Push
- GitHub Check: (Dev4) Build and Push ECS Services / call-build-and-push-ecs-service-socks / (socks) Build and Push
- GitHub Check: (Staging) Build and Push ECS Services / call-build-and-push-ecs-service-socks / (socks) Build and Push
- GitHub Check: (Dev4) Build and Push ECS Services / call-build-and-push-ecs-service-comlink / (comlink) Build and Push
- GitHub Check: (Dev4) Build and Push ECS Services / call-build-and-push-auxo-lambda / (auxo) Build and Push Lambda
- GitHub Check: (Dev4) Build and Push ECS Services / call-build-and-push-ecs-service-ender / (ender) Build and Push
- GitHub Check: (Dev4) Build and Push ECS Services / call-build-and-push-bazooka-lambda / (bazooka) Build and Push Lambda
- GitHub Check: (Dev4) Build and Push ECS Services / call-build-and-push-ecs-service-roundtable / (roundtable) Build and Push
- GitHub Check: (Dev) Build and Push ECS Services / call-build-and-push-ecs-service-roundtable / (roundtable) Build and Push
- GitHub Check: (Dev) Build and Push ECS Services / call-build-and-push-bazooka-lambda / (bazooka) Build and Push Lambda
- GitHub Check: (Dev) Build and Push ECS Services / call-build-and-push-ecs-service-ender / (ender) Build and Push
- GitHub Check: (Dev) Build and Push ECS Services / call-build-and-push-ecs-service-socks / (socks) Build and Push
- GitHub Check: (Dev) Build and Push ECS Services / call-build-and-push-auxo-lambda / (auxo) Build and Push Lambda
- GitHub Check: (Dev) Build and Push ECS Services / call-build-and-push-ecs-service-comlink / (comlink) Build and Push
- GitHub Check: (Dev2) Build and Push ECS Services / call-build-and-push-auxo-lambda / (auxo) Build and Push Lambda
- GitHub Check: (Dev2) Build and Push ECS Services / call-build-and-push-bazooka-lambda / (bazooka) Build and Push Lambda
- GitHub Check: (Dev2) Build and Push ECS Services / call-build-and-push-ecs-service-comlink / (comlink) Build and Push
- GitHub Check: (Dev2) Build and Push ECS Services / call-build-and-push-ecs-service-roundtable / (roundtable) Build and Push
- GitHub Check: (Dev2) Build and Push ECS Services / call-build-and-push-vulcan / (vulcan) Build and Push
- GitHub Check: (Dev2) Build and Push ECS Services / call-build-and-push-ecs-service-socks / (socks) Build and Push
- GitHub Check: (Dev2) Build and Push ECS Services / call-build-and-push-ecs-service-ender / (ender) Build and Push
- GitHub Check: Analyze (go)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: build-and-push-dev4
- GitHub Check: build-and-push-dev
- GitHub Check: build-and-push-snapshot-staging
- GitHub Check: build-and-push-snapshot-dev
- GitHub Check: build-and-push-snapshot-dev2
- GitHub Check: build-and-push-snapshot-dev4
- GitHub Check: build-and-push-staging
- GitHub Check: build-and-push-dev2
- GitHub Check: Summary
🔇 Additional comments (6)
.github/workflows/protocol-build-and-push-snapshot.yml (1)
9-9: Consider removing the feature branch trigger before merge.Adding
davidli/transfer_governance(a temporary feature branch) to the CI/CD workflow triggers creates technical debt. Once this branch is deleted after the PR merges, the workflow configuration will reference a non-existent branch.This branch should either be removed from the configuration before merging, or this change should be conditional/temporary if there's a specific reason to enable snapshot builds on this branch during development.
Is this trigger intended to persist after the PR merges, or should it be removed as part of the merge process?
protocol/x/sending/module_test.go (2)
11-12: LGTM - Import organization improved.The import reordering enhances code organization by properly grouping local project imports.
83-83: Interface registration count verified—no changes needed.The interface registry count of 10 is correct. The MsgServer interface in the sending module contains 5 RPC methods, each generating a request and response message type (5 methods × 2 = 10 types). The new
SendFromAccountToAccountRPC method adds 2 types (MsgSendFromAccountToAccountandMsgSendFromAccountToAccountResponse), accounting for the increase from 8 to 10. Both message types exist and are properly integrated into the message service descriptor.protocol/x/sending/keeper/transfer_test.go (3)
779-790: LGTM - Invalid message validation.The test correctly validates that an empty sender address is rejected with an appropriate error message.
792-804: LGTM - Invalid recipient validation.The test correctly validates that an invalid recipient address is rejected.
806-818: LGTM - Invalid sender validation.The test correctly validates that an invalid sender address is rejected, completing comprehensive validation coverage for the new message type.
Changelist
SendFromAccountToAccountkeeper function to thex/sendingmodulex/bankaccount to anotherx/bankaccountbankKeeper.SendCoinsTestAppModuleBasic_RegisterInterfacesto reflect 2 new registered message types (8→10)Test Plan
Unit Test
TestSendFromAccountToAccountwith comprehensive test cases:TestSendFromAccountToAccount_InvalidMsgto verify empty sender validationTestSendFromAccountToAccount_InvalidRecipientto verify invalid recipient address validationTestSendFromAccountToAccount_InvalidSenderto verify invalid sender address validationAuthor/Reviewer Checklist
state-breakinglabel.indexer-postgres-breakinglabel.PrepareProposalorProcessProposal, manually add the labelproposal-breaking.feature:[feature-name].backport/[branch-name].refactor,chore,bug.Summary by CodeRabbit