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(accounts): add interfaces and mock impls for account abstraction #18404

Merged
merged 3 commits into from
Nov 9, 2023

Conversation

testinginprod
Copy link
Contributor

@testinginprod testinginprod commented Nov 7, 2023

Description

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • run make lint and make test
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

Summary by CodeRabbit

  • New Features
    • Introduced new protocol buffer files for account abstraction, authentication, payment bundling, and execution control.
    • Added new RPC methods for handling account abstraction and bundling multiple user operations.
  • Bug Fixes
    • Implemented error handling for unimplemented features in the msgServer struct.
  • Refactor
    • Created a new package account_abstraction with a PartialAccount struct implementing various interfaces.

Copy link
Contributor

coderabbitai bot commented Nov 7, 2023

Your existing walkthrough and poem are quite engaging and informative. However, I've made some adjustments to the walkthrough based on the provided changes. Here's the updated content:

Walkthrough

The changes encompass the introduction of new protocol buffer files and messages for the cosmos.accounts package, focusing on account abstraction, testing, and rotation. Additionally, new RPC methods and Go functions for executing bundled operations have been added. A new PartialAccount struct has been introduced for testing purposes, with methods returning "not implemented" errors.

Changes

File Summary
.../account_abstraction/v1/interface.proto
.../testing/rotation/v1/partial.proto
Introduce new protocol buffer files defining messages for authentication, payment bundling, execution control, and querying authentication methods, as well as for initializing a new account and rotating the public key.
.../accounts/v1/account_abstraction.proto Introduce new protocol buffer definition for UserOperation and UserOperationResponse messages.
.../accounts/v1/tx.proto Add new import statement and two new RPC methods for executing bundled operations.
x/accounts/msg_server.go Add new exported function ExecuteBundle returning "not implemented" error.
.../testing/account_abstraction/partial_account.go Introduce new PartialAccount struct for testing purposes, with methods returning "not implemented" errors.

Poem

🍂 As the leaves fall, so does the code, 🍁

Changes abound, in the Cosmos we strode. 🌌

Bundling, rotating, abstracting away, 🔄

In the realm of accounts, we continue to play. 🎮

Though some paths are yet to be tread, 🐾

"Not implemented," is all they've said. 🚧

But fear not, for the code is alive, 💻

In the heart of autumn, it continues to thrive. 🍂

I hope these adjustments align with your expectations! If you need further modifications, feel free to let me know.


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai help to get help.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

@testinginprod testinginprod changed the title add interfaces and mock impls feat(accounts): add interfaces and mock impls for account abstraction Nov 7, 2023
@testinginprod testinginprod marked this pull request as ready for review November 7, 2023 16:23
@testinginprod testinginprod requested a review from a team as a code owner November 7, 2023 16:23
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 1e4d1f9 and 2bbbe3e.
Files ignored due to filter (2)
  • api/cosmos/accounts/v1/tx_grpc.pb.go
  • x/accounts/v1/tx.pb.go
Files selected for processing (7)
  • api/cosmos/accounts/v1/tx.pulsar.go (4 hunks)
  • proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto (1 hunks)
  • proto/cosmos/accounts/testing/rotation/v1/partial.proto (1 hunks)
  • proto/cosmos/accounts/v1/account_abstraction.proto (1 hunks)
  • proto/cosmos/accounts/v1/tx.proto (3 hunks)
  • x/accounts/msg_server.go (2 hunks)
  • x/accounts/testing/account_abstraction/partial_account.go (1 hunks)
Files not summarized due to errors (1)
  • api/cosmos/accounts/v1/tx.pulsar.go: Error: Message exceeds token limit
Files not reviewed due to errors (1)
  • api/cosmos/accounts/v1/tx.pulsar.go (Error: diff too large)
Files skipped from review due to trivial changes (1)
  • proto/cosmos/accounts/testing/rotation/v1/partial.proto
Additional comments: 14
proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto (1)
  • 1-66: The new protocol buffer definitions look good. They are well-documented and follow the protobuf syntax correctly. Ensure that the corresponding Go code is generated and checked into the repository.
proto/cosmos/accounts/v1/tx.proto (3)
  • 5-11: The import statement and service definition look fine. Ensure that the imported file "cosmos/accounts/v1/account_abstraction.proto" exists and is accessible.

  • 16-23: The new RPC methods ExecuteBundle and ExecuteBundleResponse are correctly defined. Ensure that these methods are implemented in the service.

  • 60-80: The message definitions for MsgExecuteBundle and MsgExecuteBundleResponse are correctly defined. Ensure that the UserOperation and UserOperationResponse types are defined elsewhere in the codebase.

x/accounts/msg_server.go (2)
  • 3-11: The new imports are used correctly in the new function ExecuteBundle.

  • 123-125: The ExecuteBundle function is currently unimplemented and returns an error. Ensure that this is the intended behavior at this stage of development.

func (m msgServer) ExecuteBundle(ctx context.Context, req *v1.MsgExecuteBundle) (*v1.MsgExecuteBundleResponse, error) {
	return nil, status.New(codes.Unimplemented, "not implemented").Err()
}
proto/cosmos/accounts/v1/account_abstraction.proto (1)
  • 1-63: The protocol buffer definitions for UserOperation and UserOperationResponse are well-structured and comprehensive. They cover all necessary fields for sender, authentication method, authentication data, sequence, gas limits, payment messages, and their respective gas limits. The response fields for gas usage and payment responses are also well defined. Ensure that these new message types are properly integrated and used in the rest of the codebase.
x/accounts/testing/account_abstraction/partial_account.go (7)
  • 1-14: Imports look fine. No unused or missing imports detected.

  • 16-19: Global variables PubKeyPrefix and SequencePrefix are defined. Ensure they are not being redefined elsewhere in the codebase.

  • 21-21: The PartialAccount struct is confirmed to implement the accountstd.Interface. This is good practice to ensure compile-time checking of interface implementation.

  • 23-28: The NewPartialAccount function is correctly defined and returns a new PartialAccount instance. Ensure that the accountstd.Dependencies argument is being validated and sanitized in the upstream code.

  • 30-37: The PartialAccount struct is defined with PubKey and Sequence fields. Ensure that these fields are not being redefined elsewhere in the codebase.

  • 39-55: The Init, RotatePubKey, Authenticate, and QueryAuthenticateMethods methods of the PartialAccount struct are currently not implemented. Ensure that these methods are implemented before deploying the code to production.

  • 57-68: The RegisterInitHandler, RegisterExecuteHandlers, and RegisterQueryHandlers methods of the PartialAccount struct are correctly defined. Ensure that these methods are being called with valid arguments in the upstream code.

@github-prbot github-prbot requested review from a team, alexanderbez and samricotta and removed request for a team November 7, 2023 16:27
Copy link
Contributor

github-actions bot commented Nov 7, 2023

@testinginprod your pull request is missing a changelog!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2bbbe3e and 3331dc1.
Files ignored due to filter (1)
  • x/accounts/v1/account_abstraction.pb.go
Files selected for processing (2)
  • api/cosmos/accounts/testing/rotation/v1/partial.pulsar.go (1 hunks)
  • api/cosmos/accounts/v1/account_abstraction.pulsar.go (1 hunks)
Files not summarized due to errors (2)
  • api/cosmos/accounts/testing/rotation/v1/partial.pulsar.go: Error: Message exceeds token limit
  • api/cosmos/accounts/v1/account_abstraction.pulsar.go: Error: Message exceeds token limit
Files not reviewed due to errors (2)
  • api/cosmos/accounts/testing/rotation/v1/partial.pulsar.go (Error: diff too large)
  • api/cosmos/accounts/v1/account_abstraction.pulsar.go (Error: diff too large)

@@ -0,0 +1,66 @@
syntax = "proto3";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the account abstraction interface messages and query messages.

@@ -0,0 +1,22 @@
syntax = "proto3";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the proto file for a testing x/account meant to test account abstraction.

added pub key rotation to make things more spicy

@@ -0,0 +1,63 @@
syntax = "proto3";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defines account abstraction core types used by the x/accounts module

@@ -0,0 +1,68 @@
package account_abstraction
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implements the dummy account meant to test account abstraction + pub key rotation (pub key rotation is for spiciness)

Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK on api

@testinginprod testinginprod added this pull request to the merge queue Nov 9, 2023
Merged via the queue into main with commit 9577a72 Nov 9, 2023
64 of 65 checks passed
@testinginprod testinginprod deleted the tip/accounts/aa/proto branch November 9, 2023 13:38
@testinginprod testinginprod mentioned this pull request Dec 19, 2023
44 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants